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
python/GameFlow/console/Console.py
Silversmithe/Connect4
0
23100
<gh_stars>0 import sys import os class Console(object): """ Class responsible for handling input from the user """ def __init__(self): self.log_file = "log.txt" # initialize log with open(self.log_file, 'a') as file: file.write("** NEW LOG CREATED **\n") @s...
3.734375
4
servoblst.py
ForToffee/MeArm
1
23101
<gh_stars>1-10 import time import os servos = {} class ServoController: def __init__(self): os.system('sudo /home/pi/PiBits/ServoBlaster/user/servod') def setAngle(self, servo_id, degrees): if degrees > 90: degrees = 90 elif degrees < -90: degrees = -90 #http://www.raspberrypi.org/forums/viewtopic.p...
2.921875
3
TASQ/problems/forms.py
harshraj22/smallProjects
2
23102
from django import forms from .models import Problem class ProblemForm(forms.ModelForm): options = ( ('A', 'A'), ('B', 'B'), ('C', 'C'), ('D', 'D'), ) choice = forms.ChoiceField(choices=options) class Meta: model = Problem fields = '__all__' # exclude = ['answer'] widgets = { 'answer': forms.Hid...
2.234375
2
recipes/make_spreadsheet_with_named_ranges.py
mat-m/odfdo
0
23103
#!/usr/bin/env python """ Create a spreadsheet with two tables, using some named ranges. """ import os from odfdo import Document, Table if __name__ == "__main__": document = Document('spreadsheet') body = document.body table = Table("First Table") body.append(table) # populate the table : for...
3.65625
4
gmailbox/apps.py
megatron0000/ces22-xadrez-web
0
23104
<reponame>megatron0000/ces22-xadrez-web<filename>gmailbox/apps.py from django.apps import AppConfig class GmailBoxConfig(AppConfig): name = 'gmailbox'
1.34375
1
warmup/sock_merchant.py
franloza/hackerrank
0
23105
<filename>warmup/sock_merchant.py #!/bin/python3 import math import os import random import re import sys # Complete the sockMerchant function below. def sockMerchant(n, ar): socks = {} for elem in ar: if elem in socks: socks[elem] += 1 else: socks[elem] = 1 return ...
3.453125
3
sentiment/twitter/2stepTestValidation.py
ekedziora/twinty
0
23106
from nltk.corpus.reader import CategorizedPlaintextCorpusReader from nltk.tokenize.casual import TweetTokenizer from nltk.classify.scikitlearn import SklearnClassifier from sklearn.naive_bayes import BernoulliNB, MultinomialNB from sklearn.svm import SVC, LinearSVC, NuSVC, LinearSVR, NuSVR from sklearn.linear_model im...
2.578125
3
mango/group.py
mschneider/mango-explorer
0
23107
# # ⚠ Warning # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA...
1.648438
2
office_test_interface/hede_interface_test/encryption/md5_hede.py
yag8009/office_test_team
0
23108
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : yag8009 # @FileName : md5_hede # @Time : 2020/3/18 import hashlib import time def md5_hede(md5data): md5 = hashlib.md5() # 使用MD5加密模式 md5.update(md5data.encode("utf8")) # 将参数字符串传入 sign = md5.hexdigest() return sign if __name__ == '__mai...
2.859375
3
src/tables.py
tallywiesenberg/dating-data-dividend
0
23109
<reponame>tallywiesenberg/dating-data-dividend from flask_login import UserMixin from werkzeug.security import generate_password_hash, check_password_hash from .extensions import db class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(80), unique=True, n...
2.6875
3
satyr/proxies/scheduler.py
usheth/satyr
0
23110
<filename>satyr/proxies/scheduler.py<gh_stars>0 from __future__ import absolute_import, division, print_function import logging import sys from mesos.interface import Scheduler from .messages import Filters, decode, encode class SchedulerProxy(Scheduler): def __init__(self, scheduler): self.scheduler ...
2.015625
2
NeuralNetworks/neuralnetworks/NeuralNetwork.py
AlmCoding/MachineLearningPlayground
0
23111
<filename>NeuralNetworks/neuralnetworks/NeuralNetwork.py import numpy as np class NeuralNetwork: """ Class implementing a feed forawrd neural network. Object fields: layers = a tuple containing numbers of neurons in each layer, starting from the input layer L = depth of the NN, eg, with d...
4.03125
4
xen/xen-4.2.2/tools/python/xen/xm/console.py
zhiming-shen/Xen-Blanket-NG
1
23112
<reponame>zhiming-shen/Xen-Blanket-NG<gh_stars>1-10 #============================================================================ # This library is free software; you can redistribute it and/or # modify it under the terms of version 2.1 of the GNU Lesser General Public # License as published by the Free Software Founda...
1.59375
2
Solutions/luhn.py
matthijskrul/PythonExercism
0
23113
<reponame>matthijskrul/PythonExercism<filename>Solutions/luhn.py import re class Luhn(object): def __init__(self, card_num): self.number = card_num def valid(self): if re.search("[^0-9 ]", self.number) or len(re.findall("[0-9]", self.number)) <= 1: return False else: ...
3.578125
4
tests/zzz_deprecated_unmaintained/obsmodel/TestZeroMeanGaussLocalStepSpeed.py
HongminWu/bnpy
3
23114
<filename>tests/zzz_deprecated_unmaintained/obsmodel/TestZeroMeanGaussLocalStepSpeed.py import numpy as np import scipy.linalg import argparse import time from contextlib import contextmanager def measureTime(f, nTrial=3): def f_timer(*args, **kwargs): times = list() for rep in range(nTrial): ...
2.34375
2
actions/set_status.py
Bedrock-OSS/server-updater
1
23115
<gh_stars>1-10 from subprocess import run from actions.common import get_name_and_org, get_process_config from flask import request def set_status(): if not "id" in request.form and 'status' in request.form: return "Bad request", 400 id, status = request.form['id'], request.form['status'] if(id == 'bedrock...
2.28125
2
amo2kinto/generator.py
Mozilla-GitHub-Standards/9856eb0fa59d2f9b39dc3c83d0f31961057b7f0ddf57ba213fd01b9b0f99c4cc
5
23116
import os import datetime from dateutil.parser import parse as dateutil_parser from jinja2 import Environment, PackageLoader from kinto_http import cli_utils from . import constants from .logger import logger JSON_DATE_FORMAT = "%Y-%m-%dT%H:%M:%SZ" COLLECTION_FORMAT = '/buckets/{bucket_id}/collections/{collection_i...
2.28125
2
migrations/versions/2019_03_04_optional_chart_and_table_classifications.py.py
AlexKouzy/ethnicity-facts-and-figures-publisher
1
23117
"""Make some fields on Chart and Table nullable We want to copy chart and table data across to these tables but have no way to add a classification for each one, so we'll have to live with some nulls in here. Revision ID: 2019_03_04_make_fields_nullable Revises: 2019_03_04_chart_table_settings Create Date: 2019-03-05...
1.757813
2
open_discussions/middleware/channel_api_test.py
mitodl/open-discussions
12
23118
<filename>open_discussions/middleware/channel_api_test.py """Tests for channel API middleware""" from django.utils.functional import SimpleLazyObject from open_discussions.middleware.channel_api import ChannelApiMiddleware def test_channel_api_middleware( mocker, jwt_token, rf, user ): # pylint: disable=unused-...
2.40625
2
app/python/query_strings.py
ProfessorUdGuru/toykinter
0
23119
<gh_stars>0 # query_strings.py ''' Since Sqlite queries are inserted as string in Python code, the queries can be stored here to save space in the modules where they are used. ''' delete_color_scheme = ''' DELETE FROM color_scheme WHERE color_scheme_id = ? ''' insert_color_scheme = ''' ...
2.421875
2
travel/migrations/0029_auto_20190514_2108.py
sausage-team/travel-notes
0
23120
<gh_stars>0 # Generated by Django 2.2.1 on 2019-05-14 13:08 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('travel', '0028_auto_20190514_1929'), ] operations = [ migrations.AlterField( model_name='user', name='ui...
1.414063
1
ci/mocks/sensu/sensu_verify.py
infrawatch/collectd-sensubility
0
23121
<reponame>infrawatch/collectd-sensubility<gh_stars>0 #!/usr/bin/env python """, Mocked Ruby based Sensu server. Connects to the RabbitMQ instance and sends check requests as Sensu server would and waits for appropriate response. Fails the response is not received at all or in invalid format. """ import click import j...
2.25
2
django_ecommerce/contact/admin.py
marshallhumble/Python_Web
0
23122
from django.contrib import admin from .models import ContactForm class ContactFormAdmin(admin.ModelAdmin): class Meta: model = ContactForm admin.site.register(ContactForm, ContactFormAdmin)
1.632813
2
ds/practice/daily_practice/20-07/assets/code/reverse_sll.py
tobias-fyi/vela
0
23123
<filename>ds/practice/daily_practice/20-07/assets/code/reverse_sll.py """ HackerRank :: Reverse a singly-linked list https://www.hackerrank.com/challenges/reverse-a-linked-list/problem Complete the reverse function below. For your reference: SinglyLinkedListNode: int data SinglyLinkedListNode next """ def ...
3.84375
4
ui/gfx/gfx.gyp
cvsuser-chromium/chromium
4
23124
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'targets': [ { 'target_name': 'gfx', 'type': '<(component)', 'dependencies': [ ...
1.273438
1
preprocess/python/h5py_utils.py
fredericsun/seq2seq-ChinesePoetryGenerater
0
23125
import numpy as np import h5py import os import sys from copy import deepcopy #handle .(period) and slash specially since it is part of path #replace with \period or \slash-forward when store, recover later #not using '\forward-slash' is because \f is a special character PERIOD='\period' SLASH='\slash-forward' ''' ...
2.765625
3
libs/dataset/pipeline.py
arnasRad/vits
0
23126
import re import string from libs.dataset.core import SampleEntry, oov_replacement_vocabulary, letter_replacements __word_start_regex = f'[ \t\n]|^|[{string.punctuation}]' __word_end_regex = f'[ \t\n]|$|[{string.punctuation}]' def does_not_have_numbers(s: SampleEntry): return not any(char.isdigit() for char in s...
2.859375
3
examples/rfid_lookup.py
CMU-Robotics-Club/pyrc
0
23127
<filename>examples/rfid_lookup.py #!/usr/bin/env python3 from rc.clients import APIClient if __name__ == '__main__': """ Given a valid RFID attempts to lookup the User's ID. Then using that User ID, if it exists, get more information about the User. """ # If the bash variables RC_PUBLIC_KEY and RC_PRIVA...
3.625
4
LeetCode/0417. Pacific Atlantic Water Flow/solution.py
InnoFang/oh-my-algorithms
1
23128
""" 113 / 113 test cases passed. Runtime: 92 ms Memory Usage: 16.4 MB """ class Solution: def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: m, n = len(heights), len(heights[0]) def dfs(used, x, y): used[x][y] = True for xx, yy in [(x + 1, y), (x - 1, y),...
3.359375
3
cellardoor/api/methods.py
movermeyer/cellardoor
0
23129
<reponame>movermeyer/cellardoor __all__ = ( 'LIST', 'GET', 'CREATE', 'UPDATE', 'REPLACE', 'DELETE', 'ALL', 'get_http_methods' ) LIST = 'list' GET = 'get' CREATE = 'create' REPLACE = 'replace' UPDATE = 'update' DELETE = 'delete' ALL = (LIST, GET, CREATE, UPDATE, REPLACE, DELETE) _http_methods = { LIST: ('ge...
1.914063
2
tests/test007_check_instant_ach.py
xuru/Sila-Python
9
23130
import unittest import silasdk from tests.test_config import ( app, eth_private_key, eth_private_key_4, instant_ach_handle, user_handle) class Test007CheckInstantAchTest(unittest.TestCase): def test_check_instant_ach(self): payload = { "user_handle": instant_ach_handle, "accou...
2.515625
3
lxml2json/__init__.py
meteozond/lxml2json
0
23131
<reponame>meteozond/lxml2json<gh_stars>0 #!/usr/bin/env python from functions import convert name = "convert"
1.25
1
src/day10.py
nlasheras/aoc-2021
0
23132
<gh_stars>0 """ https://adventofcode.com/2021/day/10 """ from functools import reduce def read_input(filename): with open(filename, "r", encoding='utf-8') as file: return [l.rstrip() for l in file.readlines()] opening_map = { ")": "(", "]": "[", "}": "{", ">": "<" } closing_map = {v: k for k,v in opening...
3.859375
4
bigbench/models/dummy_model.py
sebschu/BIG-bench
4
23133
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
2.15625
2
strategy/__init__.py
mmmaaaggg/QABAT
3
23134
<reponame>mmmaaaggg/QABAT # -*- coding: utf-8 -*- """ Created on 2017/11/18 @author: MG """
0.738281
1
js/data/getcytoband.py
ManuelLecaro/ucsc-xena-client
60
23135
<reponame>ManuelLecaro/ucsc-xena-client<filename>js/data/getcytoband.py<gh_stars>10-100 #!/usr/bin/env python from itertools import groupby, tee import json, os files = [ ('hg38', 'http://hgdownload.soe.ucsc.edu/goldenPath/hg38/database/cytoBand.txt.gz'), ('hg19', 'http://hgdownload.soe.ucsc.edu/goldenPath/hg...
2.453125
2
osxphotos/cli/param_types.py
oPromessa/osxphotos
0
23136
"""Click parameter types for osxphotos CLI""" import datetime import os import pathlib import re import bitmath import click import pytimeparse2 from osxphotos.export_db_utils import export_db_get_version from osxphotos.photoinfo import PhotoInfoNone from osxphotos.phototemplate import PhotoTemplate, RenderOptions fr...
2.5625
3
old/ms/django_rg/views.py
jcnelson/syndicate
16
23137
<filename>old/ms/django_rg/views.py ''' All of these views are predicated on the user already being logged in to valid session. djago_ag/views.py <NAME> Summer 2013 These are the views for the Replica Gateway section of the administration site. They are all decorated with @authenticate to make sure that a user is l...
2.015625
2
cloudbackup/tests/__init__.py
nloadholtes/python-cloudbackup-sdk
4
23138
""" Rackspace Cloud Backup API Test Suite """
0.742188
1
gym_locm/toolbox/predictor.py
dfpetrin/gym-locm
12
23139
<reponame>dfpetrin/gym-locm<gh_stars>10-100 import argparse import json import os import pathlib import numpy as np import pexpect from scipy.special import softmax base_path = str(pathlib.Path(__file__).parent.absolute()) def get_arg_parser(): p = argparse.ArgumentParser( description="This is a predict...
2.5625
3
src/ralph_assets/migrations/0012_auto__add_transitionshistory__add_attachment__add_coaoemos__add_action.py
xliiv/ralph_assets
0
23140
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Removing unique constraint on 'Licence', fields ['sn'] db.delete_unique('ralph_assets_licence', ['sn']) ...
2.125
2
ansible/modules/network/nxos/nxos_pim.py
EnjoyLifeFund/macHighSierra-py36-pkgs
1
23141
<reponame>EnjoyLifeFund/macHighSierra-py36-pkgs #!/usr/bin/python # # This file is part of Ansible # # Ansible 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, either version 3 of the License, or # (at your opt...
1.71875
2
server/openapi_server/controllers/variable_controller.py
mintproject/MINT-ModelCatalogIngestionAPI
2
23142
import connexion import six from openapi_server import query_manager from openapi_server.utils.vars import VARIABLE_TYPE_NAME, VARIABLE_TYPE_URI from openapi_server.models.variable import Variable # noqa: E501 from openapi_server import util def variables_get(username=None, label=None, page=None, per_page=None): # ...
2.46875
2
lhorizon/_request_formatters.py
arfon/lhorizon
0
23143
<reponame>arfon/lhorizon """ formatters to translate various parameters and options into URL parameters that can be parsed by JPL Horizons' CGI. These are mostly intended to be used by LHorizon methods and should probably not be called directly. """ from collections.abc import Mapping, Sequence from typing import Unio...
3.140625
3
src/aws_lambda_typing/events/kinesis_stream.py
chuckwondo/aws-lambda-typing
29
23144
#!/usr/bin/env python import sys if sys.version_info >= (3, 8): from typing import List, TypedDict else: from typing import List from typing_extensions import TypedDict class KinesisStreamKinesis(TypedDict): """ KinesisStreamKinesis Attributes: ---------- kinesisSchemaVersion: str ...
2.3125
2
tests/test_mangling.py
ecoinvent/brightway2-parameters
0
23145
from bw2parameters import * def test_mangle_formula(): given = "log(foo * bar) + 7 / baz" prefix = "pre" assert mangle_formula(given, prefix, ['bar']) == '(log((pre__foo * bar)) + (7 / pre__baz))' def test_prefix_parameter_dict(): given = { 'a': {'formula': 'a + b / c', 'foo': True}, ...
2.71875
3
venv/Lib/site-packages/clyent/errors.py
GiovanniConserva/TestDeploy
0
23146
from __future__ import absolute_import, print_function, unicode_literals class ShowHelp(Exception): pass class ClyentError(Exception): pass
1.40625
1
exercises/de/test_01_07.py
Jette16/spacy-course
2,085
23147
def test(): assert "spacy.load" in __solution__, "Rufst du spacy.load auf?" assert nlp.meta["lang"] == "de", "Lädst du das korrekte Modell?" assert nlp.meta["name"] == "core_news_sm", "Lädst du das korrekte Modell?" assert "nlp(text)" in __solution__, "Verarbeitest du den Text korrekt?" assert "prin...
2.3125
2
abm-predator-prey.py
RachidStat/PyCX
176
23148
import pycxsimulator from pylab import * import copy as cp nr = 500. # carrying capacity of rabbits r_init = 100 # initial rabbit population mr = 0.03 # magnitude of movement of rabbits dr = 1.0 # death rate of rabbits when it faces foxes rr = 0.1 # reproduction rate of rabbits f_init = 30 # initial fox population ...
3.203125
3
models/base_ae.py
christopher-beckham/amr
35
23149
<gh_stars>10-100 import torch import numpy as np from collections import OrderedDict from torch import optim from itertools import chain from .base import Base from torch import nn class BaseAE(Base): def __init__(self, generator, lamb=1.0, beta=1.0, ...
2.046875
2
psdet/models/point_detector/utils.py
Jiaolong/gcn-parking-slot
56
23150
<reponame>Jiaolong/gcn-parking-slot """Universal network struture unit definition.""" import torch import math from torch import nn import torchvision from torch.utils import model_zoo from torchvision.models.resnet import BasicBlock, model_urls, Bottleneck def define_squeeze_unit(basic_channel_size): """Define a ...
2.25
2
Config/Texts/NFSW/NFSW.py
amiralirj/DarkHelper
34
23151
<gh_stars>10-100 NFSW_Texts = [ 'سکس' ,'گایید' ,' کص' ,'جنده' ,'کیر' ,'jnde' ,'jende' ,'kos' ,'pussy' ,'kir' ,'lashi' ,'لاشی' ,'jakesh' ,'جاکش' ,'مادر خراب' ,'mad<NAME>' ,'mde kharab' ,'khar kose' ,'fuck' ,'bitch' ,'haroomzade' ,'حرومی' ,'حرامزاده' ,'حرومزاده' ,'جندس' ,'کصه ' ] NFSW_Names=...
1.335938
1
ml_collections/config_dict/tests/frozen_config_dict_test.py
wyddmw/ViT-pytorch-1
311
23152
# Copyright 2021 The ML Collections Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
2.046875
2
driver.py
kavj/npmd
0
23153
<filename>driver.py import numbers import os import sys import typing import numpy as np from dataclasses import dataclass from pathlib import Path import ir import type_interface as ti import type_resolution as tr from ASTTransform import build_module_ir_and_symbols from ccodegen import codegen from canonicalize ...
2.28125
2
ipt/ipt_hough_circles_detector.py
tpmp-inra/ipapi
1
23154
<filename>ipt/ipt_hough_circles_detector.py import os import pickle import logging logger = logging.getLogger(__name__) import cv2 import numpy as np from skimage.transform import hough_circle, hough_circle_peaks import ipso_phen.ipapi.base.ip_common as ipc from ipso_phen.ipapi.base.ipt_abstract import ...
2.359375
2
python_sample/cloud_API_endpoint/my_driving/edge_endpoint/db.py
alexcourouble/automotive-iot-samples
11
23155
<gh_stars>10-100 import sqlite3 from flask import current_app, g def get_db(): """ Connect to the application's configured database. The connection is unique for each request and will be reused if this is called again. """ if 'db' not in g: g.db = sqlite3.connect( '../data/...
3.03125
3
tests/core/test_app.py
ShepardZhao/rancher
1
23156
<filename>tests/core/test_app.py<gh_stars>1-10 from .common import random_str from .test_catalog import wait_for_template_to_be_created import time def test_app_mysql(admin_pc, admin_mc): client = admin_pc.client name = random_str() ns = admin_pc.cluster.client.create_namespace(name=random_str(), ...
2.078125
2
iotPub.py
norikokt/serverless-language-translation
0
23157
<filename>iotPub.py # Copyright 2018 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
2.609375
3
awsshell/autocomplete.py
bdharang/AWS_SHELL
0
23158
<filename>awsshell/autocomplete.py from __future__ import print_function from awsshell.fuzzy import fuzzy_search from awsshell.substring import substring_search class AWSCLIModelCompleter(object): """Autocompletion based on the JSON models for AWS services. This class consumes indexed data based on the JSON ...
3.265625
3
IM920.py
Momijinn/IM920MHz_Module
1
23159
#!/usr/bin/env python # -*- coding: UTF-8 -*- ''' パッケージpyserialをインストールすること pytho2.x系で動作(python3.*系も動作検証済み) Creater:<NAME> ''' import serial import binascii import signal import sys import platform from serial.tools import list_ports #platformの切り替え if platform.system() == 'Windows': #windows用 ports = list_ports.co...
2.671875
3
test/webdnn_test/graph_test/operators_test/sigmoid_test.py
steerapi/webdnn
1
23160
from test.webdnn_test.graph_test.operators_test.util import template_test_unary_operator from webdnn.graph.operators.sigmoid import Sigmoid def template(): template_test_unary_operator(Sigmoid) def test(): template()
1.59375
2
hw_asr/metric/__init__.py
kostyayatsok/asr_project_template
0
23161
from hw_asr.metric.cer_metric import ArgmaxCERMetric, BeamsearchCERMetric from hw_asr.metric.wer_metric import ArgmaxWERMetric, BeamsearchWERMetric __all__ = [ "ArgmaxWERMetric", "ArgmaxCERMetric", "BeamsearchCERMetric", "BeamsearchWERMetric" ]
1.046875
1
src/main_window.py
serenafr/My2048
0
23162
<reponame>serenafr/My2048 import wx import wx.lib.stattext as ST import board import score_board from os.path import expanduser SCORE_FILE_PATH = expanduser('~/.config/my2048/scores.conf') class My2048_wx(wx.Frame): def __init__(self, parent, id, title, size, board_object, score_board_object): super(My2048_wx, se...
2.921875
3
tests/base/test_maps.py
ElliotCheung/simpeg
1
23163
<filename>tests/base/test_maps.py import numpy as np import unittest import discretize from SimPEG import maps, models, utils from discretize.utils import mesh_builder_xyz, refine_tree_xyz import inspect TOL = 1e-14 np.random.seed(121) REMOVED_IGNORE = [ "FullMap", "CircleMap", "Map2Dto3D", "Vertica...
1.757813
2
src/panda_env.py
irom-lab/PAC-Imitation
12
23164
import pybullet_data import pybullet as p import time import numpy as np from src.utils_geom import * from src.utils_depth import * from src.panda import Panda def full_jacob_pb(jac_t, jac_r): return np.vstack((jac_t[0], jac_t[1], jac_t[2], jac_r[0], jac_r[1], jac_r[2])) class pandaEnv(): def __init__(self, ...
1.984375
2
desafios/desafio 021.py
juaoantonio/curso_video_python
0
23165
<gh_stars>0 import pygame pygame.mixer.init() pygame.init() pygame.mixer.music.load('/home/jaab/Música/bach_1.wav') pygame.mixer.music.play() input() pygame.event.wait() pygame.mixer.stop()
1.960938
2
deem/pytorch/layers/__init__.py
xxaxtt/TwoTowers
14
23166
from .embedding import * from .sequence import * from .mlp import *
0.960938
1
common.py
braindatalab/scrutinizing-xai
0
23167
<reponame>braindatalab/scrutinizing-xai import json import os import pickle from dataclasses import dataclass, field from os.path import join from typing import Dict, Any, ClassVar @dataclass class ScoresAttributes: global_based: str sample_based: str explanations: str method_names: str data_weigh...
2.421875
2
src/spn/tests/prometheus_tests/test.py
AmurG/SPFlow
0
23168
<reponame>AmurG/SPFlow import spn #from spn.structure.leaves.mvgauss.MVG import * from spn.io.Text import * import sys from spn.structure.leaves.parametric.Parametric import * from spn.structure.leaves.parametric.MLE import * from spn.algorithms.MPE import mpe from spn.structure.prometheus.disc import * from scipy.stat...
2.078125
2
tests/test_converters.py
stabacco/graphene-pydantic
1
23169
import datetime import decimal import enum import typing as T import uuid import graphene import graphene.types import pydantic import pytest from pydantic import BaseModel, create_model import graphene_pydantic.converters as converters from graphene_pydantic.converters import ConversionError, convert_pydantic_field ...
2.25
2
src/freesound.py
lRomul/argus-birdsong
0
23170
import numpy as np import pandas as pd from pathlib import Path import multiprocessing as mp from functools import partial from src.audio import read_as_melspectrogram from src.utils import get_params_hash from src import config NOISE_SOUNDS = [ 'Buzz', 'Car_passing_by', 'Crackle', 'Cricket', 'Hi...
2.375
2
especifico/json_schema.py
athenianco/especifico
0
23171
<gh_stars>0 """ Module containing all code related to json schema validation. """ from collections.abc import Mapping import contextlib from copy import deepcopy import io import os import typing as t import urllib.parse import urllib.request from jsonschema import Draft4Validator, RefResolver from jsonschema.excepti...
2.328125
2
mindhome_alpha/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py
Mindhome/field_service
1
23172
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe, unittest from erpnext.accounts.doctype.fiscal_year.fiscal_year import FiscalYearIncorrectDate test_records = frappe.get_test_records('...
1.851563
2
types/integers.py
anthony-walker/me499
11
23173
<reponame>anthony-walker/me499<filename>types/integers.py<gh_stars>10-100 #!/usr/bin/env python3 if __name__ == '__main__': # Python can represent integers. Here are a couple of ways to create an integer variable. Notice the truncation, # rather than rounding, in the assignment of d. a = 5 b = int()...
4.34375
4
cli/asciiart.py
Christophe1997/pyramid
0
23174
<filename>cli/asciiart.py #! /usr/bin/env python3 """Convert picture to asciiArt, requrie python3.6 or higher. Dependence: - fire - PIL - numpy Usage: - chmod +x asciiart.py - asciiart.py ${path_to_image} [Height] [Width] Also, you can remove the filetype ".py" and put it to $HOME/bin/ then enjoy it:) One example: ...
2.796875
3
tests/conftest.py
MohamedRaslan/screenpy
0
23175
from typing import Callable, Generator, Any from unittest import mock import pytest from screenpy import AnActor, pacing, settings from screenpy.abilities import AuthenticateWith2FA, BrowseTheWeb, MakeAPIRequests from screenpy.narration.narrator import Narrator @pytest.fixture(scope="function") def Tester() -> AnAc...
2.421875
2
main.py
ceciliazhang12/resource-reservation-system
0
23176
#!/usr/bin/env python # Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
2.34375
2
sutta_publisher/src/sutta_publisher/edition_parsers/__init__.py
suttacentral/publications
1
23177
from .epub import EpubEdition from .html import HtmlEdition from .pdf import PdfEdition __all__ = ["EpubEdition", "HtmlEdition", "PdfEdition"]
1.234375
1
tools/c7n_azure/tests_azure/tests_resources/test_event_hub.py
chris-angeli-rft/cloud-custodian
8
23178
# Copyright 2019 Microsoft 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 applicable law or agreed to in wri...
1.84375
2
pythonfiles/testing.py
amrut-prabhu/loan-default-prediction
2
23179
import numpy as np import pandas as pd from sklearn.externals import joblib #from sklearn.ensemble import RandomForestRegressor #from sklearn.multioutput import MultiOutputRegressor #from sklearn.multioutput import MultiOutputRegressor from sklearn.model_selection import train_test_split df = pd.read_csv('https://dr...
2.78125
3
kerasjr/Model.py
OliverMathias/kerasjr
0
23180
<filename>kerasjr/Model.py # Python 3 import numpy as np np.seterr(divide='ignore', invalid='ignore') class Model: def __init__(self, x, y, number_of_hidden_layers=2, number_of_hidden_nodes=30, quiet=False): self.x = x self.y = y self.number_of_hidden_layers = number_of_hidden_layers self.nu...
3.484375
3
generate_revision_sheet.py
geritwagner/revision-sheet-generator
1
23181
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import argparse import docx from docx.shared import Cm import pylatex from pytablewriter import MarkdownTableWriter def set_column_width(column, width): column.width = width for cell in column.cells: cell.width = width def generate_word_revisio...
2.46875
2
trainer_backup.py
dbseorms16/drnxgaze
1
23182
import torch import numpy as np import utility from decimal import Decimal from tqdm import tqdm from option import args from torchvision import transforms from PIL import Image import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import copy class Trainer(): def __init__(self, opt, loader...
2.203125
2
pymongo_test_query.py
rbola/python-mongodb
1
23183
# Get the database using the method we defined in pymongo_test_insert file from pymongo_test_insert import get_database dbname = get_database() # Create a new collection collection_name = dbname["user_1_items"] item_details = collection_name.find() for item in item_details: # This will give readable output...
3.625
4
django_backend/backend/ajax.py
team23/django_backend
3
23184
import json from django.core.serializers.json import DjangoJSONEncoder from django.http import HttpResponse from django.template import Context from django.template import RequestContext from django.template.loader import render_to_string, select_template from django.utils.encoding import force_unicode from ..compat i...
2.109375
2
flight/oled_ssd1306.py
MxToolbox/BalloonLaunch
1
23185
<filename>flight/oled_ssd1306.py """ This demo will fill the screen with white, draw a black box on top and then print Hello World! in the center of the display This example is for use on (Linux) computers that are using CPython with Adafruit Blinka to support CircuitPython libraries. CircuitPython does not support PI...
3.765625
4
setup.py
billbrod/spatial-frequency-model
0
23186
#! /usr/bin/env python from setuptools import setup, Extension import importlib import os # copied from kymatio's setup.py: https://github.com/kymatio/kymatio/blob/master/setup.py sfm_version_spec = importlib.util.spec_from_file_location('sfm_version', 'sfm/version.py') sfm_version_module = importlib.util.module_from...
1.484375
1
tests/core/test_operation/test_inventory.py
pypipet/pypipet
0
23187
# from pipet.core.sql.query_interface import * from pypipet.core.operations.inventory import * import pytest from pprint import pprint _supplie_id = 1 def test_update_invs(session, obj_classes, shop_conn): invs = [ {'sku':'s22456', 'supplier_id':_supplie_id, 'qty':20}] update_inventory_bulk(obj_classes, sess...
2
2
reliabpy/models/cost.py
FelipeGiro/ReliabiliPy
0
23188
# Costs # 2019 - Luque, Straub - Risk-based optimal inspection strategies for # structural systems using dynamic Bayesian networks # Table 4, case 1 import numpy as np class InspectionMaintenance: """ Inspection and Maintenance ========================== Cost calculation for inspection and main...
2.921875
3
Code/Examples/Example_22.py
R6500/SLab
2
23189
''' SLab Example Example_22.py Create several waveforms Connect DAC 1 to ADC 1 ''' # Locate slab in the parent folder import sys sys.path.append('..') sys.path.append('.') import slab # Set prefix to locate calibrations slab.setFilePrefix("../") # Open serial communication slab.connect() # Se...
2.90625
3
src/python_module_setup.py
Deyht/CIANNA
5
23190
<filename>src/python_module_setup.py from distutils.core import setup, Extension import os #os.environ['USE_CUDA'] = '1' #os.environ['USE_BLAS'] = '1' #os.environ['USE_OPENMP'] = '1' cuda_obj = [] cuda_extra = [] cuda_include = [] cuda_macro = [(None, None)] blas_obj = [] blas_extra = [] blas_include = [] blas_macr...
1.726563
2
potsim/filters.py
nicktimko/pots-sim
0
23191
from __future__ import absolute_import, division, print_function import json import os.path as op import six import numpy as np import scipy.signal as sig import scipy.io.wavfile as sciwav MAXINT16 = 2**15 - 1 FS = 44100 COEFF_DIR = op.join(op.dirname(op.abspath(__file__)), 'coeffs') def normalize(data, maxamp=1): ...
2.21875
2
scripts/bootstrap_optimize.py
adrn/thrift-shop
0
23192
# Standard library import atexit import os os.environ["OMP_NUM_THREADS"] = "1" import sys import traceback # Third-party from astropy.utils import iers iers.conf.auto_download = False import astropy.table as at import numpy as np # This project from totoro.config import cache_path from totoro.data import datasets, el...
2
2
Solutions/346.py
ruppysuppy/Daily-Coding-Problem-Solutions
70
23193
""" Problem: You are given a huge list of airline ticket prices between different cities around the world on a given day. These are all direct flights. Each element in the list has the format (source_city, destination, price). Consider a user who is willing to take up to k connections from their origin city A to thei...
4.0625
4
training/pytorch_ddp_nvidia.py
gclouduniverse/dlenv-templates
0
23194
"""PyTorch Distributed Data Parallel example from NVIDIA.""" # https://github.com/NVIDIA/DeepLearningExamples import argparse import utils import virtual_machine def main(): parser = argparse.ArgumentParser(description='Optional app description') parser.add_argument('--vm-name', dest='vm_name', type=str, require...
3.015625
3
Back/ecoreleve_server/modules/stations/station_resource.py
NaturalSolutions/ecoReleve-Data
15
23195
<gh_stars>10-100 import json import itertools from datetime import datetime, timedelta import pandas as pd from sqlalchemy import select, and_, join from sqlalchemy.exc import IntegrityError import copy from ecoreleve_server.core import RootCore from ecoreleve_server.core.base_resource import DynamicObjectResource, D...
2.03125
2
t_core/Mutex/HIgnoreRuleNAC0.py
levilucio/SyVOLT
3
23196
<reponame>levilucio/SyVOLT<filename>t_core/Mutex/HIgnoreRuleNAC0.py<gh_stars>1-10 from core.himesis import Himesis, HimesisPreConditionPatternNAC import cPickle as pickle from uuid import UUID class HIgnoreRuleNAC0(HimesisPreConditionPatternNAC): def __init__(self, LHS): """ Creates the ...
2.078125
2
codes/dataloader.py
UltronMHTM/pytorch_learning
0
23197
from torch.utils.data import Dataset from skimage import io import os import torch class MnistData(Dataset): def __init__(self, root_dir): self.root_dir = root_dir img_list = [] label_list = os.listdir(self.root_dir) for label in label_list: file_names = os.li...
2.671875
3
qunetsim/objects/storage/quantum_storage.py
pritamsinha2304/QuNetSim
61
23198
from qunetsim.backends.rw_lock import RWLock from qunetsim.objects.logger import Logger import queue class QuantumStorage(object): """ An object which stores qubits. """ STORAGE_LIMIT_ALL = 1 STORAGE_LIMIT_PER_HOST = 2 STORAGE_LIMIT_INDIVIDUALLY_PER_HOST = 3 def __init__(self): #...
2.671875
3
tests/test_utils.py
Guillerbr/python-pagseguro
115
23199
# -*- coding: utf-8 -*- import datetime from pagseguro.utils import (is_valid_cpf, is_valid_cnpj, is_valid_email, parse_date) from pagseguro.exceptions import PagSeguroValidationError import pytest from dateutil.tz import tzutc def test_is_valid_email(): valid = '<EMAIL>' valid2...
2.5
2