content
stringlengths
7
928k
avg_line_length
float64
3.5
33.8k
max_line_length
int64
6
139k
alphanum_fraction
float64
0.08
0.96
licenses
list
repository_name
stringlengths
7
104
path
stringlengths
4
230
size
int64
7
928k
lang
stringclasses
1 value
# -*- coding: UTF-8 -*- from __future__ import print_function, division import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler from torch.autograd import Variable from torchvision import datasets, models, transforms from tensorboardX import ...
38.755776
154
0.664311
[ "MIT" ]
mangye16/ReID-Label-Noise
PNet/train_pnet.py
11,743
Python
from abc import abstractmethod from collections import deque from copy import deepcopy from libcheckers import BoardConfig, InvalidMoveException from libcheckers.enum import Player, PieceClass, GameOverReason from libcheckers.utils import ( index_to_coords, coords_to_index, get_indexes_between, get_lin...
36.308026
108
0.623193
[ "MIT" ]
YuriyGuts/libcheckers
libcheckers/movement.py
16,738
Python
# This utility function comes up with which racers to use in the next race def racerCalculator(raceNum, numCars): print("RaceNum",raceNum) print("numCars",numCars) if raceNum is None: raceNum = 1 f = lambda x : (raceNum*3+x) % numCars return f(0),f(1),f(2)
28.6
74
0.657343
[ "MIT" ]
Sam-Gram/PiWood-Derby
racerCalculator.py
286
Python
from diversity_filters import NoFilter, NoFilterWithPenalty from diversity_filters.base_diversity_filter import BaseDiversityFilter from diversity_filters.diversity_filter_parameters import DiversityFilterParameters class DiversityFilter: def __new__(cls, parameters: DiversityFilterParameters) -> BaseDiversityFi...
40.923077
83
0.789474
[ "Apache-2.0" ]
MolecularAI/Lib-INVENT
diversity_filters/diversity_filter.py
532
Python
""" The ``transaction`` submodule contains a wrapper class to simplify the usage of transactions:: t = revitron.Transaction() ... t.close() """ # from pyrevit import script class Transaction: """ A transaction helper class. """ def __init__(self): """ Inits a...
21.325
95
0.532239
[ "MIT" ]
YKato521/revitron-for-RevitPythonShell
revitron/transaction.py
853
Python
import requests import json from pprint import pprint as print def getCode(res:str) : return str(res).split("[")[1].split("]")[0] url = 'http://localhost:4042' guid = '2012491924' # get guid from connexion.json() guid2 = '0' gurl = f"{url}/{guid}" home = requests.post(url) print (getCode(home)) print (home.json(...
25.418605
65
0.601098
[ "MIT" ]
jonelleamio/AdventureGameServer
bin/test_server.py
1,093
Python
import configargparse as cfargparse import os import torch import onmt.opts as opts from onmt.utils.logging import logger class ArgumentParser(cfargparse.ArgumentParser): def __init__( self, config_file_parser_class=cfargparse.YAMLConfigFileParser, formatter_clas...
41.307143
79
0.6175
[ "MIT" ]
ACL2020-Submission/ACL2020
onmt/utils/parse.py
5,783
Python
# -*- coding: utf-8 -*- # 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...
31.441176
74
0.77362
[ "Apache-2.0" ]
FoIIon/google-ads-python
google/ads/googleads/v7/services/services/hotel_group_view_service/transports/__init__.py
1,069
Python
import kanu while True: print('\n Select one:') print('\t1 -> Solve a linear equation') print('\t2 -> Simplify any expression') print('\t3 -> Is this number a Perfect Square?') print('\t4 -> Get Prime Numbers') print('\t5 -> START A NUCLEAR WAR :)') print('\t6 -> Factor Integers')...
27.849558
61
0.479504
[ "MIT" ]
ThiccTT/nivek-maths
Nivek maths/nivek-maths.py
3,147
Python
"""Custom data update coordinators for the GitHub integration.""" from __future__ import annotations from typing import Literal, TypedDict from aiogithubapi import ( GitHubAPI, GitHubCommitModel, GitHubException, GitHubReleaseModel, GitHubRepositoryModel, ) from homeassistant.config_entries impor...
32.577465
88
0.676827
[ "Apache-2.0" ]
Arquiteto/core
homeassistant/components/github/coordinator.py
4,626
Python
def add(a: int, b: int) -> int: return a + b def subtract(a: int, b: int) -> int: return a - b def multiply(a: int, b: int or str) -> int: return a * b """ ... ---------------------------------------------------------------------- Ran 3 tests in 0.000s OK """
13.95
70
0.387097
[ "Apache-2.0" ]
MahanBi/python-tests
unittest/code.py
279
Python
# coding=utf-8 VERSION = '1.8.1' __VERSION__ = VERSION def increase(): import os import re filename = os.path.abspath(__file__) with open(filename, encoding='utf8') as file: content = file.read() match = re.search(r"VERSION = '(\d+).(\d+).(\d+)'", content) old = f'{match.group(1)}.{m...
25.045455
72
0.598911
[ "MIT" ]
StevenBaby/chess
src/version.py
551
Python
import os import time from WebKit.URLParser import ServletFactoryManager from WebUtils.Funcs import htmlEncode from AdminSecurity import AdminSecurity class ServletCache(AdminSecurity): """Display servlet cache. This servlet displays, in a readable form, the internal data structure of the cache of all s...
37.254098
78
0.551155
[ "MIT" ]
Cito/w4py
WebKit/Admin/ServletCache.py
4,545
Python
n=(input("Enter a number")) a=len(n) s=int(n) sum=0 p=s while s>0: b=s%10 sum=sum+b**a s=s//10 if sum==p: print("It is an Amstrong Number") else: print("It is Not an Amstrong Number")
15.615385
41
0.591133
[ "Apache-2.0" ]
nikhilsamninan/python-files
day2/amstrongnospl.py
203
Python
# Generated by Django 2.1 on 2019-01-12 15:12 import django.db.models.deletion from django.db import migrations, models import pretix.base.models.fields class Migration(migrations.Migration): dependencies = [ ('pretixbase', '0104_auto_20181114_1526'), ] operations = [ migrations.AddFie...
25.703704
86
0.635447
[ "Apache-2.0" ]
Janfred/pretix
src/pretix/base/migrations/0105_auto_20190112_1512.py
694
Python
import sys sys.path.append('../') import torch import numpy as np import random import math import time import argparse from data_tlp_cite import DataHelper_t from torch.utils.data import DataLoader from model import Model from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRe...
41.418605
109
0.688564
[ "MIT" ]
WenZhihao666/TREND
main_test.py
5,343
Python
import numpy as np import random random.seed(200) # Create Sigmoid Function def sig(inp): return (1/(1+np.exp(-1*inp))) # For Back Propagation, make Desigmoid function def dsig(inp): return (1.0-inp)*inp # Define class for neuron class Neuron: def __init__(self,weights,func,dfunc): # member varia...
31.90411
83
0.572349
[ "MIT" ]
Henrynaut/ML
scripts/neural_net_workshop.py
4,658
Python
# License: MIT License import unittest import glob import os import networkx as nx import numpy as np import itertools from ...PyCTBN.structure_graph.sample_path import SamplePath from ...PyCTBN.structure_graph.network_graph import NetworkGraph from ...PyCTBN.utility.json_importer import JsonImporter class TestNe...
48.989691
127
0.675295
[ "MIT" ]
madlabunimib/PyCTBN
PyCTBN/tests/structure_graph/test_networkgraph.py
9,504
Python
import os import urllib import torch from torch.utils import model_zoo class CheckpointIO(object): ''' CheckpointIO class. It handles saving and loading checkpoints. Args: checkpoint_dir (str): path where checkpoints are saved ''' def __init__(self, checkpoint_dir='./chkpts', **kwargs):...
29.346535
70
0.584345
[ "MIT" ]
1ucky40nc3/mednerf
graf-main/submodules/GAN_stability/gan_training/checkpoints.py
2,964
Python
from axelrod.action import Action from axelrod.player import Player C, D = Action.C, Action.D class Appeaser(Player): """A player who tries to guess what the opponent wants. Switch the classifier every time the opponent plays D. Start with C, switch between C and D when opponent plays D. Names: ...
25.923077
68
0.575668
[ "MIT" ]
DPros/Axelrod
axelrod/strategies/appeaser.py
1,012
Python
from django.contrib import admin from .models import Sport, Activity, Settings, Traces, Lap admin.site.register(Sport) admin.site.register(Activity) admin.site.register(Settings) admin.site.register(Traces) admin.site.register(Lap)
23.4
58
0.807692
[ "MIT" ]
lucasace/workoutizer
wizer/admin.py
234
Python
import uuid from turkit2.common import TextClassification from turkit2.qualifications import Unique, Locale, AcceptRate from utils import get_client client = get_client() quals = [Locale(), AcceptRate()] task = TextClassification(client, 'Test3', '0.01', 'test test', 600, 6000, ['positive', 'negative'], question='Wh...
26.2
190
0.700763
[ "MIT" ]
anthliu/turkit2
tests/text_classification_nonsync.py
655
Python
from typing import Dict from exaslct_src.lib.export_container_task import ExportContainerTask from exaslct_src.lib.data.required_task_info import RequiredTaskInfo from exaslct_src.lib.docker.docker_create_image_task import DockerCreateImageTask class ExportContainerTasksCreator(): def __init__(self, export_path...
45.275
92
0.692435
[ "MIT" ]
mace84/script-languages
exaslct_src/lib/export_container_tasks_creator.py
1,811
Python
from subprocess import check_output def isrunning(processName): tasklist = check_output('tasklist', shell=False) tasklist = str(tasklist) return(processName in tasklist)
26.142857
52
0.759563
[ "MIT" ]
ShaderLight/autochampselect
modules/isrunning.py
183
Python
from lithops.multiprocessing import Process, JoinableQueue def worker(q): working = True while working: x = q.get() # Do work that may fail assert x < 10 # Confirm task q.task_done() if x == -1: working = False if __name__ == '__main__': q =...
16.484848
58
0.527574
[ "Apache-2.0" ]
GEizaguirre/lithops
examples/multiprocessing/joinable_queue.py
544
Python
# Python program to draw smile # face emoji using turtle import turtle # turtle object pen = turtle.Turtle() # function for creation of eye def eye(col, rad): pen.down() pen.fillcolor(col) pen.begin_fill() pen.circle(rad) pen.end_fill() pen.up() # draw face pen.fillcolo...
15.672727
31
0.616009
[ "MIT" ]
ShashankShenoy21/Matlab-and-Python
Smiley_face.py
862
Python
from __future__ import annotations from typing import NoReturn from . import LinearRegression from ...base import BaseEstimator import numpy as np # import linear_regression class PolynomialFitting(BaseEstimator): """ Polynomial Fitting using Least Squares estimation """ def __init__(self, k: int) -> ...
28.451613
83
0.586546
[ "MIT" ]
shirlevy007/IML.HUJI
IMLearn/learners/regressors/polynomial_fitting.py
2,646
Python
"""BackPACK extensions/hooks for computing low-rank factors of the GGN."""
37.5
74
0.76
[ "MIT" ]
PwLo3K46/vivit
vivit/extensions/secondorder/__init__.py
75
Python
import math import warnings from functools import reduce import numpy as np import torch from backpack import backpack, extend from backpack.extensions import BatchGrad from gym.utils import seeding from torchvision import datasets, transforms from dacbench import AbstractEnv warnings.filterwarnings("ignore") clas...
31.41189
100
0.59973
[ "Apache-2.0" ]
goktug97/DACBench
dacbench/envs/sgd.py
14,795
Python
from __future__ import print_function import sys import os import subprocess from .simsalabim import __version__, __copyright__ from . import add_quant_info as quant from . import helpers def main(argv): print('dinosaur-adapter version %s\n%s' % (__version__, __copyright__)) print('Issued command:', os.path.base...
47.5
176
0.622775
[ "Apache-2.0" ]
MatthewThe/simsalabim
simsalabim/dinosaur_adapter.py
5,225
Python
# _*_ coding: utf-8 _*_ """ util_urlfilter.py by xianhu """ import re import pybloom_live from .util_config import CONFIG_URLPATTERN_ALL class UrlFilter(object): """ class of UrlFilter, to filter url by regexs and (bloomfilter or set) """ def __init__(self, black_patterns=(CONFIG_URLPATTERN_ALL,), ...
31.716418
128
0.618824
[ "BSD-2-Clause" ]
charlesXu86/PSpider
spider/utilities/util_urlfilter.py
2,125
Python
#!/usr/bin/env python '''command long''' import threading import time, os import math from pymavlink import mavutil from MAVProxy.modules.lib import mp_module from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.pyplot as plt from threading import Thread import mpl_toolkits.mplot3d.axes3d as...
36.367371
93
0.487333
[ "CC0-1.0" ]
joakimzhang/python-electron
pycalc/MAVProxy/modules/mavproxy_cmdlong.py
30,985
Python
""" This module is intended to extend functionality of the code provided by original authors. The process is as follows: 1. User has to provide source root path containing (possibly nested) folders with dicom files 2. The program will recreate the structure in the destination root path and anonymize all ...
31.026923
118
0.655882
[ "BSD-3-Clause" ]
ademyanchuk/dicom-anonymizer
dicomanonymizer/batch_anonymizer.py
8,067
Python
import pickle import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import warnings warnings.filterwarnings('ignore') df = pd.read_csv('Train.csv') # check for categorical attributes cat_col = [] for x in df.dtypes.index: if df.dtypes[x] == 'object': ca...
38.302632
115
0.707317
[ "MIT" ]
MayurJ-mike/Bigmart-analysis-ml
bigmart.py
2,911
Python
"""State-Split Transformation ----------------------------- (C) Frank-Rene Schaefer The 'State-Split' is a procedure transforms a state machine that triggers on some 'pure' values (e.g. Unicode Characters) into a state machine that triggers on the code unit sequences (e.g. UTF8 Code Units) that correspond to the origi...
43.550505
91
0.606923
[ "MIT" ]
smmckay/quex-mirror
quex/engine/state_machine/transformation/state_split.py
17,246
Python
import os import platform import ctypes import subprocess import distutils.command.build_py from distutils.core import setup class build_cnmpc(distutils.command.build_py.build_py): description = """Build the CNMPC shared library""" def run(self): subprocess.call("cmake -DCMAKE_BUILD_TYPE=Release . &&...
35.1875
78
0.58733
[ "MPL-2.0" ]
GCTMODS/nmpc
setup.py
1,689
Python
# small demo for listmode TOF MLEM without subsets import os import matplotlib.pyplot as py import pyparallelproj as ppp from pyparallelproj.wrapper import joseph3d_fwd, joseph3d_fwd_tof, joseph3d_back, joseph3d_back_tof import numpy as np import argparse import ctypes from time import time #------------------------...
38.379845
99
0.576247
[ "MIT" ]
KrisThielemans/parallelproj
examples/projector_order_test.py
4,951
Python
import asyncio import random import re import textwrap import discord from .. import utils, errors, cmd from ..servermodule import ServerModule, registered from ..enums import PrivilegeLevel @registered class TruthGame(ServerModule): MODULE_NAME = "Truth Game" MODULE_SHORT_DESCRIPTION = "Tools to play *Truth*...
36.166667
113
0.650099
[ "MIT" ]
simshadows/Discord-mentionbot
mentionbot/servermodules/truthgame.py
9,114
Python
""" Module for all Form Tests. """ import pytest from django.utils.translation import gettext_lazy as _ from my_blog.users.forms import UserCreationForm from my_blog.users.models import User pytestmark = pytest.mark.django_db class TestUserCreationForm: """ Test class for all tests related to the UserCreati...
29.075
87
0.628547
[ "MIT" ]
Tanishk-Sharma/my_blog
my_blog/users/tests/test_forms.py
1,163
Python
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
41.273381
104
0.643891
[ "Apache-2.0" ]
FRI-DAY/airflow
airflow/providers/google/cloud/operators/sql_to_gcs.py
11,474
Python
from shallowflow.api.source import AbstractListOutputSource from shallowflow.api.config import Option class ForLoop(AbstractListOutputSource): """ Outputs an integer from the specified range. """ def description(self): """ Returns a description for the actor. :return: the act...
30.545455
113
0.556052
[ "MIT" ]
waikato-datamining/shallow-flow
base/src/shallowflow/base/sources/_ForLoop.py
2,016
Python
# -*- coding: utf-8 -*- # 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...
45.822581
94
0.638226
[ "Apache-2.0" ]
googleapis/googleapis-gen
google/cloud/vision/v1p3beta1/vision-v1p3beta1-py/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py
14,205
Python
import io import os import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from PIL import Image def resize_axis(tensor, axis, new_size, fill_value=0, random_sampling=False): """Truncates or pads a tensor to new_size on on a given axis. Truncate or extend tensor s...
37.033333
131
0.633663
[ "Apache-2.0" ]
glee1228/segment_temporal_context_aggregation
utils.py
2,222
Python
from .infinity import INFINITY import json from typing import List, Tuple, Any, Type, Union, TypeVar, Generic, Optional, Dict, cast, Callable T = TypeVar('T') class PageProperty(Generic[T]): """ A class to represent a property that varies depending on the pages of a spectral sequence. This...
34.520548
104
0.547619
[ "Apache-2.0", "MIT" ]
JoeyBF/sseq
chart/chart/python/spectralsequence_chart/page_property.py
5,040
Python
# Generated by Django 2.1.3 on 2018-12-08 05:56 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('staf', '0008_auto_20181207_1525'), ] operations = [ migrations.AddField( model_name='dataset', ...
24.45
123
0.640082
[ "MIT" ]
metabolism-of-cities/ARCHIVED-metabolism-of-cities-platform-v3
src/staf/migrations/0009_dataset_process.py
489
Python
"""about command for osxphotos CLI""" from textwrap import dedent import click from osxphotos._constants import OSXPHOTOS_URL from osxphotos._version import __version__ MIT_LICENSE = """ MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documen...
50.848387
104
0.748588
[ "MIT" ]
oPromessa/osxphotos
osxphotos/cli/about.py
15,763
Python
from abc import ABCMeta, abstractmethod class Book(object, metaclass=ABCMeta): def __init__(self,title,author): self.title=title self.author=author @abstractmethod def display(): pass
27.375
40
0.680365
[ "MIT" ]
SriCharan220800/RomanReigns
13)Abstract classes.py
219
Python
# -*- coding: utf-8 -*- """ Logging for the hubble daemon """ import logging import time import hubblestack.splunklogging # These patterns will not be logged by "conf_publisher" and "emit_to_splunk" PATTERNS_TO_FILTER = ["password", "token", "passphrase", "privkey", "keyid", "s3.key", "splun...
28.943231
99
0.664152
[ "Apache-2.0" ]
instructure/hubble
hubblestack/log.py
6,628
Python
import os class ConfigParams: def __init__(self,configPath): self.env_dist = os.environ #权限验证 self.api_key = "" # userID = "" # ip = "0.0.0.0" #模型相关存放根目录 self.modelPath = os.path.join(os.getcwd(),"model") cpuCores = 0 threads = 2 por...
26.3
131
0.576046
[ "MIT" ]
MistSun-Chen/py_verifier
common/configParams.py
1,622
Python
import sys, gzip, logging from .in_util import TimeReport, detectFileChrom, extendFileList, dumpReader #======================================== # Schema for AStorage #======================================== _TRASCRIPT_PROPERTIES = [ {"name": "Ensembl_geneid", "tp": "str", "opt": "repeat"}, {"name":...
37.005848
78
0.459387
[ "Apache-2.0" ]
ForomePlatform/Anfisa-Annotations
a_storage/ingest/in_dbnsfp4.py
12,656
Python
# Source: https://gist.github.com/redknightlois/c4023d393eb8f92bb44b2ab582d7ec20 from torch.optim.optimizer import Optimizer import torch import math class Ralamb(Optimizer): def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, weight_decay=1e-4): defaults = dict(lr=lr, betas=betas, eps=eps...
40.191919
195
0.508922
[ "MIT" ]
achaiah/pywick
pywick/optimizers/ralamb.py
3,979
Python
import sys import json import hashlib import gc from operator import * import shlex from pyspark import StorageLevel from pyspark.sql import SQLContext from pyspark.sql.functions import * from pyspark.sql.types import * import numpy as np from subjectivity_clues import clues def expect(name, var, expected, op=eq):...
39.711039
205
0.739024
[ "Apache-2.0" ]
chuajiesheng/twitter-sentiment-analysis
step_2/scripts/sample_subjectivity_tweets.py
12,231
Python
import os import sys from setuptools import find_packages, setup IS_RTD = os.environ.get("READTHEDOCS", None) version = "0.4.0b14.dev0" long_description = open(os.path.join(os.path.dirname(__file__), "README.rst")).read() install_requires = [ "morepath==0.19", "alembic", "rulez>=0.1.4,<0.2.0", "inv...
22.782609
94
0.579771
[ "Apache-2.0" ]
morpframework/morpfw
setup.py
2,620
Python
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
40.652174
118
0.647772
[ "MIT" ]
pjquirk/azure-sdk-for-python
sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/update_history_property.py
2,805
Python
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/ads/googleads/v6/resources/paid_organic_search_term_view.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.proto...
58.404255
1,006
0.816393
[ "Apache-2.0" ]
arammaliachi/google-ads-python
google/ads/google_ads/v6/proto/resources/paid_organic_search_term_view_pb2.py
5,490
Python
from itertools import product from json import dumps import logging import nox # noqa from pathlib import Path # noqa import sys # add parent folder to python path so that we can import noxfile_utils.py # note that you need to "pip install -r noxfile-requiterements.txt" for this file to work. sys.path.append(str(P...
44.498195
120
0.682865
[ "BSD-3-Clause" ]
texnofobix/python-genbadge
noxfile.py
12,326
Python
from hotel_app.views import * from rest_framework import routers router = routers.DefaultRouter() router.register(r'rooms', RoomAPIView) router.register(r'employee', EmployeeAPIView) router.register(r'resident', ResidentAPIView) router.register(r'booking', BookingRecordAPIView) router.register(r'cleaning', CleaningSch...
33.4
53
0.826347
[ "MIT" ]
ErmShadow/ITMO_ICT_WebDevelopment_2020-2021
students/K33401/Kunal_Shubham/lab3/hotel_project/hotel_app/router.py
334
Python
import os class FileCredentials: def __init__(self, credentials_file): if credentials_file == None: credentials_file = os.path.expanduser("~") + "/.pingboard" self.credentials_file = credentials_file self.client_id = None self.client_secret = None def load(self): ...
27.40625
95
0.600342
[ "MIT" ]
tsouza/pyngboard
pyngboard/credentials.py
1,754
Python
#!usr/bin/env python3 # -*- coding:utf-8 -*- __author__ = 'yanqiong' import random import secrets from bisect import bisect_right from sgqlc.operation import Operation from pandas.core.internals import BlockManager from tqsdk.ins_schema import ins_schema, _add_all_frags RD = random.Random(secrets.randbits(128)) #...
35.120567
108
0.577948
[ "Apache-2.0" ]
Al-Wang/tqsdk-python
tqsdk/utils.py
5,470
Python
# -*- coding: utf-8 -*- # Copyright 2018 IBM. # # 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 agre...
32.875
119
0.636248
[ "Apache-2.0" ]
eugescu/aqua
qiskit_aqua/algorithms/components/optimizers/nlopts/esch.py
2,367
Python
# Generated by Django 3.2.11 on 2022-02-10 16:05 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("cabins", "0020_auto_20211111_1825"), ("cabins", "0021_booking_is_declined"), ] operations = []
19.142857
48
0.660448
[ "MIT" ]
hovedstyret/indok-web
backend/apps/cabins/migrations/0022_merge_20220210_1705.py
268
Python
#! /usr/bin/env python3 """Unit tests for smartcard.readers.ReaderGroups This test case can be executed individually, or with all other test cases thru testsuite_framework.py. __author__ = "http://www.gemalto.com" Copyright 2001-2012 gemalto Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com This fil...
35.197531
76
0.632936
[ "BSD-3-Clause" ]
kyletanyag/LL-Smartcard
cacreader/pyscard-2.0.2/smartcard/test/framework/testcase_readergroups.py
5,702
Python
# Copyright (C) 2018-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging as log from io import IOBase import networkx as nx import numpy as np from openvino.tools.mo.ops.elementwise import Mul from openvino.tools.mo.ops.split import AttributedVariadicSplit from openvino.tools.mo.front.common....
45.217469
156
0.643277
[ "Apache-2.0" ]
3Demonica/openvino
tools/mo/openvino/tools/mo/front/kaldi/loader/loader.py
25,367
Python
#!/usr/bin/env python """ SHUTDOWN.PY Shutdown Plugin (C) 2015, rGunti """ import dot3k.lcd as lcd import dot3k.backlight as backlight import time, datetime, copy, math, psutil import sys import os from dot3k.menu import Menu, MenuOption class Shutdown(MenuOption): def __init__(self): self.last = self.millis...
20.189655
41
0.672075
[ "MIT" ]
rGunti/Yuki-Chan-Music-Player
display/plugins/Shutdown.py
1,171
Python
from collections import Iterable from itertools import combinations 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_rational_type, msat_get_bool_type from mathsat import msat_make_and, msat_make_not, msat_make...
39.578947
88
0.591534
[ "MIT" ]
EnricoMagnago/F3
benchmarks/ltl_timed_transition_system/token_ring/f3/token_ring_0024.py
13,536
Python
# Print iterations progress def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', printEnd = "\r"): """ Call in a loop to create terminal progress bar @params: iteration - Required : current iteration (Int) total - Required : tota...
47.64
123
0.592779
[ "Apache-2.0" ]
MariusDgr/AudioMining
src/utils/console_functions.py
1,193
Python
"""Julia set generator without optional PIL-based image drawing""" import time #from memory_profiler import profile # area of complex space to investigate x1, x2, y1, y2 = -1.8, 1.8, -1.8, 1.8 c_real, c_imag = -0.62772, -.42193 @profile def calculate_z_serial_purepython(maxiter, zs, cs): """Calculate output list...
34.4
109
0.642248
[ "MIT" ]
dkdldbdbdosk/High_Performance_Python
codes/01_profiling/memory_profiler/julia1_memoryprofiler2.py
2,580
Python
import os import csv # File path election_dataCSV = os.path.join('.', 'election_data.csv') # The total number of votes cast # A complete list of candidates who received votes # The percentage of votes each candidate won # The total number of votes each candidate won # The winner of the election based on popular vote...
30.625
171
0.621521
[ "MIT" ]
dorispira/Python
PyPoll/main.py
2,695
Python
''' A collection of functions to perform portfolio analysis. Max Gosselin, 2019 ''' import numpy as np import pandas as pd from scipy import optimize def portfolio_metrics(weights, avg_xs_returns, covariance_matrix): ''' Compute basic portfolio metrics: return, stdv, sharpe ratio ''' por...
32.682432
112
0.647509
[ "MIT", "Unlicense" ]
MaxGosselin/portfolio_optimizer
portfolio_functions.py
4,837
Python
from mmcv.utils import Registry, build_from_cfg from .check_argument import (equal_len, is_2dlist, is_3dlist, is_ndarray_list, is_none_or_type, is_type_list, valid_boundary) from .collect_env import collect_env from .img_util import drop_orientation from .lmdb_util import lmdb_converter fr...
37.3125
78
0.747069
[ "Apache-2.0" ]
Darrenonly/mmocr
mmocr/utils/__init__.py
597
Python
## @example pyfast_and_pyside2_custom_window.py # This example demonstrates how to use FAST in an existing PySide2 application. # # @m_class{m-block m-warning} @par PySide2 Qt Version # @parblock # For this example you <b>must</b> use the same Qt version of PySide2 as used in FAST (5.14.0) # Do this with: <b>pi...
32.897436
109
0.693687
[ "BSD-2-Clause" ]
andreped/FAST
source/FAST/Examples/Python/pyfast_and_pyside2_custom_window.py
2,566
Python
# Project Quex (http://quex.sourceforge.net); License: MIT; # (C) 2005-2020 Frank-Rene Schaefer; #_______________________________________________________________________________ from quex.input.setup import NotificationDB from quex.input.regular_expression.pattern import Patt...
44.238589
111
0.60892
[ "MIT" ]
Liby99/quex
quex/input/files/specifier/counter.py
21,323
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 5/15/20 4:49 PM # @File : grover.py # qubit number=2 # total number=20 import cirq import cirq.google as cg from typing import Optional import sys from math import log2 import numpy as np #thatsNoCode from cirq.contrib.svg import SVGCircuit # Symbols for...
31.171429
77
0.691567
[ "BSD-3-Clause" ]
UCLA-SEAL/QDiff
data/p2DJ/New/program/cirq/startCirq347.py
2,182
Python
import requests import urllib.parse import posixpath import pandas as pd def get_enrollment_dates(course): '''Takes a course object and returns student dates of enrollment. Useful for handling late registrations and modified deadlines. Example: course.get_enrollment_date()''' url_path = posixpath....
37.808511
134
0.638295
[ "MIT" ]
hsmohammed/rudaux
scripts/canvas.py
7,108
Python
# -*- coding: utf-8 -*- """ pygments.lexers.graphics ~~~~~~~~~~~~~~~~~~~~~~~~ Lexers for computer graphics and plotting related languages. :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.lexer import RegexLexe...
49.923274
104
0.479662
[ "BSD-3-Clause" ]
ritchadh/docs-like-code-demo
env/lib/python3.7/site-packages/pygments/lexers/graphics.py
39,040
Python
import os import sys from typing import Dict from typing import List from typing import Optional import pkg_resources from setuptools import find_packages from setuptools import setup def get_version() -> str: version_filepath = os.path.join(os.path.dirname(__file__), "optuna", "version.py") with open(versi...
31.574297
92
0.512338
[ "MIT" ]
130ndim/optuna
setup.py
7,862
Python
from ..coefficient_array import PwCoeffs from scipy.sparse import dia_matrix import numpy as np def make_kinetic_precond(kpointset, c0, eps=0.1, asPwCoeffs=True): """ Preconditioner P = 1 / (||k|| + ε) Keyword Arguments: kpointset -- """ nk = len(kpointset) nc = kpointset.ctx().num_s...
26.92029
91
0.544818
[ "BSD-2-Clause" ]
electronic-structure/SIRIUS
python_module/sirius/ot/ot_precondition.py
3,716
Python
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2011 Cisco Systems, Inc. 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...
34.317073
78
0.739161
[ "Apache-2.0" ]
r-mibu/neutron
quantum/plugins/cisco/nexus/cisco_nexus_configuration.py
1,407
Python
import os def ensure_dir(path: str) -> str: dirname = os.path.dirname(path) os.makedirs(dirname, exist_ok=True) return path
22.666667
39
0.691176
[ "MIT" ]
mbiemann/python-simple-toolbelt
simple_toolbelt/path.py
136
Python
import emoji import string class Tweet(): def __init__(self, text: str): self.text = text.lower() self.hashtags = self.find("#", forbidden="@") self.cleanTag() self.tags = self.find("@", forbidden="#") def find(self, prefix, forbidden): ret = [] _text = self.tex...
28.956522
105
0.512763
[ "MIT" ]
EliasSchramm/TwitterDB
crawler/tweet.py
1,336
Python
''' Neuron simulator export for: Components: net1 (Type: network) sim1 (Type: Simulation: length=1.0 (SI time) step=5.0E-5 (SI time)) hhcell (Type: cell) passive (Type: ionChannelPassive: conductance=1.0E-11 (SI conductance)) na (Type: ionChannelHH: conductance=1.0E-11 (SI conductance)) k (T...
31.72093
128
0.566166
[ "MIT" ]
openworm/org.geppetto.model.neuroml
src/test/resources/expected/neuron/hhcell/main_script.py
5,456
Python
# Character field ID when accessed: 100000201 # ParentID: 32226 # ObjectID: 0
19.5
45
0.75641
[ "MIT" ]
doriyan13/doristory
scripts/quest/autogen_q32226s.py
78
Python
# Josh Aaron Miller 2021 # VenntDB methods for Characters import venntdb from constants import * # VenntDB Methods def character_exists(self, username, char_id): return self.get_character(username, char_id) is not None def get_character(self, username, char_id): self.assert_valid("accounts",...
30.219512
77
0.702986
[ "MIT" ]
JackNolanDev/vennt-server
db_characters.py
1,239
Python
from output.models.nist_data.atomic.g_year_month.schema_instance.nistschema_sv_iv_atomic_g_year_month_enumeration_5_xsd.nistschema_sv_iv_atomic_g_year_month_enumeration_5 import ( NistschemaSvIvAtomicGYearMonthEnumeration5, NistschemaSvIvAtomicGYearMonthEnumeration5Type, ) __all__ = [ "NistschemaSvIvAtomic...
40.1
179
0.875312
[ "MIT" ]
tefra/xsdata-w3c-tests
output/models/nist_data/atomic/g_year_month/schema_instance/nistschema_sv_iv_atomic_g_year_month_enumeration_5_xsd/__init__.py
401
Python
import os from setuptools import setup def filepath(fname): return os.path.join(os.path.dirname(__file__), fname) exec(compile(open('bevel/version.py').read(), 'bevel/version.py', 'exec')) readme_md = filepath('README.md') try: import pypandoc readme_rst = pypandoc.convert_file(readm...
24.277778
60
0.591915
[ "MIT" ]
ChihHsuanLin/bevel
setup.py
1,311
Python
todos = ['barber', 'grocery'] for todo in todos: print(todo)
16.5
30
0.621212
[ "MIT" ]
theseana/fempfasb
Term 5/Vue/p.py
66
Python
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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/lice...
34.129032
111
0.757089
[ "Apache-2.0" ]
anxingle/nnUNet_simple
nnunet/utilities/file_endings.py
1,058
Python
from dataclasses import dataclass from apple.util.streamable import Streamable, streamable @dataclass(frozen=True) @streamable class BackupInitialized(Streamable): """ Stores user decision regarding import of backup info """ user_initialized: bool # Stores if user made a selection in UI. (Skip vs I...
33.941176
92
0.755633
[ "Apache-2.0" ]
Apple-Network/apple-blockchain
apple/wallet/settings/settings_objects.py
577
Python
""" This file holds all the chapter 2 areas of the game. """ from time import sleep # from classes import Player, Difficulty from chapters.chapter import Chapter from chapters.chapter3 import Chapter3 from other.sounds_effects import GameSounds from game import player1, sounds, Difficulty from choices import _player_c...
44.186047
120
0.613421
[ "MIT" ]
JordanLeich/Alpha-Zombie-Survival-Game
chapters/chapter2.py
3,800
Python
import numpy from fframework import asfunction, OpFunction __all__ = ['Angle'] class Angle(OpFunction): """Transforms a mesh into the angle of the mesh to the x axis.""" def __init__(self, mesh): """*mesh* is the mesh Function.""" self.mesh = asfunction(mesh) def __call__(self, ps): ...
24.7
70
0.621457
[ "MIT" ]
friedrichromstedt/moviemaker3
moviemaker3/math/angle.py
494
Python
from pathlib import Path import numba import numpy as np from det3d.core.bbox.geometry import ( points_count_convex_polygon_3d_jit, points_in_convex_polygon_3d_jit, ) try: from spconv.utils import rbbox_intersection, rbbox_iou except: print("Import spconv fail, no support for sparse convolut...
36.460123
88
0.57126
[ "MIT" ]
motional/polarstream
det3d/core/bbox/box_np_ops.py
29,715
Python
from core.himesis import Himesis, HimesisPreConditionPatternLHS import uuid class HContractUnitR03_ConnectedLHS(HimesisPreConditionPatternLHS): def __init__(self): """ Creates the himesis graph representing the AToM3 model HContractUnitR03_ConnectedLHS """ # Flag this instance as compiled now self.is_compil...
26.489796
114
0.716487
[ "MIT" ]
levilucio/SyVOLT
UML2ER/contracts/unit/HContractUnitR03_ConnectedLHS.py
1,298
Python
import numpy as np import networkx as nx if __name__ == '__main__': from ged4py.algorithm import graph_edit_dist else: from .ged4py.algorithm import graph_edit_dist def rearrange_adj_matrix(matrix, ordering): assert matrix.ndim == 2 # Check that matrix is square assert matrix.shape[0] == matrix.sh...
34.147059
105
0.676715
[ "MIT" ]
BrunoKM/rhoana_graph_tools
utils/graph_utils.py
3,483
Python
import time from typing import Optional, Dict import torch from torch import nn, optim from torch.utils.data import DataLoader from torch.nn.utils.rnn import pack_padded_sequence from utils import TensorboardWriter, AverageMeter, save_checkpoint, accuracy, \ clip_gradient, adjust_learning_rate from metrics import ...
36.77892
121
0.551618
[ "MIT" ]
Renovamen/Image-Caption
trainer/trainer.py
14,308
Python
# Get substring using 'start' and 'end' position. def get_substring_or_empty(data, start, end=''): if start in data: if '' == start: f = 0 else: f = len(start) f = data.find(start) + f data = data[f:] else: return '' if end in data: ...
20.04
49
0.447106
[ "MIT" ]
domorelivelonger/rss-telegram-bot
utils.py
501
Python
import cmath import math cv =150 cvconv = 736 t1 =440 t2 = 254 polos = 10 freq = 60 r1 = 0.012 R2L = 0.018 X1 = 0.08 X2L = X1 Rp = 58 Xm = 54 print("\nConsidere que o motor é alimentado com tensão de fase igual a 254 V, conexão Y e atinge escorregamento igual a 1,8%") print("\nA - Corrente no estator\n") s = 0.018 p...
17.333333
126
0.582933
[ "MIT" ]
Boa-Thomas/Eletricidade
P5/Brasilia/Q7 - BR.py
1,667
Python
from dis_snek.models import InteractionContext, OptionTypes, slash_command, slash_option from ElevatorBot.commandHelpers.subCommandTemplates import poll_sub_command from ElevatorBot.commands.base import BaseScale from ElevatorBot.core.misc.poll import Poll class PollRemove(BaseScale): @slash_command( **p...
32
114
0.710938
[ "MIT" ]
LukasSchmid97/elevatorbot
ElevatorBot/commands/miscellaneous/poll/remove.py
1,024
Python
# + import numpy as np import holoviews as hv from holoviews import opts import matplotlib.pyplot as plt from plotsun import plot_sun hv.extension('bokeh', 'matplotlib') # - # # Load data data = np.load('npz_timeseries/subset.npz') arr = data['arr'] stack = data['stack'] sun = data['sun'] print(arr.shape, stack.sha...
21.553846
73
0.589579
[ "BSD-3-Clause" ]
cisaacstern/horpyzon
datashader_nb.py
1,401
Python
# -*- coding: utf-8 -*- from django.conf.urls import include from django.conf.urls import url from rest_framework.routers import DefaultRouter from .views import * # register的可选参数 base_name: 用来生成urls名字,如果viewset中没有包含queryset, base_name一定要有 router = DefaultRouter() router.register(r'idcs', IdcViewSet) router.register...
30.956522
75
0.771067
[ "BSD-3-Clause" ]
17702296834/open-cmdb
backend/category/urls.py
758
Python
from django.contrib import admin from django.contrib.auth import get_user_model from django.contrib.contenttypes.models import ContentType from django.utils.translation import ugettext_lazy as _ from djangocms_versioning.constants import PUBLISHED, VERSION_STATES from djangocms_versioning.versionables import _cms_exte...
39.38
104
0.660995
[ "BSD-3-Clause" ]
Aiky30/djangocms-content-expiry
djangocms_content_expiry/filters.py
7,876
Python