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
import math def is_prime_power(n): #even number divisible factors = set() while n % 2 == 0: factors.add(2) n = n / 2 #n became odd for i in range(3,int(math.sqrt(n))+1,2): while (n % i == 0): factors.add(i) n = n / i if n > 2: factors.add(n) ret...
17.65625
43
0.486726
[ "Unlicense" ]
EJammy/Integer-Sequences
Prime Powers/prime_powers.py
565
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 u...
41.317884
120
0.452668
[ "Apache-2.0" ]
ksowmya/cloudstack-1
test/integration/component/test_stopped_vm.py
82,016
Python
# Created by Qingzhi Ma at 2019-07-24 # All right reserved # Department of Computer Science # the University of Warwick # Q.Ma.2@warwick.ac.uk from dbestclient.ml.density import DBEstDensity from dbestclient.ml.modelwraper import SimpleModelWrapper, GroupByModelWrapper from dbestclient.ml.regression import DBEstReg fro...
44.186441
150
0.67127
[ "BSD-2-Clause" ]
horeapinca/DBEstClient
dbestclient/ml/modeltrainer.py
2,607
Python
from sanic import Sanic, response, Blueprint from sanic.request import RequestParameters from sanic_jinja2 import SanicJinja2 from sanic_session import Session, AIORedisSessionInterface import aiosqlite import aiofiles import aioredis import asyncio import json import html import sys import os import re ...
44.087958
251
0.548713
[ "BSD-3-Clause" ]
BadaWikiDev/VientoEngine
app.py
42,730
Python
# -*- coding: utf-8 -*- # Copyright (c) 2022 Intel 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 applicab...
38.828571
93
0.740986
[ "Apache-2.0" ]
intel/lp-opt-tool
neural_compressor/ux/web/service/optimization.py
1,359
Python
# A lista a seguir possui mais uma lista interna, a lista de preços. # A lista de preços possui 3 sublistas dentro dela com os preços dos produtos. # para exemplificar, o preço do mamão é de 10.00 - alface crespa é de 2.99 e o feijão 9.0 # Será solicitado o preço de alguns produtos. para imprimir deve ser por f-string ...
40.577778
114
0.637459
[ "MIT" ]
marcelabbc07/TrabalhosPython
Aula18/rev3.py
1,853
Python
import os import arcpy from arcpy import env import time def splitGDBTool(inputGDB,inputFrame,splitField,outputDir): # Get FCs to be cliped env.workspace = inputGDB inputFCs = arcpy.ListFeatureClasses() countFCs =len(inputFCs) cursor = arcpy.da.SearchCursor(inputFrame,["TID","SHAPE@"]) in...
33.148148
77
0.622346
[ "Apache-2.0" ]
AkutoSai/ArcGIS
Arcpy Script/SplitGDB/splitGDBTool.py
895
Python
def test_positive_guess(patched_hangman): decision = patched_hangman.guess("e") assert decision is True def test_negative_guess(patched_hangman): decision = patched_hangman.guess("r") assert decision is False def test_none_guess(patched_hangman): patched_hangman.guess("e") decision = patched...
24.533333
41
0.75
[ "MIT" ]
julia-shenshina/hangman
tests/test_hangman.py
368
Python
# Copyright 2018, Erlang Solutions Ltd, and S2HC Sweden AB # # 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...
30.837209
78
0.687029
[ "Apache-2.0" ]
AlexKovalevych/Pyrlang
pyrlang/net_kernel.py
1,326
Python
#!/bin/python import platform import fabric.api from fabric.contrib.files import exists as remote_exists from cloudify import ctx from cloudify.exceptions import NonRecoverableError def _get_distro_info(): distro, _, release = platform.linux_distribution( full_distribution_name=False) return '{0} {...
37.156863
78
0.643272
[ "Apache-2.0" ]
AlexAdamenko/cloudify-openstack
components/nginx/scripts/retrieve_agents.py
1,895
Python
# Generated by Django 3.0.5 on 2020-04-22 02:42 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0057_sugestaoturma_horarios'), ] operations = [ migrations.RemoveField( model_name='sugestaoturma', name='ho...
22.434783
60
0.585271
[ "MIT" ]
ArthurGorgonio/suggestclasses
core/migrations/0058_auto_20200421_2342.py
516
Python
"""This module defines classes that handle mesh and mesh operations. This module defines a factory class for mesh, similar to geometry and size function factory class. It also defines concrete mesh types. Currently two concrete mesh types are defined for generic Eucledian mesh and specific 2D Eucledian mesh. """ from ...
31.437795
95
0.548111
[ "CC0-1.0" ]
noaa-ocs-modeling/OCSMesh
ocsmesh/mesh/mesh.py
66,711
Python
# # Solution to Project Euler problem 287 # Copyright (c) Project Nayuki. All rights reserved. # # https://www.nayuki.io/page/project-euler-solutions # https://github.com/nayuki/Project-Euler-solutions # # Let R = 2^(N-1) denote the radius of the circle (filled disk) being drawn. # # First, we can simplify the pr...
47.935897
95
0.682268
[ "MIT" ]
xianlinfeng/project_euler_python3
solutions/p287.py
3,739
Python
from probs import Binomial class TestBinomial: @staticmethod def test_binomial() -> None: d = Binomial() assert d.expectation() == 0 assert d.variance() == 0 # TODO: Python 3.7 implementation differs from 3.8+ # assert P(d == 0) == 1 # assert P(d == 1) == 0 ...
25.704545
59
0.458002
[ "MIT" ]
TylerYep/probs
tests/discrete/binomial_test.py
1,131
Python
from collections import Counter class MajorityBaselineClassifier: @staticmethod def train(_, labels): c = Counter(labels) return c.most_common()[0][0] @staticmethod def predict(_, majority_label): return majority_label
20.153846
36
0.675573
[ "MIT" ]
dompuiu/PROEA-821-005-Spring-2018
HW2/majority_baseline_classifier.py
262
Python
#! /usr/bin/env python import tensorflow as tf import numpy as np import os import time import datetime import data_helpers from text_cnn import TextCNN from tensorflow.contrib import learn # Parameters # ================================================== # Data loading params 语料文件路径定义 tf.flags.DEFINE...
42.447368
125
0.725976
[ "Apache-2.0" ]
tangku006/cnn-text-classification-tf-master
test.py
3,276
Python
import pytest import json from collections import OrderedDict from great_expectations.profile.base import DatasetProfiler from great_expectations.profile.basic_dataset_profiler import BasicDatasetProfiler from great_expectations.profile.columns_exist import ColumnsExistProfiler from great_expectations.dataset.pandas_...
48.639405
490
0.747249
[ "Apache-2.0" ]
AdamHepner/great_expectations
tests/profile/test_profile.py
13,084
Python
import os import codecs from busSchedules import schedule1B from busSchedules import schedule2 from busSchedules import schedule3 from busSchedules import schedule4 from busSchedules import schedule5 from busSchedules import schedule6 from busZonesTimes import busZonesTimesOne from busZonesTimes import busZone...
29.153409
145
0.693432
[ "MIT" ]
NazarenoCavazzon/BlueAPI
app.py
10,264
Python
""" Concatenate the labels with the notes data and split using the saved splits """ import csv from datetime import datetime import random from constants import DATA_DIR from constants import MIMIC_3_DIR import pandas as pd DATETIME_FORMAT = "%Y-%m-%d %H-%M-%S" def concat_data(labelsfile, notes_file): """ ...
28.544872
113
0.628116
[ "MIT" ]
franzbischoff/caml-mimic
dataproc/concat_and_split.py
4,453
Python
import os import json import logging from dataclasses import dataclass, field from typing import Dict, Optional, Callable import torch import wandb import numpy as np from tqdm.auto import tqdm from torch.utils.data.dataloader import DataLoader from torch.utils.data.dataset import Dataset from torch.utils.data.distrib...
38.967742
118
0.550369
[ "MIT" ]
Daupler/CA-MTL
src/mtl_trainer.py
15,704
Python
# coding: utf-8 """ Influx API Service No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 OpenAPI spec version: 0.1.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import re # noqa: F40...
34.153226
132
0.629988
[ "MIT" ]
rhajek/influxdb-client-python
influxdb_client/service/health_service.py
4,235
Python
# -*- coding: utf-8 -*- # Copyright 2022 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...
33.218182
85
0.767378
[ "Apache-2.0" ]
TheMichaelHu/python-aiplatform
samples/generated_samples/aiplatform_v1_generated_specialist_pool_service_create_specialist_pool_async.py
1,827
Python
#!/usr/bin/env python # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. import os import argparse from os.path import join as pjoin import numpy as np import networkx as nx from textworld.render import visualize from textworld.generator import Game from textworld.generat...
32.95283
107
0.658746
[ "MIT" ]
Bhaskers-Blu-Org2/TextWorld
scripts/sample_quests.py
3,493
Python
#modo indireto '''import math num = int(input('Digite um número: ')) raiz = math.sqrt(num) print('A raiz de {} é {}'.format(num, math.ceil(raiz)))''' #modo direto from math import sqrt, floor num = int(input('Digite um número:')) raiz = sqrt(num) print('A raiz de {} é {:.2f}'.format(num, floor(raiz)))
25.333333
58
0.651316
[ "MIT" ]
MarcelaSamili/Desafios-do-curso-de-Python
Python/PycharmProjects/aula 8/1.py
308
Python
# ------------------------------------------------------------------------- # Copyright (c) 2015-2017 AT&T Intellectual Property # # 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 # # ...
46.371795
123
0.685651
[ "Apache-2.0" ]
onap/optf-osdf
osdf/adapters/policy/utils.py
3,617
Python
#!/usr/bin/env python # # File Name : ptbtokenizer.py # # Description : Do the PTB Tokenization and remove punctuations. # # Creation Date : 29-12-2014 # Last Modified : Thu Mar 19 09:53:35 2015 # Authors : Hao Fang <hfang@uw.edu> and Tsung-Yi Lin <tl483@cornell.edu> import os import sys import subprocess import temp...
40.971014
114
0.520693
[ "MIT" ]
JaywongWang/DenseVideoCaptioning
densevid_eval-master/coco-caption/pycocoevalcap/tokenizer/ptbtokenizer.py
2,827
Python
""" Implementation of mooda.read_pkl(path) """ import pickle from .. import WaterFrame def read_pkl(path_pkl): """ Get a WaterFrame from a pickle file. Parameters ---------- path_pkl: str Location of the pickle file. Returns ------- wf_pkl: WaterFram...
22.148148
57
0.600334
[ "MIT" ]
rbardaji/mooda
mooda/input/read_pkl.py
598
Python
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: requirement_instance.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google...
50.360248
812
0.75555
[ "Apache-2.0" ]
easyopsapis/easyops-api-python
console_gateway_sdk/model/tuna_service/requirement_instance_pb2.py
8,108
Python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # cob documentation build configuration file, created by # sphinx-quickstart on Sun Jan 7 18:09:10 2018. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autoge...
30.378238
79
0.683268
[ "MIT" ]
C-Pauli/cob
docs/conf.py
5,863
Python
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Textfont(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "scatter3d" _path_str = "scatter3d.textfont" _valid_props = {"color", "colorsrc", "family",...
34.427609
82
0.557653
[ "MIT" ]
1abner1/plotly.py
packages/python/plotly/plotly/graph_objs/scatter3d/_textfont.py
10,225
Python
# qubit number=5 # total number=48 import pyquil from pyquil.api import local_forest_runtime, QVMConnection from pyquil import Program, get_qc from pyquil.gates import * import numpy as np conn = QVMConnection() def make_circuit()-> Program: prog = Program() # circuit begin prog += H(0) # number=3 pr...
25.139535
64
0.546253
[ "BSD-3-Clause" ]
UCLA-SEAL/QDiff
benchmark/startPyquil1068.py
2,162
Python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for the Microsoft Internet Explorer WebCache database.""" import unittest from plaso.lib import definitions from plaso.parsers.esedb_plugins import msie_webcache from tests.parsers.esedb_plugins import test_lib class MsieWebCacheESEDBPluginTest(test_lib.ESEDB...
39.23
80
0.702014
[ "Apache-2.0" ]
ColdSmoke627/plaso
tests/parsers/esedb_plugins/msie_webcache.py
3,923
Python
""" converted from Matlab code source: http://www.robots.ox.ac.uk/~fwood/teaching/AIMS_CDT_ML_2015/homework/HW_2_em/ """ import numpy as np def m_step_gaussian_mixture(data, gamma): """% Performs the M-step of the EM algorithm for gaussain mixture model. % % @param data : n x d matrix with rows as d dim...
29.682927
99
0.555464
[ "MIT" ]
leonardbj/AIMS
src/ML_Algorithms/ExpectationMaximization/m_step_gaussian_mixture.py
1,217
Python
from __future__ import print_function from __future__ import absolute_import from __future__ import division import numpy as np __all__ = [ "wigner3j", "get_camb_cl", "scale_dust", ] def blackbody(nu, ref_freq=353.0): """ The ratio of the blackbody function for dust at frequency nu over the v...
27.577273
83
0.60656
[ "MIT" ]
SPIDER-CMB/xfaster
xfaster/spec_tools.py
6,067
Python
#!/usr/bin/env python # coding: utf-8 # # Project: Azimuthal integration # https://github.com/silx-kit/pyFAI # # Copyright (C) 2015-2018 European Synchrotron Radiation Facility, Grenoble, France # # Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu) # # Permission is hereby granted, fr...
38.646018
101
0.686512
[ "MIT" ]
Jona-Engel/pyFAI
pyFAI/test/test_pickle.py
4,371
Python
import string import random from functools import wraps from urllib.parse import urlencode from seafileapi.exceptions import ClientHttpError, DoesNotExist def randstring(length=0): if length == 0: length = random.randint(1, 30) return ''.join(random.choice(string.lowercase) for i in range(length)) def...
24.862069
74
0.575589
[ "Apache-2.0" ]
AdriCueGim/python-seafile
seafileapi/utils.py
1,442
Python
# -*- coding: utf8 -*- # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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...
32.031272
110
0.600071
[ "Apache-2.0" ]
qin5506/tencentcloud-sdk-python
tencentcloud/mongodb/v20180408/models.py
50,620
Python
import numpy as np import pytest import tensorflow as tf from garage.tf.models.gru import gru from tests.fixtures import TfGraphTestCase from tests.helpers import recurrent_step_gru class TestGRU(TfGraphTestCase): def setup_method(self): super().setup_method() self.batch_size = 2 self.hi...
43.812195
79
0.490675
[ "MIT" ]
artberryx/LSD
garaged/tests/garage/tf/models/test_gru.py
17,963
Python
# -*- coding: utf-8 -*- """This file contains a basic Skype SQLite parser.""" import logging from plaso.events import time_events from plaso.parsers import sqlite from plaso.parsers.sqlite_plugins import interface __author__ = 'Joaquin Moreno Garijo (bastionado@gmail.com)' class SkypeChatEvent(time_events.PosixTi...
36.893333
80
0.665161
[ "Apache-2.0" ]
Defense-Cyber-Crime-Center/plaso
plaso/parsers/sqlite_plugins/skype.py
16,602
Python
import pycrfsuite import sklearn from itertools import chain from sklearn.metrics import classification_report, confusion_matrix from sklearn.preprocessing import LabelBinarizer import re import json annotypes = ['Participants', 'Intervention', 'Outcome'] annotype = annotypes[0] path = '/nlp/data/romap/crf/' #path = '...
38.195572
130
0.575983
[ "Apache-2.0" ]
roma-patel/lstm-crf
crf-seq/sets/sets/4/seq_detect_1p.py
10,351
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################### # Author: Mu yanru # Date : 2018.5 # Email : muyanru345@163.com ################################################################### from dayu_widgets.item_model import MSortFilterModel, MTableModel from d...
39.493671
106
0.690705
[ "MIT" ]
kanbang/dayu_widgets
dayu_widgets/item_view_set.py
3,120
Python
# Generated by Django 2.2 on 2019-05-08 20:45 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0011_update_proxy_permissions'), ] operations = [ migrations.CreateModel( name='User', fie...
49.970588
266
0.637434
[ "MIT" ]
ing-ivan-31/recipe-app
app/core/migrations/0001_initial.py
1,699
Python
import time import datetime import json import hashlib from .env import Env from .server import Server from .hardware import Hardware class Metric(object): def __init__(self): # format of report data self._version = '0.1' self._type = 'metric' self.run_id = None self.mode =...
27.071429
73
0.600923
[ "Apache-2.0" ]
NotRyan/milvus
tests/benchmark/milvus_benchmark/metrics/models/metric.py
1,516
Python
from credentials import credentials import unittest import pyperclip class TestUser(unittest.TestCase): ''' Test that defines test cases for the User class Args: unitest.Testcase: Testcase that helps in creating test cases for class User. ''' def setUp(self): ''' Set up me...
26.228571
84
0.62963
[ "Unlicense" ]
paulmunyao/Password-Locker
credentials_test.py
918
Python
import inspect import sys from enum import IntEnum from pathlib import Path from time import time from logging import getLevelName from typing import Tuple, Union, Any, List, Iterable, TextIO, Optional from . import logging from .logging import _set_log_level, _set_log_file, RootLogger _VERBOSITY_TO_LOGLEVEL = { ...
32.397229
102
0.597662
[ "BSD-3-Clause" ]
gamazeps/scanpy
scanpy/_settings.py
14,034
Python
VERSION = 'v0.0.1'
18
18
0.611111
[ "MIT" ]
shi1412/pyspark-olap-pipeline
jobs/version.py
18
Python
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
29.682353
79
0.649822
[ "Apache-2.0" ]
Lu1352/DeepCTR
docs/source/conf.py
5,046
Python
from typing import Optional import torch from torch import Tensor @torch.jit._overload # noqa def fps(src, batch=None, ratio=None, random_start=True): # noqa # type: (Tensor, Optional[Tensor], Optional[float], bool) -> Tensor pass # pragma: no cover @torch.jit._overload # noqa def fps(src, batch=None, ...
33.43662
78
0.617102
[ "MIT" ]
Hacky-DH/pytorch_cluster
torch_cluster/fps.py
2,374
Python
import pytest import click from click.testing import CliRunner from click._compat import PY2 # Use the most reasonable io that users would use for the python version. if PY2: from cStringIO import StringIO as ReasonableBytesIO else: from io import BytesIO as ReasonableBytesIO def test_runner(): @click....
25.810345
76
0.637609
[ "BSD-3-Clause" ]
ANKIT-KS/fjord
vendor/packages/click/tests/test_testing.py
2,994
Python
''' SPEECH-TO-TEXT USING MICROSOFT SPEECH API ''' ''' nonstoptimm@gmail.com ''' # Import required packages import os import glob import json import logging import codecs import helper as he import azure.cognitiveservices.speech as speechsdk import params as pa # Load and set configuration parameters pa.get_config() ...
45.008696
131
0.701893
[ "MIT" ]
microsoft/SpeechServices
src/stt.py
5,176
Python
# Generated by Django 3.2.8 on 2021-11-29 09:01 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('budget', '0004_auto_20211125_1330'), ] operations = [ migrations.DeleteModel( name='VehicleLog', ), ]
17.529412
47
0.607383
[ "MIT" ]
MadeleenRoestorff/django_budget
django_budget/budget/migrations/0005_delete_vehiclelog.py
298
Python
#!/usr/bin/env python3 # Copyright 2021 Xiaomi Corp. (authors: Fangjun Kuang # Mingshuang Luo) # # See ../../../../LICENSE for clarification regarding multiple authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use th...
29.969799
79
0.632124
[ "Apache-2.0" ]
aarora8/icefall
egs/librispeech/ASR/tdnn_lstm_ctc/train.py
17,862
Python
from collections import OrderedDict, defaultdict from typing import Optional, Dict, Tuple, List import ariadne from irrd.rpki.status import RPKIStatus from irrd.rpsl.fields import RPSLFieldListMixin, RPSLTextField, RPSLReferenceField from irrd.rpsl.rpsl_objects import (lookup_field_names, OBJECT_CLASS_MAPPING, RPSLAu...
43.822526
146
0.616745
[ "BSD-2-Clause" ]
morrowc/irrd
irrd/server/graphql/schema_generator.py
12,840
Python
""" Argo Workflows API Argo Workflows is an open source container-native workflow engine for orchestrating parallel jobs on Kubernetes. For more information, please see https://argoproj.github.io/argo-workflows/ # noqa: E501 The version of the OpenAPI document: VERSION Generated by: https://openapi-g...
44.007299
206
0.579366
[ "Apache-2.0" ]
AnuragThePathak/argo-workflows
sdks/python/client/argo_workflows/model/lifecycle_handler.py
12,058
Python
import grpc import threading import proto.connection_pb2_grpc from libs.core.Log import Log from libs.core.Switch import Switch from libs.core.Event import Event from libs.Configuration import Configuration class SwitchConnection: def __init__(self, grpc_address=None): self.channel = grpc.insecure_channe...
34.974359
158
0.674487
[ "Apache-2.0" ]
qcz994/p4-bier
Controller-Implementation/libs/core/SwitchConnection.py
1,364
Python
from torch import jit from syft.execution.placeholder import PlaceHolder from syft.execution.translation.abstract import AbstractPlanTranslator class PlanTranslatorTorchscript(AbstractPlanTranslator): """Performs translation from 'list of ops' Plan into torchscript Plan""" def __init__(self, plan): s...
38.792453
95
0.664397
[ "Apache-2.0" ]
NicoSerranoP/PySyft
syft/execution/translation/torchscript.py
2,056
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import tornado.gen import bcrypt __all__ = ["create_new_user"] @tornado.gen.coroutine def get_next_id(db, collection): counter = yield db.counters.find_and_modify( {"_id": "{}id".format(collection)}, {"$inc": {"seq": 1}}, new=True, ) ...
23.703704
69
0.635938
[ "MIT" ]
ilkerkesen/trebol
trebol/interface.py
640
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import sys import numpy as np import pandas as pd def run(args): data = pd.read_csv(sys.stdin) # Find maximum rank value and increase by one to use as a fill_value # on the pivot with cluster by day # notfound_value = grouped['rank'].max()...
29.526316
76
0.564171
[ "MIT" ]
isabella232/allsongsconsidered-poll
scripts/pivot_cluster_day.py
1,122
Python
import sys import random from collections import deque def printGrid(grid, wallChar, emptyChar): finalstr = "" finalstr += "\n" for i in range(len(grid[0])): for j in range(len(grid)): if grid[j][i]==1: finalstr += wallChar else: finalstr += e...
37.532258
150
0.572841
[ "MIT" ]
nmmarzano/CellularCaves.py
cellularcaves.py
4,658
Python
from pools import PoolTest import eventlet class EventletPool(PoolTest): def init_pool(self, worker_count): return eventlet.GreenPool(worker_count) def map(self, work_func, inputs): return self.pool.imap(work_func, inputs) def init_network_resource(self): return eventlet.import_p...
24.785714
58
0.731988
[ "MIT" ]
JohnStarich/python-pool-performance
pools/eventlet.py
347
Python
## ********Day 55 Start********** ## Advanced Python Decorator Functions class User: def __init__(self, name): self.name = name self.is_logged_in = False def is_authenticated_decorator(function): def wrapper(*args, **kwargs): if args[0].is_logged_in == True: function(args[...
24.181818
50
0.667293
[ "MIT" ]
ecanro/100DaysOfCode_Python
Day_55/sandbox.py
532
Python
import json def get_text_from_json(file): with open(file) as f: json_text = f.read() text = json.loads(json_text) return text content = get_text_from_json('content.json') test = get_text_from_json('test.json')
20.083333
44
0.672199
[ "MIT" ]
mell-old/echo-bot
json_content.py
241
Python
#!/usr/bin/env python import io import sys from datetime import datetime # To make sure all packet types are available import scapy.all # noqa import scapy.packet from scapy.layers.l2 import Ether import pcapng from pcapng.blocks import EnhancedPacket, InterfaceDescription, SectionHeader def col256(text, fg=None,...
28.015209
88
0.549946
[ "Apache-2.0" ]
dieter-exc/python-pcapng
examples/dump_pcapng_info_pretty.py
7,368
Python
from tensorflow.keras.callbacks import LambdaCallback from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Activation, LSTM from tensorflow.keras.layers import Dropout, TimeDistributed try: from tensorflow.python.keras.layers import CuDNNLSTM as lstm except: from tensorflow....
34.733333
78
0.706974
[ "MIT" ]
Wowol/Piano-Bot
model.py
1,563
Python
# -*- coding: utf-8 -*- # Copyright 2013-2021 CERN # # 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 a...
51.691101
289
0.600376
[ "Apache-2.0" ]
bari12/rucio
lib/rucio/core/replica.py
171,357
Python
import mlrose from mlrose.algorithms.decorators import short_name from mlrose.runners._runner_base import _RunnerBase """ Example usage: experiment_name = 'example_experiment' problem = TSPGenerator.generate(seed=SEED, number_of_cities=22) ga = GARunner(problem=problem, experiment_name=...
40.604167
118
0.623397
[ "BSD-3-Clause" ]
tadmorgan/mlrose
mlrose/runners/ga_runner.py
1,949
Python
from flask_wtf import FlaskForm from wtforms import StringField,PasswordField,SubmitField, ValidationError, BooleanField, TextAreaField,SelectField from wtforms.validators import Required,Email,EqualTo from ..models import User class CommentForm(FlaskForm): comment = TextAreaField('Your comment:', validators=[Requ...
48.2
158
0.75657
[ "MIT" ]
edumorris/pomodoro
app/main/forms.py
723
Python
from django.test import TestCase, override_settings from wagtail_storages.factories import ( CollectionFactory, CollectionViewRestrictionFactory, ) from wagtail_storages.utils import ( get_acl_for_collection, get_frontend_cache_configuration, is_s3_boto3_storage_used, ) class TestIsS3Boto3Storage...
33.824561
87
0.693983
[ "BSD-2-Clause" ]
PetrDlouhy/wagtail-storages
wagtail_storages/tests/test_utils.py
1,928
Python
import numpy as np import pytest from sklearn.datasets import make_classification, make_regression # To use this experimental feature, we need to explicitly ask for it: from sklearn.experimental import enable_hist_gradient_boosting # noqa from sklearn.ensemble import HistGradientBoostingRegressor from sklearn.ensembl...
40.013514
79
0.647248
[ "BSD-3-Clause" ]
KshitizSharmaV/Quant_Platform_Python
lib/python3.6/site-packages/sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py
5,922
Python
from .KdfParams import KdfParams from .CipherParams import CipherParams class CryptoStruct: def __init__( self, cipher: int, ciphertext: str, cipherparams: CipherParams, kdf: str, kdfparams: KdfParams, mac: str, ): self._cipher = cipher s...
22.641975
69
0.609051
[ "MIT" ]
coryhill/xchainpy-lib
xchainpy/xchainpy_crypto/xchainpy_crypto/models/CryptoStruct.py
1,834
Python
# coding: utf-8 """ Control-M Services Provides access to BMC Control-M Services # noqa: E501 OpenAPI spec version: 9.20.220 Contact: customer_support@bmc.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class ErrorList(...
27.486486
80
0.550967
[ "MIT" ]
dcompane/controlm_py
controlm_py/models/error_list.py
3,051
Python
# Rainbow 2, by Al Sweigart al@inventwithpython.com # Shows a simple squiggle rainbow animation. import time, random, sys try: import bext except ImportError: print("""This program requires the bext module, which you can install by opening a Terminal window (on macOS & Linux) and running: python3 -m pip ...
22.877551
76
0.576271
[ "MIT" ]
skinzor/PythonStdioGames
src/gamesbyexample/rainbow2.py
1,121
Python
''' Defines the link functions to be used with GLM and GEE families. ''' import numpy as np import scipy.stats FLOAT_EPS = np.finfo(float).eps class Link(object): """ A generic link function for one-parameter exponential family. `Link` does nothing, but lays out the methods expected of any subclass. ...
21.986656
79
0.49082
[ "BSD-3-Clause" ]
BioGeneTools/statsmodels
statsmodels/genmod/families/links.py
26,362
Python
import numpy as np class ridge: """ Ridge estimator. """ def __init__(self, lmd=0.1): self.lmd = lmd self.hat = None self.hatn = None def fit(self, X, y): if self.hat is None: G = X.T.dot(X) + self.lmd * np.eye(X.shape[1]) self.hat = np.linal...
20.831169
59
0.483791
[ "BSD-3-Clause" ]
EugeneNdiaye/rootCP
rootcp/models.py
1,604
Python
# qubit number=2 # total number=8 import cirq import qiskit from qiskit import IBMQ from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import FakeVigo from math import log2,floor, sqrt, pi import numpy as...
28.256881
80
0.620779
[ "BSD-3-Clause" ]
UCLA-SEAL/QDiff
data/p2DJ/New/program/qiskit/class/startQiskit_Class137.py
3,080
Python
# Created by SylvanasSun in 2017.10.17 # !/usr/bin/python # -*- coding: utf-8 -*- import collections import jieba from jieba import analyse # TODO: Change default hash algorithms to the other algorithms of high-performance. def _default_hashfunc(content, hashbits): """ Default hash function is variable-lengt...
36.190244
117
0.626365
[ "MIT" ]
SylvanasSun/code-snippets
algorithms/hash/simhash.py
7,893
Python
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
34.411576
100
0.611942
[ "Apache-2.0" ]
Ali-Tahir/luigi
luigi/contrib/scalding.py
10,702
Python
import hugectr solver = hugectr.CreateSolver(max_eval_batches = 1, batchsize_eval = 4096, batchsize = 64, lr = 0.001, vvgpu = [[0,1]], repeat_dataset = True, ...
58.568862
134
0.510991
[ "Apache-2.0" ]
Chunshuizhao/HugeCTR
test/pybind_test/din_fp32_2gpu.py
9,781
Python
""" file system and database initialization. tables: - polls: - id PRIMARY KEY - owner_id => users.id - topic - users: - id PRIMARY KEY - first_name - last_name - username - answers: - id PRIMARY KEY - poll_id => polls.id - text - votes: - user_id => users.id - poll_id => polls.id - answer...
19.315789
62
0.679382
[ "MIT" ]
ratijas/multi_vote_bot
src/app/fs.py
1,101
Python
# -*- coding: UTF-8 -*- import os # File and path handling import numpy import copy # for deepcopy import math from .image import ImageFile, Image, ImageROI, ImageStack from .geometry import Geometry from .processing.pipeline import Pipeline from .processing.step import Step from .helpers import * d...
30.943662
119
0.631771
[ "Apache-2.0" ]
BAMresearch/ctsimu-toolbox
ctsimu/test.py
2,197
Python
from ._abstract import AbstractScraper from ._utils import get_minutes, normalize_string, get_yields class SimplyQuinoa(AbstractScraper): @classmethod def host(self): return 'simplyquinoa.com' def title(self): return self.soup.find( 'h2', {'class': 'wprm-recipe-na...
24.694915
61
0.533288
[ "MIT" ]
PatrickPierce/recipe-scrapers
recipe_scrapers/simplyquinoa.py
1,457
Python
""" Custom dataset processing/generation functions should be added to this file """ import pathlib from sklearn.datasets import fetch_20newsgroups from functools import partial from src import workflow, paths from src.log import logger import src.log.debug from tqdm.auto import tqdm from .. import paths from ..log ...
25.423729
94
0.662667
[ "MIT" ]
acwooding/docmap_playground
src/data/process_functions.py
1,500
Python
#!/usr/bin/python # Copyright (c) 2017, 2021 Oracle and/or its affiliates. # This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Apache License v2.0 # See LICENSE.TXT for d...
41.237333
159
0.620215
[ "Apache-2.0" ]
hanielburton/oci-ansible-collection
plugins/modules/oci_vault_secret_actions.py
15,464
Python
import os import sys import json from .version import __version__ from satsearch import Search from satstac import Items from satsearch.parser import SatUtilsParser import satsearch.config as config def main(items=None, printmd=None, printcal=False, found=False, save=None, download=None, requestor_pays=Fals...
27.3
113
0.628467
[ "MIT" ]
lishrimp/sat-search
satsearch/main.py
1,911
Python
from argparse import ArgumentParser import datetime import dateutil import sys, re from os import path def parseArgs(): parser = ArgumentParser(add_help=False) parser.add_argument("-a", "--action", help="Please select an option out of <discover, manage, settings>", type=str, required=True) parser.add_argum...
49.877193
145
0.616426
[ "Apache-2.0" ]
lif22/tmpm_pipeline
stages/utils/utils.py
5,686
Python
__author__ = 'igor'
10
19
0.7
[ "MIT" ]
igorcoding/os-simulation
src/gui/__init__.py
20
Python
#!/usr/bin/env python3.8 import importlib import typing from enum import Enum import discord from discord.ext import commands from discord.types.interactions import ApplicationCommandOption import common.paginator as paginator import common.star_classes as star_classes import common.utils as utils class OwnerCMDs(c...
33.838028
108
0.594173
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
Astrea49/Seraphim-Bot
cogs/core/cmds/owner_cmds.py
4,805
Python
# Copyright (c) 2015-2016, 2018, 2020 Claudiu Popa <pcmanticore@gmail.com> # Copyright (c) 2016 Ceridwen <ceridwenv@gmail.com> # Copyright (c) 2020 hippo91 <guillaume.peillex@gmail.com> # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html # For details: https://github.com/PyCQA/astroid...
28.886076
85
0.678791
[ "MIT" ]
Nucl3arSn3k/randomplushmiku
venv/Lib/site-packages/astroid/brain/brain_nose.py
2,282
Python
from bridge.deploy.sagemaker import SageMakerDeployTarget DEPLOY_REGISTRY = {"sagemaker": SageMakerDeployTarget}
23
57
0.843478
[ "Apache-2.0" ]
jfdesroches/domino-research
bridge/bridge/deploy/registry.py
115
Python
# Lint as: python3 # Copyright 2020 The DMLab2D 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 ...
35.031746
79
0.686905
[ "Apache-2.0" ]
LaudateCorpus1/lab2d
dmlab2d/settings_helper.py
2,207
Python
def init(id, cfg): log_info("pythonmod: init called, module id is %d port: %d script: %s" % (id, cfg.port, cfg.python_script)) return True def init_standard(id, env): log_info("pythonmod: init called, module id is %d port: %d script: %s" % (id, env.cfg.port, env.cfg.python_script)) return True def deinit(...
29.815789
118
0.68579
[ "BSD-3-Clause" ]
Berbe/unbound
pythonmod/doc/examples/example0-1.py
1,133
Python
import os import numpy as np import scipy.sparse as sp import pickle import torch from torch.utils.data import DataLoader from dgl.data.utils import download, _get_dgl_url, get_download_dir, extract_archive import random import time import dgl def ReadTxtNet(file_path="", undirected=True): """ Read the txt network...
33.523585
113
0.555649
[ "Apache-2.0" ]
IzabelaMazur/dgl
examples/pytorch/ogb/line/reading_data.py
7,107
Python
"""Tests for the DirecTV component.""" from http import HTTPStatus from homeassistant.components.directv.const import CONF_RECEIVER_ID, DOMAIN from homeassistant.components.ssdp import ATTR_SSDP_LOCATION from homeassistant.const import CONF_HOST, CONTENT_TYPE_JSON from homeassistant.core import HomeAssistant from tes...
31.603175
75
0.668257
[ "Apache-2.0" ]
2Fake/core
tests/components/directv/__init__.py
3,982
Python
from random import shuffle from models.RainbowModelLeaveRecsOut import RainbowModelLeaveRecsOut from tensorflow.keras.layers import Conv1D, MaxPooling1D, Flatten, Dense, Dropout # type: ignore from tensorflow.keras.models import Sequential # type: ignore import numpy as np from utils.Recording import Recording from ...
33.311475
102
0.628937
[ "MIT" ]
Sensors-in-Paradise/OpportunityML
archive/model_archive/ConvModel.py
2,032
Python
from rest_framework import serializers from gestion.models.providerOrder import ProviderOrder from auth_app.serializers.userSerializer import UserSerializer from gestion.serializers.providerSerializer import ProviderSerializer from auth_app.models.user import User from gestion.models.provider import Provider...
34.605263
88
0.742205
[ "MIT" ]
JetLightStudio/Jet-Gest-stock-management
server/gestion/serializers/providerOrderSerializer.py
1,315
Python
import json from django.contrib.messages.storage.base import BaseStorage from django.contrib.messages.storage.cookie import ( MessageDecoder, MessageEncoder, ) from django.utils import six class SessionStorage(BaseStorage): """ Stores messages in the session (that is, django.contrib.sessions). """ ...
34.979592
90
0.65811
[ "BSD-3-Clause" ]
Acidburn0zzz/django
django/contrib/messages/storage/session.py
1,714
Python
from django.contrib import admin # Register your models here. from account.models import UserProfile from blog.models import BlogArticles class BlogArticlesAdmin(admin.ModelAdmin): list_display = ("title", "author", "publish") list_filter = ("publish", "author") search_fields = ("title", "body") raw_...
24.615385
52
0.715625
[ "MIT" ]
jinjf553/mysite
blog/admin.py
640
Python
import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'yatube.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " ...
25.857143
73
0.672192
[ "BSD-2-Clause" ]
LazarevaKate/hw02_community
yatube/manage.py
543
Python
from typing import Tuple import torch import torch.nn as nn import torch.nn.functional as F from kornia.constants import pi __all__ = [ # functional api "rad2deg", "deg2rad", "pol2cart", "cart2pol", "convert_points_from_homogeneous", "convert_points_to_homogeneous", "convert_affinematr...
35.379854
126
0.618941
[ "ECL-2.0", "Apache-2.0" ]
anthonytec2/kornia
kornia/geometry/conversions.py
29,153
Python
#!/usr/bin/env python3 # In this example, we demonstrate how Korali samples the posterior distribution # in a bayesian problem where the likelihood is calculated by providing # reference data points and their objective values. # Importing the computational model import sys sys.path.append('./_model') from model impor...
33.381818
96
0.712418
[ "MIT" ]
JonathanLehner/korali
examples/bayesian.inference/reference/run-nested.py
1,836
Python