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
ci/delete_old_binaries.py
NoahR02/Odin
2,690
12775751
import subprocess import sys import json import datetime import urllib.parse import sys def main(): files_by_date = {} bucket = sys.argv[1] days_to_keep = int(sys.argv[2]) print(f"Looking for binaries to delete older than {days_to_keep} days") files_lines = execute_cli(f"b2 ls --long --versions {b...
2.703125
3
newrelic/core/custom_event.py
newrelic/newrelic-python-agen
92
12775752
# Copyright 2010 New Relic, 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 law or agreed to in writ...
2.265625
2
tract_querier/tractography/__init__.py
gabknight/tract_querier
21
12775753
from .tractography import Tractography from .trackvis import tractography_from_trackvis_file, tractography_to_trackvis_file from warnings import warn import numpy __all__ = [ 'Tractography', 'tractography_from_trackvis_file', 'tractography_to_trackvis_file', 'tractography_from_files', 'tractography_fr...
2.3125
2
setup.py
carletes/mock-ssh-server
42
12775754
import os from setuptools import find_packages, setup def read_requirements(): ret = [] fname = os.path.join(os.path.dirname(__file__), "requirements.txt") with open(fname, "r") as f: for line in f: line = line.strip() if line and not line.startswith("#"): ...
1.921875
2
pybitcoin/transactions/scripts.py
sea212/pybitcoin
220
12775755
<filename>pybitcoin/transactions/scripts.py # -*- coding: utf-8 -*- """ pybitcoin ~~~~~ :copyright: (c) 2014 by Halfmoon Labs :license: MIT, see LICENSE for more details. """ from .opcodes import * from .utils import count_bytes from ..constants import MAX_BYTES_AFTER_OP_RETURN from ..b58check import ...
2.53125
3
Code/GraphMol/Descriptors/Wrap/test3D.py
docking-org/rdk
0
12775756
<filename>Code/GraphMol/Descriptors/Wrap/test3D.py from rdkit import Chem from rdkit import rdBase from rdkit import RDConfig import os from rdkit.Chem import rdMolDescriptors as rdMD from rdkit.Chem import AllChem haveDescrs3D = hasattr(rdMD,'CalcAUTOCORR3D') import time,unittest def _gen3D(m,is3d,calculator): ...
1.960938
2
Bin/model_vdsr.py
MingSun-Tse/pytorch-vdsr
1
12775757
<filename>Bin/model_vdsr.py<gh_stars>1-10 import numpy as np import os import torch.nn as nn import torch # Load param from model1 to model2 # For each layer of model2, if model1 has the same layer, then copy the params. def load_param(model1_path, model2): dict_param1 = torch.load(model1_path) # model1_pa...
2.28125
2
pinax/projects/temp_group_project/apps/temp_tribes/admin.py
skabber/pinax
2
12775758
from django.contrib import admin from temp_tribes.models import Tribe class TribeAdmin(admin.ModelAdmin): list_display = ('name', 'slug', 'creator', 'created', 'deleted') admin.site.register(Tribe, TribeAdmin)
1.773438
2
stone/common/errors.py
Coderhypo/booklib
0
12775759
class BaseError(Exception): error_id = "" error_msg = "" def __repr__(self): return "<{err_id}>: {err_msg}".format( err_id=self.error_id, err_msg=self.error_msg, ) def render(self): return dict( error_id=self.error_id, error_msg=s...
2.75
3
src/euler_python_package/euler_python/medium/p374.py
wilsonify/euler
0
12775760
<reponame>wilsonify/euler def problem374(): pass
0.84375
1
links/views.py
RuijiaX/w3hacks
1
12775761
from django.shortcuts import render from django.http import HttpResponseRedirect, HttpResponse from app.models import ResourceLink def index(request): links = ResourceLink.objects.all() return render(request, "links/index.html", context={ "links": links }) def link(request, url_extension): # L...
2.15625
2
app/main.py
lauralex/DSBD_csv_gen
0
12775762
<gh_stars>0 from fastapi import FastAPI from app.kafka import consumers, producers from app.utils.advanced_scheduler import init_scheduler app = FastAPI() @app.on_event("startup") def run_consumers_producers(): init_scheduler() consumers.init_consumers() producers.init_producers() @app.on_event("shutd...
2.171875
2
test/test_model.py
vkazei/deepwave
73
12775763
<reponame>vkazei/deepwave<filename>test/test_model.py<gh_stars>10-100 import torch import pytest import deepwave.base.model def test_init_scalar(): """Init model with scalars""" properties = {'a': torch.ones(3, 4), 'b': torch.zeros(3, 4)} dx = 5.0 model = deepwave.base.model.Model(pr...
2.359375
2
fitseq/fitseq.py
darachm/PyFitSeq
1
12775764
<reponame>darachm/PyFitSeq #!/usr/bin/env python3 import numpy as np import pandas as pd import math import argparse import itertools import sys from scipy.stats import linregress from scipy.optimize import minimize from scipy.optimize import Bounds from tqdm import tqdm from scipy.misc import derivative from multipro...
2.515625
3
data processing/deleteJudge.py
xiameng552180/SeqDynamics_V0
0
12775765
<filename>data processing/deleteJudge.py<gh_stars>0 import MongoProcessor connection = MongoProcessor.Processor() collection = connection.loadCollections('mega_authors') collection2 = connection.loadCollections('sequences') """ collection.delete_many({"author":{"$regex": "judge"}}) collection.delete_many({"author":{"...
2.953125
3
python-package/arboretum/core.py
sh1ng/arboretum
67
12775766
<filename>python-package/arboretum/core.py # coding: utf-8 # pylint: disable=too-many-arguments, too-many-branches """Core Arboretum Library.""" from __future__ import absolute_import import os import ctypes from ctypes import * import numpy as np import scipy.sparse import json from sklearn.metrics import mean_squar...
1.90625
2
profiles/migrations/0031_populate_mail_id.py
Wassaf-Shahzad/micromasters
32
12775767
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-04-06 20:14 from __future__ import unicode_literals import uuid from django.db import migrations, models def gen_uuid(apps, schema_editor): """Generate unique UUID values""" Profile = apps.get_model('profiles', 'Profile') for profile in Profil...
2.25
2
gesture_recognition/models.py
JoshBClemons/gesture_recognition
0
12775768
import pdb import binascii import os from flask import g from werkzeug.security import generate_password_hash, check_password_hash from . import db from .utils import timestamp class User(db.Model): """The User model Attributes: __tablename__ (str): Table name for user model in database id (S...
2.9375
3
hmm_event_detection.py
Lab-Work/gpsresilience
21
12775769
<filename>hmm_event_detection.py # -*- coding: utf-8 -*- """ Created on Tue May 5 12:31:30 2015 @author: <NAME> (<EMAIL>) """ from hmmlearn.hmm import MultinomialHMM from numpy import array from tools import * from measureOutliers import readGlobalPace, getExpectedPace import csv #Read the time-series outlier sco...
2.78125
3
python/testData/paramInfo/InitializingDataclassHierarchy/a.py
Sajaki/intellij-community
2
12775770
from dataclasses import dataclass @dataclass class A1: a: int @dataclass class B1(A1): b: str B1(<arg1>) @dataclass(init=False) class A2: a: int @dataclass class B2(A2): b: str B2(<arg2>) @dataclass class A3: a: int @dataclass(init=False) class B3(A3): b: str B3(<arg3>) @dataclass(i...
3
3
trodesnetwork-0.0.9/trodesnetwork-0.0.9/trodesnetwork/trodes/trodes.py
JohnLauFoo/clc_packages_Yu
1
12775771
from trodesnetwork import socket from enum import Enum, auto __all__ = ['CurrentScaling', 'GlobalStimulationSettings', 'StimulationCommand', 'TrodesHardware', 'TrodesInfoRequester', 'TrodesAnnotationRequester', 'TrodesAcquisitionRequester', 'TrodesEventSubscriber', 'TrodesAcquisitionS...
2.359375
2
working/roberta_pretrain.py
upura/commonlitreadabilityprize
9
12775772
<filename>working/roberta_pretrain.py<gh_stars>1-10 import warnings import pandas as pd from transformers import ( AutoModelForMaskedLM, AutoTokenizer, DataCollatorForLanguageModeling, LineByLineTextDataset, Trainer, TrainingArguments, ) warnings.filterwarnings("ignore") if __name__ == "__ma...
2.53125
3
code/message/image_to_text_message.py
ITE-5th/skill-socket
1
12775773
<gh_stars>1-10 from .image_message import ImageMessage class ImageToTextMessage(ImageMessage): pass
1.203125
1
python/trezorlib/transport/bridge.py
Kayuii/trezor-crypto
0
12775774
# This file is part of the Trezor project. # # Copyright (C) 2012-2018 SatoshiLabs and contributors # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 # as published by the Free Software Foundation. # # This library is distrib...
1.960938
2
goalboost/blueprints/auth/__init__.py
JohnLockwood/Goalboost
0
12775775
<reponame>JohnLockwood/Goalboost from flask.ext.login import LoginManager from itsdangerous import TimedJSONWebSignatureSerializer as Serializer, SignatureExpired, BadSignature from goalboost.model.auth_models import Role, User from flask.ext.security import Security, MongoEngineUserDatastore from flask.ext.principal i...
2.25
2
dataset/convert_repository_json.py
DevashishX/AbstractClustering
0
12775776
<reponame>DevashishX/AbstractClustering<filename>dataset/convert_repository_json.py import json import numpy as np import pandas as pd from pprint import pprint from preprocessing import AbstractPreprocessor, preproc def simpleSplit(text): return text.split() #reads joson form the repo files. Every line is a vali...
2.53125
3
venv/Lib/site-packages/eyed3/id3/apple.py
shadowstriker15/Online_Ripper
0
12775777
""" Here lies Apple frames, all of which are non-standard. All of these would have been standard user text frames by anyone not being a bastard, on purpose. """ from .frames import Frame, TextFrame PCST_FID = b"PCST" WFED_FID = b"WFED" TKWD_FID = b"TKWD" TDES_FID = b"TDES" TGID_FID = b"TGID" class PCST(Frame): "...
2.75
3
greaze/forms.py
Cian747/awaards
0
12775778
from django import forms from .models import Project,Rate,Profile,DESIGN_CHOICES,USABILITY_CHOICES,CONTENT_CHOICES from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm class GreazeRegistrationForm(UserCreationForm): class Meta: model = User fields = ['f...
2.328125
2
tests/core/test_optimizers_schedulers.py
jerke123/mridc
0
12775779
# encoding: utf-8 __author__ = "<NAME>" # Taken and adapted from: https://github.com/wdika/NeMo/blob/main/tests/core/test_optimizers_schedulers.py import math import os import random import shutil from abc import ABC import numpy as np import omegaconf import pytest import pytorch_lightning as pl import torch import...
2.3125
2
DatabaseServer/procserv_utils.py
GustavLero/EPICS-inst_servers
1
12775780
from __future__ import print_function, absolute_import, division, unicode_literals # This file is part of the ISIS IBEX application. # Copyright (C) 2012-2016 Science & Technology Facilities Council. # All rights reserved. # # This program is distributed in the hope that it will be useful. # This program and the accomp...
1.96875
2
00_STARTUP/09_UPDATE_USER_PROFILE/orm_databases/blog/models.py
CrispenGari/python-and-django
0
12775781
<gh_stars>0 from django.db import models from django.utils import timezone from django.contrib.auth.models import User # Create your models here. class Post(models.Model): title = models.CharField(max_length=50, null=False) content = models.TextField(null=False) created_at = models.DateTimeField(default=ti...
2.359375
2
trace_data/filter.py
kanishkarj/Distributed-Systems
0
12775782
#!/usr/bin/python import csv import os def find_headers(lines) : host_headers = ['host'] for line in lines : if(line.count("State") > 0 and line.count("rank-1") > 0) : t = line.split(",") host_headers.append(t[7]) return host_headers def print_data(file_name) : f = open...
2.6875
3
MPLearn/experimental_design/hill_model.py
momeara/MPLearn
5
12775783
# -*- tab-width:4;indent-tabs-mode:nil;show-trailing-whitespace:t;rm-trailing-spaces:t -*- # vi: set ts=4 noet: import math from contextlib import ExitStack # pytorch libraries import torch from torch.distributions import constraints from torch import nn ggg# pyro libraries import pyro import pyro.distributions as...
2.046875
2
profiles/mxq/mxq-status.py
giesselmann/nanopype
87
12775784
#!/usr/bin/env python3 # \HEADER\------------------------------------------------------------------------- # # CONTENTS : snakemake mxq status script # # DESCRIPTION : none # # RESTRICTIONS : none # # REQUIRES : none # # --------------------------------------------------------------------------------- ...
1.390625
1
usaspending_api/references/constants.py
Violet26/usaspending-api
0
12775785
TOTAL_BUDGET_AUTHORITY = 8361447130497.72 TOTAL_OBLIGATIONS_INCURRED = 4690484214947.31 WEBSITE_AWARD_BINS = { "<1M": {"lower": None, "upper": 1000000}, "1M..25M": {"lower": 1000000, "upper": 25000000}, "25M..100M": {"lower": 25000000, "upper": 100000000}, "100M..500M": {"lower": 100000000, "upper": 500...
1.578125
2
pyrai/dispatcher/structures/notification_data.py
routable-ai/pyrai
0
12775786
<reponame>routable-ai/pyrai class NotificationData(object): """ Class used to represent notification data. Attributes: veh_id (int): The vehicle ID. req_id (int): The request ID. waiting_duration (str): The waiting duration. assigned (bool): True if assigned, false if not. ...
3.109375
3
tests/errors/test_assign5.py
akshanshbhatt/lpython
31
12775787
<reponame>akshanshbhatt/lpython def f(): x: list[list[i32]] x = [[1, 2, 3]] y: list[list[str]] y = [['a', 'b']] x = y
2.9375
3
basic_python/encapsulation.py
ravic499/blog-tips
0
12775788
"""Module to explain Encapsulation in Python """ class SeeMe(): """Class grouping the public, private varaibles and methods """ def __init__(self): """Constructor """ self.see_me = 'See Me' # public variable self._still_see_me = 'Still See Me !' # private varaible self.__cant_see_me = 'C...
4.59375
5
homework/03/hw-03-youens-clark/model_bias_variance.py
kyclark/info521
0
12775789
#!/usr/bin/env python3 # Author: <NAME> # INFO521 Homeword 3 Problem 6 import numpy as np import matplotlib.pyplot as plt # -------------------------------------------------- def true_function(x): """$t = 5x+x^2-0.5x^3$""" return (5 * x) + x**2 - (0.5 * x**3) # --------------------------------------------...
3.984375
4
modules/batt_health/tools/auto_test/auto_test.py
namagi/android_device_motorola_qcom-common
1
12775790
<reponame>namagi/android_device_motorola_qcom-common import os import struct import time import random import traceback import re state = dict() nvm_state = dict() def adb_command(sub_cmd): rsp ='' cmd = 'adb ' + sub_cmd res = os.popen(cmd, "r") while 1: line = res.readline() if not li...
2.125
2
framework/components/gen_dataset.py
HXX97/rng-kbqa
37
12775791
<filename>framework/components/gen_dataset.py """ Copyright (c) 2021, salesforce.com, inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause """ from components.utils import * import os from compo...
1.960938
2
plot/plot_results_tests.py
biomac-lab/COVID_schools_dashboard
0
12775792
import sys sys.path.append('../') from matplotlib import figure import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import os from tqdm import tqdm from models import model ### Config folders config_data = pd.read_csv('config.csv', sep=',', header=None, index_col=0) figures_path = config_data.l...
2.328125
2
choi/object_search/webcam_train.py
HDNua/kwin
2
12775793
""" webcam_train Developer: <NAME>, <NAME> Version: 0.1.0 Release Date: 2017-09-30 """ import numpy as np import cv2 import tensorflow as tf import sys from kwin import * import time import webcam import dataset import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' #################################################...
2.4375
2
videoToAudio.py
anthonyattard/video-to-audio
2
12775794
#!/usr/bin/env python3 import os import subprocess sourceDir = "/Video/File/Directory" #Choose the file formats below. See https://ffmpeg.org/ffmpeg.html for supported file types. videoFormat = ".mp4" audioFormat = ".mp3" for file in os.listdir(sourceDir): name = file[:file.rfind(".")] subprocess.call(["f...
2.515625
3
posts/admin.py
lakshaykhatter/djangox-project-attempt
0
12775795
from django.contrib.auth import get_user_model from django.contrib import admin # Register your models here. from .models import Post, Link User = get_user_model() class LinkInline(admin.StackedInline): model = Link extra = 0 # readonly_fields = ['url',] fields = ['url'] class PostAdmin(admin.ModelA...
2.015625
2
app/gws/lib/test.py
gbd-consult/gbd-websuite
3
12775796
<reponame>gbd-consult/gbd-websuite """Support tests""" import datetime import http.cookies import inspect import os.path import shutil import sys import time import psycopg2 import psycopg2.extras import pytest import werkzeug.test import werkzeug.wrappers import gws import gws.base.web.web_app import gws.config imp...
1.625
2
app/comm/psql_wrapper.py
viaacode/teamleader2db
0
12775797
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # @Author: <NAME> # # app/comm/psql_wrapper.py # # PostgresqlWrapper that wraps postgres connection # and also allows for our unit and integration tests to more # easily mock it. # import psycopg2 from functools import wraps class PostgresqlWrapper: """All...
3.015625
3
vectorhub/encoders/video/sampler.py
boba-and-beer/vectorhub
385
12775798
<gh_stars>100-1000 from math import ceil import numpy as np import os import tempfile from ...import_utils import * if is_all_dependency_installed('encoders-video'): import librosa import soundfile as sf from cv2 import cv2 from moviepy.video.io.ffmpeg_reader import ffmpeg_parse_infos from moviepy....
2.625
3
gigbackend/about/migrations/0002_auto_20201225_1328.py
sourabhmandal/goofygig
0
12775799
<gh_stars>0 # Generated by Django 3.1.4 on 2020-12-25 07:58 from django.db import migrations import wagtail.core.blocks import wagtail.core.fields import wagtail.images.blocks class Migration(migrations.Migration): dependencies = [ ('about', '0001_initial'), ] operations = [ migrations....
1.835938
2
upcfcardsearch/c246.py
ProfessorSean/Kasutamaiza
0
12775800
<filename>upcfcardsearch/c246.py<gh_stars>0 import discord from discord.ext import commands from discord.utils import get class c246(commands.Cog, name="c246"): def __init__(self, bot: commands.Bot): self.bot = bot @commands.command(name='Magia_Dance_Sacramentum', aliases=['c246', 'Magia_11']) asy...
2.90625
3
config.py
durbar/AllSpark
1
12775801
PORT=5000 HOST='127.0.0.1' DEBUG=True
1.117188
1
tree_classifier.py
kubapok/human-motion-classification
2
12775802
import csv from sklearn import tree class tree_classifier(): classes_dict = {0: 'going_left', 1: 'going_right', 2: 'falling', 3: 'just_sitting', 4: 'just_standing', 5: 'just_lying', 6: 'sitting...
3
3
examples/example_egscollabE2.py
GeoDesignTool/GeoDT
0
12775803
<gh_stars>0 # **************************************************************************** #### EGS collab example # **************************************************************************** # **************************************************************************** #### standard imports # **********************...
2.046875
2
dev/mixtures/TableA7_to_JSON.py
tarment10/CoolProp
0
12775804
from CoolProp.CoolProp import get_fluid_param_string lines = open('KunzWagner2012_TableA7.txt','r').read() template = """{{"Name1" : "{Name1:s}", "Name2" : "{Name2:s}", "CAS1" : "{CAS1:s}", "CAS2" : "{CAS2:s}", "d" : {d:s}, "t" : {t:s}, "n" : {n:s}, "eta" : {eta:s}, "epsilon" : {epsilon:s}, "beta": {beta:s}, "gamma":...
2.3125
2
graph_generation/attribute_generator.py
googleinterns/data-dependency-graph-analysis
4
12775805
""" This module implements methods for generating random attributes from nodes in a graph based on distribution and range. Method generate() will create all the necessary attributes for the graph: Collection: name. Dataset collection: name. System collection: name. System: system criticality, environme...
3.546875
4
tests/models/test_vtk_sphere_model.py
NMontanaBrown/scikit-surgeryvtk
1
12775806
<filename>tests/models/test_vtk_sphere_model.py # -*- coding: utf-8 -*- # -*- coding: utf-8 -*- import pytest import vtk import six import numpy as np import sksurgeryvtk.widgets.vtk_overlay_window as ow import sksurgeryvtk.models.vtk_sphere_model as sm def test_sphere_model_invalid_because_null_points(): with ...
2.09375
2
main/__init__.py
MrDrache333/InformatiCup2021-spe_ed-Python-Bot
0
12775807
<gh_stars>0 import asyncio import copy import json import logging import os import sys import time from datetime import datetime import pygame import websockets as websockets from JsonInterpreter import JsonInterpreter from game.Playground import Playground from game.graphic.PlaygroundPresenter import PlaygroundPrese...
2.65625
3
Signatures/train_classifier.py
angelos-c/OCR-with-Neural-Networks-and-Support-Vector-Machines
0
12775808
import numpy as np import os import itertools import operator import random import matplotlib.pyplot as plt import matplotlib.cm as cm from skimage.feature import hog from skimage import color, exposure from scipy.misc import imread,imsave,imresize import numpy.random as nprnd from sklearn.svm import SVC from sklearn ...
2.21875
2
prime.py
koen1711/pythongportfolio
0
12775809
<gh_stars>0 import math first = 1 last = 500 prime_numbers = [] if last == 1: print("Not a prime number.") else: for i in range(first, last): prime_flag = 0 for x in range(2, int(math.sqrt(i)) + 1): if (i % x == 0): prime_flag = 1 break i...
3.546875
4
src/fuckbot/db.py
Zer0-One/fuckbot
0
12775810
<gh_stars>0 from sqlalchemy import create_engine from .config import Config config = Config() def db_init(): engine = create_engine("sqlite+pysqlite:///" + config["WORKING_DIR"] + "/" + config["SQLITE_DB"], future=True) with engine.connect() as con: res = con.execute(text("CREATE TABLE trigger")) # ...
2.515625
3
tqt/function/adder.py
guohao-fly/TQT
2
12775811
""" Provide quantilized form of Adder2d, https://arxiv.org/pdf/1912.13200.pdf """ import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Function import math from . import extra as ex from .number import qsigned class Adder2d(ex.Adder2d): def __init__(self, ...
2.765625
3
src/server.py
benob/howto-app
0
12775812
import sys import asyncio import uvloop asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) from aiohttp import web from aiohttp_session import get_session, setup from aiohttp_session.cookie_storage import EncryptedCookieStorage import aiohttp_jinja2 import jinja2 import user import search #import personal impo...
1.875
2
plugins/custom_operators.py
FrankSchleyCBA/docker-airflow
0
12775813
import logging from airflow.models import BaseOperator from airflow.operators.sensors import BaseSensorOperator from airflow.plugins_manager import AirflowPlugin from airflow.utils.decorators import apply_defaults log = logging.getLogger(__name__) #Test comment class CustomOperator(BaseOperator): @apply_defaults...
2.375
2
pilight2mqtt/core.py
mcdeck/pilight2mqtt
6
12775814
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- """ core module of pilight2mqtt """ from __future__ import print_function import socket import sys import re import json import signal import logging import paho.mqtt.client as mqtt from pilight2mqtt.discover import discover __all__ = ['Pilight2MQTT', ...
2.40625
2
SparkAutoML/utils/models_dict_file.py
brainalysis/sparkify
0
12775815
# make a dictionary of available models in pyspark from pyspark.ml.classification import ( LogisticRegression, GBTClassifier, RandomForestClassifier, DecisionTreeClassifier, MultilayerPerceptronClassifier, LinearSVC, NaiveBayes, FMClassifier, ) from pyspark.ml.regression import ( L...
2.65625
3
load_affnist.py
YuZiHanorz/stacked_capsule_autoencoders
0
12775816
<filename>load_affnist.py import numpy as np import tensorflow as tf import scipy.io as sio from glob import glob import os from monty.collections import AttrDict def load_data_from_mat(path): data = sio.loadmat(path, struct_as_record=False, squeeze_me=True) for key in data: if isinstance(data[key], s...
2.265625
2
project_name/settings/prod.py
wearespindle/Estrada
2
12775817
from {{ project_name }}.settings.base import * # noqa DEBUG = boolean(os.environ.get('DEBUG', 0)) TEMPLATE_DEBUG = boolean(os.environ.get('DEBUG', DEBUG)) ALLOWED_HOSTS = ['.example.com'] # Use the cached template loader so template is compiled once and read from # memory instead of reading from disk on each load. ...
1.71875
2
phjokes/jokes/jokes.py
Tmpts21/phjokes
0
12775818
pinoy_jokes = { 1: {'dialect': 'bisaya', 'joke': ['Teban: Dok, ngano gasakit man akong dughan kada inum nakug ' 'tuba, pero kung libre gani dili mosakit??', 'Doktor: Ah kabalo nako ana, nipis imong BAGA, pero BAGA IMONG ' 'NAWONG']}, 2: {'dialect': 'bisaya', 'jok...
2.15625
2
raids/urls.py
SvenStahlmann/Early-Bird
0
12775819
from django.urls import path from raids import views urlpatterns = [ path('encounter', views.encounter, name='raids_encounter'), path('dispatch', views.dispatch_loot_system, name='raids_dispatch'), path('search', views.search, name='raids_search'), # Ajax path('ajax/autocomplete', views.ajax_autoc...
1.53125
2
scopes/assignment_operator.py
padmacho/pythontutorial
0
12775820
a = 0 def fun1(): print("fun1: a=", a) def fun2(): a = 10 # By default, the assignment statement creates variables in the local scope print("fun2: a=", a) def fun3(): global a # refer global variable a = 5 print("fun3: a=", a) fun1() fun2() fun1() fun3() fun1()
4.15625
4
doc/source/user/plots/matplotlib3.py
leonarduschen/numpy
5
12775821
<gh_stars>1-10 import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = Axes3D(fig) X = np.arange(-5, 5, 0.15) Y = np.arange(-5, 5, 0.15) X, Y = np.meshgrid(X, Y) R = np.sqrt(X**2 + Y**2) Z = np.sin(R) ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap='virid...
2.640625
3
osg_configure/configure_modules/siteinformation.py
mmascher/osg-configure
0
12775822
""" Module to handle attributes related to the site location and details """ import re import logging from osg_configure.modules import utilities from osg_configure.modules import configfile from osg_configure.modules import validation from osg_configure.modules.baseconfiguration import BaseConfiguration __all__ = [...
2.21875
2
covid_berlin_scraper/utils/parse_utils.py
jakubvalenta/covid-berlin-scraper
1
12775823
import datetime from typing import Dict, Optional import dateparser import regex def get_element_text(el) -> str: return ''.join(el.strings).strip() def parse_int( s: str, numbers_map: Dict[str, int], thousands_separator: str ) -> int: m = regex.search(r'\d+', s.strip().replace(thousands_separator, '')...
3.515625
4
sroka/api/athena/athena_api.py
jacekbj/sroka
66
12775824
<reponame>jacekbj/sroka<filename>sroka/api/athena/athena_api.py from configparser import NoOptionError from urllib.parse import urlparse import boto3 from botocore.exceptions import ClientError, EndpointConnectionError import sroka.config.config as config from sroka.api.athena.athena_api_helpers import poll_status, d...
2.15625
2
django_project/blog/migrations/0007_add_snippet_to_post_model.py
jsolly/shower-thought-blog
1
12775825
# Generated by Django 3.2.7 on 2022-03-07 15:25 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0006_change_content_field_to_richtextuploading'), ] operations = [ migrations.AddField( model_name='post', n...
1.578125
2
django_formset_vuejs/threads.py
fatse/django-formsets-vuejs
11
12775826
import threading import time from django_formset_vuejs.models import Book def start_cleanup_job(): def cleanup_db(): while True: time.sleep(60*60) print('hello') Book.objects.all().delete() thread1 = threading.Thread(target=cleanup_db) thread1.start()
1.867188
2
tools/DeployTool/python/generatesdkmodule.py
stepanp/luna2d
30
12775827
#----------------------------------------------------------------------------- # luna2d DeployTool # This is part of luna2d engine # Copyright 2014-2017 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # de...
1.648438
2
question_bank/binary-tree-zigzag-level-order-traversal/binary-tree-zigzag-level-order-traversal.py
yatengLG/leetcode-python
9
12775828
<filename>question_bank/binary-tree-zigzag-level-order-traversal/binary-tree-zigzag-level-order-traversal.py # -*- coding: utf-8 -*- # @Author : LG """ 执行用时:36 ms, 在所有 Python3 提交中击败了91.91% 的用户 内存消耗:13.8 MB, 在所有 Python3 提交中击败了5.59% 的用户 解题思路: 深度优先搜索 然后进行翻转 """ class Solution: def zigzagLevelOrder(self, roo...
3.875
4
tests/test_522.py
sungho-joo/leetcode2github
0
12775829
<filename>tests/test_522.py #!/usr/bin/env python import pytest """ Test 522. Longest Uncommon Subsequence II """ @pytest.fixture(scope="session") def init_variables_522(): from src.leetcode_522_longest_uncommon_subsequence_ii import Solution solution = Solution() def _init_variables_522(): re...
2.6875
3
Code/utils.py
sirebellum/catz_contest
4
12775830
<filename>Code/utils.py<gh_stars>1-10 import tensorflow as tf import numpy as np from PIL import Image from scipy.ndimage import imread from glob import glob import os import random import cv2 import constants as c from tfutils import log10 ## # Data ## def normalize_frames(frames): """ Convert frames from i...
2.59375
3
Lib/glyphNameFormatter/rangeProcessors/latin_extended_b.py
peterennis/glyphNameFormatter
69
12775831
def process(self): self.edit("LATIN") self.replace("CAPITAL LETTER D WITH SMALL LETTER Z", "Dz") self.replace("CAPITAL LETTER DZ", "DZ") self.edit("AFRICAN", "african") self.edit("WITH LONG RIGHT LEG", "long", "right", "leg") self.edit('LETTER YR', "yr") self.edit("CAPITAL LETTER O WITH...
3.078125
3
location_parsers/kern.py
rajbot/vaccinebot
2
12775832
<gh_stars>1-10 # Parse vaccination site locations for Kern County # Run manually: python3 -m location_parsers.kern import csv import os import re import tempfile import time from . import County, Location from . import driver_start, driver_stop from . import debug_print, validate from selenium.webdriver.common.by i...
3.09375
3
results/gafqmc_info.py
wirawan0/pyqmc
0
12775833
# $Id: gafqmc_info.py,v 1.3 2011-03-09 15:44:47 wirawan Exp $ # # gafqmc_info.py # Tools to parse GAFQMC INFO file # # <NAME> # Created: 20101025 # # IMPORTANT: Try to make field names consistent with those in pwqmc_info. # Python standard modules import math import os import os.path import re import sys import time ...
2.28125
2
bus_monitor/plotter/start_live_streaming.py
mxl00474/Yokohama_bus_navi
0
12775834
import os from PlotterBokeh import PlotterBokeh from BusInfo import BusInfo def start_live_streaming(doc): if doc is None: raise NotImplementedError() # Set the initial location as Yokohama station lat=35.46591430126525 lng=139.62125644093177 apiKey = os.getenv('GMAP_TOKEN') plotter ...
2.734375
3
invertendo_sequencia.py
isaberamos/Programinhas
1
12775835
<reponame>isaberamos/Programinhas<filename>invertendo_sequencia.py<gh_stars>1-10 seq = [] n = 1 while n: n = int(input(print("Digite um número: "))) if n != 0: seq.append(n) print(seq) print(seq[:-1])
3.5625
4
tpp/models/encoders/base/recurrent.py
dqmis/neuralTPPs-1
17
12775836
import torch as th import torch.nn as nn import torch.nn.functional as F from typing import Dict, List, Optional, Tuple from tpp.models.encoders.base.variable_history import VariableHistoryEncoder from tpp.pytorch.models import MLP from tpp.utils.events import Events class RecurrentEncoder(VariableHistoryEncoder): ...
2.6875
3
vision/datasets/utils.py
tamnguyenvan/pytorch-ssd
0
12775837
import os import glob import numpy as np from datetime import datetime from scipy.io import loadmat from PIL import Image np.random.seed(42) def calc_age(taken, dob): birth = datetime.fromordinal(max(int(dob) - 366, 1)) # assume the photo was taken in the middle of the year if birth.month < 7: ...
2.453125
2
signup/migrations/0001_initial.py
harry-7/django-trial
0
12775838
<gh_stars>0 # -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-06-12 21:35 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( n...
1.59375
2
settings.py
fastent/fastent
8
12775839
import couchdb def init(username = None, password = <PASSWORD>): """ Global Initialization of settings Return the list of words closer to word1 in comparison with word2 Args: word1 (str): first word word2 (str): second word Returns: void: As it is global settings init not...
3.015625
3
Mediante_Kid_day5_act2.py
RomartM/PythonSeminarActivities
0
12775840
<gh_stars>0 def reverse_string(string): reversed_letters = list() index = 1 for letter in string: reversed_letters.append(string[ len(string) - index ]) index += 1 return "".join(reversed_letters) word_input = str(input("Input a word: ")) print(f"INPUT: {word_input}") print("OUTPUT:...
4.03125
4
simulation/dm_control_cur/ddpg/ddpg_classes/simulator_residual.py
Cambridge-University-Robotics/cur_policy_learning_research
0
12775841
from simulation.dm_control_cur.utility_classes.simulator import Simulation class ResidualSimulation(Simulation): def __init__( self, controller_load_model=True, controller_num_episodes=50, **kwargs ): super().__init__(**kwargs) self.controller = ...
2.671875
3
phy_sx127x/phy_sx127x_ahsm.py
dwhall/phy_sx127x
1
12775842
""" Copyright 2020 <NAME>. See LICENSE for details. """ import logging import time import farc from . import phy_sx127x class PhySX127xAhsm(farc.Ahsm): """The physical layer (PHY) state machine for a Semtech SX127x device. Automates the behavior of the Semtech SX127x family of radio transceivers. For...
2.671875
3
data_tools/__init__.py
erik-grabljevec/Tennis-Modelling
4
12775843
__author__ = 'riko' from handle_data import *
1.078125
1
search_operation/icde/views.py
youyinnn/COEN6311_super
0
12775844
from common.http_response import json_response_builder as response from common.jwt import get_user_id as get_id_from_request from common.jwt import auth_require from common.project_const import const from icde.capture import icde_capture from . import access as icde_access @auth_require @icde_capture(const.PAPER_SH...
2.25
2
build/android/xwalkcore_library_template/prepare_r_java.py
shawngao5/crosswalk
1
12775845
<filename>build/android/xwalkcore_library_template/prepare_r_java.py #!/usr/bin/env python # # Copyright (c) 2013 Intel Corporation. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Copy the generated R.java to additional packages under gen. ...
2.25
2
trial_of_the_stones/the_trial_of_the_stones.py
ikostan/ElegantBrowserAutomationWithPythonAndSelenium
3
12775846
from trial_of_the_stones.models.page_model import PageModel import selenium import unittest import time def trial_of_the_stones_automation(): ''' Source web page: https://techstepacademy.com/trial-of-the-stones :return: ''' # open web page page = PageModel(selenium.webdriver.Chrome()) pag...
3.046875
3
data-structures/sorting/quicksort/quicksort-randomized.py
andrenbrandao/algorithm-problems
0
12775847
from random import randint """ For an array of size 10^6 the execution time of the randomized version was 10x faster. I used an already sorted array, which is an example of a worst case scenario. The algorithm by selection always the smallest element as the pivot makes n recursive calls and because the partition step ...
4.09375
4
src/evaluation/krippendorffalpha.py
anbasile/arxiv2018-bayesian-ensembles
21
12775848
<reponame>anbasile/arxiv2018-bayesian-ensembles ''' Created on 10 May 2016 @author: simpson ''' import numpy as np def alpha(U, C, L): ''' U - units of analysis, i.e. the data points being labelled C - a list of classification labels L - a list of labeller IDs ''' N = float(np.unique(U).shape...
2.296875
2
bioimageit_core/dataset.py
bioimageit/bioimageit_core
2
12775849
# -*- coding: utf-8 -*- """BioImagePy dataset metadata definitions. This module contains classes that allows to describe the metadata of scientific dataset Classes ------- DataSet RawDataSet ProcessedDataSet """ import re from bioimageit_core.config import ConfigAccess from bioimageit_core.data import RawData, Pro...
2.640625
3
Handout/09.Strings e Fatiamento/02ex.py
pedroivoal/Dessoft
0
12775850
def conta_a(palavra): c = 0 for letra in palavra: if letra == 'a': c += 1 return c s = 'Insper' r = s[::-2] print(r)
3.5625
4