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
resc/functions.py
DougAF/joblib-demo
0
54900
""" Some math functions. """ def factors(a_int): """Find factors of an integer.""" factors_list = [] for i in range(1, a_int): if a_int % i == 0: factors_list.append(i) return factors_list
3.84375
4
nature/benchmarks/protein_folding_problem_benchmark.py
t-imamichi/qiskit-app-benchmarks
18
54901
<filename>nature/benchmarks/protein_folding_problem_benchmark.py # This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache...
2.03125
2
examples/mlp_mnist/mnist_loader.py
MarvinLer/MultiLayerPerceptron
1
54902
<filename>examples/mlp_mnist/mnist_loader.py<gh_stars>1-10 import os import struct import numpy as np import matplotlib.pyplot as plt n_classes = 10 def preprocess(images, labels, one_hot, normalize): # One-hot labels if one_hot: tmp = np.zeros((len(labels), n_classes)) for i, l in enumerate(...
2.859375
3
submissions/diverta2019/a.py
m-star18/atcoder
1
54903
n, k = map(int, input().split()) ans = n-k+1 print(ans)
2.53125
3
log/urls.py
deep2696/DBMS_Website
0
54904
<filename>log/urls.py from django.conf.urls import url, include from . import views from django.contrib.auth import views as auth_views app_name = 'log' urlpatterns = [ url(r'^login/$', views.login_view, name='login_url'), url(r'^logout/$', views.logout_view, name='logout_url'), ]
1.90625
2
nuaal/connections/api/RestBase2.py
mihudec/nuaal
0
54905
<filename>nuaal/connections/api/RestBase2.py import timeit import logging import requests from requests.auth import HTTPBasicAuth from requests.exceptions import ConnectionError, Timeout import json import os from nuaal.definitions import DATA_PATH from nuaal.utils import get_logger class RestBase2(object): """ ...
2.734375
3
postprocess/cross_cpu_cluster_graph.py
Reinazhard/freqbench
121
54906
<gh_stars>100-1000 #!/usr/bin/env python3 import json import csv import sys import matplotlib.pyplot as plt CPU_LABELS = { 1: "Little", 4: "Big", 6: "Big", 7: "Prime" } COL_LABELS = { "power_mean": "Power (mW)", "coremark_score": "Performance (iter/s)", "energy_joules": "Energy (J)", ...
2.625
3
code/fields2network.py
alexeyknorre/PyVK
0
54907
# -*- coding: utf-8 -*- """ Created on Mon Jul 04 13:44:10 2016 @author: Alexey """ import pandas as pd import operator from transliterate import translit, get_available_language_codes import re csv = '../results/profiles.csv' ## test # csv = '../tests/profiles.csv' # PAJEK_EDGELIST = '../tests/test_edgelist.net' ...
3.03125
3
7.py
Polar1ty/euler_problems
2
54908
i = 3 shit_indicator = 0 simple_nums = [2] while len(simple_nums) < 10001: for k in range(2, i): if i % k == 0: shit_indicator = 1 break if shit_indicator == 1: pass else: simple_nums.append(i) i += 1 shit_indicator = 0 print(simple_nums[...
3.296875
3
package/params.py
pchtsp/fmp-instances
0
54909
<filename>package/params.py OPTIONS = { 'start': '2018-01' # start of the planning horizon , 'num_period': 90 # size of the planning horizon # simulation params: , 'simulation': { 'num_resources': 15 # this depends on the number of tasks actually , 'num_parallel_tasks': 1 # number of...
2.015625
2
Dataset/Leetcode/valid/66/626.py
kkcookies99/UAST
0
54910
<reponame>kkcookies99/UAST class Solution: def XXX(self, digits: List[int]) -> List[int]: ans = collections.deque() c = 1 for n in reversed(digits): c, t = divmod(n + c, 10) ans.appendleft(t) if c > 0: ans.appendleft(c) return list(ans)
3.03125
3
__init__.py
pnarvor/nephelae_simulation
0
54911
<filename>__init__.py from . import mesonh_interface from . import mesonh_probe
1.210938
1
stats/simplestats.py
WPPlugins/simple-flash-video
0
54912
<filename>stats/simplestats.py<gh_stars>0 #!/usr/bin/env python """ Simple Stats ============ Generate statistics for the JW FLV player and provide nice graphs and tables using Open Flash Chart and XHTML. http://www.simplethoughtproductions.com/simple-stats/ Usage ----- simple...
2.1875
2
fabfile.py
fakegit/Lulu
922
54913
<filename>fabfile.py # coding=utf-8 from fabric.api import ( local, ) def test(proxy=False): cmd = 'PYTHONPATH=./ {} coverage run tests/runtests.py'.format( 'proxychains4 -q' if proxy else '' ) local(cmd) def test_download(func): ''' fab test_download:acfun ''' cmd = ( ...
1.875
2
video/stream.py
ktolstikhin/faceid
0
54914
import cv2 class VideoStream: def __init__(self, path='/dev/video0', size=(640, 480)): self.path = path self.size = size self.cap = self.capture_stream() def __del__(self): cap = getattr(self, 'cap', None) if cap is not None: cap.release() def captur...
2.75
3
skytour/skytour/apps/solar_system/admin.py
ursomniac/skytour
0
54915
from django.contrib import admin from ..abstract.admin import AbstractObservation, ObservableObjectAdmin from .models import ( Asteroid, AsteroidObservation, Comet, CometObservation, Planet, PlanetObservation, MoonObservation, MeteorShower, ) class AsteroidObservationAdmin(AbstractObservation): ...
1.953125
2
ftputil/tool.py
pombredanne/https-hg.sschwarzer.net-ftputil
0
54916
# Copyright (C) 2013-2020, <NAME> # and ftputil contributors (see `doc/contributors.txt`) # See the file LICENSE for licensing terms. """ tool.py - helper code """ import os __all__ = ["same_string_type_as", "as_str", "as_str_path"] # Encoding to convert between byte string and unicode string. This is # a "lossle...
2.953125
3
analyze.py
dangoldin/annual-stats-analysis
0
54917
#!/usr/bin/python import sys, csv, re, pprint, math from collections import namedtuple, Counter RE_ALL_NUM = re.compile(r'[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?') Row = namedtuple('Row', ('date','sleep','wakeup','physical_morning','physical_day','physical_evening','mood_morning','mood_day','mood_evening','food','d...
3.140625
3
apps/data/migrations/0071_rename_code_id_taibifcode_objid.py
Jeffersonktw/portal20
0
54918
# Generated by Django 3.2.7 on 2022-01-06 03:42 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('data', '0070_taibifcode'), ] operations = [ migrations.RenameField( model_name='taibifcode', old_name='code_id', ...
1.726563
2
1-beginner/1074.py
alenvieira/uri-online-judge-solutions
0
54919
<filename>1-beginner/1074.py n = int(input()) values = [int(input()) for _ in range(n)] for value in values: msg = 'ODD ' if value % 2 == 0: msg = 'EVEN ' if value < 0: msg = msg + 'NEGATIVE' elif value > 0: msg = msg + 'POSITIVE' else: msg = 'NULL' print(msg)
3.671875
4
service/util/log.py
mutouxia/kamiFaka
717
54920
<reponame>mutouxia/kamiFaka import time # 定义日志记录器 # import sys # def get_cur_info(): # return sys._getframe().f_code.co_filename + ' 第' + str(sys._getframe().f_lineno)+'行' # 获取具体路径位置 # get_cur_info() def log(msg): with open('service.log','a',encoding='utf=8') as f: f.write('\n' + time.strftime("%Y-...
2.34375
2
melodies_monet/util/write_util.py
lkemmons/MELODIES-MONET
1
54921
# Copyright (C) 2022 National Center for Atmospheric Research and National Oceanic and Atmospheric Administration # SPDX-License-Identifier: Apache-2.0 # import numpy as np from pandas.api.types import is_float_dtype def write_ncf(dset, output_name, title=''): """Function to write netcdf4 files with some compress...
2.90625
3
url_shortener/shorter/migrations/0002_auto_20150506_0010.py
PythonicNinja/UrlShortener
0
54922
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('shorter', '0001_initial'), ] operations = [ migrations.AlterField( model_name='urlslug', name='is_us...
1.578125
2
week-6/problems/dna/dna.py
asankov/cs50
2
54923
<reponame>asankov/cs50 import sys import csv def main(): if len(sys.argv) != 3: print("Invalid number of arguments.") return dataset, dna_sequence = sys.argv[1], sys.argv[2] with open(dataset, newline='') as csvfile: with open(dna_sequence, newline='') as dnafile: dna ...
3.609375
4
test/deprecated/test6.py
davidliyutong/Flint
0
54924
<gh_stars>0 import numpy as np import scipy.linalg.blas as blas import numba.cuda as cuda import pyculib.blas as cublas A = np.random.randn(3, 3) B = np.random.randn(3, 3) C = blas.sgemm(1.0, A, B) print(C) A_d = cuda.to_device(A) B_d = cuda.to_device(B) C_d = cublas.gemm("N", "N", 1.0, A_d, B_d) print(C_d)
2.15625
2
code/utils/tests/test_imaging.py
berkeley-stat159/project-alpha
4
54925
""" Tests for functions in imaging module Run at the project directory with: nosetests code/utils/tests/test_imaging.py """ # Loading modules. from __future__ import absolute_import, division, print_function import numpy as np import nibabel as nib import os import sys from numpy.testing import assert_almost_equal...
2.609375
3
indoor_location/getSampleSet.py
WQAQs/keras-bert
0
54926
<filename>indoor_location/getSampleSet.py<gh_stars>0 import indoor_location.dataProcess as dp import indoor_location.globalConfig as globalConfig #不能删除,因为在 experiment_config.py 中更改了当前路径 import pandas as pd pointTxtRootDir = globalConfig.root_txt_dir # 原始数据存在的文件夹 pointCsvRootDir = globalConfig.root_csv_dir # 转换的csv文...
2.28125
2
avicena/parsers/LogistiCareParser.py
ribsthakkar/RiderPickup
2
54927
import re from datetime import datetime from typing import List, Optional, Match, AnyStr, Dict import logging import pandas as pd from PyPDF2 import PdfFileReader from nltk.tokenize import word_tokenize from pandas import DataFrame from avicena.models.MergeAddress import MergeAddress from avicena.models.RevenueRate im...
2.828125
3
release/release.py
MarcoMernberger/mbf_bam
0
54928
<filename>release/release.py #!/usr/bin/python3 import sys import subprocess from pathlib import Path import os os.chdir(str(Path(__file__).parent.absolute())) sys.path.insert(0, "../src") try: import mbf_bam print("Building release for", mbf_bam.__version__) except (ImportError, AttributeError): print(...
2.15625
2
mailchimp3/entities/interest.py
klaviyo/python-mailchimp
0
54929
<reponame>klaviyo/python-mailchimp from __future__ import unicode_literals from ..baseapi import BaseApi class Interest(BaseApi): def __init__(self, *args, **kwargs): super(Interest, self).__init__(*args, **kwargs) self.endpoint = 'lists' def all(self, list_id, category_id, **kwargs): ...
2.40625
2
lib/analyzer/actions.py
aam/dart-sublime-bundle
0
54930
# Copyright (c) 2014, <NAME>. Please see the AUTHORS file for details. # All rights reserved. Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file.) """Actions performed using the analyzer's responses. """ import sublime import os from Dart.lib.analyzer.api.types import...
2
2
tests/test_versioning_checks.py
webbyfox/djangocms-versioning-filer
0
54931
from djangocms_versioning.exceptions import ConditionFailed from djangocms_versioning.models import Version from djangocms_versioning_filer.models import FileGrouper from djangocms_versioning_filer.monkeypatch.models import ( is_file_content_valid_for_discard, is_file_content_valid_for_revert, ) from .base im...
2.109375
2
lcm/ns_vnfs/serializers/grant_vnf_serializer.py
onap/vfc-nfvo-lcm
4
54932
<reponame>onap/vfc-nfvo-lcm # Copyright 2018 ZTE Corporation. # # 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 app...
1.351563
1
course/admin.py
duwhop/relate
0
54933
<gh_stars>0 # -*- coding: utf-8 -*- __copyright__ = "Copyright (C) 2014 <NAME>" __license__ = """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation...
1.65625
2
middleware.py
jfroejk/cartridge_quickpay
0
54934
from django.http import HttpRequest, HttpResponse from django.utils.deprecation import MiddlewareMixin from typing import Optional import logging class QuickpayMiddleware(MiddlewareMixin): def process_view(self, request: HttpRequest, view_func, view_args, view_kwargs) -> Optional[HttpResponse]: from cartr...
1.890625
2
CarParkArcGisApi/CarParkArcGisApi/env/Lib/site-packages/arcgis/gis/server/admin/_logs.py
moazzamwaheed2017/carparkapi
0
54935
<gh_stars>0 """ """ from __future__ import absolute_import from __future__ import print_function import csv from datetime import datetime from .._common import BaseServer ######################################################################## class LogManager(BaseServer): """ Helper class for the management...
2.140625
2
modules/lmi.py
YNedderhoff/sentiment-classifier
1
54936
<reponame>YNedderhoff/sentiment-classifier<gh_stars>1-10 from math import log class lmi(object): def __init__(self, tokens, feat_vec): self.tokens = tokens self.feat_vec = feat_vec self.top_x = [2, 3, 4, 5] def compute_lmi(self): pos_tags = {} lmi_dict = {}...
2.765625
3
facedancer/devices/keyboard.py
mrh1997/Facedancer
345
54937
<gh_stars>100-1000 # pylint: disable=unused-wildcard-import, wildcard-import # # This file is part of FaceDancer. # import asyncio from typing import Iterable from . import default_main from ..future import * from ..classes.hid.usage import * from ..clas...
2.09375
2
tests/client_gen/example_program_gen/instructions/initialize_with_values2.py
kevinheavey/anchorpy
87
54938
<gh_stars>10-100 from __future__ import annotations import typing from solana.publickey import PublicKey from solana.transaction import TransactionInstruction, AccountMeta from construct import Construct import borsh_construct as borsh from ..program_id import PROGRAM_ID class InitializeWithValues2Args(typing.TypedDi...
2.046875
2
lib/datasets/wider/convert_face_to_coco.py
AruniRC/detectron-self-train
128
54939
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import h5py import json import os import scipy.misc import sys import re import fnmatch import datetime from PIL import Image import numpy as np ''' sr...
2.046875
2
spry/__init__.py
Ofekmeister/spry
1
54940
from spry.api import httpget
1.101563
1
env/share/doc/dipy/examples/tracking_eudx_tensor.py
Raniac/NEURO-LEARN
8
54941
""" ================================================= Deterministic Tracking with EuDX on Tensor Fields ================================================= In this example we do deterministic fiber tracking on Tensor fields with EuDX [Garyfallidis12]_. This example requires to import example `reconst_dti.py` to run. E...
2.03125
2
ownership/esg.py
NoFishLikeIan/nlp-financial-env
0
54942
<filename>ownership/esg.py from typing import Callable import pandas as pd import numpy as np """ From raw .xlsx ESG data construct a function of year that yields pd.DataFrame with companies as row, type of index as columns, and scores. """ def yearly_esg_maker(raw:pd.DataFrame) -> Callable[[str, str], pd.DataFrame]:...
3.109375
3
bin/pretty-nvtx.py
wandering-logic/dotfiles
0
54943
#!/usr/bin/env python3 import sqlite3 import argparse ############################################################################### # # Super simple (and probably not very efficient) way to query sqlite file and # produce a python list of dictionaries with the result of that query # ################################...
3.09375
3
ncf.py
puririshi98/NCF
0
54944
<gh_stars>0 # Copyright (c) 2018, deepakn94, codyaustun, robieta. 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
1.328125
1
unet/generatePatches.py
MartimChaves/ret_detect
0
54945
<filename>unet/generatePatches.py # this needs to be in the previous directory import cv2.cv2 as cv2 import numpy as np import os from skimage.measure import label, regionprops os.chdir('C:/Users/Martim_Pc/Desktop/DACO/PROJECT_DACO/convNet/Unet') def myShowImage(img,name = "from_show_function"): cv2....
2.390625
2
Python3/scripts-python3/desafios/mundo03/desafio103.py
Joey-Resende/Estudando-Python
0
54946
def ficha(jog='<Fulaninho>', gol=0): print(f'O jogador {jog} fez {gol} gol(s) no campeonato.') print('-' * 30) n = str(input('Nome do jogador: ')) g = str(input('Números de Gols: ')) if g.isnumeric(): g = int(g) else: g = 0 if n.strip() == '': ficha(gol=g) else: ficha(n, g)
3.640625
4
Sensor_Hat/src/mod_thread.py
riccardoarona/thread_sense_2
0
54947
import threading import time import mod_log import mod_measure_list import mod_sense_hat # Threads management class class ThreadManager(object): def __init__(self, log_mgr, channel, delay, source, measure_list): self.log_mgr = log_mgr # Logger module self.channel = channel ...
2.421875
2
pyleecan/Methods/Elmer/Section/__setitem__.py
IrakozeFD/pyleecan
95
54948
# -*- coding: utf-8 -*- def __setitem__(self, key, value): """Called to implement assignment to self[key].""" if isinstance(value, tuple): self._statements.__setitem__(key, value[0]) if len(tuple) >= 1: self._comments.__setitem__(key, value[1]) else: self._comme...
2.765625
3
Task/9-billion-names-of-God-the-integer/Python/9-billion-names-of-god-the-integer-2.py
LaudateCorpus1/RosettaCodeData
1
54949
<gh_stars>1-10 def partitions(N): diffs,k,s = [],1,1 while k * (3*k-1) < 2*N: diffs.extend([(2*k - 1, s), (k, s)]) k,s = k+1,-s out = [1] + [0]*N for p in range(0, N+1): x = out[p] for (o,s) in diffs: p += o if p > N: break out[p] += x*s return ou...
2.96875
3
Codeforce/CF59-D2-A/Word.py
Sonu589/Hacktoberfest-2025
1
54950
#!/usr/bin/env python3 import sys input = sys.stdin.readline ############ ---- Input Functions, coutery of 'thekushalghosh' ---- ############ def inp(): return(int(input())) def inlt(): return(list(map(int, input().split()))) def insr(): s = input() return(list(s[:len(s) - 1])) def invr(): ...
3.703125
4
App.py
rodolfocruzbsb/clean-jboss-tmp-directories
0
54951
#!/usr/local/bin/python # -*- coding: utf-8 -*- from DAO import ServidoresDAO from Tkinter import * import ConfigParser import os class Application: def __init__(self, master=None): self.fonte = ("Verdana", "8") self.container1 = Frame(master) self.container1["pady"] = 10 self.container1.p...
2.484375
2
runExpPsychopy/Exp1_olderPsychopy_correctStructure0214_writeResp.py
miaoli-psy/CrowdingNumerosityGit
0
54952
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ This experiment was created using PsychoPy2 Experiment Builder (v1.84.2), on February 14, 2019, at 13:04 If you publish work using this script please cite the PsychoPy publications: <NAME> (2007) PsychoPy - Psychophysics software in Python. Journal of N...
2
2
NotebookManage/notebook/apps.py
ahriknow/ahriknow
0
54953
<gh_stars>0 from django.apps import AppConfig class NotebookConfig(AppConfig): name = 'NotebookManage.notebook'
0.984375
1
python2/run_tests.py
shibukawa/berrymq
0
54954
<filename>python2/run_tests.py<gh_stars>0 # -*- coding: utf-8 -*- import sys import unittest import berrymq.berrymq as berrymq def show_usage(alert_version=False): print("""berryMQ tests for Python 2.4, 2.5, 2.6 (current interpreter: %d.%d.%d) run_tests.py [option] target: *target --all...
2.484375
2
cmpe321-master/cmpe321-master/src/app.py
egirgin/junior-projects
0
54955
from flask import Flask, render_template, request, redirect, url_for from flaskext.mysql import MySQL app = Flask(__name__) mysql = MySQL() app.config['MYSQL_DATABASE_USER'] = 'root' app.config['MYSQL_DATABASE_PASSWORD'] = '<PASSWORD>' app.config['MYSQL_DATABASE_HOST'] = 'localhost' app.config['MYSQL_DATABASE_DB'] = ...
3.03125
3
setup.py
bendichter/brainrender
0
54956
from setuptools import setup, find_namespace_packages from os import path this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, "README.md"), encoding="utf-8") as f: long_description = f.read() requirements = [ "numpy", "pandas", "vedo>=2020.3.3", "k3d==2.7.4", ...
1.4375
1
analysis/fairness-2021/boxplot.py
lyonva/Nue
0
54957
import pandas as pd import numpy as np import seaborn as sns import os import matplotlib.pyplot as plt df = pd.read_csv( os.path.join( "fairness-2021", "simple-rank-res.csv" ) ) df["pp"] = [ "fs" if x == 'fairsmote' else x for x in df["pp"] ] df["pt"] = [ "rs" if x == 'random' else x for x in df["pt"] ] df["tech"] = [...
2.765625
3
sources/praline/client/repository/remote_proxy.py
dansandu/praline
0
54958
<reponame>dansandu/praline<gh_stars>0 from praline.common.file_system import basename, FileSystem from praline.common.package import get_package, get_package_dependencies_from_pralinefile from praline.common.tracing import trace from typing import Any, Dict import requests class RemoteProxy: def __init__(self, fi...
2.21875
2
allmychanges/management/commands/update_package.py
AllMyChanges/allmychanges.com
46
54959
<reponame>AllMyChanges/allmychanges.com from django.core.management.base import BaseCommand from twiggy_goodies.django import LogMixin from allmychanges.models import Changelog class Command(LogMixin, BaseCommand): help = u"""Tests crawler on selected projects.""" def handle(self, *args, **options): ...
2.03125
2
zpar/Tagger.py
BettyFabre/python-zpar
49
54960
# License: MIT ''' :author: <NAME> (<EMAIL>) :organization: ETS ''' import ctypes as c import logging import os class Tagger(object): """The ZPar English POS Tagger""" def __init__(self, modelpath, libptr, zpar_session_obj): super(Tagger, self).__init__() # save the zpar session object ...
2.5
2
docs/auto_generate_api.py
Weepingchestnut/BasicSR
0
54961
<gh_stars>0 import os from os import path as osp def scandir(dir_path, suffix=None, recursive=False, full_path=False): """Scan a directory to find the interested files. Args: dir_path (str): Path of the directory. suffix (str | tuple(str), optional): File suffix that we are intere...
3.15625
3
test_flair.py
Alexa-TWIZ/BLINK
0
54962
<filename>test_flair.py from flair.data import Sentence from flair.models import SequenceTagger # load tagger tagger = SequenceTagger.load("flair/pos-english") # make example sentence sentence = Sentence("I love Berlin.") # predict NER tags tagger.predict(sentence) # print sentence print(sentence) # print predicte...
2.921875
3
experiments/run_export_profiler.py
Cinofix/poisoning-clustering
2
54963
<gh_stars>1-10 import sys sys.path.extend(["./"]) import datetime, warnings from tqdm import tqdm from src.threat.clustering.constrained_poisoning_export import ( ConstrainedAdvPoisoningGlobalExport, ) from experiments.utilities import * def run( X, Y, model, seeds, dt_range, s_range, ...
2.125
2
networktree.py
aresta/TreeShareNet
0
54964
<reponame>aresta/TreeShareNet import random, math import hashlib class NetworkTree: """ Our home-made internet """ __nodes = {} def __str__(self): return str(NetworkTree.__nodes) @staticmethod def connectTo( fromAddr, toAddr): toNode = NetworkTree.__getNode(to...
3.09375
3
savu/plugins/ring_removal/ring_removal_fitting.py
elainehoml/Savu
39
54965
<filename>savu/plugins/ring_removal/ring_removal_fitting.py # Copyright 2014 Diamond Light Source Ltd. # # 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/L...
1.875
2
study/third_party_library/crawler/FindInterestedPaperVLDB2014.py
CheYulin/PythonStudy
3
54966
import urllib2 import gzip import re import sys from StringIO import StringIO from bs4 import BeautifulSoup __author__ = 'cheyulin' def loadData(url): request = urllib2.Request(url) request.add_header('Accept-encoding', 'gzip') response = urllib2.urlopen(request) print response.info().get('Content-En...
3
3
Games/Easy/Connect4/connect4.py
saintwithataint/Pro-g-rammingChallenges4
1
54967
<gh_stars>1-10 import turtle import time screen = turtle.Screen() screen.setup(800, 800) screen.setworldcoordinates(-500, -500, 500, 500) screen.title("Connect 4") screen.tracer(0, 0) turtle.speed(0) turtle.hideturtle() score = turtle.Turtle() score.up() score.hideturtle() rows = 6 cols = 7 InitX = -450 InitY = -450...
3.515625
4
mpath/layer/source.py
cantordust/mpath
2
54968
# ------------------------------------------------------------------------------ # Global imports # ------------------------------------------------------------------------------ # *** Type hints *** # from typing import Any from typing import Optional from typing import Union # *** Enumerations *** # import enum # *...
2.296875
2
s3splitmerge/tests/__init__.py
MacHu-GWU/s3splitmerge-project
0
54969
<filename>s3splitmerge/tests/__init__.py # -*- coding: utf-8 -*- """ """ from .aws import ( boto_ses, s3_client, bucket, prefix, )
1.085938
1
netvisor/_compat.py
fastmonkeys/netvisor.py
3
54970
<filename>netvisor/_compat.py # -*- coding: utf-8 -*- """ netvisor._compat ~~~~~~~~~~~~~~~~ :copyright: (c) 2013-2016 by <NAME>. :license: MIT, see LICENSE for more details. """ import sys PY2 = sys.version_info[0] == 2 if not PY2: text_type = str string_types = (str,) else: text_type = ...
1.8125
2
transformer.py
fangyihao/teamnet
1
54971
<reponame>fangyihao/teamnet ''' Created on Jun 21, 2018 @author: fangy5 ''' # Imports we need. import tensorflow as tf import matplotlib.pyplot as plt import numpy as np import os import collections from tensor2tensor import models from tensor2tensor import problems from tensor2tensor.layers import common_layers from...
2.09375
2
bookStore/users/migrations/0022_creditcard.py
afern247/BookStore-Web
0
54972
<reponame>afern247/BookStore-Web<gh_stars>0 # Generated by Django 2.1.5 on 2019-03-23 22:30 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('users', '0021_address_primaryaddress'), ] operations = [ migrat...
1.898438
2
xfraud/glib/brisk_utils.py
eBay/xFraud
17
54973
# Copyright 2020-2021 eBay 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, so...
1.960938
2
sw/migrations/0003_note.py
Nigar-mr/SwTechnices
0
54974
<filename>sw/migrations/0003_note.py # Generated by Django 2.2.7 on 2019-11-22 08:33 import ckeditor.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('sw', '0002_message_occupation'), ] operations = [ migrations.CreateModel( ...
1.585938
2
src/language.py
Coestaris/pyvkgram
2
54975
<reponame>Coestaris/pyvkgram # coding=utf8 lang = [ { "lang" : "ru", "content" : { "help" : u"""Бот для автоматического репоста постов с ВэКа вам в телегу. Для начала вам необходимо подписаться на паблики, посты с которых вы хотите видеть в боте. 🤔Комманды бота🤔 Юзай: /su...
1.90625
2
srcs/types/Defines.py
Cardiox12/TheExecutor
7
54976
<reponame>Cardiox12/TheExecutor from enum import Enum BACKTICKS = "```" NEWLINE = "\n" RUN_CMD = "!run" class RunnerDefs(Enum): WORKDIR = "/runner" RESOURCES = "/resources"
2.625
3
smolDM/scenes.py
andreheringer/smolDM
4
54977
"""This module defines the Scene related interfaces. Attributes: SCENE_RE: Python regular expression that matches SmolDM's adventure scene SCENE_TITLE_RE: Python regular expression that matches SmolDM's adventure scene title SCENE_OPTION_RE: Python regular expression that matches SmolDM...
2.65625
3
tools/generate_example_data.py
itaigat/pytorch-template
13
54978
<filename>tools/generate_example_data.py<gh_stars>10-100 """ Example data generation """ import torch import pickle train = {} validation = {} for i in range(1000): input_env_0 = torch.randn((50, )) * 0.5 train[i] = {'label': 0, 'input': input_env_0} input_env_0 = torch.randn((50,)) * 0.5 vali...
2.4375
2
task_widgets/calculation/numbers_calculation.py
athrn/kognitivo
80
54979
import random from task_widgets.task_base.intro_hint import IntroHint from utils import import_kv from .calculation import ModeOperandsCalculation import_kv(__file__) class IntroHintNumbersCalculation(IntroHint): pass class NumbersCalculation(ModeOperandsCalculation): FROM = 101 TO = 899 TASK_KEY ...
2.953125
3
splitter.py
welpdx/mp3splitter
0
54980
<filename>splitter.py<gh_stars>0 #!/usr/bin/env python3 import eyed3 import pathlib import subprocess import sys import xml.etree.ElementTree as ET import os import shutil ''' Added code to do the following: - Check if ffmpeg is in directory. - Replace invalid characters in markers, so files can be created ni windows...
2.875
3
learnit/autolearn/evaluate.py
suhara/learnit
5
54981
import warnings import numpy as np import pandas as pd import sklearn from sklearn import metrics class MetricCatalog: catalog_dict = { 'accuracy': { 'func': metrics.accuracy_score, 'params': {}, 'require_score': False, 'binary': True, 'multi': ...
2.34375
2
raml/layers.py
Mathemmagician/raML
2
54982
from abc import ABC, abstractmethod import numpy as np from .activations import Identity class Layer(ABC): def __init__(self, size, input_shape=(None, None)): ''' Params ------ size : int number of neurons (size) of output layer input_shape : (int, ...
3.453125
3
EskomFunctions/function5.py
KeletsoM/Predict-Team-7
0
54983
def number_of_tweets_per_day(df): """This function takes a pandas dataframe of twitter data and returns the number of tweets per day on a given day. Example ---------- Input: twitter_df Tweets Date @BongaDlulane Please send an...
4.34375
4
widgets_sample_project/widgets_app/widgets.py
DeppSRL/django-widgets
1
54984
<reponame>DeppSRL/django-widgets<gh_stars>1-10 from __future__ import absolute_import from django import forms from widgets.models import Widget class TestWidget(Widget): site_url = 'http://localhost:8001' embed_template = 'widgets/test_embed_code.html' class BasicWidget(TestWidget): code = 'basic' ...
2.359375
2
Incident-Response/Tools/cyphon/cyphon/utils/parserutils/parserutils.py
sn0b4ll/Incident-Playbook
1
54985
<reponame>sn0b4ll/Incident-Playbook # -*- coding: utf-8 -*- # Copyright 2017-2019 ControlScan, Inc. # # This file is part of Cyphon Engine. # # Cyphon Engine is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, ver...
2.421875
2
Chapter_1_Introduction/Adhoc_Problems/kattis_beatspread.py
BrandonTang89/CP4_Code
2
54986
<filename>Chapter_1_Introduction/Adhoc_Problems/kattis_beatspread.py ''' Kattis - beatspread Very easy math problem. Time: O(1), Space: O(1) ''' num_tc = int(input()) for i in range(num_tc): a, b = map(int, input().split()) l = (a+b)//2 s = (a-b)//2 if (a+b)%2 == 1 or s < 0: print(f"i...
3.546875
4
lyna.py
nisegami/dart-consistency-checker
0
54987
<gh_stars>0 from typing import List, Optional, Tuple from framework import CardType, DeckList, Disruption, Manager, Card, Game class LynaManager(Manager): # Invoked aleister = Card("Aleister the Invoker", CardType.MONSTER) invocation = Card("Invocation", CardType.SPELL) meltdown = Card("Magical Meltdo...
2.375
2
app/user/views.py
default-sameer/count
0
54988
<reponame>default-sameer/count from app.user import user from flask import render_template from flask_login import login_required, current_user from .utlis import save_picture @user.route('/dashboard') @login_required def dashboard(): return render_template('users/dashboard.html', title='Dashboard') @user.route('...
1.773438
2
cinemanio/core/tests/translit.py
cinemanio/backend
4
54989
from transliterate import translit from parameterized import parameterized from cinemanio.core.tests.base import BaseTestCase class TranslitTest(BaseTestCase): @parameterized.expand([ ('Ирония судьбы, или с легким паром!', "Ironiya sudby, ili s legkim parom!"), ('<NAME>', '<NAME>'), ('<NA...
2.71875
3
prometheus_ecs_discoverer/__init__.py
lejmr/prometheus-ecs-discoverer
0
54990
<filename>prometheus_ecs_discoverer/__init__.py import os from dynaconf import Dynaconf # Copyright 2020 <NAME>. Licensed under the Apache License 2.0 current_directory = os.path.dirname(os.path.realpath(__file__)) settings = Dynaconf( envvar_prefix="PROMED", settings_files=[ f"{current_directory}/...
1.726563
2
gpu_implementation/neuroevolution/helper.py
deyandyankov/research.mtne
0
54991
__copyright__ = """ Copyright (c) 2018 Uber Technologies, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, mer...
1.9375
2
parse_automl_logs.py
jtorniainen/wine-quality-predictor
0
54992
import pandas as pd if __name__ == '__main__': target_file = '/home/jarto/work/wine-quality-predictor/b87fe6d2-ab92-4d36-8946-111850523f12/AutoML(1):wine-quality.log' with open(target_file, 'r') as file_h: content = file_h.readlines() preprocessors = [] regressors = [] rescalers = [] ...
2.90625
3
cflare/lib/__init__.py
trisongz/cflare
1
54993
<reponame>trisongz/cflare from . import models from .models import MXRecords, GoogleMXRecords, CFlareRecord from .models import CFlareAuth, CFlareAPI
0.929688
1
cloudmesh-exercises/e-cloudmesh-shell-3/cloudmesh-experiment_docopt/cloudmesh/experiment_docopt/command/experiment_docopt.py
cybertraining-dsc/fa19-516-151
0
54994
<gh_stars>0 from __future__ import print_function from cloudmesh.shell.command import command from cloudmesh.shell.command import PluginCommand from cloudmesh.experiment_docopt.api.manager import Manager from cloudmesh.common.console import Console from cloudmesh.common.util import path_expand from pprint import pprint...
2.296875
2
docs/source/theory/make_model_page.py
bws428/ambiance
18
54995
<filename>docs/source/theory/make_model_page.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys HERE = os.path.abspath(os.path.dirname(__file__)) os.chdir(HERE) sys.path.insert(0, os.path.abspath('../../../src/ambiance')) from _doc import props, vars_const URL_PLOTS = 'https://raw.githubusercon...
2.21875
2
src/riotwatcher/__version__.py
mikeread-dev/Riot-Watcher
0
54996
__version__ = "3.1.2" __author__ = "pseudonym117" __title__ = "RiotWatcher"
0.964844
1
asyncio/asyncio02_libs/netdev/ex02_netdev_show.py
levs72/pyneng-examples
11
54997
from pprint import pprint import asyncio import netdev import yaml r1 = { "device_type": "cisco_ios", "host": "192.168.100.1", "username": "cisco", "password": "<PASSWORD>", "secret": "cisco", } async def send_show(device, commands): result = {} if type(commands) == str: command...
2.75
3
chesscorpy/user.py
kurtjd/correspondence-chess
2
54998
from flask import session from werkzeug.security import generate_password_hash from . import database USERNAME_MAX_LEN = 15 EMAIL_MAX_LEN = 320 PASSWORD_MAX_LEN = 100 DEFAULT_RATING = 1000 MIN_RATING = 1 MAX_RATING = 3000 PUBLIC_USER_ID = 0 DRAW_USER_ID = 0 USER_SESSION = 'user_id' def get_data_by_id(userid, field...
2.921875
3
xm02_array_two_pointers/TP_02_remove_duplicates.py
RagnorLixiaomeng/grokkingTheCoding
0
54999
<gh_stars>0 # -*- coding: utf-8 -*- # @Time : 2021/5/24 4:08 PM # @Author: lixiaomeng_someday # @Email : <EMAIL> # @File : TP_02_remove_duplicates.py """ story: Given an array of sorted numbers, remove all duplicates from it. You should not use any extra space; after removing the duplicates in-place retur...
4.09375
4