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
depth_upsampling/losses/gradient_loss.py
Levintsky/ARKitScenes
237
12766951
import torch import dataset_keys def div_by_mask_sum(loss: torch.Tensor, mask_sum: torch.Tensor): return loss / torch.max(mask_sum, torch.ones_like(mask_sum)) class SafeTorchLog(torch.autograd.Function): @staticmethod def forward(ctx, input): """ In the forward pass we receive a Tensor...
2.71875
3
model/TextCNN/text_cnn_pytorch.py
stanli124/TextClassification-Pytorch
0
12766952
<filename>model/TextCNN/text_cnn_pytorch.py ''' AUTHOR :<NAME> DATE :2021/07/18 10:22 ''' import torch.nn as nn import torch import numpy as np class TextCNN_torch(nn.Module): def __init__(self, vocab_size=None, embedding_dims=50, seq_len=400, kernel_size=[3, 4, 5], ...
2.4375
2
analysis/thermistors.py
sanielfishawy/ODrive
5
12766953
#%% import matplotlib.pyplot as plt import numpy as np Rload = 3300 R_25 = 10000 T_25 = 25 + 273.15 #Kelvin Beta = 3434 Tmin = 0 Tmax = 140 temps = np.linspace(Tmin, Tmax, 1000) tempsK = temps + 273.15 # https://en.wikipedia.org/wiki/Thermistor#B_or_%CE%B2_parameter_equation r_inf = R_25 * np.exp(-Beta/T_25) R_temps...
2.9375
3
q2_protein_pca/__init__.py
misialq/q2-protein-pca
2
12766954
<reponame>misialq/q2-protein-pca # ---------------------------------------------------------------------------- # Copyright (c) 2021, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # --------------------...
1.203125
1
PBO_18099/Latihan_3.2.Penugasan.py
viviyanti/PBO
0
12766955
<reponame>viviyanti/PBO<gh_stars>0 #OPERATOR PENUGASAN #input mengisi nilai nilai_x=int(input("masukan nilai x: ")) #operator penjumlahan nilai_x +=20 print("hasil jumlah: ", nilai_x) nilai_x=int(input("masukan nilai x: ")) #operator pengurangan nilai_x -=10 print("hasil kurang:",nilai_x) nilai_x=int(...
3.578125
4
poop/hfdp/adapter/ducks/challenge/drone_adapter.py
cassiobotaro/poop
37
12766956
from poop.hfdp.adapter.ducks.challenge.drone import Drone class DroneAdapter: def __init__(self, drone: Drone) -> None: self.__drone = drone def quack(self) -> None: self.__drone.beep() def fly(self) -> None: self.__drone.spin_rotors() self.__drone.take_off()
2.109375
2
samples/knn.py
likeand/ml
1
12766957
# -*- coding: utf-8 -*- # @Date : 2020/5/24 # @Author: Luokun # @Email : <EMAIL> import sys from os.path import dirname, abspath import matplotlib.pyplot as plt import numpy as np sys.path.append(dirname(dirname(abspath(__file__)))) def test_knn(): from models.knn import KNN x, y = np.random.randn(3, 200...
2.734375
3
ramachandran/run_phi_angles.py
simonholmes001/ramachandran
0
12766958
import os import concurrent.futures from tqdm import tqdm from phi_angles import PhiDihedralAngleStatistics import argparse parser = argparse.ArgumentParser(description='To set to the path to the data') parser.add_argument('-i', '--input_directory', help='An input directory for the psi angles must be named', required...
2.5
2
inferencia/task/object_tracking/object_tracking/model/object_tracking_result.py
yuya-mochimaru-np/inferencia
0
12766959
from dataclasses import dataclass import numpy as np @dataclass class ObjectTrackingResult: frame_index: int tracking_id: int class_id: int class_name: str xmin: int ymin: int xmax: int ymax: int confidence: float is_active: bool def to_txt(self): return "{} {} {} ...
2.765625
3
tf2_models/trainer.py
samiraabnar/DistillingInductiveBias
10
12766960
import tensorflow as tf import os from tf2_models.keras_callbacks import CheckpointCallback, SummaryCallback from tf2_models.train_utils import RectifiedAdam, ExponentialDecayWithWarmpUp OPTIMIZER_DIC = {'adam': tf.keras.optimizers.Adam, 'radam': RectifiedAdam, } class Trainer(object)...
2.265625
2
tests/test__text_to_nlp.py
JeremyGibson/xml_parser
2
12766961
#!/usr/bin/env python3 # import modules. import sys; sys.path.append("..") import logging import math import plac import unittest from tomes_tagger.lib.text_to_nlp import * # enable logging. logging.basicConfig(level=logging.DEBUG) class Test_TextToNLP(unittest.TestCase): def setUp(self): # ...
2.921875
3
plugins/trivia/trivia.py
awesomarcus/haaaaaaaah
0
12766962
from threading import Thread import time from plugins.trivia.questions import QuestionGenerator # This class will put itself in a pseudo-while loop that is non-blocking # to the rest of the program. class Question: def __init__(self, q, a): self.text = q self.ans = a class Trivia: def __init__(...
3.40625
3
trustpayments/models/subscription_charge_type.py
TrustPayments/python-sdk
2
12766963
# coding: utf-8 from enum import Enum, unique @unique class SubscriptionChargeType(Enum): MANUAL = "MANUAL" AUTOMATIC = "AUTOMATIC"
2.15625
2
setupext/sdist.py
theHamsta/jpype
1
12766964
<filename>setupext/sdist.py # -*- coding: utf-8 -*- import os import sys import warnings import distutils from distutils.dir_util import copy_tree, remove_tree from setuptools.command.sdist import sdist from setuptools import Extension # Customization of the sdist class BuildSourceDistribution(sdist): """ Over...
2.15625
2
src/ezdxf/render/dimension.py
jpsantos-mf/ezdxf
2
12766965
<gh_stars>1-10 # Created: 28.12.2018 # Copyright (c) 2018-2020, <NAME> # License: MIT License from typing import TYPE_CHECKING from ezdxf.math import UCS from ezdxf.lldxf.const import DXFValueError from ezdxf.entities.dimstyleoverride import DimStyleOverride from .dim_linear import LinearDimension from .dim_radius imp...
2.140625
2
scrapy_auto_trans/exceptions.py
jiansongyang/scrapy-auto-translation-middelware
4
12766966
from scrapy.exceptions import IgnoreRequest class TranslationResult(IgnoreRequest): """A translation response was received""" def __init__(self, response, *args, **kwargs): self.response = response super(TranslationResult, self).__init__(*args, **kwargs) class TranslationError(Exception): ...
2.578125
3
Graph/Graph/users/models.py
MGijon/TheGraph.es
0
12766967
"""Users Models.""" # Django from django.db import models from django.contrib.auth.models import User class Profile(models.Model): """Profile extended: Proxy model that extends the base data with other information. """ # this links Profile with the User profile, one to one relationship profile_use...
2.875
3
flask/templates/app/views.py
telliott99/Pi
0
12766968
from flask import render_template, url_for from app import app script_list = ['demo', 'format_DNA', 'translate', 'extra_sites'] default_choice = 'format_DNA' def render_index_template(): return render_template( "index.html", script_list...
2.40625
2
test/integration/ggrc_workflows/notifications/test_data_handler.py
Smotko/ggrc-core
0
12766969
<gh_stars>0 # coding: utf-8 # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: <EMAIL> # Maintained By: <EMAIL> from integration.ggrc import TestCase from ggrc import db from ggrc.models.revision i...
1.804688
2
text_wrappers.py
11ajith/pypassman
0
12766970
<reponame>11ajith/pypassman<gh_stars>0 import sys class TextWrappers: def __init__(self): if (sys.platform == 'win32'): self.LOCK = '' self.ERROR = '' self.SUCCESS = '' self.INFO = '' self.BANNER = '' self.PARAM = '' self....
2.5625
3
dask_sql/physical/rex/core/over.py
goodwanghan/dask-sql
0
12766971
<reponame>goodwanghan/dask-sql<filename>dask_sql/physical/rex/core/over.py import logging from typing import Any, Callable, List, Tuple import dask.dataframe as dd import pandas as pd from dask_sql.datacontainer import ColumnContainer, DataContainer from dask_sql.java import org from dask_sql.physical.rex.base import...
1.992188
2
dramkit/find_addends/find_addends_utils.py
Genlovy-Hoo/dramkit
0
12766972
# -*- coding: utf-8 -*- import numpy as np #%% def tol2side_x_eq_y(x, y, tol_below=0.0, tol_above=0.0): '''在上界误差tol_above和下界误差tol_below范围内判断x是否等于y''' return y - tol_below <= x <= y + tol_above def tol_eq(x, y, tol=0.0): '''在绝对误差tol范围内判断x和y相等''' return abs(x - y) <= tol def tol_x_big_y(x, y, tol=0....
3.078125
3
tests/tests/test_02_integration.py
tkw1536/django_selenium_test
0
12766973
<gh_stars>0 from __future__ import annotations from unittest import mock from django_selenium_test import IntegrationTest class ExampleIntegrationTest(IntegrationTest): find_element_selector = "main" def test_element_mixins(self) -> None: """ Checks that the element mixins work as intended """ ...
2.4375
2
invoice/migrations/0016_expensegroup.py
pickleshb/PyInvoice
2
12766974
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2018-01-03 13:56 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('invoice', '0015_auto_20180102_0048'), ] operations...
1.617188
2
yammler/yammler.py
EttyKitty/OpenXcom_Tools
0
12766975
# python3 yammler.py ~/Games/openxcom_71_40k/user/mods/ROSIGMA/Ruleset ~/Games/openxcom_71_40k/user/mods/40k/Ruleset/ import sys, os import yaml print(sys.argv) # os.chdir(sys.argv[1]) paths = sys.argv[1:] fileList = [] DEBUG = False def debugPrint(debugText): if DEBUG: print(debugText) def addTrailing...
2.234375
2
setup.py
whit537/httpy
0
12766976
from distutils.core import setup classifiers = [ 'Development Status :: 3 - Alpha' , 'Intended Audience :: Developers' , 'License :: OSI Approved :: BSD License' , 'Natural Language :: English' , 'Operating System :: MacOS :: MacOS X' , 'Operating System :: Microsoft :: Windows' , 'Operating System ::...
1.125
1
utils/time_watcher.py
Johnson145/RapidObjectDetectionUsingCascadedCNNs
9
12766977
<gh_stars>1-10 from time import time from datetime import timedelta from utils import log class TimeWatcher: """A TimeWatcher object can be used to evaluate the runtime of individual code parts.""" def __init__(self, name: str): """Create a new TimeWatcher. :param name: The name of the time...
3.5625
4
test/map_optimizer.py
fritzo/kazoo
3
12766978
<gh_stars>1-10 #!/usr/bin/python from math import * from scipy import * #from matplotlib import pyplot #from scipy import linalg import main #----( commands )------------------------------------------------------------- @main.command def project_unif (X = 3, Y = 2): 'projects dJ matrix via inclusion-exclusion, WRT...
2.734375
3
data_resource/storage/aws_s3.py
brighthive/data-resource-generator
2
12766979
<reponame>brighthive/data-resource-generator import os import logging import boto3 import json from botocore.exceptions import ClientError class S3Manager: """S3Manager Manager Class.""" def __init__(self, config): self.config = config self.aws_iam_role = self.config.AWS_S3_USE_IAM_ROLE ...
2.21875
2
tftk/optuna/__init__.py
kitfactory/tftk
6
12766980
import optuna from . optuna_util import Optuna from . mongo import get_storage_mongo __all__ = ['Optuna'] optuna.storages.get_storage = get_storage_mongo
1.070313
1
main/dash/layout.py
sdf94/flask-dash-blog
0
12766981
import os """Plotly Dash HTML layout override.""" dir_path = os.getcwd() with open(os.path.join(dir_path, 'main', 'templates', 'base.html'), 'r') as f: rows = f.readlines() rows = [row.strip() for row in rows] nav_index = rows.index('</nav>') dash_str = rows[:nav_index+1] + ['{%app_entry%}', ...
2.671875
3
helpers/simulation_helpers/scripts/schunk_machine_server.py
GT-RAIL/assistance_arbitration
0
12766982
#!/usr/bin/python # Copyright 2019 Fetch Robotics Inc. # Author(s): <NAME> # Python from __future__ import print_function from datetime import datetime from datetime import timedelta # ROS import rospy import actionlib from fetchit_challenge.msg import SchunkMachineAction, SchunkMachineResult, SchunkMachineGoal # #...
2.421875
2
tests/test_convert.py
vikpe/exex-cli
2
12766983
<filename>tests/test_convert.py<gh_stars>1-10 from exex_cli import convert def test_to_string(): assert convert.to_string(None) == "" assert convert.to_string("None") == "None" assert convert.to_string(0) == "0" assert convert.to_string(1) == "1" assert convert.to_string("a") == "a" assert con...
2.65625
3
tests/roots/test-epub-anchor-id/conf.py
samdoran/sphinx
4,973
12766984
<filename>tests/roots/test-epub-anchor-id/conf.py def setup(app): app.add_crossref_type(directivename="setting", rolename="setting")
1.1875
1
Python/Set .add()/Solution.py
chessmastersan/HackerRank
2
12766985
#author <NAME> # Enter your code here. Read input from STDIN. Print output to STDOUT n = int(input()) s = set() for i in range(0, n) : s.add(input()) print(len(s))
3.484375
3
Trellis.py
plex1/turbo-code-simulation
1
12766986
#! /usr/bin/env python # title : Trellis.py # description : This class generates a trellis based on a trellis definition class. # Parameters such as reduction (radix) can be used to construct the trellis. # author : <NAME> # python_version : 3.5.2 import utils class Trellis(...
3.5625
4
postcodeinfo/apps/postcode_api/management/commands/download_and_import_postcode_gss_codes.py
UKHomeOffice/postcodeinfo
0
12766987
<gh_stars>0 import os from django.core.management.base import BaseCommand from postcode_api.utils import ZipExtractor from postcode_api.downloaders import PostcodeGssCodeDownloader from postcode_api.importers.postcode_gss_code_importer \ import PostcodeGssCodeImporter class Command(BaseCommand): args = '<des...
2.140625
2
teda/fitting.py
majkelx/teda
1
12766988
<gh_stars>1-10 import math import numpy as np from scipy import optimize def fit_gauss_1d_zero_c(x, y): """ Fits a*gaussian(0, sig) + sky of mu=0 Returns ------- model, a, sig, c, rmse """ x, y = np.asarray(x), np.asarray(y) gauss0 = lambda x, a, c, sig2: c + a * np.exp(-x ** 2 / (2 *...
2.734375
3
dataset/waveform_dataset.py
wimmerb/Wave-U-Net-for-Speech-Enhancement
166
12766989
import os import librosa from torch.utils import data from util.utils import sample_fixed_length_data_aligned class Dataset(data.Dataset): def __init__(self, dataset, limit=None, offset=0, sample_length=16384, mod...
2.84375
3
benchmark/utils.py
facebookresearch/fairring
42
12766990
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import multiprocessing from typing import Any, List, Tuple def recv_from_connections_and...
2.828125
3
image_indexer/imageDAO.py
RikEnde/image-indexer
2
12766991
<gh_stars>1-10 #!/usr/bin/env python import bson import pymongo class ImageDAO(object): """ Wraps inserts and queries to the images collection As well as some aggregations """ def __init__(self, connection_string='mongodb://localhost', database='pictures', collection='images', upsert=False): ...
3.015625
3
saas/backend/apps/subject/views.py
nannan00/bk-iam-saas
0
12766992
<gh_stars>0 # -*- coding: utf-8 -*- """ TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心(BlueKing-IAM) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in compli...
1.351563
1
aplicaciones_informaticas/backend/migrations/0023_atentionqueue_max_capacity.py
awainer/7539
0
12766993
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2016-12-08 22:10 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('backend', '0022_auto_20161208_1740'), ] operations = [ migrations.AddField(...
1.46875
1
src/einsteinpy/coordinates/utils.py
Bhavam/einsteinpy
0
12766994
<gh_stars>0 import numpy as np from ..ijit import jit def cartesian_to_spherical_fast( x, y, z, v_x=None, v_y=None, v_z=None, velocities_provided=False ): if velocities_provided: return cartesian_to_spherical(x, y, z, v_x, v_y, v_z) return cartesian_to_spherical_novel(x, y, z) @jit def cartesia...
3
3
test/conductor/test_conductor_translation.py
onap/optf-osdf
3
12766995
# ------------------------------------------------------------------------- # Copyright (c) 2017-2018 AT&T Intellectual Property # Copyright (C) 2020 Wipro Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may ...
1.734375
2
url200.py
endritqerreti/URL200
0
12766996
<filename>url200.py #!/usr/bin/python #App Name : URL200 #Author : <NAME> #Repo : https://github.com/endritqerreti/URL200 #License : MIT License #Version : 1.0.0 import requests import csv import sys import time from datetime import date seconds = 2 path = 'urls.txt' today = date.today() f...
2.875
3
garden/models.py
e-dang/Autogarden
0
12766997
from datetime import datetime, timedelta import pytz from django.conf import settings from django.contrib.auth.hashers import check_password from django.db import models from django.urls import reverse from rest_framework.request import Request from garden.formatters import WateringStationFormatter from .managers im...
2.15625
2
fast_bird_part_localization/geometry_utils.py
thedekel/fast-bird-part-localization
25
12766998
import numpy as np import cv2 from poisson_disk import PoissonDiskSampler import skimage.morphology import skimage.measure import scipy.stats class Box(object): """ This class represents a box in an image. This could be a bounding box of an object or part. Internally each box is represented by a tuple of ...
3.078125
3
codility_python_tests/04_frog_jump_across_road.py
sreedhar-venkatesan/codility-python-tests
0
12766999
<filename>codility_python_tests/04_frog_jump_across_road.py import math def solution(X,Y,D): distance = Y-X return math.ceil(distance/D) if __name__ =="__main__": X=10 Y=85 D=30 ans = solution(X,Y, D) print (ans)
3.671875
4
captioner/utils.py
svaisakh/captioner
1
12767000
<reponame>svaisakh/captioner import numpy as np from contextlib import contextmanager from collections import namedtuple from itertools import chain def _get_data_paths(): from pathlib import Path DIR_DATA = Path('~/.data/COCO').expanduser() DIR_CHECKPOINTS = Path(__file__).resolve().parents[1] / 'checkpoints' ...
2.625
3
norns/gear/migrations/0007_auto_20180523_2359.py
the-norns/norns
0
12767001
<gh_stars>0 # Generated by Django 2.0.5 on 2018-05-23 23:59 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('gear', '0006_auto_20180522_2102'), ] operations = [ migrations.AlterField( model_na...
1.460938
1
month05/Hadoop/day02_course/code/word_count.py
chaofan-zheng/python_learning_code
0
12767002
<filename>month05/Hadoop/day02_course/code/word_count.py """ 统计文件中每个文件中单词的数量 """ from mrjob.job import MRJob class WordCount(MRJob): # 重写mapper和reducer方法 # def mapper(self, key, value): def mapper(self, _, line): # 参数key:每行行首的偏移量 # 参数value:一行的内容 # mapper的执行次数由文本的行数决定。 # 文件有...
3.234375
3
setup.py
TheTechRobo/PyGit
2
12767003
from setuptools import setup import os with open(os.devnull, 'w') as a: print("If this raises an error, you're using python 2 - not supported.", file=a) #get rid of python 2 users with open("README.md", "r") as file: long_desc = file.read() import sys if sys.version_info < (3,7): sys.exit('Sorry, Python < 3...
2.078125
2
src/ch3/dictionary_code.py
hillaryychan/iccsh
1
12767004
def find_prefix_entry(message, dictionary): """ Find the longest entry in dictionary which is a prefix of the given message """ for entry in dictionary[::-1]: if message.startswith(entry[0]): return dictionary.index(entry) return -1 def lz78_encode(message, *args, **kwargs): ...
3.546875
4
extras/sm_to_graph.py
Attumm/semantic-model
0
12767005
import json import sys from dsm import dsm_looper def get_color(item): n = len(item) return COLORS[n % len(COLORS)] class Node(): DN = {} head = None def __init__(self, val, dn): self.val = val self.nodes = [] self.dn = dn Node.DN[dn] = self def connect(sel...
3
3
pages/02_multipage.py
sebastiandres/stb_chapter_demo_v070
0
12767006
import streamlit as st import streamlit_book as stb st.title("Multipage") st.markdown("There are several user cases for having multipages on streamlit. We'll explore each one of those") st.header("Basic or interactive single page") st.markdown(""" You use only streamlit (no need can use streamlit_book). Optionall...
3.421875
3
scripts/find_revdeps.py
clouserw/zamboni
0
12767007
<gh_stars>0 #!/usr/bin/env python import pip import sys from pip.req import parse_requirements def rdeps(pkg_name): return [pkg.project_name for pkg in pip.get_installed_distributions() if pkg_name in [requirement.project_name for requirement in pkg.requires()]...
2.515625
3
momo/plugins/flask/functions.py
shichao-an/momo
6
12767008
# template global functions # make sure not to conflict with built-ins: # http://jinja.pocoo.org/docs/2.9/templates/#list-of-global-functions from flask.helpers import url_for as _url_for from flask_paginate import Pagination def paginate(page, total, per_page, config): record_name = config['MOMO_PAGINATION_RECO...
2.546875
3
todos/models/definitions.py
asidlare/todos
0
12767009
<filename>todos/models/definitions.py from .base import db, DictMixin, DATETIME_TYPE, BOOLEAN_TYPE, UNSIGNEDSMALLINT_TYPE from .utils import on_create, on_drop from sqlalchemy_utils import PasswordType, EmailType, force_auto_coercion from sqlalchemy.ext.hybrid import hybrid_property from enum import Enum from flask_log...
2.109375
2
common/geometry.py
ocozalp/Algorithms
5
12767010
__author__ = 'orhan' from math import asin, sqrt, degrees class Point: def __init__(self, x, y=0.0, z=0.0): self.x = x self.y = y self.z = z def angle_x(self, p2): dy = self.y - p2.y dx = self.x - p2.x h = sqrt(dy ** 2 + dx ** 2) if h == 0: ...
3.734375
4
data-generation-GAN/solver/make_optimizer.py
lulujianjie/efficient-person-generation-for-reid
24
12767011
import torch def make_optimizer(Cfg, model): params = [] for key, value in model.named_parameters(): if not value.requires_grad: continue lr = Cfg.SOLVER.BASE_LR weight_decay = Cfg.SOLVER.WEIGHT_DECAY if "bias" in key: lr = Cfg.SOLVER.BASE_LR * Cfg.SOLVER...
2.453125
2
src/clusterfuzz/_internal/tests/core/bot/fuzzers/afl/afl_engine_test.py
anonymousandrew/clusterfuzz
1
12767012
# Copyright 2020 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, ...
1.78125
2
fuzzy_dynamic_cluster.py
FlashZoom/Fuzzy-Dynamic-Cluster
1
12767013
import numpy as np # direct cluster class FCM(object): def __init__(self, data): self.lambd = 0 self.data = data self.cluster = [] self.F_S = [] def standard(self): data_min, data_max = np.min(self.data, axis=0), np.max(self.data, axis=0) num_sampl...
2.6875
3
tools.py
Frankkie/Thesis-Project-IF-Game
1
12767014
""" Some useful functions for file management. Functions: copytree(scr, dst, symlinks=False, ignore=None): Copy all the contents of directory scr to directory dst. empty_folder(folder): Empty the directory folder from all subfolders and files. """ import os import shutil def copytree(src, ...
3.4375
3
plaso/formatters/android_sms.py
Defense-Cyber-Crime-Center/plaso
2
12767015
<gh_stars>1-10 # -*- coding: utf-8 -*- """The Android mmssms.db database event formatter.""" from plaso.formatters import interface from plaso.formatters import manager class AndroidSmsFormatter(interface.ConditionalEventFormatter): """Formatter for an Android SMS event.""" DATA_TYPE = u'android:messaging:sms' ...
1.945313
2
apps/categories/urls.py
tuanquanghpvn/bideox
0
12767016
<filename>apps/categories/urls.py from django.conf.urls import url from . import views urlpatterns = [ url(r'^(?P<pk>[0-9]+)-(?P<slug>[\w-]+)/$', views.CategoryListView.as_view(), name='list') ]
1.835938
2
paddlespeech/t2s/audio/codec.py
jerryuhoo/PaddleSpeech
1,379
12767017
<filename>paddlespeech/t2s/audio/codec.py # Copyright (c) 2020 PaddlePaddle Authors. 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/license...
2.609375
3
tests/_test_flow_output/fairytool/tests/test_version.py
Sillte/fairytemplate-
0
12767018
"""Version's attribute test. """ import pytest import fairytool def test_version(): assert hasattr(fairytool, "__version__") if __name__ == "__main__": pytest.main(["--capture=no"])
1.734375
2
dynamodb_ce/ceparser.py
QuiNovas/dynamodb-conditional-expressions
0
12767019
__all__ = ["CeParser"] from copy import deepcopy from decimal import Decimal from typing import Callable, Dict, Set, Union import simplejson as json from boto3.dynamodb.types import ( BINARY, BINARY_SET, BOOLEAN, LIST, MAP, NULL, NUMBER, NUMBER_SET, STRING, STRING_SET, Bina...
2.015625
2
tools/Scripts/UploadToFtp.py
rozyczko/easyDiffractionApp
1
12767020
# SPDX-FileCopyrightText: 2021 easyDiffraction contributors <<EMAIL>> # SPDX-License-Identifier: BSD-3-Clause # © 2021 Contributors to the easyDiffraction project <https://github.com/easyScience/easyDiffractionApp> __author__ = "github.com/AndrewSazonov" __version__ = '0.0.1' import os, sys import ftplib import pathl...
2.3125
2
main.py
nonjosh/tg_bot_webscrap_update
0
12767021
<gh_stars>0 """main""" import time from typing import List import yaml import schedule from helpers import ( TgHelper, # CocomanhuaHelper, WutuxsHelper, ManhuaguiHelper, EsjzoneHelper, SyosetuHelper, Qiman6Helper, BaozimhHelper, ) from utils import get_logger, get_main_domain_name LIST_...
2.3125
2
To do.py
dotkim/PyToDo
0
12767022
<gh_stars>0 import pypyodbc, cmd, sys, os, datetime, pathlib ScriptDir = os.path.dirname(os.path.realpath('__file__')) # Where the scripts should be placed, which is root def dbconnection(): try: conString = open('.\Config\ConnectionStrings.config', 'r') connection = pypyodbc.connect(conStr...
2.1875
2
acapi/resources/environmentlist.py
marynaperesypkina/python-acquia-cloud
0
12767023
<filename>acapi/resources/environmentlist.py """Acquia Cloud API server list resource.""" from acapi.resources.acquialist import AcquiaList from acapi.resources.environment import Environment class EnvironmentList(AcquiaList): """Dict of Acquia Cloud API Environment resources keyed by short name.""" def __i...
3.03125
3
pygradethis/utils.py
nischalshrestha/pygradethis
12
12767024
""" Module with useful functions. """ from typing import Union, List import ast def parse_code(input: Union[str, List[str]]) -> str: """Tries to parse code represented as string or list of strings Parameters ---------- input : Union[str, List[str]] either a str or a list of str Returns ...
3.609375
4
shifthappens/models/base.py
shift-happens-benchmark/icml-2022
1
12767025
<reponame>shift-happens-benchmark/icml-2022 """Base classes and helper functions for adding models to the benchmark. To add a new model, implement a new wrapper class inheriting from :py:class:`shifthappens.models.base.Model`, and from any of the Mixins defined in :py:mod:`shifthappens.models.mixins`. Model results s...
2.5625
3
data/stream/electricityTest.py
PseudoAj/MyInsightRepo
5
12767026
<reponame>PseudoAj/MyInsightRepo<gh_stars>1-10 #!/usr/bin/env python #title :electricityTest.py #description :Class to test the electricity logic #author :<NAME> #date :02122017 #version :0.1 #============================================================================== # Libra...
2.71875
3
components/mpas-seaice/testing_and_setup/testcases/square/1D_velocity_hex/plot_method_comparison.py
Fa-Li/E3SM
235
12767027
<reponame>Fa-Li/E3SM from netCDF4 import Dataset import numpy as np import matplotlib.pyplot as plt import math fig, axes = plt.subplots() subcycleNumber = 7680 operatorMethods = ["wachspress","pwl","weak"] for operatorMethod in operatorMethods: # data in filenameIn = "./output_hex_%s_%i/output.2000.nc" %(...
1.757813
2
File Corruption/excel.py
box-community/admin-toolkit
2
12767028
<gh_stars>1-10 # Import pandas from __future__ import print_function import os import pandas as pd import csv # Assign spreadsheet filename to `file` xl_file = "..\..\Box File Corruption Investigation\EID 81319 - All Affected File Versions (Fixed info as of " \ "2018-02-27).xlsx " # Load spreadsheet into tw...
2.640625
3
azure-iot-device/azure/iot/device/iothub/sync_handler_manager.py
danewalton/azure-iot-sdk-python
0
12767029
<reponame>danewalton/azure-iot-sdk-python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------...
2.015625
2
miner/__init__.py
chrisedebo/nice-py-switcher
0
12767030
<reponame>chrisedebo/nice-py-switcher #Miner plugin definition
0.941406
1
src/relstorage/adapters/drivers.py
mamico/relstorage
0
12767031
############################################################################## # # Copyright (c) 2016 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
1.78125
2
skyportal/handlers/api/source_exists.py
jadalilleboe/skyportal
1
12767032
<filename>skyportal/handlers/api/source_exists.py<gh_stars>1-10 import conesearch_alchemy as ca from baselayer.app.access import auth_or_token from ..base import BaseHandler from ...models import ( Obj, ) class SourceExistsHandler(BaseHandler): @auth_or_token def get(self, obj_id=None): """ ...
2.1875
2
einsum_pc.py
ByzanTine/AutoHOOT
13
12767033
# Copyright 2020 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.234375
2
aaem_summaries/components/ashp_non_res/summary.py
gina-alaska/alaska_affordable_energy_model
1
12767034
<filename>aaem_summaries/components/ashp_non_res/summary.py """ Air Source Heat Pump Non-residential Outputs -------------------------------------------- output functions for Air Source Heat Pump Non-residential component """ import os.path from pandas import DataFrame import aaem.constants as constants from aaem.com...
2.8125
3
test/utility/test_read_file_by_name.py
SoorajModi/PrOwl
0
12767035
<filename>test/utility/test_read_file_by_name.py from prowl.utility.file import read_file_by_line def test_read_file_by_line_returns_string(): expected: list = ["This", "is", "a", "test!"] received: list = read_file_by_line('test/utility/test_read_file.txt') assert expected == received
2.9375
3
onisite/urls_example.py
johnscancella/open-oni
0
12767036
# Copy this to urls.py. Most sites can leave this as-is. If you have custom # apps which need routing, modify this file to include those urlconfs. from django.conf.urls import url, include urlpatterns = [ url('', include("core.urls")), # If you were to add a plugin app that handles its own URLs, you might do ...
1.445313
1
test/test_pwm.py
randomsamples/rgb_mixer
1
12767037
import cocotb from cocotb.clock import Clock from cocotb.triggers import RisingEdge, FallingEdge, ClockCycles import random async def reset(dut): dut.reset <= 1 await ClockCycles(dut.clk, 5) dut.reset <= 0; @cocotb.test() async def test_pwm(dut): clock = Clock(dut.clk, 10, units="us") cocotb.fork...
2.59375
3
python/algorism/sort/selection_sort.py
mts-uw/trainning-repository
0
12767038
import random from typing import List def selection_sort(numbers: List[int]) -> List[int]: len_numbers = len(numbers) for i in range(len_numbers): min_idx = i for j in range(i + 1, len_numbers): if numbers[min_idx] > numbers[j]: min_idx = j numbers[i], numb...
3.96875
4
lib/ui/__init__.py
mattermccrea/expensive-skeleton-free
0
12767039
# this is init file
1.117188
1
PANDAS/PetalProject.py
abhinavmish96/LEARN_DATA_SCIENCE
1
12767040
import codecademylib import pandas as pd inventory = pd.read_csv('inventory.csv') print(inventory.head(10)) staten_island = inventory.head(10) product_request = staten_island.product_description seed_request = inventory[(inventory.location == 'Brooklyn') & (inventory.product_type == 'seeds')] inventory['in_stock'] =...
3.453125
3
src/randomExpression/ExpressionBranch.py
rossweinstein/Evolutionary-Computing-Python
0
12767041
from random import randint from src.randomExpression.RandomOperand import RandomOperand from src.randomExpression.RandomOperator import RandomOperator class ExpressionBranch: def __init__(self, size): """ This class create a random expression of a given length. The operands will only be...
4.0625
4
astropy/coordinates/builtin_frames/fk5.py
REMeyer/astropy
3
12767042
<filename>astropy/coordinates/builtin_frames/fk5.py # -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, unicode_literals, division, print_function) from ..baseframe import frame_transform_graph from ..attributes import...
2.25
2
test2.py
lyx003288/python_test
0
12767043
# import os import sys from multiprocessing import Pool # import time # from concurrent import futures import test4 print("test2 run") class MyLocker: def __init__(self): print("mylocker.__init__() called.") @staticmethod def acquire(): print("mylocker.acquire() called.") @staticmetho...
3.109375
3
ingine/examples/seabattle_engine.py
sqarrt/Ingine
0
12767044
import random as rnd EMPTY = ' ' DEAD = 'X' HIT = '+' MISSED = '-' SHIP = 'O' LETTERKEYS = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J' ] def digit(key): if key in LETTERKEYS: return LETTERKEYS.index(key) + 1 elif 1 <= key <= 10: return key e...
3.421875
3
application/KitchenMagician/kitchen_magician/groups/db/init_groups.py
AsuPaul19/Kitchen-Magician
0
12767045
groups = [ { "img": "groups/images/vegan.png", "name": "Vegan Group", }, { "img": "groups/images/ketogenic-diet.png", "name": "Keto Group", }, { "img": "groups/images/vegetables.png", "name": "Vegetarian Group", }, { "img...
2.546875
3
notes/algo-ds-practice/problems/dp/egg_dropping_puzzle/egg_dropping1.py
Anmol-Singh-Jaggi/interview-notes
6
12767046
<gh_stars>1-10 import math import sys from functools import lru_cache @lru_cache(maxsize=None) def min_trials(num_eggs, num_floors): ''' min_trials[eggs][floor] = 1 + max(min_trials[eggs-1][floor-1], min_trials[eggs][num_floors-floor]) for floor = 1 .. num_floor That is, get the min of every floor...
3.09375
3
xls/dslx/free_variables.py
julianviera99/xls
0
12767047
<filename>xls/dslx/free_variables.py<gh_stars>0 # Copyright 2020 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 requ...
2.390625
2
tests/test_expect_column_values_to_not_be_null.py
dm-drogeriemarkt/pyspark-expectations
0
12767048
<filename>tests/test_expect_column_values_to_not_be_null.py<gh_stars>0 import pytest from pyspark.sql.functions import lit from pyspark_expectations import expectations def test_when_some_values_are_null(df): res = df.expect_column_values_to_not_be_null("height") assert not res["success"] def test_when_allowe...
2.75
3
biot_1.5/Datos.py
javacasm/biot
0
12767049
# Datos # 'SERIALIZACION' DE OBJETOS (para manejar el salvado de datos) try: import cPickle as pickle except ImportError: import pickle # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm # FUNCIONES CONTROL Y GESTION DE FICHEROS DE DATOS # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm def...
2.703125
3
tests/unit/market_data/fx_rate.py
amaas-fintech/amaas-core-sdk-python
0
12767050
from __future__ import absolute_import, division, print_function, unicode_literals import json import unittest from amaascore.market_data.fx_rate import FXRate from amaascore.tools.generate_market_data import generate_fx_rate class FXRateTest(unittest.TestCase): def setUp(self): self.longMessage = True...
2.671875
3