max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
molo/helpers/request_schemas.py | djvaroli/samsung_oct | 2 | 12768851 | <filename>molo/helpers/request_schemas.py
from typing import *
from pydantic import BaseModel
class GeneratePDFReportSchema(BaseModel):
predictionData: List[dict] | 1.484375 | 1 |
smoke/features/steps/delete_steps.py | nhojpatrick/openshift_jenkins | 267 | 12768852 | <reponame>nhojpatrick/openshift_jenkins<gh_stars>100-1000
from smoke.features.steps.openshift import Openshift
from kubernetes import client, config
oc = Openshift()
v1 = client.CoreV1Api()
@then(u'we delete deploymentconfig.apps.openshift.io "jenkins"')
def del_dc(context):
res = oc.delete("deploymentconfig","je... | 2.046875 | 2 |
Lab 2/key.py | lcchiang/Artificial-Intelligence-Course | 0 | 12768853 | <gh_stars>0
# Login information for the 6.034 Automated Tester
USERNAME="lcchiang_MIT_EDU"
PASSWORD="<PASSWORD>"
XMLRPC_URL="https://ai6034.mit.edu/labs/xmlrpc/"
| 0.953125 | 1 |
contrib/spanlib/src/template.setup.py | xylar/cdat | 62 | 12768854 | <filename>contrib/spanlib/src/template.setup.py
######################################################################
## SpanLib, Raynaud 2006-2009
######################################################################
import os
import sys
from getopt import gnu_getopt
# Gather up all the files we need.
files = ['... | 1.75 | 2 |
rocket/a_car_rental/b_website/migrations/0002_auto_20210908_1356.py | t444ov/django-carrental | 0 | 12768855 | <filename>rocket/a_car_rental/b_website/migrations/0002_auto_20210908_1356.py<gh_stars>0
# Generated by Django 3.2.7 on 2021-09-08 10:56
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('b_website', '0001_initial'),
]
operations = [
migrations.Al... | 1.664063 | 2 |
api/v1/ev_gpq.py | muslax/aces-api | 0 | 12768856 | <filename>api/v1/ev_gpq.py
import logging
from random import shuffle
from typing import Any, List
from fastapi import APIRouter, Depends
from api.v1.deps import get_current_active_user, get_current_project_admin
from crud.persona import find_one as find_persona
from crud.utils import raise_not_found, raise_bad_reques... | 2.4375 | 2 |
setup.py | KiranNanduri/Stocksdata | 1 | 12768857 | <reponame>KiranNanduri/Stocksdata<filename>setup.py
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 25 22:59:19 2021
@author: kiran
"""
from setuptools import setup, find_packages
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Operating System :: M... | 1.179688 | 1 |
rapid_plotly/barplot.py | def-mycroft/rapid-plotly | 1 | 12768858 | <reponame>def-mycroft/rapid-plotly
"""Convenience function for creating a Plotly barplot
Use `create_graph` to create an attractive, highly interactive Plotly
barplot, either in a Jupyter notebook or as an html file.
"""
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode,... | 3.03125 | 3 |
BuildingDepot-v3.2.8/buildingdepot/CentralService/app/auth/forms.py | Entromorgan/GIoTTo | 0 | 12768859 | """
CentalService.auth.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contains all the forms for the CentralService authorization functions.
The two forms that are used are for login and for creating a new user.
@copyright: (c) 2016 SynergyLabs
@license: UCSD License. See License file for details.
"""
from flask_wtf import Form... | 2.6875 | 3 |
movies/migrations/0006_movies_ph_credit.py | Saifur43/Movie-Success-Prediction | 7 | 12768860 | # Generated by Django 2.1.7 on 2019-04-10 01:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('movies', '0005_auto_20190410_0659'),
]
operations = [
migrations.AddField(
model_name='movies',
name='ph_credit',
... | 1.539063 | 2 |
tests/unit/modules/grains_test.py | jkur/salt | 2 | 12768861 | <filename>tests/unit/modules/grains_test.py
# -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import
import copy
# Import Salt Testing libs
from salttesting import TestCase
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt libs
from salt.exception... | 2.3125 | 2 |
nexuscasc/api/endpoint/__init__.py | vjda/nexus3-casc-cli | 7 | 12768862 | from .script import Script
from .status_check import CheckStatus
| 1.046875 | 1 |
supervisor_jcmd/tests/test_controllerplugin.py | astronouth7303/supervisor-jcmd | 84 | 12768863 | import sys
import unittest
try:
from StringIO import StringIO
except:
from io import StringIO
class TestControllerPlugin(unittest.TestCase):
# Factory
def test_make_cache_controllerplugin_factory(self):
from supervisor_cache import controllerplugin
controller = DummyController()
... | 2.59375 | 3 |
Estruturas de Dados/arvore_binaria_de_busca.py | da-ferreira/algorithms_and_data_structures | 0 | 12768864 |
# Autor: <NAME>
# Implementacao de uma Árvore Binária de Busca
#
# Exemplo de uma Árvore Binária de Busca que será usado durante o código.
# O elemento à esquerda são menores que o valor do pai, e os elementos à
# direita são maiores ou iguais ao valor do pai.
#
# 61
# /\
# ... | 3.96875 | 4 |
python/bits/190.reverse-bits.py | Nobodylesszb/LeetCode | 0 | 12768865 | <reponame>Nobodylesszb/LeetCode<filename>python/bits/190.reverse-bits.py
class Solution:
def reverseBits(self, n):
res = 0
for _ in range(32):
res = (res<<1) + (n&1) # 右移动
n>>=1 # 左移
return res
s =Solution()
b = s.reverseBits(101010111)
print(b)... | 3.296875 | 3 |
haas_lib_bundles/python/docs/examples/home_intrusion_alarm/esp32/code/buzzer.py | wstong999/AliOS-Things | 0 | 12768866 | <gh_stars>0
from driver import PWM
class BUZZER(object):
def __init__(self, pwmObj,data=None):
self.pwmObj = None
if not isinstance(pwmObj, PWM):
raise ValueError("parameter is not an PWM object")
self.pwmObj = pwmObj
if data is not None:
self.setOptionDuty... | 2.90625 | 3 |
test/test_vasicek.py | slpenn13/pythoninterestrates | 0 | 12768867 | ''' Pytest corresponding to calc_norm_v '''
# import numpy as np
import shortrate_model_vasicek as vas
import interest_rate_capfloor_convenience as intconv
mdl = vas.short_rate_vasicek(kappa=0.86, theta=0.08, sigma=0.01, r0=0.06,
norm_method=intconv.calc_v_norm_1d, dbg=True)
def test_norm... | 2.71875 | 3 |
wikipedia_parser/wikipedia_api/urls.py | ojones/wikipedia_parser | 9 | 12768868 | ENDPOINT = "https://en.wikipedia.org/w/api.php"
def make_url(id, is_expanded=False, is_html=False):
# TODO: isdigit is not robust enough, title could be number instead of string
return make_id_url(id, is_expanded, is_html) if str(id).isdigit() else make_title_url(id, is_expanded, is_html)
def make_title_ur... | 3 | 3 |
test/e2e/htdocs/cgi/echo.py | notroj/mod_h2 | 0 | 12768869 | <reponame>notroj/mod_h2
#!/usr/bin/env python
import sys, cgi, os
status = '200 Ok'
content = ''
for line in sys.stdin:
content += line
# Just echo what we get
print "Status: 200"
print """Content-Type: application/data\n"""
print content,
| 2.1875 | 2 |
sphinx/source/docs/user_guide/source_examples/plotting_arrow.py | quasiben/bokeh | 1 | 12768870 | from bokeh.plotting import figure, output_file, show
from bokeh.models import Arrow, OpenHead, NormalHead, VeeHead
output_file("arrow.html", title="arrow.py example")
p = figure(plot_width=600, plot_height=600, x_range=(-0.1,1.1), y_range=(-0.1,0.8))
p.circle(x=[0, 1, 0.5], y=[0, 0, 0.7], radius=0.1, color=["navy", ... | 2.84375 | 3 |
utils/auth_utils.py | darth-dodo/hustlers-den | 3 | 12768871 | from django.core.exceptions import PermissionDenied
from django.utils.crypto import get_random_string
from rest_framework_jwt.settings import api_settings
from utils.constants import AUTO_GENERATED_PASSWORD_LENGTH
# binding.pry equivalent
# import code; code.interact(local=locals())
def get_hustler_data(hustler_obj... | 2.28125 | 2 |
dataservice/api/common/id_service.py | ConnorBarnhill/kf-api-dataservice | 6 | 12768872 | <reponame>ConnorBarnhill/kf-api-dataservice
import uuid
import random
import base32_crockford as b32
def uuid_generator():
"""
Returns a stringified uuid of 36 characters
"""
return str(uuid.uuid4())
def kf_id_generator(prefix):
"""
Returns a function to generator
(Crockford)[http://www.... | 3.078125 | 3 |
app/app/cal.py | bigdave2058/recipe-app-api | 0 | 12768873 | <filename>app/app/cal.py
def addNumber(x,y)
"""Add two numbers""
return x + y
def subtract(x,y)
""" subtract two numbers """
return 0
def multiply(x,y)
""" multiply two numbers """
return x,y
| 2.5 | 2 |
src/vtd_interface/viRDBIcd.py | StanfordASL/vtd_interface | 20 | 12768874 | <reponame>StanfordASL/vtd_interface
# Automatically generated from the C message definitions
import cstruct
RDB_DEFAULT_PORT = 48190
RDB_FEEDBACK_PORT = 48191
RDB_IMAGE_PORT = 48192
RDB_MAGIC_NO = 35712
RDB_VERSION = 0x011D
RDB_SIZE_OBJECT_NAME = 32
RDB_SIZE_SCP_NAME = 64
RDB_SIZE_FILENAME = 1024
RDB_SIZE_TRLIGHT_PHA... | 1.359375 | 1 |
ais-kml/descriptionService.py | ctwardy/jacobs-vault | 1 | 12768875 |
from datetime import datetime
from flask import Flask
from flask import request
from flask import send_file
try:
# restplus is dead: https://github.com/noirbizarre/flask-restplus/issues/770
from flask_restx import Resource, Api
from flask_restx import reqparse
except ImportError:
try:
from f... | 2.6875 | 3 |
uninstall.py | slmjy/oci-ansible-modules | 106 | 12768876 | #!/usr/bin/env python
# Copyright (c) 2018, 2019 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT f... | 2.171875 | 2 |
setup.py | 51pricing/toplines | 0 | 12768877 | <reponame>51pricing/toplines<filename>setup.py
#!/usr/bin/env python
# coding=utf-8
from setuptools import setup, find_packages
setup(
name = 'toplines',
version = '0.1',
description = 'Get top lines from a large file',
author = 'haierol',
author_email = '<EMAIL>',
maintainer = '51p... | 1.4375 | 1 |
accounts/admin.py | mugagambi/retail-system | 1 | 12768878 | <reponame>mugagambi/retail-system
from django.contrib import admin
from accounts import models
class IncomeAccountAdmin(admin.ModelAdmin):
list_display = ('name', 'amount', 'created_at')
date_hierarchy = 'created_at'
class ExpenditureAccountAdmin(admin.ModelAdmin):
list_display = ('name', 'amount', 'cre... | 2.171875 | 2 |
blockchain_adapter/__init__.py | bountyful/bountyfulcoins | 0 | 12768879 | <reponame>bountyful/bountyfulcoins
import logging
import unittest
import requests
logger = logging.getLogger('blockchain_adapter')
URL_BASE = 'https://blockchain.info'
URL_BALANCE = '{base}/q/addressbalance/{addr}'
CONFIRMATIONS_MIN = 6 # min recommended by blockchain docs
class BlockChainAdapter(object):
""... | 3.109375 | 3 |
wisc/wisc-coords-local.py | beninato8/pokemon-go | 0 | 12768880 | from geopy.distance import geodesic
from pprint import pprint
from itertools import permutations
from tqdm import tqdm
import gmplot
from math import cos, sin, atan2, sqrt
import time
import re
home = (43.077589, -89.414075)
with open('wisc-coords-local.txt', 'r') as f:
text = f.read()
def dist_between(coords, ... | 2.875 | 3 |
tests/test_cmd.py | KrishanBhasin/giraffez | 122 | 12768881 | # -*- coding: utf-8 -*-
import pytest
from giraffez._teradata import RequestEnded, StatementEnded, StatementInfoEnded
import giraffez
from giraffez.constants import *
from giraffez.errors import *
from giraffez.types import *
class ResultsHelper:
"""
Helps to emulate how exceptions are raised when working w... | 2.28125 | 2 |
setup.py | mrexmelle/setuptools-example-hello | 0 | 12768882 | <reponame>mrexmelle/setuptools-example-hello
#!/bin/python
from setuptools import setup, find_packages
setup(
name="setuptools-example-hello",
version="1.0",
packages=find_packages(),
url="https://github.com/mrexmelle/setuptools-example-hello",
entry_points={
'console_scripts': [
'setuptools... | 1.414063 | 1 |
tasks/data.py | jrnold/acw_battle_data | 15 | 12768883 | #!/usr/bin/env python3
"""Command line tasks to build and deploy the ACW Battle Data."""
import os
import shutil
from os import path
import logging
from invoke import task
LOGGER = logging.getLogger(__name__)
@task
def setup(ctx):
"""Setup directory structure."""
os.makedirs(ctx.dst, exist_ok=True)
@task... | 2.40625 | 2 |
2017/spring/s1/samples/example3/main.py | Rouzbeh-School/Python101 | 1 | 12768884 | #!/usr/bin/python3
def main():
buffersize = 50000
infile = open('obama.png', 'rb')
outfile = open('obama-copy.png', 'wb')
buffer = infile.read(buffersize)
while len(buffer):
outfile.write(buffer)
print('.', end = '')
buffer = infile.read(buffersize)
print()
print('D... | 3.0625 | 3 |
python/191116_A.py | Xanonymous-GitHub/main | 1 | 12768885 | a, b, c = sorted(list(map(float, input().split())))
if(((a+b) > c)and((c-a) < b)):
print('It is a triangle.')
if(((a**2)+(b**2)) == (c**2)):
print('-> also a Right triangle.')
if(not(a-b)):
print('-> Wow it\'s a Isosceles right triangle!')
else:
print('not a triangle.') | 3.90625 | 4 |
MiniMaxAgent.py | youssef-sherif/riskgame | 0 | 12768886 | from Agent import Agent
from Color import Color
from State import State
class MiniMaxAgent(Agent):
def make_decision(self, board):
self.receive_armies(board)
state = State(board, self.available_armies_count, 1)
place_armies_result, _ = self.maximize_place_armies(state, -999999, 999999)
... | 2.96875 | 3 |
otree_manager/otree_manager/om/views/legal.py | chkgk/otree_manager | 2 | 12768887 | from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.contrib.flatpages.forms import FlatpageForm
from django.contrib.flatpages.models import FlatPage
from django.contrib.auth.decorators import login_required
"""Views for editing legal pages."""
#... | 2.25 | 2 |
airdrop/testcases/functional_testcases/test_airdrop_handler.py | rajeevbbqq/airdrop-services | 0 | 12768888 | <filename>airdrop/testcases/functional_testcases/test_airdrop_handler.py
import unittest
import json
from unittest.mock import patch
from http import HTTPStatus
from datetime import datetime, timedelta
from airdrop.infrastructure.repositories.airdrop_repository import AirdropRepository
from airdrop.application.handlers... | 2.125 | 2 |
sapsan/core/abstrctions/experiment.py | MilesCranmer/Sapsan | 11 | 12768889 | from abc import ABC, abstractmethod
from typing import List
from sapsan.core.abstrctions.algorithm import Parameter, Metric, Artifact
from sapsan.core.abstrctions.tracking import TrackingBackend
from sapsan.core.tracking.logger import LoggingBackend
class Experiment(ABC):
"""
Base experiment class
"""
... | 2.78125 | 3 |
setup.py | ulysse06/vtam | 1 | 12768890 | <gh_stars>1-10
# -*- coding: UTF-8 -*-
__author__ = "<NAME>, <NAME>, <NAME>, <NAME>"
__copyright__ = "Copyright 2018-2020, <NAME>, <NAME>"
__email__ = "<EMAIL>, <EMAIL>"
__license__ = "MIT"
import codecs
import configparser
from setuptools import setup
from setuptools import find_packages
import os
import sys
config... | 1.960938 | 2 |
tests/fullcontact_tests.py | fullcontact/fullcontact.py | 26 | 12768891 | from types import FunctionType
from fullcontact import FullContact
from nose.tools import assert_equal, assert_true
class TestFullContact(object):
def test_init(self):
fc = FullContact('test_key')
assert_equal(fc.api_key, 'test_key')
def test__prepare_batch_url(self):
fc = FullContact... | 2.453125 | 2 |
vaultier/accounts/tests/api.py | witoon-acom/vaultier | 0 | 12768892 | from time import time
from django.core.urlresolvers import reverse
from rest_framework.test import APIClient
# todo: Backend?
# from accounts.business.authentication import Backend
from accounts.business.fields import RecoverTypeField
from vaultier.test.tools import FileAccessMixin, VaultierAPIClient
from django.utils ... | 2.0625 | 2 |
project/sema2/migrations/0011_answer_answered_option.py | eorygen/sema2_web | 0 | 12768893 | <filename>project/sema2/migrations/0011_answer_answered_option.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sema2', '0010_auto_20150421_0420'),
]
operations = [
migra... | 1.539063 | 2 |
glustercli2/peer.py | aravindavk/glustercli2-python | 0 | 12768894 | from glustercli2.parsers import parsed_pool_list
class Peer:
def __init__(self, cli, hostname):
self.cli = cli
self.hostname = hostname
@classmethod
def peer_cmd(cls, cli, cmd):
return cli.exec_gluster_command(
["peer"] + cmd
)
@classmethod
def list(cl... | 2.921875 | 3 |
src/sampler.py | nespinoza/tso-abc | 0 | 12768895 | <reponame>nespinoza/tso-abc<filename>src/sampler.py
import os
import numpy as np
import pickle
from scipy.stats import multivariate_normal
from ._version import __version__
def get_weights(prior, old_weights, old_thetas, old_covariance, new_thetas, N):
""" Function that calculates the (normalized) weights of each... | 2.6875 | 3 |
3_GenderClassification/notebooks/highlevel-tensorflow-helper.py | Shuu-Ri/aws-nlp-workshop | 54 | 12768896 | <reponame>Shuu-Ri/aws-nlp-workshop<filename>3_GenderClassification/notebooks/highlevel-tensorflow-helper.py
import numpy as np
import pandas as pd
from numpy import genfromtxt
import os
import tensorflow as tf
from tensorflow.python.estimator.export.export import build_raw_serving_input_receiver_fn
from tensorflow.pyth... | 2.734375 | 3 |
library/word_spliter.py | guoruibiao/memokeeper | 0 | 12768897 | <filename>library/word_spliter.py
# coding: utf8
import os
import jieba
import conf.conf as app_conf
def extract_keywords(content):
"""
extract keywords by word's frequency
:param content: something in your system clipboard
:return:
"""
keywords = []
if content == "":
return keywor... | 3.390625 | 3 |
create_model.py | shenalt/stroke_predictor | 0 | 12768898 | <gh_stars>0
# Import our libraries
# Import pandas and numpy
import pandas as pd
import numpy as np
import pickle
import matplotlib.pyplot as plt
# Helper function to split our data
from sklearn.model_selection import train_test_split
# Import our Logistic Regression model
from sklearn.linear_model import Logi... | 2.890625 | 3 |
iberzetsn/__init__.py | jwg4/iberzetsn | 0 | 12768899 | <gh_stars>0
from .to_yiddish import roman_to_yiddish # noqa: F401
from .from_yiddish import yiddish_to_roman # noqa: F401
| 1.078125 | 1 |
src/animalClassifier.py | UBC-MDS/animalsgonewild | 1 | 12768900 | from pickle import TRUE
import string
def animalClassifier(text):
"""
Count total unique words in the input text and returns an animal type.
Parameters
----------
text: str
text to be analyzed
Returns
-------
str
the corresponding animal species
Examp... | 4.0625 | 4 |
twitterdedupe/tests/test_lengthen_url.py | jonohill/twitter-dedupe | 0 | 12768901 | <filename>twitterdedupe/tests/test_lengthen_url.py
import pytest
from unittest.mock import Mock
@pytest.fixture
def meth():
from twitterdedupe import lengthen_url
return lengthen_url
def reqlib(url):
reqlib = Mock(name="requests")
response = Mock(name="response")
response.url = url
reqlib.ge... | 2.953125 | 3 |
delivery_bots/bots/tgbot/checkout/buttons.py | savilard/delivery-bots | 0 | 12768902 | <gh_stars>0
from aiogram.types import InlineKeyboardButton
from aiogram.utils.emoji import emojize
async def create_checkout_button() -> InlineKeyboardButton:
"""Create tgbot checkout button."""
return InlineKeyboardButton(
text=emojize('💱 Оформить заказ'),
callback_data='checkout',
)
| 2.609375 | 3 |
core/test/src/xal/model/benchmarks/ring-turns-test.py | luxiaohan/openxal-csns-luxh | 10 | 12768903 | #!/usr/bin/env jython
import sys
from jarray import *
from java.lang import *
from java.util import *
from java.io import *
from java.text import *
from javax.swing import *
from java.awt.event import *
from java.awt import *
from java.util.regex import *
from gov.sns.xal.smf import *
from gov.sns.xal.smf.data impor... | 2.109375 | 2 |
tests/integration_tests/test_integration.py | VladSkripniuk/optuna | 2 | 12768904 | <gh_stars>1-10
import pytest
def test_import():
# type: () -> None
from optuna.integration import chainer # NOQA
from optuna.integration import chainermn # NOQA
from optuna.integration import keras # NOQA
from optuna.integration import lightgbm # NOQA
from optuna.integration import mxnet ... | 1.992188 | 2 |
apps/redirects/tests.py | jfterpstra/onepercentclub-site | 7 | 12768905 | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import six
from .middleware import RedirectFallbackMiddleware
from .models import Redirect
@override_settings(
APPEND_SLASH=F... | 2.09375 | 2 |
export-reach-contact-list/export_reach_contact_list.py | AfricasVoices/Project-OCHA | 0 | 12768906 | import argparse
import csv
import sys
from core_data_modules.cleaners import Codes
from core_data_modules.logging import Logger
from core_data_modules.traced_data.io import TracedDataJsonIO
from core_data_modules.util import PhoneNumberUuidTable
Logger.set_project_name("OCHA")
log = Logger(__name__)
if __name__ == "... | 2.65625 | 3 |
main_refactor.py | karl-crl/decagon | 0 | 12768907 | <filename>main_refactor.py
import argparse
import os
from run_decagon_toy import RunDecagonToy
from run_decagon_real import RunDecagonReal
from constants import PARAMS, INPUT_FILE_PATH
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--log', default=False,
... | 2.21875 | 2 |
python/labs/quick-banking-app/starter-code/banking.py | silpillasil/DANK_CSSI_STUFFS | 1 | 12768908 | <gh_stars>1-10
#!/usr/bin/python
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 3.546875 | 4 |
src/colourutils.py | erichards97/categorical-colour-calendar | 0 | 12768909 | from matplotlib.colors import hsv_to_rgb, to_hex
def get_n_colours(n, s=0.5, v=0.95):
return [hsv_to_rgb((i/n, s, v)) for i in range(n)]
def extend_colour_map(data, colour_map, date_colour):
missing_values = [x for x in data.dropna().unique() if x not in colour_map] # All events that don't have a specified... | 3.015625 | 3 |
_teaching/csci127-summer-2020/readings/activities/alternating.py | lgw2/lgw2.github.io | 0 | 12768910 | <reponame>lgw2/lgw2.github.io
def alternating(list_of_ints):
pass
print(alternating([1, 2, 3, 4]))
print(alternating([10, 11, 1, 12]))
print(alternating([10, 21, 22, -5, 100, 101, 2]))
| 3.3125 | 3 |
helloWorld/helloWorldApp/migrations/0011_suggestion_upvote.py | jcheon/reddit_clone | 4 | 12768911 | # Generated by Django 2.2.5 on 2019-10-27 02:27
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('helloWorldApp', '0010_auto_20191025_2008'),
]
op... | 1.539063 | 2 |
sensehat_dashboard/pi/environment.py | gdmgent-IoT-1920/labo-3-firebase-jensderyckere | 0 | 12768912 | from sense_hat import SenseHat
import threading
import firebase_admin
from firebase_admin import credentials, firestore
# constants
COLLECTION = 'raspberry'
DOCUMENT = 'omgeving'
# firebase
cred = credentials.Certificate("../config/firebase_admin.json")
firebase_admin.initialize_app(cred)
# connect firestore
db = fi... | 2.5 | 2 |
tester.py | vishwasmehra/Flask-Chat-interface | 1 | 12768913 | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 15 17:25:09 2018
@author: Heller
"""
import os
inde="1"
inde=int(inde)
flag=0
for f in os.listdir("notes/"):
flag=flag+1
if(flag==inde):
file="notes/"+f
with open(file) as fa:
content = fa.readlines()
content=[x.strip() for x in content... | 2.984375 | 3 |
hatebu2pocket.py | naimasa/hatebu2pocket | 0 | 12768914 | # -*- coding: utf-8 -*-
import sys
import pocket
from xml.etree.ElementTree import *
import json
param = sys.argv
if (len(param) < 2):
print "invalid auguments"
exit(1)
# parse xml
infile = param[1]
tree = parse(infile)
elem = tree.getroot()
list = []
for e in elem.findall(".//{http://purl.org/atom/ns#}link[... | 2.453125 | 2 |
lib/python2.7/site-packages/pyscope/simccdcamera2.py | leschzinerlab/myami-3.2-freeHand | 0 | 12768915 | import copy
import ccdcamera
import numpy
import random
random.seed()
import time
import remote
import os
from pyami import mrc
import itertools
from pyscope import falconframe
FRAME_DIR = '.'
rawtype = numpy.uint32
frametype = numpy.uint8
idcounter = itertools.cycle(range(100))
has_energy_filter = False
class SimC... | 1.960938 | 2 |
src/setup.py | anchepiece/pydukeenergy | 24 | 12768916 | from setuptools import setup, find_packages
setup(name='pydukeenergy',
version='0.0.6',
description='Interface to the unofficial Duke Energy API',
url='http://github.com/w1ll1am23/pyduke-energy',
author='<NAME>',
license='MIT',
install_requires=['requests>=2.0', 'beautifulsoup4>=4.6... | 1.3125 | 1 |
aquaticore/taxa/urls.py | rockerBOO/aquaticore | 0 | 12768917 | <reponame>rockerBOO/aquaticore
from django.conf.urls.defaults import *
urlpatterns = patterns('aquaticore.taxa.views',
(r'^$', 'index'),
(r'^species/(?P<species_name>[^\/]+)/?', 'species_detail'),
(r'^species/?', 'species_list'),
(r'^family/(?P<family_name>[^\/]+)/?', ... | 1.648438 | 2 |
app/nextmove.py | xm-evanguo/starter-snake-python | 0 | 12768918 | import collections
import random
def next_move_state(map, head_xy, direction):
switcher = {
'left': (-1, 0),
'right': (1, 0),
'up': (0, -1),
'down': (0, 1)
}
return map[head_xy[1] + switcher.get(direction)[1]][head_xy[0] + switcher.get(direction)[0]]
def next_direction(map,... | 3.59375 | 4 |
TensorCook.py | AmanKishore/TensorCook | 1 | 12768919 |
from google_images_download import google_images_download
food_list = ['food with protein','unhealthy food','carbs','food with sugar','vegetables']
for food in food_list:
args = {"keywords":food, "format": "jpg", "limit":1000, "output_directory":"./tf_files/food_images"}
response = google_images_downl... | 2.953125 | 3 |
canny.py | HuangKaiHuan/edge_detection | 3 | 12768920 | <filename>canny.py
#!/usr/bin/python2.7
# -*- coding:utf-8 -*-
__author__ = 'hkh'
__date__ = '05/02/2018'
__version__ = 1.0
"""
主要参考: 数字图像处理(第三版)10.2.6,<NAME>
"""
import cv2
import numpy as np
import time
def geodesicDilation(src, mask, kernel, iteration=-1):
if iteration > 0:
while iteration:
... | 2.21875 | 2 |
feeds/view/_utils.py | qq20004604/Mail-Report-System | 1 | 12768921 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from ..models import *
from django.utils import timezone
from django.db.models import Q
from user.models import UserModel
from mail_pusher.models import PuberMailPushHistory
from mail_pusher.utils import send_feeds_mail
from package.simple_log import log
fro... | 1.992188 | 2 |
MuSCADeT/MCA.py | aymgal/MuSCADeT | 0 | 12768922 | """@package MuSCADeT
"""
from scipy import signal as scp
import numpy as np
import matplotlib.pyplot as plt
import astropy.io.fits as pf
import scipy.ndimage.filters as med
import MuSCADeT.pca_ring_spectrum as pcas
import MuSCADeT.wave_transform as mw
NOISE_TAB = np.array([ 0.8907963 , 0.20066385, 0.08550751, 0... | 2.421875 | 2 |
xiaomi_thermo_unified/sensors/uuids.py | h4/xiaomi_thermo_unified | 1 | 12768923 | DEVICE_NAME = '00002a00-0000-1000-8000-00805f9b34fb'
MODEL_NUMBER = '00002a24-0000-1000-8000-00805f9b34fb'
SERIAL_NUMBER = '00002a25-0000-1000-8000-00805f9b34fb'
FIRMWARE_VERSION = '00002a26-0000-1000-8000-00805f9b34fb'
HARDWARE_VERSION = '00002a27-0000-1000-8000-00805f9b34fb'
MANUFACTURER_NAME = '00002a29-0000-1000-80... | 1.132813 | 1 |
xarray_sentinel/sentinel1.py | shaorenshengg/bopene | 0 | 12768924 | import os
import typing as T
import warnings
import fsspec # type: ignore
import numpy as np
import numpy.typing as NT
import pandas as pd # type: ignore
import rioxarray # type: ignore
import xarray as xr
from xarray_sentinel import conventions, esa_safe
def open_calibration_dataset(calibration: esa_safe.PathTy... | 2.421875 | 2 |
utils/metrics.py | teddy4445/OIEI | 6 | 12768925 | """
Authors: <NAME>, <NAME>
Helper functions:
1. Overall score between, explainability and performance with normalization between 0-1 (logaritmic_power, sigmoid_power).
2. An explainability minimization (smaller is better) with additive constrains according the number of leaves and the error for the optimization.
... | 3.1875 | 3 |
main/libusbmuxd/template.py | RoastVeg/cports | 0 | 12768926 | <reponame>RoastVeg/cports
pkgname = "libusbmuxd"
pkgver = "2.0.2"
pkgrel = 0
build_style = "gnu_configure"
hostmakedepends = ["pkgconf", "automake", "libtool"]
makedepends = ["libusb-devel", "libplist-devel"]
pkgdesc = "Client library to multiplex connections to/from iOS devices"
maintainer = "q66 <<EMAIL>>"
license = ... | 1.367188 | 1 |
ks4.py | raspitv/KStracker | 0 | 12768927 | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# cli arguments: nolog nodis noloop
from urllib2 import Request, urlopen, URLError
from time import sleep # we need sleep for a delay between readings
import sys # we use sys for command line arguments
# inser... | 2.640625 | 3 |
gluon/tests/api/test_baseObject.py | lfntac/ipv6 | 0 | 12768928 | # Copyright 2016, AT&T
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 2.3125 | 2 |
05.04.2022/listas/final.py | N0N4T0/python-codes | 0 | 12768929 | allowedAccess = ['Danilo', 'Lucio', 'Daiana', 'Vanessa']
requestName = input("Por gentileza informa seu nome para verificar nivel de permissão: ")
for name in allowedAccess:
if(name == requestName):
print("Acesso autorizado a " + requestName)
break
else:
print("Acesso negado a " + requ... | 3.765625 | 4 |
terrascript/oneandone/__init__.py | hugovk/python-terrascript | 507 | 12768930 | <filename>terrascript/oneandone/__init__.py
# terrascript/oneandone/__init__.py
import terrascript
class oneandone(terrascript.Provider):
pass
| 1.242188 | 1 |
functests/execassets.py | Serhiy1/archivist-python | 2 | 12768931 | <reponame>Serhiy1/archivist-python
"""
Test assets creation
"""
from copy import copy, deepcopy
import json
from os import environ
from unittest import skip, TestCase
from uuid import uuid4
from archivist.archivist import Archivist
from archivist.proof_mechanism import ProofMechanism
# pylint: disable=fixme
# pylint... | 2.53125 | 3 |
src/UQpy/inference/information_criteria/baseclass/InformationCriterion.py | SURGroup/UncertaintyQuantification | 0 | 12768932 | <reponame>SURGroup/UncertaintyQuantification
from abc import ABC, abstractmethod
from typing import Union
import numpy as np
from UQpy.inference.BayesParameterEstimation import BayesParameterEstimation
from UQpy.inference.MLE import MLE
class InformationCriterion(ABC):
@abstractmethod
def minimize_criterio... | 2.875 | 3 |
test/functional/test-framework/core/test_run.py | josehu07/open-cas-linux-mf | 2 | 12768933 | <gh_stars>1-10
#
# Copyright(c) 2019-2020 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
from log.logger import Log
import pytest
class Blocked(Exception):
pass
class TestRun:
dut = None
executor = None
LOGGER: Log = None
plugin_manager = None
@classmethod
def step(... | 2.078125 | 2 |
XboxHelper.py | abaire/nv2a-trace | 0 | 12768934 | <filename>XboxHelper.py
"""Various helper methods"""
# pylint: disable=missing-function-docstring
# pylint: disable=consider-using-f-string
# pylint: disable=chained-comparison
import atexit
from collections import namedtuple
from typing import Optional
from typing import Tuple
import time
DMAState = namedtuple(
... | 2.359375 | 2 |
GreyMatter/sleep.py | nayangupta824/Melissa-Web | 20 | 12768935 | from SenseCells.tts import tts
def go_to_sleep():
tts('Goodbye! Have a great day!')
quit()
| 1.625 | 2 |
playground.py | JoseLuisRojasAranda/FB-Friends-Scraper | 0 | 12768936 | <reponame>JoseLuisRojasAranda/FB-Friends-Scraper<gh_stars>0
import time
import scrapy
from scrapy import Spider
from scrapy.utils.response import open_in_browser
from scrapy.http import FormRequest
from scrapy.crawler import CrawlerProcess
from selenium import webdriver
class FBCrawler(object):
def __init__(self... | 3.046875 | 3 |
seed/routes/helpers/graphene_view.py | erick-rivas/django-reference | 0 | 12768937 | <filename>seed/routes/helpers/graphene_view.py<gh_stars>0
"""
__Seed builder__
(Read_only) Routes helper
"""
from graphene_django.views import GraphQLView
from rest_framework.authentication import TokenAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.decorators import authent... | 2.078125 | 2 |
BitTornado/clock.py | weedy/BitTornado | 0 | 12768938 | """Replicate win32 time.clock() behavior for all platforms"""
import time
import sys
_MAXFORWARD = 100
_FUDGE = 1
class RelativeTime:
def __init__(self):
self.time = time.time()
self.offset = 0
def get_time(self):
t = time.time() + self.offset
if t < self.time or t > self.ti... | 3.46875 | 3 |
Archive/dynasty_extract.py | 46319943/SLan-NLP | 0 | 12768939 | <reponame>46319943/SLan-NLP<filename>Archive/dynasty_extract.py
import re
def past_time_concat(loc_list: list):
'''
连接误分割的公元前字符串
'''
loc_list = loc_list.copy()
for index, loc_str in enumerate(loc_list):
if loc_str == '公元前' and '000' in loc_list[index + 1]:
loc_list[index] = loc_... | 2.796875 | 3 |
paprika/system/Message.py | thunder-/paprika | 0 | 12768940 | <filename>paprika/system/Message.py
import json
from paprika.system.logger.Logger import Logger
from requests import post
from paprika.system.Traceback import Traceback
class Message:
def __init__(self):
pass
@staticmethod
def get_header(response, name):
for key in response.headers.keys... | 2.453125 | 2 |
app/__init__.py | alphagov/team-metrics | 0 | 12768941 | <gh_stars>0
import os
import uuid
import alembic.config
from alembic.config import Config
import alembic.command
from flask import redirect, request, session
from flask import Flask
from psycopg2 import ProgrammingError
import requests
from app.metrics_db import Metrics_DB
import logging
db = Metrics_DB()
def cre... | 2.171875 | 2 |
localization_env.py | robger98/CS5313_Localization_Env | 0 | 12768942 | # Author : <NAME>
# Contact : <EMAIL>
# Date : Feb 16, 2020
import random
import time
import numpy as np
import random
import time
import numpy as np
try:
from CS5313_Localization_Env import maze
except:
print(
'Problem finding CS5313_Localization_Env.maze... Trying to "import maze" only...'... | 2.4375 | 2 |
quant_eval.py | sharanramjee/single-image-stereo-depth-estimation | 0 | 12768943 | <reponame>sharanramjee/single-image-stereo-depth-estimation
import os
import numpy as np
from PIL import Image
def replace_zeros(data):
min_nonzero = np.min(data[np.nonzero(data)])
data[data == 0] = min_nonzero
return data
def compute_errors(gt_path, pred_path):
gt = np.clip(np.asarray(Image.open(gt... | 2.6875 | 3 |
django_auth_http_basic/__init__.py | t73fde/django-auth-http-basic | 8 | 12768944 | # -*- coding: utf-8 -*-
"""Simple authenticaton backend based on HTTP basic authentication.
:copyright: (c) 2016-2019 by <NAME>
:license: Apache 2.0, see LICENSE
"""
import logging
import requests
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.conf ... | 2.96875 | 3 |
synapseclient/annotations.py | lingyunsong/synapse_scripts | 0 | 12768945 | <filename>synapseclient/annotations.py
"""
***********
Annotations
***********
Annotations are arbitrary metadata attached to Synapse entities. They can be
accessed like ordinary object properties or like dictionary keys::
entity.my_annotation = 'This is one way to do it'
entity['other_annotation'] = 'This is... | 2.953125 | 3 |
src/view/sprites/founder.py | Matimed/Barbarism | 2 | 12768946 | <filename>src/view/sprites/founder.py
import pygame as pg
from src.events import Tick
from src.references.images import JOB
from src.view.sprites.charactor import CharactorSprite
class FounderSprite(CharactorSprite):
native_job = JOB['founder']
job = native_job.copy()
@classmethod
def update_size(cl... | 2.734375 | 3 |
src/strategies/reinforce/NoReinforceStrategy.py | jgc128/crabada.py | 34 | 12768947 | from typing import Any, List
from src.libs.CrabadaWeb2Client.types import CrabForLending, Game, TeamStatus
from src.strategies.reinforce.ReinforceStrategy import ReinforceStrategy
class NoReinforceStrategy(ReinforceStrategy):
"""
Strategy to adopt if you do not wish to reinforce
at all; useful for auto-lo... | 2.90625 | 3 |
pymedphys/labs/pedromartinez/qc-lightrad.py | pymedphys/pymedphys-archive-2019 | 1 | 12768948 | #############################START LICENSE##########################################
# Copyright (C) 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/l... | 1.445313 | 1 |
cli/endpoints/online/triton/ensemble/models/triton/bidaf-preprocess/1/model.py | denniseik/azureml-examples | 331 | 12768949 | import nltk
import json
import numpy as np
from nltk import word_tokenize
import triton_python_backend_utils as pb_utils
class TritonPythonModel:
"""Your Python model must use the same class name. Every Python model
that is created must have "TritonPythonModel" as the class name.
"""
def initialize... | 3.203125 | 3 |
run.py | neoocean/arlo | 0 | 12768950 | from arlo import Arlo
from datetime import timedelta, date
import datetime
import sys
import platform
import os.path
from os import path
USERNAME = ''
PASSWORD = ''
try:
# Instantiating the Arlo object automatically calls Login(), which returns an oAuth token that gets cached.
# Subsequent successful calls to lo... | 2.875 | 3 |