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
py3plex/algorithms/infomap/examples/python/example-simple.py
awesome-archive/Py3plex
1
16800
<reponame>awesome-archive/Py3plex<filename>py3plex/algorithms/infomap/examples/python/example-simple.py from infomap import infomap infomapWrapper = infomap.Infomap("--two-level") # Add weight as an optional third argument infomapWrapper.addLink(0, 1) infomapWrapper.addLink(0, 2) infomapWrapper.addLink(0, 3) infomapW...
2.8125
3
api/tests.py
everett-toews/metaslacker
90
16801
<filename>api/tests.py import unittest class MainTestCase(unittest.TestCase): def test_two_and_two(self): four = 2 + 2 self.assertEqual(four, 4) self.assertNotEqual(four, 5) self.assertNotEqual(four, 6) self.assertNotEqual(four, 22) if __name__ == '__main__': unittest...
2.8125
3
tools/modules/verify.py
andscha/containerization-for-sap-s4hana
6
16802
<filename>tools/modules/verify.py # ------------------------------------------------------------------------ # Copyright 2020, 2021 IBM Corp. All Rights Reserved. # # 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 cop...
2.140625
2
rainbow/rainbow.py
jaxzin/adafruit-voice-docker
0
16803
<gh_stars>0 import time import board import adafruit_dotstar import atexit import signal kill_now = False DOTSTAR_DATA = board.D5 DOTSTAR_CLOCK = board.D6 dots = adafruit_dotstar.DotStar(DOTSTAR_CLOCK, DOTSTAR_DATA, 3, brightness=0.5) def exit_handler(): kill_now = True # turn off the pixel dots for i in...
2.984375
3
src/iranlowo/corpus/__init__.py
Niger-Volta-LTI/iranlowo
17
16804
<reponame>Niger-Volta-LTI/iranlowo<filename>src/iranlowo/corpus/__init__.py from .corpus import Corpus, DirectoryCorpus from .loaders import OweLoader, YorubaBlogCorpus, BBCCorpus, BibeliCorpus
0.976563
1
seq2seq.py
frozen86/SeqLite
1
16805
import torch import torch.nn as nn import torch.nn.functional as F import math import matplotlib.pyplot as plt import matplotlib.ticker as ticker import numpy as np from masked_cross_entropy import * from preprocess import * from parameter import * import time # # Training def train(input_batches,...
2.734375
3
ANNarchy_future/__init__.py
vitay/ANNarchy_future
2
16806
<gh_stars>1-10 from .api import * __version__ = "5.0.0"
1.15625
1
pycqed/tests/analysis_v2/test_simple_analysis.py
nuttamas/PycQED_py3
60
16807
import unittest import pycqed as pq import os import matplotlib.pyplot as plt from pycqed.analysis_v2 import measurement_analysis as ma class Test_SimpleAnalysis(unittest.TestCase): @classmethod def tearDownClass(self): plt.close('all') @classmethod def setUpClass(self): self.datadir...
2.453125
2
CS2/1275_turtle_recursion/2499_koch_snowflake/alternate_snowflake.py
nealholt/python_programming_curricula
7
16808
import turtle '''http://www.algorithm.co.il/blogs/computer-science/fractals-in-10-minutes-no-6-turtle-snowflake/ This would be a good introduction to recursion. I don't see how students would invent this on their own, but they could modify it and see what other fractals they could generate. ''' pen = turtle.Turtle() p...
4.5625
5
test/test_edge.py
jbschwartz/spatial
1
16809
<gh_stars>1-10 import unittest from spatial import Edge, Vector3 class TestEdge(unittest.TestCase): def setUp(self) -> None: self.start = Vector3(1, 2, 3) self.end = Vector3(-1, -2, -3) self.middle = Vector3(0, 0, 0) self.edge = Edge(self.start, self.end) def test__init__acce...
3.21875
3
wdae/wdae/user_queries/urls.py
iossifovlab/gpf
0
16810
from django.urls import re_path from user_queries.views import UserQuerySaveView, UserQueryCollectView urlpatterns = [ re_path(r"^/save/?$", UserQuerySaveView.as_view(), name="user-save-query"), re_path( r"^/collect/?$", UserQueryCollectView.as_view(), name="user-collect-queries", )...
1.914063
2
src/login/migrations/0017_auto_20191006_1716.py
vandana0608/Pharmacy-Managament
0
16811
<reponame>vandana0608/Pharmacy-Managament # Generated by Django 2.0.7 on 2019-10-06 11:46 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('login', '0016_auto_20191006_1715'), ] operations = [ migrations.AlterField( ...
1.65625
2
InfoGain.py
gsndr/AIDA
4
16812
import pandas as pd from math import log class InfoGain(): def __init__(self, path): self._path=path def extractVariables(self): self._df = pd.read_csv(self._path + ".csv"); # put the original column names in a python list '''if 'Unnamed: 0' in self._df.columns: ...
3.703125
4
bot/localization.py
Supportiii/telegram-report-bot
0
16813
strings = { "en": { "error_no_reply": "This command must be sent as a reply to one's message!", "error_report_admin": "Whoa! Don't report admins 😈", "error_restrict_admin": "You cannot restrict an admin.", "report_date_format": "%d.%m.%Y at %H:%M", "report_message": '👆 Sen...
1.789063
2
swagger_server/models/linecode_r_matrix.py
garagonc/simulation-engine
3
16814
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model from swagger_server.models.impedance import Impedance # noqa: F401,E501 from swagger_server import util class Lin...
2.125
2
workshop/serializers.py
shivammaniharsahu/django_api
0
16815
<filename>workshop/serializers.py from rest_framework import serializers from .models import Register class RegisterSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Register fields = ('id', 'name', 'email', 'contact', 'password', 'confirm_password')
1.898438
2
experiments/twitter_event_data_2019/evaluation/groundtruth_processor.py
HHansi/WhatsUp
0
16816
# Created by Hansi at 3/16/2020 import os from algo.data_process.data_preprocessor import data_cleaning_flow from algo.utils.file_utils import delete_create_folder def extract_gt_tokens(text): """ Given GT string, method to extract GT labels. GT string should be formatted as Twitter-Event-Data-2019. ...
2.890625
3
metaflow/plugins/env_escape/configurations/test_lib_impl/test_lib.py
RobBlumberg/metaflow
5,821
16817
<filename>metaflow/plugins/env_escape/configurations/test_lib_impl/test_lib.py import functools class MyBaseException(Exception): pass class SomeException(MyBaseException): pass class TestClass1(object): cls_object = 25 def __init__(self, value): self._value = value self._value2 ...
2.5625
3
venv/Lib/site-packages/aniso8601/tests/test_interval.py
GabrielSilva2y3d/api_atividade-sqlalchemy
0
16818
<gh_stars>0 # -*- coding: utf-8 -*- # Copyright (c) 2019, <NAME> # All rights reserved. # # This software may be modified and distributed under the terms # of the BSD license. See the LICENSE file for details. import unittest import aniso8601 from aniso8601.exceptions import ISOFormatError from aniso8601.interval i...
2.421875
2
cool/core/utils.py
007gzs/django-cool
11
16819
<reponame>007gzs/django-cool # encoding: utf-8 import operator from functools import reduce from django.core.exceptions import FieldDoesNotExist from django.db.models import Q from django.db.models.constants import LOOKUP_SEP def split_camel_name(name, fall=False): """ 驼峰命名分割为单词 GenerateURLs => [Generat...
2.171875
2
setup.py
atait/klayout-gadgets
13
16820
<gh_stars>10-100 from setuptools import setup def readme(): with open('README.md', 'r') as fx: return fx.read() setup(name='lygadgets', version='0.1.31', description='Tools to make klayout, the standalone, and python environments work better together', long_description=readme(), lo...
1.539063
2
Python/Zelle/Chapter10_DefiningClasses/ProgrammingExercises/16_CannonballTarget/inputDialog.py
jeffvswanson/CodingPractice
0
16821
<filename>Python/Zelle/Chapter10_DefiningClasses/ProgrammingExercises/16_CannonballTarget/inputDialog.py # inputDialog.py """ Provides a window to get input values from the user to animate a cannonball.""" from graphics import GraphWin, Entry, Text, Point from button import Button class InputDialog: """ A custo...
3.90625
4
gym_envs/envs/reacher_done.py
gautams3/reacher-done
1
16822
<reponame>gautams3/reacher-done import gym from gym import error, spaces, utils from gym.utils import seeding from gym.envs.mujoco.reacher import ReacherEnv import numpy as np class ReacherDoneEnv(ReacherEnv): metadata = {'render.modes': ['human']} # def __init__(self): # ... def step(self, action): sel...
2.421875
2
stackalytics/get_metric.py
yaoice/python_demo
0
16823
#/usr/bin/env python import httplib2 import json import sys from prettytable import PrettyTable from config import field class BaseStackalytics(object): _instance = None def __new__(cls, *args, **kwargs): if not cls._instance: cls._instance = super(BaseStackalytics, cls).__new__(cls, *arg...
2.40625
2
modules/worker.py
strangest-quark/iConsent
10
16824
import logging from queue import Queue from threading import Thread from time import time logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger(__name__) class Worker(Thread): def __init__(self, queue, out_que): Thread.__init__...
3.140625
3
src/saml2/extension/pefim.py
cnelson/pysaml2
5,079
16825
#!/usr/bin/env python import saml2 from saml2 import SamlBase from saml2.xmldsig import KeyInfo NAMESPACE = 'urn:net:eustix:names:tc:PEFIM:0.0:assertion' class SPCertEncType_(SamlBase): """The urn:net:eustix:names:tc:PEFIM:0.0:assertion:SPCertEncType element """ c_tag = 'SPCertEncType' c_namespace = NA...
2.265625
2
ontask/migrations/0004_remove_old_migration_refs.py
pinheiroo27/ontask_b
33
16826
# Generated by Django 2.2.4 on 2019-08-24 06:02 from django.db import connection as con, migrations from psycopg2 import sql def remove_old_migration_refs(apps, schema_editor): __sql_delete_migration_ref = 'DELETE FROM django_migrations WHERE app={0}' old_apps = [ 'action', 'core', 'dataops', 'logs'...
1.960938
2
scripts/tfloc_summary.py
lldelisle/bx-python
122
16827
<filename>scripts/tfloc_summary.py #!/usr/bin/env python """ Read TFLOC output from stdin and write out a summary in which the nth line contains the number of sites found in the nth alignment of the input. TODO: This is very special case, should it be here? """ import sys from collections import defaultdict counts ...
3.796875
4
plugins/data/bAbI/digitsDataPluginBAbI/data.py
Linda-liugongzi/DIGITS-digits-py3
0
16828
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. import os from digits.utils import subclass, override, constants from digits.extensions.data.interface import DataIngestionInterface from .forms import DatasetForm, InferenceForm from . import utils from flask_babel import lazy_gettext as _ DATASET_TE...
2.109375
2
13_TransparentOrigami/fold2.py
dandrianneDEL/PyAdventOfCode2021
0
16829
<filename>13_TransparentOrigami/fold2.py<gh_stars>0 import filehelper fileResult = filehelper.readfile() class Matrix: cells: list[list[bool]] maxX: int maxY: int def __init__(self, sizeX:int, sizeY:int) -> None: self.cells = [] self.maxX = sizeX self.maxY = sizeY # prin...
3.15625
3
complete/01 - 10/Problem1/main.py
this-jacob/project-euler
0
16830
<reponame>this-jacob/project-euler def main(): total = 0 for i in range(0, 1000): if i % 3 == 0: total += i elif i % 5 == 0: total += i print(total) if __name__ == '__main__': main()
3.515625
4
reward/batcher/transforms/base_transform.py
lgvaz/torchrl
5
16831
<filename>reward/batcher/transforms/base_transform.py class BaseTransform: def transform_s(self, s, training=True): return s def transform_batch(self, batch, training=True): return batch def write_logs(self, logger): pass
2.015625
2
webapp/scan_comments.py
ctrl-meta-f/ngk
0
16832
<reponame>ctrl-meta-f/ngk<filename>webapp/scan_comments.py import logging import time import requests import lxml.etree import re import os from schema import ScopedSession, SyncState logging.basicConfig( filename=os.getenv("LOG_FILE", "../logs/scan_comments.log"), format="%(asctime)s %(levelname)s %(message)...
2.359375
2
s3prl/upstream/example/hubconf.py
hhhaaahhhaa/s3prl
856
16833
from .expert import UpstreamExpert as _UpstreamExpert def customized_upstream(*args, **kwargs): """ To enable your customized pretrained model, you only need to implement upstream/example/expert.py and leave this file as is. This file is used to register the UpstreamExpert in upstream/example/expert.p...
2.4375
2
g-code-testing/g_code_parsing/g_code_functionality_defs/thermocycler/set_ramp_rate_g_code_functionality_def.py
Opentrons/protocol_framework
0
16834
from typing import Dict from g_code_parsing.g_code_functionality_defs.g_code_functionality_def_base import ( GCodeFunctionalityDefBase, ) class SetRampRateGCodeFunctionalityDef(GCodeFunctionalityDefBase): @classmethod def _generate_command_explanation(cls, g_code_args: Dict[str, str]) -> str: retu...
2.390625
2
src/mrio.py
ElcoK/MRIA_Argentina
0
16835
import os,sys import pandas as pd import numpy as np import subprocess from tqdm import tqdm from ras_method import ras_method import warnings warnings.filterwarnings('ignore') def est_trade_value(x,output_new,sector): """ Function to estimate the trade value between two sectors """ if (sector is not ...
2.46875
2
task_manager/users/forms.py
Ritesh-Aggarwal/Task-Manager-Django
0
16836
from django import forms from django.contrib.auth import get_user_model from django.contrib.auth.forms import ( AuthenticationForm, UserCreationForm, UsernameField, ) User = get_user_model() class UserLoginForm(AuthenticationForm): def __init__(self, *args, **kwargs): super(UserLoginForm, sel...
2.515625
3
boa3/model/builtin/interop/oracle/oracletype.py
hal0x2328/neo3-boa
25
16837
from __future__ import annotations from typing import Any, Dict, Optional from boa3.model.method import Method from boa3.model.property import Property from boa3.model.type.classes.classarraytype import ClassArrayType from boa3.model.variable import Variable class OracleType(ClassArrayType): """ A class use...
2.46875
2
photo-hub/api/pagination.py
RodionChachura/photo-hub
0
16838
from rest_framework.pagination import PageNumberPagination class StandardPagination(PageNumberPagination): page_size = 30 page_size_query_param = 'page_size' max_page_size = 1000
1.742188
2
wiiu.py
RN-JK/UBIART-Texture-Decoder
0
16839
import os, glob try: os.mkdir("output") except: pass wiiudir="input/wiiu" try: os.makedirs(wiiudir) print('The directories have been made.') input('Insert your textures in input/wiiu and then run the tool again to convert it.') except: pass dir = 'input/temp' t...
2.734375
3
jp.atcoder/abc046/arc062_a/8984820.py
kagemeka/atcoder-submissions
1
16840
import sys n = int(sys.stdin.readline().rstrip()) ab = map(int, sys.stdin.read().split()) ab = list(zip(ab, ab)) def main(): c_a = ab[0][0] c_b = ab[0][1] for a, b in ab[1:]: ratio = a / b while c_a / c_b != ratio: if c_a / c_b < ratio: c_a += 1 ...
2.96875
3
pycsw/pycsw/plugins/profiles/profile.py
Geosoft2/Geosoftware-II-AALLH
118
16841
# -*- coding: utf-8 -*- # ================================================================= # # Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # Copyright (c) 2015 <NAME> # Copyright (c) 2015 <NAME> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associat...
1.789063
2
push-package.py
OpenTrustGroup/scripts
0
16842
#!/usr/bin/env python # Copyright 2017 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import errno import json import os import subprocess import sys import tempfile DEFAULT_DST_ROOT = '/system' DEFAULT_OU...
2.046875
2
tests/e2e/registry/test_registry_image_push_pull.py
OdedViner/ocs-ci
0
16843
<gh_stars>0 import logging import pytest from ocs_ci.framework.testlib import workloads, E2ETest, ignore_leftovers from ocs_ci.ocs import ocp, registry, constants from ocs_ci.framework import config from ocs_ci.ocs.exceptions import UnexpectedBehaviour logger = logging.getLogger(__name__) class TestRegistryImagePull...
2.09375
2
tOYOpy/settings.py
fkab/tOYO
0
16844
<gh_stars>0 elements = { 'em': '', 'blockquote': '<br/>' }
1.179688
1
1.6.py
kevrodg/pynet
0
16845
<reponame>kevrodg/pynet<gh_stars>0 #!/usr/bin/env python import json import yaml my_list = [0, 1, 2, 3, 'whatever', 'hello', {'attribs': [0, 1, 2, 3, 4], 'ip_addr': '10.10.10.239'}] with open("my_file.json", "w") as f: json.dump(my_list, f) with open("my_file.yaml", "w") as f: f.write(yaml.dump(my_list, ...
2.78125
3
jp.atcoder/abc069/arc080_a/11903517.py
kagemeka/atcoder-submissions
1
16846
<reponame>kagemeka/atcoder-submissions<gh_stars>1-10 import sys n, *a = map(int, sys.stdin.read().split()) def main(): c4 = c2 = 0 for x in a: if not x % 4: c4 += 1 elif not x % 2: c2 += 1 ans = "Yes" if c4 >= n // 2 or c4 * 2 + c2 >= n else "No" p...
2.734375
3
tests/test_url_enc_dec.py
FWidm/poe-profile
1
16847
<gh_stars>1-10 # -*- coding: utf-8 -*- import logging import sys import unittest from src.util.tree_codec import encode_hashes, decode_url url = '<KEY>' \ '<KEY>' \ '3xrj6vp7c-uJO8n7zqvk_AZsT2xq7MvM9-0B_Tj9P72L3ZXtl82mLfsONq5FHqGOvu7IPsiu8O7-vwH_JF8933MvfX-Ov56PrS_Ev-Cv5U_oH-jw==' decoded = (4, 3, 3, 1...
1.921875
2
_test/registry/reg04.py
javacommons/commonthread
0
16848
# source http://itasuke.hatenablog.com/entry/2018/01/08/133510 import winreg newkey = winreg.CreateKeyEx(winreg.HKEY_CURRENT_USER, r'Software\__javacommons__\abc') newkey.Close() winreg.DeleteKeyEx(winreg.HKEY_CURRENT_USER, r'Software\__javacommons__\abc')
1.546875
2
setuptools-37.0.0/pkg_resources/tests/test_working_set.py
coderlongren/PreliminaryPython
1
16849
import inspect import re import textwrap import pytest import pkg_resources from .test_resources import Metadata def strip_comments(s): return '\n'.join( l for l in s.split('\n') if l.strip() and not l.strip().startswith('#') ) def parse_distributions(s): ''' Parse a series of dist...
2.625
3
setup.py
Sigel1/yolo-tf2
0
16850
from setuptools import find_packages, setup install_requires = [dep.strip() for dep in open('requirements.txt')] setup( name='yolo_tf2', version='1.5', packages=find_packages(), url='https://github.com/schissmantics/yolo-tf2', license='MIT', author='schismantics', author_email='<EMAIL>', ...
1.484375
1
btc_tracker_engine/helper_functions.py
metalerk/4btc
0
16851
def rate_diff_percentage(previous_rate, current_rate, percentage=False): diff_percentage = (current_rate - previous_rate) / previous_rate if percentage: return diff_percentage * 100 return diff_percentage
3.171875
3
nngeometry/object/__init__.py
amyami187/nngeometry
103
16852
from .pspace import (PMatDense, PMatBlockDiag, PMatDiag, PMatLowRank, PMatImplicit, PMatKFAC, PMatEKFAC, PMatQuasiDiag) from .vector import (PVector, FVector) from .fspace import (FMatDense,) from .map import (PushForwardDense, PushForwardImplicit, PullBackDen...
1.164063
1
vkwave/bots/core/dispatching/dp/middleware/middleware.py
YorkDW/vkwave
0
16853
<filename>vkwave/bots/core/dispatching/dp/middleware/middleware.py from abc import ABC, abstractmethod from typing import List, NewType from vkwave.bots.core.dispatching.events.base import BaseEvent MiddlewareResult = NewType("MiddlewareResult", bool) class BaseMiddleware(ABC): @abstractmethod async def pre...
2.46875
2
plot_scripts/try_networkx.py
gabrielasuchopar/arch2vec
35
16854
import networkx as nx import numpy as np import matplotlib.pyplot as plt def node_match(n1, n2): if n1['op'] == n2['op']: return True else: return False def edge_match(e1, e2): return True def gen_graph(adj, ops): G = nx.DiGraph() for k, op in enumerate(ops): G.add_node(k,...
2.703125
3
endpoints/v2/errors.py
giuseppe/quay
2,027
16855
import bitmath class V2RegistryException(Exception): def __init__( self, error_code_str, message, detail, http_status_code=400, repository=None, scopes=None, is_read_only=False, ): super(V2RegistryException, self).__init__(message) ...
2.375
2
scoreboard.py
TheLurkingCat/scoreboard
0
16856
''' LICENSE: MIT license This module can help us know about who can ask when we have troubles in some buggy codes while solving problems. ''' from asyncio import gather, get_event_loop from pandas import DataFrame, set_option from online_judge import Online_Judge loop = get_event_loop() set_option('display.max_col...
3
3
custom_transforms.py
zyxu1996/Efficient-Transformer
22
16857
<filename>custom_transforms.py<gh_stars>10-100 import torch import random import numpy as np import cv2 import os import torch.nn as nn from torchvision import transforms class RandomHorizontalFlip(object): def __call__(self, sample): image = sample['image'] label = sample['label'] if rando...
2.40625
2
ui/staff.py
AryaStarkSakura/Stylized-Neural-Painting
0
16858
<filename>ui/staff.py<gh_stars>0 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'staff.ui' # # Created by: PyQt5 UI code generator 5.13.0 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(se...
1.789063
2
dataset.py
ceyzaguirre4/mac-network-pytorch
4
16859
import os import pickle import numpy as np from PIL import Image import torch from torch.utils.data import Dataset from torchvision import transforms import h5py from transforms import Scale class CLEVR(Dataset): def __init__(self, root, split='train', transform=None): features_path = os.path.join(root, ...
2.296875
2
tests/distributions/test_log_normal.py
thomasaarholt/xgboost-distribution
17
16860
import pytest import numpy as np import pandas as pd from xgboost_distribution.distributions import LogNormal @pytest.fixture def lognormal(): return LogNormal() def test_target_validation(lognormal): valid_target = np.array([0.5, 1, 4, 5, 10]) lognormal.check_target(valid_target) @pytest.mark.param...
2.53125
3
script/forecasting/forecaster.py
bialesdaniel/noisepage
0
16861
#!/usr/bin/env python3 """ Main script for workload forecasting. Example usage: - Generate data (runs OLTP benchmark on the built database) and perform training, and save the trained model ./forecaster --gen_data --models=LSTM --model_save_path=model.pickle - Use the trained models (LSTM) to generate predictions. ...
2.40625
2
tests/test_master/test_jobtypes_api.py
guidow/pyfarm-master
0
16862
<gh_stars>0 # No shebang line, this module is meant to be imported # # Copyright 2013 <NAME> # Copyright 2014 Ambient Entertainment GmbH & Co. KG # # 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 ...
1.875
2
imagekit/hashers.py
radicalgraphics/django-imagekit
0
16863
from copy import copy from hashlib import md5 from pickle import Pickler, MARK, DICT from types import DictionaryType from .lib import StringIO class CanonicalizingPickler(Pickler): dispatch = copy(Pickler.dispatch) def save_set(self, obj): rv = obj.__reduce_ex__(0) rv = (rv[0], (sorted(rv[1]...
2.796875
3
sun.py
funxiun/AstroAlgorithms4Python
7
16864
'''Meeus: Astronomical Algorithms (2nd ed.), chapter 25''' import math from nutation_ecliptic import ecliptic from constants import AU def coordinates(jd): '''equatorial coordinates of Sun''' lon=math.radians(longitude(jd)) eps=math.radians(ecliptic(jd)) ra=math.degrees(math.atan2(math.c...
3.4375
3
test/paths.py
cychitivav/kobuki_navigation
0
16865
#!/usr/bin/python import numpy as np import cv2 from matplotlib import pyplot as plt import networkx as nx def rotate_image(image, angle): image_center = tuple(np.array(image.shape[0:2]) / 2) rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1) vertical = cv2.warpAffine(image, rot_mat, image.shape[0...
2.734375
3
intro-to-programming/python-for-everyone/3-variables-expressions-statements/exercise-4.py
udpsunil/computer-science
0
16866
# Assume that we execute the following assignment statements # width = 17 # height = 12.0 width = 17 height = 12.0 value_1 = width // 2 value_2 = width / 2.0 value_3 = height / 3 value_4 = 1 + 2 * 5 print(f"value_1 is {value_1} and it's type is {type(value_1)}") print(f"value_2 is {value_2} and it's type is {type(va...
4.15625
4
apps/weapons/admin.py
tufbel/wFocus
0
16867
from django.contrib import admin # Register your models here. from apps.weapons.models import Weapon admin.site.register(Weapon)
1.3125
1
modules/kubrick/apps/awards/models.py
Lab-Quatro/aposcar
3
16868
from django.db import models class Nominee(models.Model): name = models.TextField() picture_url = models.ImageField(upload_to="nominees/") description = models.TextField(max_length=350) class Meta: verbose_name_plural = "nominees" def __str__(self): return self.name class Categ...
2.171875
2
scholarly_citation_finder/apps/citation/search/PublicationDocumentExtractor.py
citationfinder/scholarly_citation_finder
1
16869
#!/usr/bin/python # -*- coding: utf-8 -*- import logging from datetime import datetime from scholarly_citation_finder import config from scholarly_citation_finder.apps.parser.Parser import Parser from scholarly_citation_finder.apps.core.models import PublicationUrl from scholarly_citation_finder.tools.extractor.grobid...
1.921875
2
webapp/web.py
thunderz99/azure_image_caption
1
16870
import sys import os import json import urllib from PIL import Image from flask import Flask, request, redirect, url_for from flask import send_from_directory, render_template from werkzeug.utils import secure_filename from datetime import datetime from caption_service import CaptionService from translation_service imp...
2.515625
3
map2loop/m2l_map_checker.py
Leguark/map2loop
0
16871
import geopandas as gpd from shapely.geometry import LineString, Polygon,MultiLineString import os.path from map2loop import m2l_utils import warnings import numpy as np import pandas as pd #explodes polylines and modifies objectid for exploded parts def explode_polylines(indf,c_l,dst_crs): ...
2.40625
2
DeepBrainSeg/readers/nib.py
JasperHG90/DeepBrainSeg
130
16872
<reponame>JasperHG90/DeepBrainSeg #! /usr/bin/env python # -*- coding: utf-8 -*- # # author: <NAME> # contact: <EMAIL> # MIT License # Copyright (c) 2020 <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...
2.046875
2
tensorflow/intro/main.py
donutloop/machine_learning_examples
1
16873
import os import tensorflow as tf os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' x1 = tf.constant(5) x2 = tf.constant(6) result = tf.multiply(x1, x2) print(result) sess = tf.Session() with tf.Session() as sess: output = sess.run(result) print(output)
2.640625
3
twitter-bots/auto_liker.py
debasish-dutta/Python-projects
0
16874
import auth_key import tweepy import time auth = tweepy.OAuthHandler(auth_key.API_key, auth_key.API_secret_key) auth.set_access_token(auth_key.Access_token, auth_key.Access_token_secret) api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True) user = api.me() indId = 2282863 india...
2.703125
3
ds_discovery/engines/distributed_mesh/domain_products/controller/src/controller.py
project-hadron/discovery-transition-ds
2
16875
from ds_discovery import Controller import os import warnings warnings.simplefilter(action='ignore', category=FutureWarning) warnings.simplefilter(action='ignore', category=DeprecationWarning) __author__ = '<NAME>' def domain_controller(): # Controller uri_pm_repo = os.environ.get('HADRON_PM_REPO', None) ...
1.960938
2
utils_test.py
lostsquirrel/words
0
16876
import json import unittest from utils import CustomEncoder, Paging, ValidationError, generate_uuid, Validator class UtilsTest(unittest.TestCase): def test_uuid(self): print(generate_uuid()) self.assertEqual(len(generate_uuid()), 32) def test_valiate(self): form = dict( ...
2.640625
3
src/pyclean/cli.py
uranusjr/pyclean-py
0
16877
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import logging import os import sys from . import entries, meta logger = logging.getLogger(__name__) def build_parser(): prog = os.path.basename(sys.argv[0]) if prog not in ("pyclean", "pyclean.py"): prog = "pyclean" parser = argpar...
2.46875
2
app.py
ZhongxuanWang/simple_web_remainder-python
0
16878
from flask import Flask, render_template, url_for, redirect, request from flask_sqlalchemy import SQLAlchemy from datetime import datetime from dateutil.relativedelta import relativedelta from demail import demail __author__ = '<NAME>' __doc__ = 'Never Forget online remainder' app = Flask(__name__) app.config['SQLALC...
2.75
3
homeassistant/components/solaredge/__init__.py
DavidDeSloovere/core
4
16879
"""The solaredge integration.""" from __future__ import annotations from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv from .const import DOMAIN CONFIG_SCHEMA = cv.deprecated(DOMAIN) async def async_setup_entry(hass...
1.648438
2
main.py
eteq/door_beeper
0
16880
<gh_stars>0 import uos import utime import machine from machine import Pin, PWM import utils default_config = dict( sleep_time_ms = 250, freezer_delay_ms = 1000, fridge_delay_ms = 1000, write_battery_voltage = True, piezo_plus_pin_num = 12, piezo_min_pin_num = 33, freezer_swi...
2.390625
2
modules/backend.py
Uncle-Yuanl/model_zoo
0
16881
import os, sys from distutils.util import strtobool import numpy as np import tensorflow as tf import tensorflow.keras.backend as K from tensorflow.python.util import nest, tf_inspect from tensorflow.python.eager import tape # from tensorflow.python.ops.custom_gradient import graph_mode_decorator # 是否使用重计...
2.203125
2
apod_daily.py
gultugaydemir/apod_daily
0
16882
import datetime import os import requests import tweepy from PIL import Image # Get your own keys from developer.twitter.com # You can find a detailed tutorial about authenticating accounts from github.com/gultugaydemir/Twitter_OAuth1.0a consumer_key = '' consumer_secret = '' access_token = '' access_token_secret = '...
3.578125
4
datasets/dad.py
LivingSkyTechnologies/Document_Layout_Segmentation
4
16883
import pickle import os import tensorflow as tf from glob import glob import utils.DataLoaderUtils as dlu from utils.AnnotationUtils import write_dad_masks # Static Dataset Config Options TAG_NAMES = {'highlights', 'urls_to_supplementary', 'abbreviation', 'abstract', ...
1.710938
2
terrascript/resource/ddelnano/mikrotik.py
mjuenema/python-terrascript
507
16884
<filename>terrascript/resource/ddelnano/mikrotik.py # terrascript/resource/ddelnano/mikrotik.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:21:43 UTC) import terrascript class mikrotik_bgp_instance(terrascript.Resource): pass class mikrotik_bgp_peer(terrascript.Resource): pass class mik...
1.601563
2
test/threaddd.py
liaohongdong/IPProxy
0
16885
import time import queue import threading def aaa(i): while True: item = q.get() if item is None: print("线程%s发现了一个None,可以休息了^-^" % i) break time.sleep(0.01) print('aaaaa -> ' + str(i) + " ---> " + str(item)) q.task_done() if __name__ == '__main__':...
3.390625
3
Codes/Liam/203_remove_linked_list_elements.py
liuxiaohui1221/algorithm
256
16886
<filename>Codes/Liam/203_remove_linked_list_elements.py # 执行用时 : 68 ms # 内存消耗 : 16.6 MB # 方案:哨兵结点 sentinel,插入在head结点之前 # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def removeElements(self, head: ListNode, va...
3.359375
3
bailleurs/migrations/0001_initial.py
MTES-MCT/appel
0
16887
# Generated by Django 3.2.5 on 2021-07-06 14:18 import uuid from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [] operations = [ migrations.CreateModel( name="Bailleur", fields=[ ("id", models.Au...
1.960938
2
tests/primitives/flow/probe_tcpip_extended_unibiflow_test.py
kjerabek/netexp
0
16888
<reponame>kjerabek/netexp from tests.primitives.flow import probe_tcpip_extended_biflow_test from netexp.primitives.flow import TCPIPFlowExtendedUniBiFlowInfo from netexp.common import naming class TestTCPIPExtendedUniBiFlow(probe_tcpip_extended_biflow_test.TestTCPIPExtendedBiFlow): flow_class = TCPIPFlowExtend...
1.898438
2
optionstrader/database.py
Zaitsev11/Optionstrader
6
16889
import time import mysql.connector from optionstrader.customlogging import CustomLog from optionstrader.parser import Parser MYSQL_IP_ADDR = '192.168.1.10' # Used to debug via logs DEBUG = False class Database: def __init__(self): """ There's some confusion with database vs table. We wil...
2.625
3
backend/api/migrations/0001_initial.py
leowotzak/ljwe-db
0
16890
# Generated by Django 3.2.9 on 2021-11-24 02:52 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Symbol', fields=[ ...
1.78125
2
Ch2_Linked_Lists/test/test_CTCI_Ch2_Ex6.py
mtrdazzo/CTCI
0
16891
from unittest import TestCase from CTCI.Ch2_Linked_Lists.common.SinglyLinkedList import Empty, Node from CTCI.Ch2_Linked_Lists.exercises.CTCI_Ch2_Ex6 import PalindromeSinglyLinkedList, is_palindrome_brute_force from CTCI.Ch2_Linked_Lists.exercises.CTCI_Ch2_Ex6 import is_palindrome_reverse class TestPalindromeSinglyLi...
3.109375
3
alphafold2_pytorch/utils.py
nilbot/alphafold2
1
16892
# utils for working with 3d-protein structures import os import numpy as np import torch from functools import wraps from einops import rearrange, repeat # import torch_sparse # only needed for sparse nth_deg adj calculation # bio from Bio import SeqIO import itertools import string # sidechainnet from sidechainnet...
1.835938
2
src/clean_property_file.py
wmaciel/van-crime
2
16893
<gh_stars>1-10 __author__ = 'walthermaciel' import pandas as pd import numpy as np def load_csv(path): # Load print 'Loading', path df = pd.read_csv(path) # Remove unwanted columns print 'Dropping unwanted columns' df = df[['PID', 'TAX_ASSESSMENT_YEAR', 'CURRENT_LAND_VALUE', 'STREET_NAME', 'T...
3.078125
3
homeassistant/components/sensor/verisure.py
beschouten/home-assistant
1
16894
""" Interfaces with Verisure sensors. For more details about this platform, please refer to the documentation at documentation at https://home-assistant.io/components/verisure/ """ import logging from homeassistant.components.verisure import HUB as hub from homeassistant.const import TEMP_CELSIUS from homeassistant.h...
2.734375
3
articles/blogs/tests/factories.py
MahmoudFarid/articles
0
16895
import factory from factory.django import DjangoModelFactory as Factory from django.contrib.auth.models import Permission from ..models import Blog from articles.users.tests.factories import UserFactory class Blogfactory(Factory): user = user = factory.SubFactory(UserFactory) title = factory.Faker('sentence...
2.4375
2
api_formatter/serializers.py
RockefellerArchiveCenter/argo
0
16896
<filename>api_formatter/serializers.py from datetime import datetime from django.urls import reverse from rest_framework import serializers from .view_helpers import description_from_notes class ExternalIdentifierSerializer(serializers.Serializer): identifier = serializers.CharField() source = serializers.C...
2.375
2
cmz/cms_news/migrations/0004_auto_20160923_1958.py
inmagik/cmz
1
16897
<reponame>inmagik/cmz # -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-09-23 19:58 from __future__ import unicode_literals import datetime from django.db import migrations, models from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('cms_news', '0003_...
1.820313
2
mopidy/audio/utils.py
grdorin/mopidy
6,700
16898
<filename>mopidy/audio/utils.py from mopidy import httpclient from mopidy.internal.gi import Gst def calculate_duration(num_samples, sample_rate): """Determine duration of samples using GStreamer helper for precise math.""" return Gst.util_uint64_scale(num_samples, Gst.SECOND, sample_rate) def create_bu...
2.40625
2
day09/part1.py
mtn/advent16
0
16899
#!/usr/bin/env python3 import re with open("input.txt") as f: content = f.read().strip() ans = "" i = 0 while i < len(content): if content[i] == "(": end = content[i:].find(")") + i instr = content[i+1:end] chars, times = map(int, content[i+1:end].split("x")) to_copy = conten...
3.328125
3