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
validators.py
mk-rn/django_cash_register
0
28700
<gh_stars>0 from django.core.exceptions import ValidationError def positive_number(value): """Checking the value. Must be greater than 0.""" if value <= 0.0: raise ValidationError('Count must be greater than 0', params={'value': value},)
2.640625
3
others.py
blguweb/radiarDetection
0
28701
import sensor, image, time, pyb from pid import PID from pyb import Servo from pyb import UART uart = UART(3, 19200) usb = pyb.USB_VCP() led_red = pyb.LED(1) # Red LED = 1, Green LED = 2, Blue LED = 3, IR LEDs = 4. led_green = pyb.LED(2) pan_pid = PID(p=0.07, i=0, imax=90) #脱机运行或者禁用图像传输,使用这个PID tilt_pid = PID(p=0...
2.484375
2
executiontime_calculator.py
baumartig/paperboy
3
28702
<gh_stars>1-10 from datetime import datetime from datetime import timedelta from job import WEEKDAYS from job import Job def calculateNextExecution(job, now=datetime.now()): executionTime = now.replace() if job.executionType == "weekly": diff = WEEKDAYS.index(job.executionDay) - now.weekday() ...
3.078125
3
molsysmt/api_forms/api_openmm_GromacsGroFile.py
uibcdf/MolModMTs
0
28703
<filename>molsysmt/api_forms/api_openmm_GromacsGroFile.py from molsysmt._private.exceptions import * from molsysmt.item.openmm_GromacsGroFile.is_openmm_GromacsGroFile import is_openmm_GromacsGroFile as is_form from molsysmt.item.openmm_GromacsGroFile.extract import extract from molsysmt.item.openmm_GromacsGroFile.add ...
1.648438
2
simple_permutations.py
mutazag/nlpia
0
28704
<reponame>mutazag/nlpia #%% from itertools import permutations, product # %% A =['a','b'] Z = ['x','z'] [p for p in product('ab', range(3))] [p for p in product(A,Z)] [p for p in product(A, repeat=3)] # %% msg = 'Good Morning Rosa!' msgList = msg.split() [' '.join(p) for p in permutations(msgList,3)] # %% # complex...
3.234375
3
olea/packages/ip2loc/ip2loc.py
Pix-00/olea
2
28705
<reponame>Pix-00/olea __all__ = ['IP2Loc'] import IP2Location from .update_ipdb import download class IP2Loc(): def __init__(self, app=None): self.ip2loc = None if app: self.init_app(app) def init_app(self, app): path = app.config['IP2LOC_IPDB_PATH'] if not path....
2.609375
3
tests/BaseCase.py
YaroslavChyhryn/SchoolAPI
0
28706
<gh_stars>0 import unittest from school_api.app import create_app from school_api.db import create_tables, drop_tables from school_api.data_generator import test_db class BaseCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.app = create_app('test') def setUp(self): drop_tabl...
2.375
2
msgflow/logging.py
noriyukipy/smilechat
5
28707
import json import datetime def print_json_log(logger_, level_, message_): dict_ = {"level": level_, "message": message_, "time": str(datetime.datetime.now())} json_str = json.dumps(dict_) getattr(logger_, level_)(json_str)
2.65625
3
tests/test_nace2.py
sayari-analytics/pyisic
3
28708
# -*- coding: utf-8 -*- import pytest from pyisic import NACE2_to_ISIC4 from pyisic.types import Standards @pytest.mark.parametrize( "code,expected", [ ("DOESNT EXIST", set()), ("A", {(Standards.ISIC4, "A")}), ("01", {(Standards.ISIC4, "01")}), ("01.1", {(Standards.ISIC4, "011...
2.484375
2
JiaLu/learn/list_training9.py
13022108937/homework
0
28709
#!/usr/bin/env python def bubble_search_func(data_list): cnt_num_all = len(data_list) for i in range(cnt_num_all-1): for j in range(1,cnt_num_all-i): if(data_list[j-1]>data_list[j]): data_list[j-1],data_list[j]=data_list[j],data_list[j-1] data_list = [54, 25, 93, 17, 77...
3.921875
4
src/custom_user_app/urls.py
JackCX777/user_polls_2
0
28710
from django.urls import path from custom_user_app.views import (CustomUserLoginView, CustomUserLogoutView, CustomUserCreationView, CustomUserUpdateView, CustomUserPasswordChangeVie...
1.859375
2
src/utils/preprocess_dataset.py
FedericoBottoni/household-poverty-classifier
0
28711
import numpy as np import csv as csv from clean_data import clean_data from join_columns import join_columns from fix_decimals import add_int, cut_decimals def preprocess_dataset(): preprocess_data('train', False) preprocess_data('test', False) preprocess_data('train', True) preprocess_data('test', Tru...
2.828125
3
helpme/migrations/0003_auto_20200901_2025.py
renderbox/django-help-me
1
28712
<reponame>renderbox/django-help-me # Generated by Django 3.1 on 2020-09-01 20:25 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('sites', '0002_alter_domain_unique'), ('helpme', '0002_category_question'), ] ...
1.632813
2
lib/surface/anthos/auth/login.py
google-cloud-sdk-unofficial/google-cloud-sdk
2
28713
<filename>lib/surface/anthos/auth/login.py<gh_stars>1-10 # -*- coding: utf-8 -*- # # Copyright 2020 Google LLC. 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 # # htt...
2
2
projects/migrations/0005_alter_location_location.py
Gomax-07/gallery
0
28714
# Generated by Django 3.2.7 on 2021-09-07 02:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('projects', '0004_location'), ] operations = [ migrations.AlterField( model_name='location', name='location', ...
1.445313
1
src/napari_mahotas_image_processing/_function.py
haesleinhuepf/napari-mahotas-image-processing
2
28715
import numpy as np from napari_plugin_engine import napari_hook_implementation from napari_tools_menu import register_function from napari_time_slicer import time_slicer, slice_by_slice import napari from napari.types import ImageData, LabelsData @napari_hook_implementation def napari_experimental_provide_function()...
2.578125
3
CoquoBot/order_manager.py
Josef212/CoquoBot
0
28716
from order import Order class OrderManager: def __init__(self): self.orders = {} def user_has_any_order(self, chat_id: int, user: str) -> bool: order = self.get_order(chat_id) return order.user_has_any_order(user) def get_order(self, id: int) -> Order: if id not in sel...
3.0625
3
tests/binary/run.py
learnflexswitch/pyangbind
1
28717
#!/usr/bin/env python import os, sys, getopt TESTNAME="binary" # generate bindings in this folder def main(): try: opts, args = getopt.getopt(sys.argv[1:], "k", ["keepfiles"]) except getopt.GetoptError as e: print str(e) sys.exit(127) k = False for o, a in opts: if o in ["-k", "--keepfiles"...
2.21875
2
ScoutingBox/Box/admin.py
JoannaNitek/ScoutingBox
0
28718
from django.contrib import admin # Register your models here. from Box.models import Player, ObservationList, Comments, ObservationForm class PlayerAdmin(admin.ModelAdmin): list_display = ['first_name', 'last_name', 'year_of_birth', 'club', 'position', 'status', 'mail', 'phone', 'agent'] class ObservationListA...
2.125
2
activity_1/src/testTimeExecution.py
lucasguesserts/MO824A-combinatorial-optimization
0
28719
<reponame>lucasguesserts/MO824A-combinatorial-optimization<filename>activity_1/src/testTimeExecution.py from datetime import datetime from CompanyProblemSolver import CompanyProblemSolver class TimedSolution: def __init__(self, J): time_start = datetime.now() solver = CompanyProblemSolver(J, displa...
2.9375
3
app/repository/model.py
maestro-server/data-app
0
28720
<gh_stars>0 import datetime import re from app import db from bson.objectid import ObjectId from pymongo import InsertOne, UpdateOne from pymongo.errors import BulkWriteError from app.error.factoryInvalid import FactoryInvalid class Model(object): def __init__(self, id=None, name=None): if name is None: ...
2.375
2
python_lib/mitxgraders/comparers/linear_comparer.py
haharay/python_lib
17
28721
from __future__ import print_function, division, absolute_import, unicode_literals from numbers import Number import numpy as np from voluptuous import Schema, Required, Any, Range from mitxgraders.comparers.baseclasses import CorrelatedComparer from mitxgraders.helpers.calc.mathfuncs import is_nearly_zero from mitxgra...
2.625
3
2017/day8-2.py
alvaropp/AdventOfCode2017
0
28722
<gh_stars>0 filename = "day8.txt" ops = {"inc": "+=", "dec": "-="} # Initialise registers to zero regs = {} with open(filename) as f: for line in f.readlines(): data = line.split(' ') reg = data[0] if reg not in regs: regs[reg] = 0 # Follow the instructions maxReg = 0 with ope...
2.9375
3
tests/components/unifi/test_services.py
rahulsinghsss/core
1
28723
<filename>tests/components/unifi/test_services.py """deCONZ service tests.""" from unittest.mock import Mock, patch from homeassistant.components.unifi.const import DOMAIN as UNIFI_DOMAIN from homeassistant.components.unifi.services import ( SERVICE_REMOVE_CLIENTS, UNIFI_SERVICES, async_setup_services, ...
2.515625
3
{{cookiecutter.directory_name}}/config/settings/development.py
ragnarok22/cookiecutter-django
2
28724
<reponame>ragnarok22/cookiecutter-django """ This is the settings file that you use when you're working on the project locally. Local development-specific include DEBUG mode, log level, and activation of developer tools like django-debug-toolsbar """ from .base import * # SECURITY WARNING: don't run with debug turned...
1.46875
1
analysis_scripts/prose_CCLE_PE2_evidence.py
bwbio/PROSE
0
28725
# -*- coding: utf-8 -*- """ Created on Mon Oct 25 05:21:45 2021 @author: bw98j """ import prose as pgx import pandas as pd import matplotlib.pyplot as plt import matplotlib.colors as colors import seaborn as sns import numpy as np import itertools import glob import os from tqdm import tqdm import ...
2.28125
2
python/play.py
banza-group/2048
2
28726
<filename>python/play.py """Play the game.""" import engine import numpy as np board = engine.createBoard(4) message1 = "Use the keys to move (L)eft (R)ight (U)p (D)own." message2 = "Press (Q) to quit:" while True: print(np.array(engine.showBoard(board))) inputValue = input("{} {} ".format(message1, message2...
3.40625
3
pyorient/ogm/commands.py
spy7/pyorient
142
28727
<reponame>spy7/pyorient from ..utils import to_str class VertexCommand(object): def __init__(self, command_text): self.command_text = command_text def __str__(self): return to_str(self.__unicode__()) def __unicode__(self): return u'{}'.format(self.command_text) class CreateEdgeCo...
2.578125
3
source/GetDatasetInformation.py
san-harsh/PyImageRoi
10
28728
import argparse import os import glob import pandas as pd from libraryTools import imageRegionOfInterest #filename,width,height,class,xmin,ymin,xmax,ymax #20170730_132530-(F00000).jpeg,576,1024,sinaleira,221,396,246,437 valid_images = [".jpg",".gif",".png",".tga",".jpeg"] def run(image_path, classNameList = ["somecl...
2.828125
3
AShareData/data_source/WindData.py
TMG-TheMoneyGame/AShareData
0
28729
<gh_stars>0 import datetime as dt from functools import cached_property from typing import Dict, List, Sequence, Union import numpy as np import pandas as pd import WindPy from tqdm import tqdm from .DataSource import DataSource from .. import config, constants, DateUtils, utils from ..DBInterface import DBInterface ...
2.328125
2
benchmark/obd/evaluate_off_policy_estimators.py
isabella232/pyIEOE
8
28730
<reponame>isabella232/pyIEOE # Copyright (c) 2021 Sony Group Corporation and Hanjuku-kaso Co., Ltd. All Rights Reserved. # # This software is released under the MIT License. # http://opensource.org/licenses/mit-license.php import argparse from distutils.util import strtobool from pathlib import Path import pickle imp...
1.804688
2
lab5/script/loadimg.py
rum2mojito/osdi2020
0
28731
# coding=utf-8 import serial import time import os KERNEL_PATH = './kernel9.img' def serial_w(content): ser.write(content) time.sleep(1) port1 = '/dev/pts/4' port2 = '/dev/ttyUSB0' if __name__ == "__main__": ser = serial.Serial(port=port1, baudrate=115200) kernel_size = os.path.getsize(KERNEL_PATH)...
2.515625
3
weather.py
Qu4ndo/Weather_API
0
28732
<filename>weather.py<gh_stars>0 import configparser import requests import json def get_callback(): #read the config.txt config = configparser.ConfigParser() config.read_file(open(r'config.txt')) API_key = config.get('Basic-Configuration', 'API_key') city_name = config.get('Basic-Configuration', 'c...
3.5625
4
src/documentos/tools/repair.py
TroyWilliams3687/documentos
0
28733
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # ----------- # SPDX-License-Identifier: MIT # Copyright (c) 2021 <NAME> # uuid : 633f2088-bbe3-11eb-b9c2-33be0bb8451e # author: <NAME> # email : <EMAIL> # date : 2021-05-23 # ----------- """ The `repair` command has access to tools that can repair various problems th...
2.28125
2
connect/cli/plugins/product/export.py
vgrebenschikov/connect-cli
0
28734
# -*- coding: utf-8 -*- # This file is part of the Ingram Micro Cloud Blue Connect connect-cli. # Copyright (c) 2019-2021 Ingram Micro. All Rights Reserved. import os import json from datetime import datetime from urllib import parse import requests from click import ClickException from openpyxl import Workbook from...
1.835938
2
HackTheVote/2020/fileshare/cleaner.py
mystickev/ctf-archives
1
28735
import os, time, shutil def get_used_dirs(): pids = [p for p in os.listdir("/proc") if p.isnumeric()] res = set() for p in pids: try: path = os.path.realpath("/proc/%s/cwd"%p) if path.startswith("/tmp/fileshare."): res.add(path) except: pa...
2.34375
2
scripts/dataset-preparation/get_image_urls.py
byewokko/guessing-game
2
28736
import os import requests from nltk.corpus import wordnet as wn urldir = "urls" geturls = "http://www.image-net.org/api/text/imagenet.synset.geturls?wnid={wnid}" if not os.path.isdir(urldir): os.makedirs(urldir) with open("base_concepts.txt") as fin: for line in fin: concept = line.strip().split("_"...
2.859375
3
common/database.py
santoshpanna/Discord-Bot
0
28737
<reponame>santoshpanna/Discord-Bot import time from . import common from datetime import datetime from pymongo import MongoClient, ASCENDING, errors from _datetime import timedelta # TODO # - More error handling # - Refactor class Database: def __init__(self): # getting the configuration config = ...
2.484375
2
resources.py
luca-penasa/circle-craters
1
28738
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt5 (Qt v5.15.0) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x01\x64\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x00\x18\x...
1.109375
1
analysis_util.py
googleinterns/invobs-data-assimilation
16
28739
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
1.867188
2
Model&Data/tf-VAEGAN/main.py
LiangjunFeng/Generative-Any-Shot-Learning
0
28740
import argparse from train_images import run # generalized ZSL # CUDA_VISIBLE_DEVICES=0 nohup python -u main.py --dataset AWA1 --few_train False --num_shots 0 --generalized True > awa1.log 2>&1 & # CUDA_VISIBLE_DEVICES=1 nohup python -u main.py --dataset SUN --few_train False --num_shots 0 --generalized True > sun.lo...
1.539063
2
src/charm.py
openstack-charmers/charm-ovn-central-operator
0
28741
<filename>src/charm.py #!/usr/bin/env python3 """OVN Central Operator Charm. This charm provide Glance services as part of an OpenStack deployment """ import ovn import ovsdb as ch_ovsdb import logging from typing import List import ops.charm from ops.framework import StoredState from ops.main import main import ad...
1.734375
2
main.py
tonymorony/trollbox_gui
2
28742
from kivy.app import App from kivy.config import Config from kivy.uix.listview import ListItemButton from kivy.uix.screenmanager import ScreenManager, Screen from kivy.uix.label import Label from kivy.clock import Clock from kivy.uix.button import Button from kivy.uix.widget import Widget from functools import partial ...
2.359375
2
marinetrafficapi/vessel_data/VD02_vessel_particulars/models.py
arrrlo/marine-traffic-client-api
15
28743
<filename>marinetrafficapi/vessel_data/VD02_vessel_particulars/models.py from marinetrafficapi.models import Model from marinetrafficapi.fields import TextField, NumberField, RealNumberField class VesselParticural(Model): """Get vessel particulars (including type, dimensions, ownership etc).""" mmsi = Number...
2.609375
3
01-tapsterbot/click-accuracy/ClickAutomation.py
AppTestBot/AppTestBot
0
28744
import os import sys import shutil import csv import subprocess ...
2.078125
2
tools/export_fbx.py
SeijiEmery/unity_tools
0
28745
<filename>tools/export_fbx.py<gh_stars>0 #!/usr/bin/env python3 import os import sys from run_bpy_script import run_blender_script def export_fbx(input_blend_file, output=None, **kwargs): default_args = { 'global_scale': 1e-3 } default_args.update(kwargs) kwargs = default_args run_blender_...
2.578125
3
g2pk/special.py
elbum/g2pK
136
28746
# -*- coding: utf-8 -*- ''' Special rule for processing Hangul https://github.com/kyubyong/g2pK ''' import re from g2pk.utils import gloss, get_rule_id2text rule_id2text = get_rule_id2text() ############################ vowels ############################ def jyeo(inp, descriptive=False, verbose=False): rule =...
2.421875
2
mi/dataset/driver/flord_l_wfp/sio/flord_l_wfp_sio_telemetered_driver.py
petercable/mi-dataset
1
28747
#!/usr/local/bin/python2.7 ## # OOIPLACEHOLDER # # Copyright 2014 <NAME>. ## __author__ = '<NAME>' from mi.dataset.dataset_parser import DataSetDriverConfigKeys from mi.dataset.dataset_driver import SimpleDatasetDriver from mi.dataset.parser.flord_l_wfp_sio import FlordLWfpSioParser from mi.core.versioning import ver...
1.84375
2
qa_tool/models.py
pg-irc/pathways-backend
12
28748
<reponame>pg-irc/pathways-backend<filename>qa_tool/models.py from django.contrib.gis.db import models from common.models import (RequiredURLField, OptionalTextField, RequiredCharField) from human_services.locations.models import ServiceAtLocation from search.models import Task from users.mode...
2.21875
2
ivi/tektronix/__init__.py
sacherjj/python-ivi
161
28749
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2012-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 deal in the Software without restriction, including without limitation the rights ...
1.390625
1
wazimap_ng/boundaries/migrations/0007_auto_20200121_0907.py
arghyaiitb/wazimap-ng
11
28750
<filename>wazimap_ng/boundaries/migrations/0007_auto_20200121_0907.py # Generated by Django 2.2.8 on 2020-01-21 09:07 import django.contrib.gis.db.models.fields from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('boundaries', '0006_worldborder'), ] operati...
1.265625
1
rldb/db/repo__openai_baselines_cbd21ef/algo__ppo2_mpi/entries.py
seungjaeryanlee/sotarl
45
28751
<filename>rldb/db/repo__openai_baselines_cbd21ef/algo__ppo2_mpi/entries.py entries = [ { 'env-title': 'atari-enduro', 'score': 207.47, }, { 'env-title': 'atari-space-invaders', 'score': 459.89, }, { 'env-title': 'atari-qbert', 'score': 7184.73, }, ...
1.210938
1
autoPyTorch/pipeline/components/setup/network_initializer/NoInit.py
ravinkohli/Auto-PyTorch
1
28752
<filename>autoPyTorch/pipeline/components/setup/network_initializer/NoInit.py from typing import Callable import torch from autoPyTorch.pipeline.components.setup.network_initializer.base_network_initializer import ( BaseNetworkInitializerComponent ) class NoInit(BaseNetworkInitializerComponent): """ No ...
2.9375
3
NSI/Chapitre 6/TP6.py
S-c-r-a-t-c-h-y/coding-projects
0
28753
<reponame>S-c-r-a-t-c-h-y/coding-projects from arbre_binaire import AB from dessiner_arbre import dessiner def hauteur(arbre): """Fonction qui renvoie la hauteur d'un arbre binaire""" # si l'arbre est vide if arbre is None: return 0 hg = hauteur(arbre.get_ag()) hd = hauteur(arbre.get_ad(...
3.09375
3
benchmarks/ltl_timed_transition_system/f3/timed_extending_bound.py
EnricoMagnago/F3
3
28754
<reponame>EnricoMagnago/F3 from collections import Iterable from math import log, ceil from mathsat import msat_term, msat_env from mathsat import msat_make_constant, msat_declare_function from mathsat import msat_get_integer_type, msat_get_rational_type, \ msat_get_bool_type from mathsat import msat_make_and, msa...
2.296875
2
Python Examples/Example-FunctionWithNestedIFElse.py
crissyg/SCH-PRACTICE
0
28755
# Function with Nested IF Else def printColor(value): value = value.upper() if (value == 'Y'): print "yellow" elif (value == 'B'): print "blue" elif (value == 'R'): print "red" else: print "unknown" printColor('r') # call function
3.921875
4
estimators/__init__.py
eliberis/network-prop-estimator
0
28756
<gh_stars>0 from estimators.weighted_edge_estimator import * from estimators.weighted_node_estimator import * from estimators.weighted_triangle_estimator import * from estimators.formula_edge_estimator import * from estimators.formula_node_estimator import * from estimators.formula_triangle_estimator import *
1.117188
1
p3d/__init__.py
Derfies/p3d
0
28757
<filename>p3d/__init__.py<gh_stars>0 from pandac.PandaModules import Vec3 P3D_VERSION = '0.1' __version__ = P3D_VERSION from constants import * from functions import * import commonUtils from object import Object from singleTask import SingleTask from nodePathObject import NodePathObject from pandaObject import ...
1.523438
2
project/user/models/user.py
fv316/flask-template-project
9
28758
<reponame>fv316/flask-template-project # !/usr/bin/python # -*- coding: utf-8 -*- from project.database import Base from sqlalchemy.orm import relationship from sqlalchemy import Column, Integer, String from flask_login import UserMixin from project.user.models.rbac_user_mixin import UserMixin as RBACUserMixin class ...
2.5
2
test/convert_to_lemon.py
cltl/FrameNetNLTK
1
28759
import sys import os sys.path.insert(0, '../..') from nltk.corpus import framenet as fn import FrameNetNLTK from FrameNetNLTK import load, convert_to_lemon my_fn = load(folder='test_lexicon', verbose=2) output_path = os.path.join(os.getcwd(), 'stats', ...
2.546875
3
python/dataProcessing/generatePlots.py
Maplenormandy/list-62x
1
28760
<filename>python/dataProcessing/generatePlots.py import pandas as pd import matplotlib.pyplot as plt import numpy as np from statsmodels.stats.weightstats import ttost_paired data = pd.read_csv(open('combined_data.csv')) for t in data.index: if int(data.loc[t, 'Baseline']) == 0: data.loc[t, 'STF Baselin...
2.609375
3
zunzun/app/app.py
aprezcuba24/zunzun
0
28761
<reponame>aprezcuba24/zunzun<filename>zunzun/app/app.py import importlib from zunzun import CommandRegister from injector import inject, singleton from click.core import Group from zunzun import ListenerConnector from zunzun import inspect from pathlib import Path @singleton class App: name = "" listeners_con...
2.265625
2
scitbx/examples/principal_axes_of_inertia.py
rimmartin/cctbx_project
0
28762
from __future__ import division from scitbx.math import principal_axes_of_inertia from scitbx.array_family import flex def run(): points = flex.vec3_double([ ( 8.292, 1.817, 6.147), ( 9.159, 2.144, 7.299), (10.603, 2.331, 6.885), (11.041, 1.811, 5.855), ( 9.061, 1.065, 8.369), ( 7.6...
2.203125
2
ape.py
PhilRW/appdaemon-apps
5
28763
<reponame>PhilRW/appdaemon-apps import bisect import calendar import datetime import pickle import appdaemon.plugins.hass.hassapi as hass class Event: def __init__(self, dt, entity, new): self.dt = dt self.entity = entity self.new = new def __str__(self): return "event({0}, ...
2.1875
2
main/migrations/0013_game.py
AyushHazard/Samskritam
0
28764
<gh_stars>0 # Generated by Django 3.1.2 on 2021-01-01 05:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0012_attempted_contests'), ] operations = [ migrations.CreateModel( name='Game', fields=[ ...
1.804688
2
genome_designer/debug/2014_08_05_de_novo_on_dep_data_with_intervals.py
churchlab/millstone
45
28765
""" Re-running de novo assembly, this time including reads that map to mobile elements. """ import os import sys # Setup Django environment. sys.path.append( os.path.join(os.path.dirname(os.path.realpath(__file__)), '../')) os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from Bio import SeqIO from experim...
1.773438
2
P942.py
Muntaha-Islam0019/Leetcode-Solutions
0
28766
class Solution: def diStringMatch(self, S): low,high=0,len(S) ans=[] for i in S: if i=="I": ans.append(low) low+=1 else: ans.append(high) high-=1 return ans +[low]
3.34375
3
controle/admin.py
jeremyrodrigues/auto-ambient-music
0
28767
from django.contrib import admin from controle.models import Time, Music # Register your models here. admin.site.register(Time) admin.site.register(Music)
1.382813
1
src/fvm/scripts/Output.py
drm42/fvm-drm
0
28768
import os import pdb import fvm.models_atyped_double as models import fvm.exporters_atyped_double as exporters class Output(): def __init__(self, outputDir, probeIndex, sim): if os.path.isdir(outputDir) == False: os.mkdir(outputDir) self.defFile = open(outputDir + 'deformation.dat...
2.359375
2
forecasting/src/autogluon/forecasting/trainer/auto_trainer.py
sgdread/autogluon
0
28769
<gh_stars>0 import logging from typing import Dict, Union, Optional, Any from ..models.presets import get_preset_models from .abstract_trainer import AbstractForecastingTrainer, TimeSeriesDataFrame logger = logging.getLogger(__name__) class AutoForecastingTrainer(AbstractForecastingTrainer): def construct_model...
2.28125
2
textbot/action.py
sparwow/textbot
0
28770
class EmailAction: pass
1.140625
1
snippet/example/python/sqlalchemy-orm-model.py
yp2800/snippet
94
28771
<filename>snippet/example/python/sqlalchemy-orm-model.py # Copyright (c) 2011 X.commerce, a business unit of eBay Inc. # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011 Piston Cloud Computing, Inc. # Copyright 2012 Clou...
2.453125
2
boofuzz/boofuzz/connections/raw_l3_socket_connection.py
mrTavas/owasp-fstm-auto
2
28772
from __future__ import absolute_import import errno import socket import sys from future.utils import raise_ from boofuzz import exception from boofuzz.connections import base_socket_connection ETH_P_ALL = 0x0003 # Ethernet protocol: Every packet, see Linux if_ether.h docs for more details. ETH_P_IP = 0x0800 # Et...
2.546875
3
django_google_dork/migrations/0001_initial.py
chgans/django-google-dork
1
28773
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django_google_dork.models import model_utils.fields import django.utils.timezone class Migration(migrations.Migration): replaces = [('django_google_dork', '0001_initial'), ('django_google_dork', '0002...
1.90625
2
model2.py
incredible-vision/show-and-tell
8
28774
<filename>model2.py import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F from torch.autograd import Variable from torchvision.models import vgg16 from torch.nn.utils.rnn import pack_padded_sequence class ShowAttendTellModel(nn.Module): def __init__(self, hidden_size, con...
2.984375
3
src/fruit_castle/hadwin/hadwin.py
brownboycodes/common-api-server
2
28775
from flask import Blueprint, abort, jsonify, render_template from src.fruit_castle.hadwin.utilities import get_json_data from .v1.version_1 import v1 from .v2.version_2 import v2 from .v3.version_3 import v3 hadwin = Blueprint('hadwin', __name__, url_prefix='/hadwin',static_url_path='/dist', static_folde...
2.109375
2
tests/formatting/catch_for_formatting_tests.py
friendly-traceback/friendly-traceback
45
28776
import pytest import friendly_traceback from friendly_traceback.console_helpers import _get_info from ..syntax_errors_formatting_cases import descriptions friendly_traceback.set_lang("en") where = "parsing_error_source" cause = "cause" @pytest.mark.parametrize("filename", descriptions.keys()) def test_syntax_errors...
2.234375
2
solutions/day17.py
rds504/AoC-2020
0
28777
from itertools import product from tools.general import load_input_list def get_new_active_range(current_active_set, dimensions): lowest = [0] * dimensions highest = [0] * dimensions for point in current_active_set: for i, coord in enumerate(point): if coord < lowest[i]: ...
3.0625
3
app/endpoints/sillyusers/gen_user.py
kant/test-api
9
28778
<reponame>kant/test-api # -*- coding: utf-8 -*- import random import uuid import silly def user_test_info(): set_id = str(uuid.uuid1()) rand_name: str = silly.noun() rand_num: int = random.randint(1, 10000) username: str = f"{rand_name}-{rand_num}" first_name: str = silly.verb() last_name: st...
2.59375
3
applications/Corpus/controllers/MI.py
jolivaresc/corpus
1
28779
# -*- coding: utf-8 -*- from numpy import log2 from pickle import load """ * Clase que se encarga de ver la información mutua que hay entre dos tokens * sirve para determinar si es colocación o no """ class MI: def __init__(self): self.words = load(open("./models/words.d",'r')) self.ngrams = load(open("./models...
2.96875
3
tests/test_cli.py
chrahunt/quicken
3
28780
<reponame>chrahunt/quicken import logging import os import subprocess import sys from contextlib import contextmanager from pathlib import Path from textwrap import dedent import pytest from quicken._internal.cli.cli import get_arg_parser, parse_file from quicken._internal.constants import ( DEFAULT_IDLE_TIMEOUT...
2.0625
2
bmtk/simulator/popnet/popsimulator.py
hernando/bmtk
1
28781
<reponame>hernando/bmtk # Copyright 2017. <NAME>. All rights reserved # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the # following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this list of conditions...
1.429688
1
magnrings.py
Qvapil/Electromagnetic_Fields_B_2020
3
28782
<reponame>Qvapil/Electromagnetic_Fields_B_2020 import matplotlib.pyplot as plt import matplotlib.cm as cm import numpy as np import math #constants d=2 h=1 a=0.1 I=1 #Axes N=100 xmin=0 xmax=4 xx=np.linspace(xmin,xmax,N) ymin=0 ymax=4 yy=np.linspace(ymin,ymax,N) zmin=-2 zmax=2 zz=np.linspace(zmin,zmax,N) X,Z=np.me...
2.140625
2
examples/video.py
ankur09011/pycozmo
1
28783
<filename>examples/video.py #!/usr/bin/env python import time import pycozmo # Last image, received from the robot. last_im = None def on_camera_image(cli, new_im): """ Handle new images, coming from the robot. """ del cli global last_im last_im = new_im def pycozmo_program(cli: pycozmo.client....
3.03125
3
2020/aoc6.py
lachtanek/advent-of-code
0
28784
from functools import reduce data = [] with open("aoc6.inp") as rf: sets = [] for l in rf: if l == "\n": data.append(sets) sets = [] else: sets.append(set([c for c in l.strip()])) a1 = a2 = 0 for sets in data: a1 += len(reduce(lambda s1, s2: s1 | s2, s...
2.78125
3
hello_tradera.py
ErikAndren/hello_tradera
0
28785
import zeep import logging logging.getLogger('zeep').setLevel(logging.ERROR) publicServiceUrl = 'https://api.tradera.com/v3/PublicService.asmx' appId = 'REPLACE ME WITH TRADERA ID' appKey = 'REPLACE ME WITH TRADERA KEY' wsdl = 'https://api.tradera.com/v3/PublicService.asmx?WSDL' client = zeep.Client(wsdl=wsdl) au...
2.1875
2
messungen/decrypt_trace.py
tihmstar/gido_public
16
28786
<reponame>tihmstar/gido_public import struct import sys import binascii import tarfile import usb import recovery BLOCKS_CNT = 8 if len(sys.argv) < 2: print("Usage: %s <path>"%sys.argv[0]) exit(0) infile = sys.argv[1] if infile[-len(".tar.gz"):] == ".tar.gz": print("cant open compressed file!") exi...
2.21875
2
ghnotifier/menu.py
iamtalhaasghar/ghnotifier
1
28787
#!/usr/bin/env python3 import webbrowser import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk from ghnotifier.notifier import Notifier from ghnotifier.settings import Settings class Menu: GITHUB_NOTIFICATIONS = 'https://github.com/notifications' def __init__(self): self.menu =...
2.53125
3
apps/enterprice/apps.py
jimforit/lagou
2
28788
<gh_stars>1-10 from django.apps import AppConfig class EnterpriceConfig(AppConfig): name = 'enterprice' verbose_name = '企业'
1.179688
1
python/utils/LaplacianLoss.py
aytewari/GVV-Differentiable-CUDA-Renderer
40
28789
import tensorflow as tf ######################################################################################################################## # Isometry Loss ######################################################################################################################## def getLoss(inputMeshTensor, restTe...
2.046875
2
scripts/logfetch/search.py
madhuri7112/Singularity
692
28790
import os import re import fnmatch from logfetch_base import log, is_in_date_range from termcolor import colored def find_cached_logs(args): matching_logs = [] log_fn_match = get_matcher(args) for filename in os.listdir(args.dest): if fnmatch.fnmatch(filename, log_fn_match) and in_date_range(args, ...
2.765625
3
algorithms/in_order.py
AutuanLiu/LeetCode2019
1
28791
<gh_stars>1-10 # 二叉树中序遍历的 生成器写法 # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None def mid_order(root): if not root: return yield from mid_order(root.left) yield root.val yield from mid_order(root.right...
3.640625
4
predict_bw_lstm1.py
kyeongsoo/dash-simulation
0
28792
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ## # @file predict_bw_lstm1.py # @author <NAME> (<NAME> <<EMAIL>> # @date 2019-04-22 # 2022-03-23 - updated for TensorFlow version 2.6 # # @brief Predict channel bandwidth. # # @remarks This code is based on the nice sample code from: # ht...
3.03125
3
tests/integration/test_todo.py
nomilkinmyhome/todo-list
3
28793
from src.use_cases.todo import create_todo, update_todo def test_create_todo(client, user): payload = { 'title': 'test todo', 'description': 'very long and useful description', } todo = create_todo(user.id, payload) assert todo.id == 1 assert todo.title == payload['title'] def t...
2.46875
2
src/loopHandler.py
jerryduan07/gametime
0
28794
#!/usr/bin/env python """Exposes functions to perform a source-to-source transformation that detects and unrolls loops in the code being analyzed. """ """See the LICENSE file, located in the root directory of the source distribution and at http://verifun.eecs.berkeley.edu/gametime/about/LICENSE, for details on the Ga...
2.34375
2
Python/Maths/factorielle.py
GeneralNZR/maths-and-javascript
3
28795
def factorielle_rec(n: int) -> int: """ Description: Factorielle méthode récursive Paramètres: n: {int} -- Nombre à factorielle Retourne: {int} -- Factorielle de n Exemple: >>> factorielle_rec(100) 9.332622e+157 Pour l'écriture scientif...
3.90625
4
Gui.py
LLCoolDave/ALttPEntranceRandomizer
17
28796
from Main import main, __version__ as ESVersion from argparse import Namespace import random from tkinter import Checkbutton, OptionMenu, Tk, LEFT, RIGHT, BOTTOM, TOP, StringVar, IntVar, Frame, Label, W, E, Entry, Spinbox, Button, filedialog, messagebox def guiMain(args=None): mainWindow = Tk() mainWindow.wm...
2.5625
3
src/dmri/coregister.py
erramuzpe/ruber
2
28797
<filename>src/dmri/coregister.py # -*- coding: utf-8 -*- """ Nipype workflows to co-register anatomical MRI to diffusion MRI. """ from src.env import DATA import nipype.pipeline.engine as pe from nipype.interfaces.fsl import MultiImageMaths from nipype.interfaces.utility import IdentityInterface, Select, Split from ni...
2.09375
2
tests/test_pack_data.py
derekmerck/endpoint
0
28798
from datetime import datetime from pprint import pprint from cryptography.fernet import Fernet from libsvc.utils import pack_data, unpack_data def pack_data_test(): fkey = Fernet.generate_key() data = {"today": datetime.today(), "dog": "cat", "red": "blue"} p = pack_data(data, f...
2.828125
3
threading/part6.py
kryvokhyzha/examples-and-courses
1
28799
<filename>threading/part6.py import threading import queue import time def putting_thread(q): while True: print('start thread') time.sleep(10) q.put(5) print('sup something') q = queue.Queue() t = threading.Thread(target=putting_thread, args=(q,), daemon=True) t.start() q.put(0)...
3.15625
3