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
backend/translator/admin.py
Gobaan/menu-translator-django
0
15900
<gh_stars>0 from django.contrib import admin from django import forms from .models import Annotation, Clip, Food, Image, Language, Website, UserProfile class AnnotationAdminForm(forms.ModelForm): class Meta: model = Annotation fields = '__all__' class AnnotationAdmin(admin.ModelAdmin): form ...
1.96875
2
colibris/docs/openapi/__init__.py
AMecea/colibris
6
15901
from os.path import abspath, join, dirname from colibris.conf import settings STATIC_PATH = abspath(join(dirname(__file__), 'swagger')) UI_URL = settings.API_DOCS_URL STATIC_URL = '{}/static'.format(UI_URL) APISPEC_URL = '{}/apispec'.format(UI_URL)
1.5
2
arc/__init__.py
jtguibas/arc
6
15902
#!/usr/bin/env python from arc import models from arc import methods from arc import black_boxes from arc import others from arc import coverage
1.109375
1
qcloudsdkbatch/TerminateTaskInstanceRequest.py
f3n9/qcloudcli
0
15903
<filename>qcloudsdkbatch/TerminateTaskInstanceRequest.py # -*- coding: utf-8 -*- from qcloudsdkcore.request import Request class TerminateTaskInstanceRequest(Request): def __init__(self): super(TerminateTaskInstanceRequest, self).__init__( 'batch', 'qcloudcliV1', 'TerminateTaskInstance', 'bat...
2.0625
2
altair/vegalite/v2/examples/step_chart.py
hydrosquall/altair
0
15904
""" Step Chart ----------------- This example shows Google's stock price over time. """ import altair as alt from vega_datasets import data source = data.stocks() chart = alt.Chart(source).mark_line(interpolate = 'step-after').encode( x = 'date', y = 'price' ) chart.transform = [{"filter": "datum.symbol==='...
2.921875
3
graphit/graph_networkx.py
py-graphit/py-graphit
1
15905
# -*- coding: utf-8 -*- """ file: graph_networkx.py Provides a NetworkX compliant Graph class. """ from graphit.graph import GraphBase from graphit.graph_exceptions import GraphitException, GraphitNodeNotFound from graphit.graph_algorithms import degree, size from graphit.graph_utils.graph_utilities import graph_und...
2.78125
3
Chapter02/Shuffle.py
Tanishadel/Mastering-Machine-Learning-for-Penetration-Testing
241
15906
<reponame>Tanishadel/Mastering-Machine-Learning-for-Penetration-Testing<filename>Chapter02/Shuffle.py import os import random #initiate a list called emails_list emails_list = [] Directory = '/home/azureuser/spam_filter/enron1/emails/' Dir_list = os.listdir(Directory) for file in Dir_list: f = open(Directory + file, 'r...
2.828125
3
computer vision/pose_module.py
Francois-Adham/OpenCV
0
15907
<filename>computer vision/pose_module.py import cv2 as cv import mediapipe as mp class PoseDetector: def __init__(self, mode=False, complexity=1, smooth=False, confidence=0.5, tracking_confidence=0.5) -> None: self.mode = mode self.complexity = complexity self.smooth = smooth ...
2.953125
3
Irene/base.py
mghasemi/Irene
12
15908
r""" This is the base module for all other objects of the package. + `LaTeX` returns a LaTeX string out of an `Irene` object. + `base` is the parent of all `Irene` objects. """ def LaTeX(obj): r""" Returns LaTeX representation of Irene's objects. """ from sympy.core.core import all_classes ...
2.984375
3
demo/corenlp.py
Rvlis/stanza
0
15909
<gh_stars>0 from stanza.server import CoreNLPClient import os # example text print('---') print('input text') print('') # text = "<NAME> is a nice person. Chris wrote a simple sentence. He also gives oranges to people." text = "PyTables is built on top of the HDF5 library, using the Python language and the NumPy pac...
2.859375
3
basic/fasta.py
JinyuanSun/my_bio_script
0
15910
<gh_stars>0 #!/usr/bin/env python # By <NAME> def fasta2dic(fastafilename): #read a fasta file into a dict fasta_dict = {} with open(fastafilename) as fastafile: for line in fastafile: if line[0] == ">": head = line.strip() fasta_dict[head] = '' ...
3.015625
3
tea_client/http.py
alefnula/tea-client
1
15911
<reponame>alefnula/tea-client import enum from typing import Optional, Dict import httpx from tea import serde from tea_client import errors from tea_client.models import TeaClientModel class AuthorizationMethod(enum.Enum): basic = "Basic" token = "Token" jwt = "JWT" class HttpClient: """Generic r...
2.515625
3
PRPConnector/TestPRPConnector.py
manuelbieri/PRP-APIConnect
0
15912
<reponame>manuelbieri/PRP-APIConnect import unittest from typing import List import Connector class PRPConnectorTest(unittest.TestCase): connection: Connector.PRPConnector = Connector.PRPConnector('admin', 'adminTest', 'https://marblch.pythonanywhere.com/') def test_test_message(self): response: dic...
2.59375
3
competitors/VAE.py
umarov90/DeepFake
3
15913
<reponame>umarov90/DeepFake import tensorflow as tf from tensorflow import keras class VAE(keras.Model): def __init__(self, encoder, decoder, **kwargs): super(VAE, self).__init__(**kwargs) self.encoder = encoder self.decoder = decoder self.e_count = 0 def train_step(self, dat...
2.734375
3
test/unit/database/test_work.py
matiasmorant/py2neo
0
15914
<gh_stars>0 #!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright 2011-2020, <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/licenses/LICENSE-2.0 #...
2.09375
2
extract/read_acc.py
YutoNakayachi/jankenEstimate
0
15915
#from https://github.com/mfurukawa/imu_sensor/tree/master/src/Python # September 03, 2020 # <NAME> from __future__ import unicode_literals ,print_function import serial from time import sleep import numpy as np import matplotlib.pyplot as plt import io import csv import time import datetime import struct impo...
2
2
scripts/backup/eval.py
vafaei-ar/Ngene
0
15916
import matplotlib as mpl mpl.use('agg') import glob import argparse from time import time import numpy as np import pylab as plt import rficnn as rfc parser = argparse.ArgumentParser() parser.add_argument('--arch', required=False, help='choose architecture', type=str, default='1') parser.add_argument('--trsh', requir...
2.03125
2
ctemail.py
dyike/CTEmail
47
15917
from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.image import MIMEImage from email.header import Header from email.mime.base import MIMEBase from email import encoders import os import uuid import smtplib import re class CTEmail(object): def __i...
2.78125
3
alipay/aop/api/domain/RequestExtShopItem.py
snowxmas/alipay-sdk-python-all
213
15918
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class RequestExtShopItem(object): def __init__(self): self._brand_code = None self._category_code = None self._description = None self._item_code = No...
2.09375
2
tornado/s3server.py
suocean16/osu_study
9
15919
<reponame>suocean16/osu_study #!/usr/bin/env python # # Copyright 2009 Facebook # # 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 r...
2.296875
2
multitest_transport/api/test_result_api.py
maksonlee/multitest_transport
0
15920
# Copyright 2021 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 applicable law or agreed to in writing, ...
1.890625
2
remcall/schema/typeref.py
luphord/remcall
0
15921
class TypeRef: '''Represents temporary type references by an integer; to be resolved to actual types later ''' def __init__(self, type_ref: int): self.type_ref = type_ref def __hash__(self): return hash(self.type_ref) def __eq__(self, other): return isinstance(other,...
3.484375
3
visualize_loss/loss_verification.py
entn-at/RL-LightSpeech
1
15922
<filename>visualize_loss/loss_verification.py<gh_stars>1-10 import numpy as np loss_arr = np.array(list()) with open("total_loss.txt", "r") as f_loss: cnt = 0 for loss in f_loss.readlines(): cnt += 1 # print(loss) loss_arr = np.append(loss_arr, float(loss)) print(cnt)
2.984375
3
road_roughness_prediction/tools/image_utils.py
mknz/dsr-road-roughness-prediction
7
15923
<reponame>mknz/dsr-road-roughness-prediction '''Image utils''' from io import BytesIO from PIL import Image import matplotlib.pyplot as plt def save_and_open(save_func): '''Save to in-memory buffer and re-open ''' buf = BytesIO() save_func(buf) buf.seek(0) bytes_ = buf.read() buf_ = BytesIO(b...
2.578125
3
machida/lib/wallaroo/experimental/connectors.py
pvmsikrsna/wallaroo
0
15924
<reponame>pvmsikrsna/wallaroo<gh_stars>0 import hashlib import logging from struct import unpack import sys import time from . import (connector_wire_messages as cwm, AtLeastOnceSourceConnector, ProtocolError, ConnectorError) if sys.version_info.major == 2: from .bas...
2.171875
2
pytorch_lightning/callbacks/device_stats_monitor.py
Code-Cornelius/pytorch-lightning
4
15925
# Copyright The PyTorch Lightning team. # # 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 i...
2.328125
2
plugins/Hikvision_app.py
cflq3/getcms
22
15926
<gh_stars>10-100 #!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_file(pluginname, "doc/page/login.asp", "Hikvision")
1.34375
1
package/awesome_panel/database/settings.py
mycarta/awesome-panel
1
15927
<gh_stars>1-10 """In this module we provide a list paths, urls and other usefull settings.""" GITHUB_URL = "https://github.com/MarcSkovMadsen/awesome-panel/" GITHUB_BLOB_MASTER_URL = "https://github.com/MarcSkovMadsen/awesome-panel/blob/master/" GITHUB_RAW_URL = "https://raw.githubusercontent.com/MarcSkovMadsen/awes...
1.5
2
astropy/coordinates/tests/test_pickle.py
MatiasRepetto/astropy
1
15928
import pickle import pytest import numpy as np from astropy.coordinates import Longitude from astropy import coordinates as coord from astropy.tests.helper import pickle_protocol, check_pickling_recovery # noqa # Can't test distances without scipy due to cosmology deps from astropy.utils.compat.optional_deps import ...
2.34375
2
articles/Machine Learning/SupervisedLearning/knn_classify/knn.py
wjiec/packages
0
15929
#!/usr/bin/env python # # Copyright (C) 2017 ShadowMan # import operator import numpy as np group = np.array([ [1.0, 1.1], [1.0, 1.0], [0.0, 0.0], [0.0, 0.1] ]) labels = ['A', 'A', 'B','B'] def auto_normal(data_set): # 寻找一行/列中的最小值 # axis:表示行(1)或者列(0) min_values = data_set.min(axis = 0) ...
2.71875
3
src/pymir-controller/controller/label_model/label_runner.py
IJtLJZ8Rm4Yr/ymir-backend
0
15930
import os from typing import Tuple, List from controller.invoker.invoker_task_exporting import TaskExportingInvoker from controller import config from controller.label_model.label_studio import LabelStudio from controller.utils.app_logger import logger def prepare_label_dir(working_dir: str, task_id: str) -> Tuple[s...
2.09375
2
run-workflow-cloud-run/main.py
UriKatsirPrivate/gcp-workflows
1
15931
<filename>run-workflow-cloud-run/main.py import os from flask import Flask from googleapiclient.discovery import build import json import sys from google.oauth2 import service_account import googleapiclient.discovery app = Flask(__name__) workflow_service = build('workflowexecutions', 'v1') @app.route("/") def h...
2.65625
3
rendering/viewer.py
MTKat/FloorplanTransformation
323
15932
from math import pi, sin, cos from panda3d.core import * from direct.showbase.ShowBase import ShowBase from direct.task import Task from floorplan import Floorplan import numpy as np import random import copy class Viewer(ShowBase): def __init__(self): ShowBase.__init__(self) #self.scene = self.loader.loadM...
2.328125
2
application/gen/today/TodayInternalApiService.py
today-app/today-api
0
15933
# # Autogenerated by Thrift Compiler (0.9.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # # options string: py # from thrift.Thrift import TType, TMessageType, TException, TApplicationException from ttypes import * from thrift.Thrift import TProcessor from thrift.transport import TTransport ...
1.960938
2
common/kalman/simple_kalman_old.py
919bot/Tessa
114
15934
import numpy as np class KF1D: # this EKF assumes constant covariance matrix, so calculations are much simpler # the Kalman gain also needs to be precomputed using the control module def __init__(self, x0, A, C, K): self.x = x0 self.A = A self.C = C self.K = K self.A_K = self.A - np.dot(se...
2.765625
3
serverless/apps/qctokyo/horoscope.py
snuffkin/qctokyo
8
15935
import datetime import logging import os import boto3 from qiskit import IBMQ from qiskit import QuantumCircuit, execute logger = logging.getLogger() logger.setLevel(logging.INFO) backend_candidates = [ "ibmq_athens", "ibmq_santiago", "ibmq_belem", "ibmq_quito", "ibmq_lima", ] def _get_provider...
2.21875
2
boot/rpi/tools/patman/func_test.py
yodaos-project/yodaos
1,144
15936
<filename>boot/rpi/tools/patman/func_test.py # -*- coding: utf-8 -*- # SPDX-License-Identifier: GPL-2.0+ # # Copyright 2017 Google, Inc # import contextlib import os import re import shutil import sys import tempfile import unittest import gitutil import patchstream import settings @contextlib.contextmanager def ca...
2.03125
2
anime downloaders/animeblkom downloader.py
badr286/anime-stuff
0
15937
<reponame>badr286/anime-stuff from animeblkom import Animeblkom, animeblkom_episode from downloader import blkom from requests import get download_list = [] anime_url = input('Anime Url: ') # ex. https://animeblkom.net/watch/one-piece episodes = Animeblkom.get_anime_episodes(anime_url) print(f'{len(episodes...
3.265625
3
src/spaceone/monitoring/interface/rest/v1/common.py
xellos00/monitoring
0
15938
<reponame>xellos00/monitoring<gh_stars>0 import logging from fastapi import APIRouter from spaceone.core.locator import Locator _LOGGER = logging.getLogger(__name__) router = APIRouter() @router.get('/check') async def check(): return {'status': 'SERVING'}
1.8125
2
figures/kCSD_properties/figure_eigensources_M_1D.py
rdarie/kCSD-python
11
15939
""" @author: mkowalska """ import os import numpy as np from numpy.linalg import LinAlgError import matplotlib.pyplot as plt from figure_properties import * import matplotlib.gridspec as gridspec from kcsd import KCSD1D import targeted_basis as tb __abs_file__ = os.path.abspath(__file__) def _html(r, g, b): ret...
2.265625
2
examples/task1.py
qqgg231/Allegro
27
15940
<reponame>qqgg231/Allegro<gh_stars>10-100 #!/usr/bin/env python # coding=utf-8 from celery import Celery from pprint import pprint import time app = Celery('tasks', backend='redis://localhost:6379/0', broker = 'redis://localhost:6379/0') @app.task def get(message): #=========== #pprint(message) #========...
1.78125
2
checkov/common/comment/enum.py
antonblr/checkov
4,013
15941
import re COMMENT_REGEX = re.compile(r'(checkov:skip=|bridgecrew:skip=) *([A-Z_\d]+)(:[^\n]+)?')
2.171875
2
chris_backend/plugins/migrations/0034_auto_20200420_2320.py
rudolphpienaar/ChRIS_ultron_backEnd
26
15942
# Generated by Django 2.1.4 on 2020-04-20 23:20 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('plugins', '0033_pluginparameter_short_flag'), ] operations = [ migrations.AlterField( model_name='computeresource', ...
1.453125
1
src/StarTrac/forms.py
Stdubic/Track
1
15943
''' Created on Dec 21, 2014 @author: Milos ''' ''' Forma za eventualna prosirenja djangovog user-a ''' from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404...
2.109375
2
mysite/settings/base.py
HumanCellAtlas/HCA-Tracker
3
15944
<reponame>HumanCellAtlas/HCA-Tracker """ Django settings for mysite project. Generated by 'django-admin startproject' using Django 2.2.4. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en...
1.734375
2
setup.py
kiranmantri/python-remote-import
0
15945
<reponame>kiranmantri/python-remote-import """Create the distribution file (pypi).""" import importlib import setuptools from pathlib import Path this_package_name = 'remote_import' version_file = Path(__file__).absolute().parent / this_package_name / "__version__.py" setuptools.setup( name=this_package_name, ...
1.804688
2
flaskr/test/unit/webapp/test_aquarium_mode.py
UnibucProjects/SmartAquarium
6
15946
<filename>flaskr/test/unit/webapp/test_aquarium_mode.py from flask import request import pytest import json from app import create_app, create_rest_api from db import get_db @pytest.fixture def client(): local_app = create_app() create_rest_api(local_app) client = local_app.test_client() yield client...
2.265625
2
get_anns.py
hoangnt2601/RAPiD
0
15947
<gh_stars>0 import json import os import cv2 import imutils import numpy as np import torch import torchvision.transforms.functional as tvf from PIL import Image from models.rapid import RAPiD from tracker.deep_sort import DeepSort from utils import utils weights_path = "weights/pL1_HBCP608_Apr14_6000.ckpt" model = ...
2.015625
2
src/pypipegraph2/util.py
TyberiusPrime/pypipegraph2
0
15948
import os import sys from loguru import logger from rich.console import Console console_args = {} if "pytest" in sys.modules: console_args["width"] = 120 console = Console(**console_args) cpu_count = None def escape_logging(s): return str(s).replace("<", "\\<").replace("{", "{{").replace("}", "}}") def CP...
2.703125
3
hwk/tests/unit/test_udev.py
jaypipes/os-hardware
0
15949
<gh_stars>0 # -*- coding: utf-8 -*- # 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 in wr...
1.742188
2
app/resources/continent.py
visar/world
2
15950
from http import HTTPStatus from flask_restful import Resource from ..extensions import cache from ..models.country import Country from ..schemas.continent import ContinentSchema continent_list_schema = ContinentSchema(many=True) class ContinentListResource(Resource): @cache.cached(timeout=60, query_string=Tru...
2.484375
2
sublimebookmark.py
gwenzek/sublimeBookmark
0
15951
<filename>sublimebookmark.py import sublime import sublime_plugin import threading import os.path from pickle import dump, load, UnpicklingError, PicklingError from copy import deepcopy from .common import * from .bookmark import * from .visibilityHandler import * from .ui import * BOOKMARKS = [] UID = None #list...
2.421875
2
xrpc/examples/exemplary_rpc.py
andreycizov/python-xrpc
0
15952
<reponame>andreycizov/python-xrpc<gh_stars>0 import logging import random from typing import Dict from xrpc.dsl import rpc, RPCType, regular, signal from xrpc.error import TerminationException from xrpc.runtime import sender, service # todo: the issue is actually that not only the request-reply pattern wouldn't work ...
2.5
2
tests/__init__.py
sgbaird/ml-matrics
11
15953
<reponame>sgbaird/ml-matrics import matplotlib.pyplot as plt import pandas as pd import pytest from ml_matrics import ROOT @pytest.fixture(autouse=True) def run_around_tests(): # Code that runs before each test yield # Code that runs after each test plt.close() y_binary, y_proba, y_clf = pd.read_...
2.5
2
example_run.py
altsoph/community_loglike
16
15954
<reponame>altsoph/community_loglike # -*- coding: utf-8 -*- #!/usr/bin/env python from __future__ import print_function import community_ext import networkx as nx fn1 = "datasets/polblogs/polblogs.edges" fn2 = fn1.replace(".edges",".clusters") print("DATASET:",fn1) # load graph G = nx.Graph() for line in open(fn1): ...
2.046875
2
rebalanced_balanced_tests/evalr.py
zhanghuiying2319/Master
0
15955
<reponame>zhanghuiying2319/Master import os,sys,math,numpy as np, matplotlib.pyplot as plt def runstuff(): #savept= './scores_v2_23042021' #0.7580982029438019 0.5812124161981046 #savept= './scores_v2_23042021_sizes' #0.7552803814411163 0.583345946110785 #savept= './scores_v2_23042021_sizes_posenc' #0.759697741...
2.109375
2
recognize.py
pg992/face-recognition
0
15956
from keras.models import Model, Sequential from keras.layers import Input, Convolution2D, ZeroPadding2D, MaxPooling2D, Flatten, Dense, Dropout, Activation import numpy as np from os import listdir,path from os.path import isfile, join from PIL import Image from keras.preprocessing.image import load_img, save_img, img_t...
2.5625
3
learning_journal/views/default.py
famavott/pyramid-learning-journal
0
15957
"""Module with view functions that serve each uri.""" from datetime import datetime from learning_journal.models.mymodel import Journal from learning_journal.security import is_authenticated from pyramid.httpexceptions import HTTPFound, HTTPNotFound from pyramid.security import NO_PERMISSION_REQUIRED, forget, remem...
2.609375
3
algorithms/search/depth_first_search/depth_first_search_power_set.py
josephedradan/algorithms
0
15958
<reponame>josephedradan/algorithms """ Created by <NAME> Github: https://github.com/josephedradan Date created: 3/23/2020 Purpose: The most generic DFS algorithm capable of being modified to Fit your needs. It is also optimized. Details: Description: Notes: IMPORTANT NOTES: Explanation: Time Complexity:...
3.0625
3
apps/core/models/cb_media_movel/parameters_MM.py
bispojr/observatorio-ufj-covid19
3
15959
<gh_stars>1-10 from django.db import models import json class ParametersMM(): corGrafico = { "Novos Casos": "pink", "Média Móvel": "red" } def cores(self, tipo): cores = [] for cat in self.categorias(self, tipo): cores.append(self.corGrafico[cat]) ...
2.421875
2
httprider/model/app_data_reader.py
iSWORD/http-rider
27
15960
<gh_stars>10-100 import json import logging from PyQt5.QtCore import QObject, pyqtSignal from ..core.constants import ( API_TEST_CASE_RECORD_TYPE, HTTP_EXCHANGE_RECORD_TYPE, ENVIRONMENT_RECORD_TYPE, PROJECT_INFO_RECORD_TYPE, APP_STATE_RECORD_TYPE, API_CALL_RECORD_TYPE, ) from ..model.app_data ...
2.140625
2
labels/migrations/0002_auto_20210210_0110.py
plaf2000/webspec
0
15961
# Generated by Django 3.1.3 on 2021-02-10 01:10 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('labels', '0001_initial'), ] operations = [ migrations.AddField( model_name='species', name='de', field=m...
1.671875
2
src/MeshSegmentation/conjgrad.py
paigeco/VirtualGoniometer
1
15962
<filename>src/MeshSegmentation/conjgrad.py import numpy as np def conjgrad(A, b, x, T, tol): r = b - A@x p = r rsold = np.sum(r * r, 0) for i in range(T): Ap = A@p alpha = rsold / np.sum(p*Ap, 0) x = x + alpha*p r = r - alpha*Ap rsnew = np.sum(r*r, 0) if ...
2.609375
3
handlers/_my.py
MelomanCool/telegram-stickers
0
15963
<filename>handlers/_my.py import model sticker_storage = model.get_storage() def my(_, update): """Prints stickers added by user""" message = update.message user_id = update.message.from_user.id stickers = sticker_storage.get_for_owner(user_id, max_count=20, tagged=True) text = '\n\n'.join( ...
2.578125
3
src/forest/main.py
ADVRHumanoids/forest
0
15964
#!/usr/bin/env python3 import argparse import getpass import os import sys import argcomplete from datetime import datetime from forest import cmake_tools from forest.common.eval_handler import EvalHandler from forest.common.install import install_package, write_setup_file, write_ws_file, check_ws_file, uninstall_pac...
2
2
csc140/divideAndConquer/maximumSubArray.py
Matt-Crow/SmallPythonPrograms
1
15965
""" Given an array of numbers, find the subarray that maximizes the sum of all elements in the array. Note that these numbers can be negative """ import random def createArray(n): nums = [] for i in range(n): nums.append(random.randint(-10, 10)) return nums def bruteForceBest(a): best = a...
3.625
4
setup.py
thusoy/blag
0
15966
<gh_stars>0 #!/usr/bin/env python # coding: utf-8 from setuptools import setup, find_packages import os def package_files(directory, relative_to): paths = [] for (path, directories, filenames) in os.walk(directory): for filename in filenames: full_path = os.path.join(path, filename) ...
1.617188
2
DataStructures/Stacks/TextEditor.py
baby5/HackerRank
0
15967
<reponame>baby5/HackerRank #coding:utf-8 N = int(raw_input()) S = '' stack = [S] for _ in xrange(N): s = raw_input() if s.startswith('1'): S = ''.join((S, s.split()[-1])) stack.append(S) elif s.startswith('2'): k = int(s.split()[-1]) S = S[:-k] stack.append(S) e...
3.546875
4
backend/server/services.py
Masyru/gisspot
0
15968
from datetime import datetime from typing import Optional, List, Dict import sys sys.path.append("../../") from backend.server.pd_model import * from backend.queue.services import add_task, stop_all_ws_task from backend.database.main import gis_stac __all__ = ["preview_processing", "vector_processing", "refuse_proces...
2.28125
2
openwater/views.py
openwater/h2o-really
3
15969
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- from django.views.generic.base import TemplateView from diario.models import Entry from observations.models import Measurement class HomePageView(TemplateView): template_name = "home.html" def get_context_data(self, **kwargs): context = ...
1.890625
2
backtrace_with_time/backtrace_with_time.py
chimicus/addons
0
15970
""" Adds a ubt command which adds basic block counts to frames within a backtrace. Usage: ubt Contributors: <NAME>, <NAME> Copyright (C) 2019 Undo Ltd """ import gdb from undodb.debugger_extensions import ( debugger_utils, udb, ) class BacktraceWithTime(gdb.Command): def __init__(self): supe...
2.71875
3
envoy/examples/puma-proxy/internal_lib/backend/netflix/database_connect.py
kevinjesse/puma
0
15971
# # @author <NAME> # @email <EMAIL> # """ Database Connect serves to connect to the database postgres, as the master user. Autocommit has been turned on so all inserts, updates, and deletes will be enforced atomically """ import psycopg2 def db_connect(): cur = None try: conn = psycopg2.connect("dbna...
3.046875
3
tests/integration_tests/data_steward/cdr_cleaner/cleaning_rules/remove_participants_under_18years_test.py
lrwb-aou/curation
16
15972
""" Integration test for remove_participants_under_18years module Original Issues: DC-1724 The intent is to remove data for participants under 18 years old from all the domain tables.""" # Python Imports import os import datetime # Project Imports from common import VISIT_OCCURRENCE, OBSERVATION from common import...
2.046875
2
exercises/en/solution_08_15.py
Lavendulaa/programming-in-python-for-data-science
1
15973
import pandas as pd canucks = pd.read_csv('data/canucks.csv') # Identify any columns with null values with .info() # Save this dataframe as canucks_info canucks_info = canucks.info() canucks_info # Create a new column in the dataframe named Wealth # where all the values equal "comfortable" # Name the new dataframe ...
3.78125
4
题源分类/LeetCode/LeetCode日刷/python/461.汉明距离.py
ZhengyangXu/Algorithm-Daily-Practice
0
15974
<reponame>ZhengyangXu/Algorithm-Daily-Practice # # @lc app=leetcode.cn id=461 lang=python3 # # [461] 汉明距离 # # https://leetcode-cn.com/problems/hamming-distance/description/ # # algorithms # Easy (79.21%) # Likes: 459 # Dislikes: 0 # Total Accepted: 137K # Total Submissions: 170K # Testcase Example: '1\n4' # # 两个...
3.4375
3
emissionsapi/db.py
brennerm/emissions-api
0
15975
<filename>emissionsapi/db.py """Database Layer for the Emmission API. """ from functools import wraps from sqlalchemy import create_engine, Column, DateTime, Integer, Float, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker import geoalchemy2 from emissionsapi.co...
2.609375
3
cmdb/views.py
proffalken/edison
3
15976
# This file is part of the Edison Project. # Please refer to the LICENSE document that was supplied with this software for information on how it can be used. # Create your views here. from django.http import Http404, HttpResponse from django.shortcuts import render_to_response, get_object_or_404 from django.template im...
2.140625
2
setup.py
williamgilpin/pypdb_legacy
0
15977
<reponame>williamgilpin/pypdb_legacy from setuptools import setup setup( name = 'pypdb', packages = ['pypdb'], # same as 'name' version = '1.310', install_requires=[ 'xmltodict', 'beautifulsoup4', 'requests' ], description = 'A Python wrapper for the RCSB Protein Data Bank (PDB) API', ...
1.226563
1
awwards/urls.py
cossie14/slyawwards
0
15978
from django.conf import settings from django.conf.urls.static import static from django.conf.urls import include,url from . import views urlpatterns=[ url(r'api/user/user-id/(?P<pk>[0-9]+)/$', views.UserDescription.as_view()), url(r'api/project/project-id/(?P<pk>[0-9]+)/$', views.ProjectDesc...
1.882813
2
webinar_part_2/2.0_nxos_existing_with_netbox/setup.py
Miradot/webinar
1
15979
<reponame>Miradot/webinar<filename>webinar_part_2/2.0_nxos_existing_with_netbox/setup.py import yaml import argparse from ansible_vault import Vault def create_file(args): svc = open("netbox_tools/webhook_proxy_svc.py", "r") all_lines = svc.readlines() svc = open("netbox_tools/webhook_proxy_svc.py", "w"...
2.25
2
Core/solar/performance_ratio.py
ncatunda/hive
0
15980
# -*- coding: utf-8 -*- """ The data is (should be) based on the lecture Energie und Klimasysteme II, Erneuerbare Energieerzeugung am Gebäude, FS 2019, Folie 30, """ from __future__ import print_function def get_performance_ratio(performance_scenario): # return "\n".join("{key}: {value}".format(key=key, value=va...
2.0625
2
tests/e2e/process_chm15k/tests.py
actris-cloudnet/data-processing
0
15981
<reponame>actris-cloudnet/data-processing import netCDF4 from os import path from test_utils.utils import count_strings, read_log_file import pytest SCRIPT_PATH = path.dirname(path.realpath(__file__)) class TestChm15kProcessing: product = 'lidar' instrument = 'chm15k' @pytest.fixture(autouse=True) ...
2.140625
2
type_page/models.py
dumel93/project-
0
15982
<filename>type_page/models.py<gh_stars>0 from django.contrib.auth.models import AbstractUser from django.db import models from .validators import validate_bet, validate_course class User(AbstractUser): email = models.EmailField('email address', unique=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['use...
2.375
2
applications/pytorch/cnns/utils/distributed.py
kew96/GraphcoreExamples
0
15983
<filename>applications/pytorch/cnns/utils/distributed.py # Copyright (c) 2021 Graphcore Ltd. All rights reserved. import logging import popdist import popdist.poptorch import horovod.torch as hvd def handle_distributed_settings(opts): # Initialise popdist if popdist.isPopdistEnvSet(): init_popdist(opt...
1.960938
2
aiohttp_apispec/decorators/__init__.py
maksimvrs/aiohttp-apispec
0
15984
<filename>aiohttp_apispec/decorators/__init__.py<gh_stars>0 from .docs import docs from .request import ( request_schema, use_kwargs, # for backward compatibility path_schema, # request_schema with locations=["path"] querystring_schema, # request_schema with locations=["querystring"] form_schema,...
1.640625
2
tests/api/v1/test_tags.py
redhat-cip/dci-control-server
17
15985
# -*- coding: utf-8 -*- # # Copyright (C) 2018 Red Hat, Inc # # 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 la...
2.03125
2
graypy/rabbitmq.py
bakkerd/graypy
0
15986
#!/usr/bin/env python # -*- coding: utf-8 -*- """Logging Handler integrating RabbitMQ and Graylog Extended Log Format (GELF)""" import json from logging import Filter from logging.handlers import SocketHandler from amqplib import client_0_8 as amqp # pylint: disable=import-error from graypy.handler import BaseGELF...
2.25
2
workmail-translate-email/src/translate_helper.py
zjt/amazon-workmail-lambda-templates
31
15987
import boto3 comprehend = boto3.client(service_name='comprehend') translate = boto3.client(service_name='translate') def detect_language(text): """ Detects the dominant language in a text Parameters ---------- text: string, required Input text Returns ------- string Rep...
3.578125
4
mylearner.py
USC-MCL/Func-Pool
3
15988
# 2020.05.10 # update topNscore # learner on subspace # particular designed for encounter missing class in this subspace # if one class do not exists in training data, probability for this class would be zeros under anytime # # learner: a regressor or classifier, must have methods named 'predict' # num_class: tota...
2.84375
3
pritunl_wireguard_client/utils/token.py
SuperBo/pritunl-wireguard-cient
1
15989
<reponame>SuperBo/pritunl-wireguard-cient import time import pritunl_wireguard_client.utils.random as utils class Tokens: def __init__(self): self.store = dict() def get(self, profile_id: str, ttl: int): """Return token for profile_id""" if profile_id not in self.store: se...
2.609375
3
github_util.py
dglo/svn2git_tools
0
15990
<gh_stars>0 #!/usr/bin/env python3 from __future__ import print_function import getpass import os import shutil import time from datetime import datetime from github import Github, GithubException, GithubObject from git import git_init class GithubUtilException(Exception): "General GitHub utilities exception"...
2.671875
3
moabb/analysis/__init__.py
plcrodrigues/moabb
321
15991
<filename>moabb/analysis/__init__.py import logging import os import platform from datetime import datetime from moabb.analysis import plotting as plt from moabb.analysis.meta_analysis import ( # noqa: E501 compute_dataset_statistics, find_significant_differences, ) from moabb.analysis.results import Results ...
2.671875
3
smm/lemm/numba_optimisations.py
jamesthomasgriffin/smm
2
15992
<gh_stars>1-10 from numba import guvectorize, float64, int64, njit import numpy as np from smm import numba_target as target_preset @guvectorize([(int64, float64, float64[:, :], float64[:])], '(),(),(M,n)->(n)', nopython=True, target=target_preset) def indexed_x_axpy(ix, a, x, r...
1.945313
2
exercices_todo/duplicates_find.py
AntonioIonica/Automation_testing
0
15993
<reponame>AntonioIonica/Automation_testing<gh_stars>0 """ How to find only the duplicates """ some_list = ['a', 'b', 'c', 'b', 'd', 'm', 'n', 'n'] duplicates = [] # o noua lista unde adaugam duplicatele for value in some_list: if some_list.count(value) > 1: # cand in lista numaram fiecare valoarea si se gaseste...
3.921875
4
ethgasstation.py
ethgasstation/ethgasstation-adaptive-oracle
47
15994
<filename>ethgasstation.py<gh_stars>10-100 #!/usr/bin/env python3 """ ETH Gas Station Primary backend. """ import argparse from egs.main import master_control from egs.output import Output def main(): """Parse command line options.""" parser = argparse.ArgumentParser(description="An adaptive gas price...
2.4375
2
app/tests/controls/tests_template_helpers.py
madussault/FlaskyPress
0
15995
"""Contains tests for the functions found in ``controls/templates_helpers.py`` To run this particular test file use the following command line: nose2 -v app.tests.controls.tests_template_helpers """ from app import db, create_app import unittest from unittest import TestCase from config import Config from app.tests.u...
2.4375
2
MAModule/networks/predict.py
MrReochen/MultiAgentModule
0
15996
import torch import torch.nn as nn from ..networks.basic.util import check from ..networks.basic.predict import PredictNet, PredictLayer, OutLayer from ..utils.util import get_shape_from_obs_space class OneHot: def __init__(self, out_dim): self.out_dim = out_dim def transform(self, tensor): y_...
2.40625
2
repositories/gae/blob_dataset.py
singhj/locality-sensitive-hashing
19
15997
<filename>repositories/gae/blob_dataset.py from google.appengine.ext import ndb from repositories.gae.dataset import Dataset from repositories.gae.dataset import calculate_max_hashes, get_random_bits class BlobDataset(Dataset): filename = ndb.StringProperty() blob_key = ndb.BlobKeyProperty() @classmethod...
2.578125
3
wetrunner/tests/test_evmat.py
DavidMStraub/python-wetrunner
0
15998
"""Compare evolution matrices to v0.1 numerics""" import wetrunner import unittest from pkg_resources import resource_filename import numpy as np import numpy.testing as npt def getUs_new(classname): arg = (0.56, 5, 0.12, 1/127, 0, 0, 0, 1.2, 4.2, 0, 0, 1.8) return wetrunner.rge.getUs(classname, *arg) def ...
2.296875
2
python/clockwork/ena/submit_files.py
jeff-k/clockwork
18
15999
<reponame>jeff-k/clockwork import configparser import random import string from clockwork import utils class Error(Exception): pass def _make_dummy_success_receipt(outfile, object_type): accession = "".join( [random.choice(string.ascii_uppercase + string.digits) for _ in range(10)] ) with o...
2.421875
2