max_stars_repo_path
stringlengths
4
245
max_stars_repo_name
stringlengths
7
115
max_stars_count
int64
101
368k
id
stringlengths
2
8
content
stringlengths
6
1.03M
tick/hawkes/simulation/__init__.py
sumau/tick
411
11032759
<filename>tick/hawkes/simulation/__init__.py # License: BSD 3 clause import tick.base from .hawkes_kernels import (HawkesKernel0, HawkesKernelExp, HawkesKernelPowerLaw, HawkesKernelSumExp, HawkesKernelTimeFunc) from .simu_hawkes import SimuHawkes from .simu_ha...
bookwyrm/views/landing/landing.py
mouse-reeve/fedireads
270
11032760
<gh_stars>100-1000 """ non-interactive pages """ from django.shortcuts import redirect from django.template.response import TemplateResponse from django.views import View from bookwyrm import forms, models from bookwyrm.views.feed import Feed # pylint: disable= no-self-use class Home(View): """landing page or ho...
doc/examples/dev/multi/fluidFlow.py
baender/gimli
224
11032782
<reponame>baender/gimli<filename>doc/examples/dev/multi/fluidFlow.py #!/usr/bin/env python """ Fluid flow stuff .. calc - static velocity field - calc nonsteady advection/diffusion """ import matplotlib.pyplot as plt import numpy as np import pygimli as pg from pygimli import physics from pygimli.s...
test/test_hxcfunc.py
paulfariello-syn/bip
145
11032784
from bip.hexrays import * from bip.base import BipDecompileError, BipFunction import idc import pytest """ Test for basics in class :class:`HxCFunc` in ``bip/hexrays/hx_cfunc.py``. This do not include test for visitor, cnodes and hxitem. """ def test_biphxcfunc00(): # hxcfunc base, other and class/stati...
tests/unit/test_payment_method_nonce.py
futureironman/braintree_python
182
11032806
<reponame>futureironman/braintree_python from tests.test_helper import * class TestPaymentMethodNonce(unittest.TestCase): @raises(NotFoundError) def test_finding_empty_id_raises_not_found_exception(self): PaymentMethodNonce.find(" ") @raises(NotFoundError) def test_finding_None_id_raises_not_f...
2019/finals/web-gphotos-finals/app/gallery/middleware.py
iicarus-bit/google-ctf
2,757
11032869
<filename>2019/finals/web-gphotos-finals/app/gallery/middleware.py # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-...
doc/examples/scripts/structure/contact_sites_pymol.py
danijoo/biotite
208
11032880
<gh_stars>100-1000 import numpy as np from matplotlib.colors import to_rgb import biotite import biotite.structure as struc import ammolite PNG_SIZE = (1000, 550) # General configuration ammolite.cmd.set("cartoon_side_chain_helper", 1) ammolite.cmd.set("cartoon_discrete_colors", 1) ammolite.cmd.set("depth_cue", 0) a...
easy_rl/agents/a3c_agent.py
simonoso/EasyRL
125
11032919
<filename>easy_rl/agents/a3c_agent.py # Copyright (c) 2019 Alibaba 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.org/licenses/LICENSE-2.0...
dataset/kitti_dataset.py
Umass-ITS/Open3D-PointNet2-Semantic3D
330
11032968
import os import open3d import numpy as np from dataset.semantic_dataset import SemanticFileData, SemanticDataset import pykitti class KittiFileData(SemanticFileData): def __init__(self, points, box_size_x, box_size_y): self.box_size_x = box_size_x self.box_size_y = box_size_y # Crop the ...
docs/rst_generator.py
iamchetry/DataChallenge-Fall2021
108
11032995
<filename>docs/rst_generator.py ## run this file in the main directory ## import os import shutil import inspect import pandas as pd # from tabulate import tabulate databases = ['chemml', 'sklearn', 'pd'] directory = 'documentation_trial' # first remove all files in the directory shutil.rmtree(directory) os.makedirs(...
lisa/analysis/virustotal.py
jrespeto/LiSa
244
11033017
<gh_stars>100-1000 """ VirusTotal API module. """ import requests import logging.config from lisa.core.base import AbstractSubAnalyzer from lisa.config import logging_config, virus_total_key logging.config.dictConfig(logging_config) log = logging.getLogger() class VirusTotalAnalyzer(AbstractSubAnalyzer): "...
src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/skype_api.py
neurodebian/htcondor
217
11033065
<gh_stars>100-1000 #! /usr/bin/python # # Some tools to use the Skype Public API under Linux. # Uses X11 as communication protocol. Tested with Skype version 1.4. # # Requires python-xlib # # # (c) Copyright 2007, <NAME>, <EMAIL> # # Initial code from Amarok Skype mood poster by <NAME> # http://www.kde-apps.org/content...
sphinx_gallery/tests/tinybuild/examples/future/plot_future_imports.py
andriyor/sphinx-gallery
309
11033080
""" Test __future__ imports across cells ------------------------------------ This example tests that __future__ imports works across cells. """ from __future__ import division from __future__ import print_function import matplotlib #################### # Dummy section, with :func:`sphinx_gallery.backreferences.Name...
scirpy/pl/_spectratype.py
BenTenmann/scirpy
104
11033089
import matplotlib.pyplot as plt import numpy as np from .._compat import Literal from anndata import AnnData from .. import tl from . import base from typing import Union, List, Collection, Callable from .styling import _get_colors from ..io._util import _check_upgrade_schema @_check_upgrade_schema() def spectratype(...
visualize/plot_validation.py
yttdebaba2/meta-learning-lstm
349
11033108
<filename>visualize/plot_validation.py import matplotlib.pyplot as plt import sys FILE1 = 'stdout_simpleConv_2layerLstm_noBN' FILE2 = 'stdout_BN' def readFile(fileName): iters = [] vals = [] with open(fileName) as f: iterFound = False iteration = 0 for line in f: arr = line.split(...
astropy/modeling/tests/irafutil.py
jayvdb/astropy
445
11033133
<reponame>jayvdb/astropy # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module provides functions to help with testing against iraf tasks """ from astropy.logger import log import numpy as np iraf_models_map = {1.: 'Chebyshev', 2.: 'Legendre', 3.: 'Spl...
res/TensorFlowPythonExamples/examples/l2_normalize/__init__.py
periannath/ONE
255
11033138
import tensorflow as tf arg = tf.compat.v1.placeholder(dtype=tf.float32, shape=(4, 4), name="Hole") op_ = tf.math.l2_normalize(arg)
RecoBTag/ImpactParameter/python/pfTrackCountingHighPurBJetTags_cfi.py
ckamtsikis/cmssw
852
11033180
<gh_stars>100-1000 import FWCore.ParameterSet.Config as cms pfTrackCountingHighPurBJetTags = cms.EDProducer("JetTagProducer", jetTagComputer = cms.string('candidateTrackCounting3D3rdComputer'), tagInfos = cms.VInputTag(cms.InputTag("pfImpactParameterTagInfos")) )
apps/webguacamole/views_api.py
crazypenguin/devops
300
11033211
<reponame>crazypenguin/devops from webssh.models import TerminalSession from django.http import JsonResponse from django.conf import settings from ratelimit.decorators import ratelimit # 限速 from ratelimit import ALL from util.rate import rate, key from util.tool import login_required, post_required, file_combine f...
rlkit/core/timer.py
Asap7772/railrl_evalsawyer
1,662
11033259
import time from collections import defaultdict class Timer: def __init__(self, return_global_times=False): self.stamps = None self.epoch_start_time = None self.global_start_time = time.time() self._return_global_times = return_global_times self.reset() def reset(sel...
main.py
taha-a/image
161
11033275
from caption_generator import * from utils.data_util import generate_captions from configuration import Configuration import os, sys import argparse import json parser = argparse.ArgumentParser() parser.add_argument( "--mode", type=str, help="train|test|eval", choices=[ "train", "test",...
plugins/k8s/resoto_plugin_k8s/utils.py
someengineering/resoto
126
11033281
<gh_stars>100-1000 import resotolib.logger from resotolib.config import Config from typing import Dict from kubernetes import client, config log = resotolib.logger.getLogger("resoto." + __name__) def k8s_config() -> Dict: cfg = {} num_k8s_clusters = len(Config.k8s.cluster) num_k8s_apiserver = len(Config...
demos/rally/libs/baseclass/root_screen.py
Jonypr-code/KivyMD
1,111
11033294
<filename>demos/rally/libs/baseclass/root_screen.py from kivy.properties import ColorProperty, StringProperty from kivymd.theming import ThemableBehavior from kivymd.uix.behaviors import RectangularRippleBehavior from kivymd.uix.boxlayout import MDBoxLayout from kivymd.uix.screen import MDScreen class RallyRootScree...
tests/database/test_batch_db.py
ggs134/py-evm
1,641
11033323
<gh_stars>1000+ import pytest from eth_utils import ( ValidationError, ) from eth.db.backends.memory import MemoryDB from eth.db.batch import BatchDB @pytest.fixture def base_db(): return MemoryDB() @pytest.fixture def batch_db(base_db): return BatchDB(base_db) @pytest.fixture def base2_db(): ret...
hypergan/trainers/simultaneous_trainer.py
limberc/HyperGAN
889
11033326
import numpy as np import torch import hyperchamber as hc import inspect from hypergan.gan_component import ValidationException, GANComponent from hypergan.trainers.base_trainer import BaseTrainer from hypergan.optimizers.adamirror import Adamirror TINY = 1e-12 class SimultaneousTrainer(BaseTrainer): """ Steps G...
machine_learning/text recognition/main.py
avi-pal/al-go-rithms
1,253
11033345
<filename>machine_learning/text recognition/main.py<gh_stars>1000+ import scipy.io as sio import numpy as np from PIL import Image import matplotlib.pyplot as plt import time from random import randint def sigmoid(s): return 1/(1+np.exp(-s)) data_matrix=sio.loadmat('data.mat') theta_matrix=sio.loadmat('weights.mat')...
examples/test_cws.py
smilelight/lightNLP
889
11033354
<filename>examples/test_cws.py import os import sys sys.path.append(os.path.split(os.path.realpath(__file__))[0]) from lightnlp.sl import CWS cws_model = CWS() train_path = '../data/cws/train.sample.txt' dev_path = '../data/corpus/cws/test.sample.txt' vec_path = 'D:/Data/NLP/embedding/char/token_vec_300.bin' cws_mo...
spikeextractors/extractors/numpyextractors/__init__.py
zekearneodo/spikeextractors
145
11033418
from .numpyextractors import NumpyRecordingExtractor, NumpySortingExtractor
Python3/1163.py
rakhi2001/ecom7
854
11033480
<reponame>rakhi2001/ecom7<filename>Python3/1163.py __________________________________________________________________________________________________ Runtime: 200 ms Memory Usage: 34 MB class Solution: def lastSubstring(self, s: str) -> str: count=collections.defaultdict(list) for i in range(len(s))...
test/test_generic.py
timgates42/uliweb
202
11033511
<gh_stars>100-1000 #coding=utf-8 import time, sys sys.path.insert(0, '../uliweb/lib') from uliweb.orm import * import uliweb import uliweb.orm uliweb.orm.__auto_create__ = True uliweb.orm.__nullable__ = True uliweb.orm.__server_default__ = False import mock from uliweb.utils.generic import QueryView, ListView class Re...
apps/drug_target_interaction/sign/train.py
agave233/PaddleHelix
454
11033547
# 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/licenses/LICENSE-2.0 # # Unless required by applic...
Packs/GoogleBigQuery/Integrations/GoogleBigQuery/GoogleBigQuery_test.py
diCagri/content
799
11033580
<gh_stars>100-1000 import datetime from GoogleBigQuery import convert_to_string_if_datetime def test_convert_to_string_if_datetime(): test_conversion_for_none = convert_to_string_if_datetime(None) assert test_conversion_for_none is None now = datetime.datetime.now() convert_to_string_if_datetime(now)...
sdk/network/azure-mgmt-privatedns/azure/mgmt/privatedns/models/_private_dns_management_client_enums.py
rsdoherty/azure-sdk-for-python
2,728
11033604
# 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 may ...
python/203 Remove Linked List Elements.py
allandproust/leetcode-share
156
11033629
<reponame>allandproust/leetcode-share ''' Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6 Return: 1 --> 2 --> 3 --> 4 --> 5 ''' # Definition for singly-linked list. class ListNode(object): def __init__(self, x): ...
rsbook_code/planning/fmm.py
patricknaughton01/RoboticSystemsBook
116
11033641
import numpy as np import heapq def fmm(f,x0,bmin,bmax,h): """Uses the Fast Marching Method to solve for the shortest paths from point x0 to all points in a domain [bmin,bmax] under the incremental cost function f(x). The resulting cost field V(x) is the value function for the cost $\min_y \int_0^...
cmake/external/coremltools/mlmodel/docs/conf.py
fushwLZU/onnxruntime_test
11,356
11033653
<reponame>fushwLZU/onnxruntime_test<filename>cmake/external/coremltools/mlmodel/docs/conf.py ../../docs/conf.py
labview_automation/labview.py
TamilNeram/python_labview_automation
111
11033667
<filename>labview_automation/labview.py import ConfigParser from distutils.dir_util import copy_tree from hoplite.remote_enabler import remotify import logging import os import platform import psutil import stat import subprocess import tempfile import time from labview_automation.client import LabVIEWClient _log = ...
events/migrations/0036_auto_20190908_2340.py
horacexd/clist
166
11033690
# Generated by Django 2.1.7 on 2019-09-08 23:40 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('events', '0035_participant__team'), ] operations = [ migrations.RemoveField( model_name='team',...
webhooks-with-cloud-run/MicroServices/Webhook/webhook.py
suganyaprasad27/serverless-expeditions
105
11033696
<reponame>suganyaprasad27/serverless-expeditions # Copyright 2019 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 req...
release/stubs.min/Autodesk/Revit/DB/__init__.py
htlcnn/ironpython-stubs
182
11033709
<reponame>htlcnn/ironpython-stubs # encoding: utf-8 # module Autodesk.Revit.DB calls itself DB # from RevitAPI,Version=17.0.0.0,Culture=neutral,PublicKeyToken=null # by generator 1.145 # no doc # no imports # no functions # classes from __init___parts.BaseExportOptions import BaseExportOptions from __init___...
backend/projects/migrations/0002_page.py
donroyco/falco
796
11033764
<reponame>donroyco/falco # Generated by Django 2.1.5 on 2019-02-04 21:28 from django.db import migrations, models import django.db.models.deletion import uuid class Migration(migrations.Migration): dependencies = [("projects", "0001_initial")] operations = [ migrations.CreateModel( name...
zmail/api.py
wsgfz/zmail
317
11033767
""" zmail.api ~~~~~~~~~~~~ This module implements the zmail API. """ import logging from typing import Optional from .info import get_supported_server_info from .server import MailServer from .utils import read, read_html, save, save_attachment, show logger = logging.getLogger('zmail') # Backward-compatible with ear...
paperboy/__init__.py
datalayer-externals/papermill-paperboy
233
11033773
__all__ = ['config', 'middleware', 'output', 'resources', 'scheduler', 'server', 'storage', 'worker'] from . import config # noqa: F401 from . import output # noqa: F401 from . import utils # noqa: F401 from ._version import __version__ # noqa: F401
examples/hello_world/app.py
rperesy/aioflask
189
11033774
<filename>examples/hello_world/app.py from aioflask import Flask, render_template app = Flask(__name__) @app.route('/') async def index(): return await render_template('index.html') @app.cli.command() async def hello(): """Example async CLI handler.""" print('hello!')
doc/src/modules/mpmath/plots/chebyu.py
shipci/sympy
319
11033803
<reponame>shipci/sympy<filename>doc/src/modules/mpmath/plots/chebyu.py # Chebyshev polynomials U_n(x) on [-1,1] for n=0,1,2,3,4 f0 = lambda x: chebyu(0,x) f1 = lambda x: chebyu(1,x) f2 = lambda x: chebyu(2,x) f3 = lambda x: chebyu(3,x) f4 = lambda x: chebyu(4,x) plot([f0,f1,f2,f3,f4],[-1,1])
transformers/nlp/text_preprocessing_transformer.py
james94/driverlessai-recipes
194
11033830
"""Preprocess the text column by stemming, lemmatization and stop word removal""" import datatable as dt import numpy as np import shutil import os from zipfile import ZipFile import filelock from h2oaicore.transformer_utils import CustomTransformer from h2oaicore.systemutils import config, remove, user_dir from h2oai...
airesources/ML-StarterBot-Python/tests/neural_net_test.py
xinnosuke/Halite-II
232
11033831
<filename>airesources/ML-StarterBot-Python/tests/neural_net_test.py from tsmlstarterbot.neural_net import NeuralNet from tsmlstarterbot.common import PLANET_MAX_NUM, PER_PLANET_FEATURES import numpy as np import unittest EPSILON = 1e-6 SEED = 0 def equal(a, b): return abs(a - b) < EPSILON class TestNeuralNet(...
tests/test_utils.py
aronianm/flask-apscheduler
942
11033871
from copy import deepcopy from flask_apscheduler import utils from unittest import TestCase class TestUtils(TestCase): def test_pop_trigger(self): def __pop_trigger(trigger, *params): data = dict(trigger=trigger) next_value = 1 for param in params: data[...
doc/conf.py
tonybaloney/pycharm-bandit
304
11033913
<reponame>tonybaloney/pycharm-bandit # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information -------------------------...
autodist/patch.py
Ezra-H/autodist
127
11033927
<filename>autodist/patch.py # Copyright 2020 Petuum, Inc. All Rights Reserved. # # It includes the derived work based on: # https://github.com/tensorflow/tensorflow # Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this fi...
test_server/evsutils/__init__.py
mbarak/EventSource
172
11033961
<reponame>mbarak/EventSource # from protocol import * # from utils import *
appsettings/settings.py
NGXTDN/webvirtcloud
1,246
11033984
from .models import AppSettings class Settings: pass app_settings = Settings() def get_settings(): try: entries = AppSettings.objects.all() except: pass for entry in entries: setattr(app_settings, entry.key, entry.value)
image_processing/histogram_equalization/python/histogram.py
avi-pal/al-go-rithms
1,253
11033988
from PIL import Image def grayscale(image): new = Image.new("RGB",(image.size[0],image.size[1]),(0,0,0)) for i in range(image.size[0]): for j in range(image.size[1]): p = image.getpixel((i,j)) media = int((p[0]+p[1]+p[2])/3) new.putpixel((i,j),(media,media,media)) ...
tests/test_commit.py
vonkad/marge-bot
518
11034005
<gh_stars>100-1000 from unittest.mock import Mock from marge.gitlab import Api, GET from marge.commit import Commit INFO = { "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6", "short_id": "6104942438c", "title": "Sanitize for network graph", "author_name": "randx", "author_email": "<EMAIL>", "...
tests/extensions/run.py
jonnyrocks/pyangbind
176
11034013
#!/usr/bin/env python from __future__ import unicode_literals import unittest from tests.base import PyangBindTestCase class ExtensionsTests(PyangBindTestCase): yang_files = ["extensions.yang"] pyang_flags = ["--interesting-extension=extdef", "--interesting-extension=extdef-two"] maxDiff = None def...
codigo/Live49/exemplo_6.py
cassiasamp/live-de-python
572
11034024
<gh_stars>100-1000 """Exemplo usando shelve.""" import shelve dbm = shelve.open('shelve.pkl') dbm['dados'] = [1, 2, 3, 4, 5] dbm['bananas'] = 'bananas' print(dbm['bananas']) print(type(dbm['dados']))
robot-server/robot_server/service/session/command_execution/__init__.py
anuwrag/opentrons
235
11034050
from .base_command_queue import CommandQueue # noqa: F401 from .base_executor import CommandExecutor # noqa: F401 from .command import ( # noqa: F401 Command, CompletedCommand, create_command, CommandResult, ) from .callable_executor import CallableExecutor # noqa: F401
intro-to-bokeh/code-snippets/output-file-example.py
syberflea/materials
3,682
11034081
<gh_stars>1000+ # Bokeh Libraries from bokeh.io import output_file from bokeh.plotting import figure, show # The figure will be rendered in a static HTML file # called output_file_test.html output_file("output_file_test.html", title="Empty Bokeh Figure") # Set up a generic figure() object fig = figure() # See what i...
tests/unit2/test_calculate_points.py
LiorAvrahami/arcade
824
11034084
<reponame>LiorAvrahami/arcade<gh_stars>100-1000 from uuid import uuid4 import PIL from PIL.Image import Image import arcade def test_calculate_points(): texture = arcade.load_texture(":resources:images/items/coinGold.png") result = arcade.calculate_hit_box_points_detailed(texture.image) print(result) ...
docs/examples/service_container.py
vlcinsky/nameko
3,425
11034087
from nameko.containers import ServiceContainer class Service: name = "service" # create a container container = ServiceContainer(Service, config={}) # ``container.extensions`` exposes all extensions used by the service service_extensions = list(container.extensions) # start service container.start() # stop ser...
L1Trigger/DTTriggerPhase2/test/macros/compare_groupings_StdToBayes.py
Purva-Chaudhari/cmssw
852
11034092
#!/bin/env python # # PyROOT study of standard selector performance using sim-hit matching # to identify fake and signal muons # import os, re, ROOT, sys, pickle, time from pprint import pprint from math import * from array import array from DataFormats.FWLite import Events, Handle import numpy as np ## ## User Inpu...
neurst_pt/layers/modalities/audio_modalities.py
ishine/neurst
208
11034101
<gh_stars>100-1000 # Copyright 2020 ByteDance Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
axelrod/strategies/cooperator.py
nandhinianandj/Axelrod
596
11034111
from axelrod.action import Action from axelrod.player import Player C, D = Action.C, Action.D class Cooperator(Player): """A player who only ever cooperates. Names: - Cooperator: [Axelrod1984]_ - ALLC: [Press2012]_ - Always cooperate: [Mittal2009]_ """ name = "Cooperator" classifie...
intake/catalog/tests/test_alias.py
gramhagen/intake
578
11034118
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2018, Anaconda, Inc. and Intake contributors # All rights reserved. # # The full license is in the LICENSE file, distributed with this software. #------------------------------------------------------------------------...
pylandtemp/exceptions.py
dimejimudele/pylandtemp
104
11034121
<reponame>dimejimudele/pylandtemp import numpy as np __all__ = [ "InvalidMaskError", "InputShapesNotEqual", "InvalidMethodRequested", ] class InvalidMaskError(Exception): """Invalid mask error""" pass class KeywordArgumentError(Exception): """Required keyword argument missing""" pass...
OpenAttack/utils/zip_downloader.py
e-tornike/OpenAttack
444
11034133
<gh_stars>100-1000 import urllib import zipfile import os from tqdm import tqdm def make_zip_downloader(URL : str, file_list=None, resource_name = None): """ This function is used to make a zipfile downloader for data. """ if isinstance(file_list, str): file_list = [file_list] use_sou...
Dataset/dataset_professional_scatter.py
pyecharts/pyecharts_gallery
759
11034166
<reponame>pyecharts/pyecharts_gallery<gh_stars>100-1000 import json from pyecharts import options as opts from pyecharts.charts import Grid, Scatter with open("life-expectancy-table.json", "r", encoding="utf-8") as f: j = json.load(f) l1_1 = ( Scatter() .add_dataset( dimensions=[ "Inc...
cli/endpoints/online/triton/ensemble/models/triton/bidaf-postprocess/1/model.py
denniseik/azureml-examples
331
11034194
<filename>cli/endpoints/online/triton/ensemble/models/triton/bidaf-postprocess/1/model.py import json import numpy as np import triton_python_backend_utils as pb_utils class TritonPythonModel: """Your Python model must use the same class name. Every Python model that is created must have "TritonPythonModel" ...
common/spaces/__init__.py
HaxThePlanet/nexus-wars-training
813
11034208
from common.spaces import prng from common.spaces import multi_discrete
attalos/dataset/generic_prep.py
millertime145/attalos
101
11034238
from __future__ import absolute_import from __future__ import division from __future__ import print_function import gzip import shutil from attalos.dataset.dataset_prep import DatasetPrep, RecordMetadata, SplitType class GenericDatasetPrep(DatasetPrep): def __init__(self, dataset_description, split='train'): ...
ch02/test_pymongo_2.py
pjhinton/Agile_Data_Code_2
454
11034259
from pymongo import MongoClient client = MongoClient() record = {"foo": "bar"} client.agile_data_science.collection_two.insert_one(record) record2 = client.agile_data_science.collection_one.find_one( { "foo": "bar" } )
recipes/Python/577021_Short_Enum_Recipe/recipe-577021.py
tdiprima/code
2,023
11034286
<filename>recipes/Python/577021_Short_Enum_Recipe/recipe-577021.py def enum(names): "Create a simple enumeration having similarities to C." return type('enum', (), dict(map(reversed, enumerate( names.replace(',', ' ').split())), __slots__=()))()
InvenTree/company/test_views.py
carlos-riquelme/InvenTree
656
11034304
<reponame>carlos-riquelme/InvenTree """ Unit tests for Company views (see views.py) """ # -*- coding: utf-8 -*- from __future__ import unicode_literals import json from django.test import TestCase from django.urls import reverse from django.contrib.auth import get_user_model from django.contrib.auth.models import Gr...
dbaas/maintenance/scripts/filer_migrate.py
didindinn/database-as-a-service
303
11034323
from datetime import datetime from socket import gethostname from notification.models import TaskHistory from logical.models import Database from util.providers import get_filer_migrate_steps from workflow.workflow import steps_for_instances from maintenance.models import FilerMigrate as FilerMigrateManager class Fil...
alex/ml/gmm/gmm.py
oplatek/alex
184
11034332
#!/usr/bin/env python # -*- coding: utf-8 -*- # This code is based on https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/mixture/gmm.py code # which is distributed under the new BSD license. import numpy as np import cPickle as pickle from sklearn.utils.extmath import logsumexp EPS = np.finfo(float).e...
Chapter08/tests/test_environ.py
feiwang20/DRLHandsOn-Playground
2,497
11034349
<filename>Chapter08/tests/test_environ.py import unittest import numpy as np from lib import data, environ class TestEnv(unittest.TestCase): def test_simple(self): prices = data.load_relative("data/YNDX_160101_161231.csv") env = environ.StocksEnv({"YNDX": prices}) s = env.reset() ...
v2/backend/site/views/__init__.py
jonfairbanks/rtsp-nvr
558
11034360
from .blueprint import site from .contact_submission_resource import ContactSubmissionResource from .index import index
torchbenchmark/models/fastNLP/reproduction/Summarization/Baseline/tools/PositionEmbedding.py
Chillee/benchmark
2,693
11034378
<reponame>Chillee/benchmark #!/usr/bin/python # -*- coding: utf-8 -*- # __author__="<NAME>" # # 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/licen...
pygears/typing/math.py
bogdanvuk/pygears
120
11034397
from math import floor def bitw(num: int) -> int: num = int(num) if num < 0: num = -2 * num - 1 elif num == 0: return 1 return num.bit_length() def ceil_pow2(num: int) -> int: return int(2**(bitw(num - 1))) def ceil_div(num: int, divisor: int) -> int: return (num + divisor...
torchrecipes/audio/source_separation/metrics/sdr.py
facebookresearch/recipes
161
11034412
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python3 # pyre-strict import torch from torchrecipes.audio.source_separation.loss import utils def sisdri_metric( ...
c2/lib/models/builder/audio_model.py
ankitshah009/R2Plus1D
752
11034425
<reponame>ankitshah009/R2Plus1D # Copyright 2020-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
moe/optimal_learning/python/python_version/optimization.py
dstoeckel/MOE
966
11034430
# -*- coding: utf-8 -*- r"""Classes for various optimizers (maximizers) and multistarting said optimizers. .. Note:: comments in this module are copied from the header comments in gpp_optimization.hpp. Table of Contents: 1. FILE OVERVIEW 2. OPTIMIZATION OF OBJECTIVE FUNCTIONS a. GRADIENT DESCENT i. OVERVI...
utils/ecg_signal_quality_model_creation/data_creation.py
ucohen/NeuroKit.py
338
11034478
import os import re import numpy as np import pandas as pd import wfdb import neurokit as nk import seaborn as sns import matplotlib.pyplot as plt """ The data from the PTB-Diagnostic-ECG database must be in a data folder. - data_creation.py - model_creation.py - data/ - patient001/ - patient002/ - ... ""...
pyradio/common.py
tcarobruce/pyradio
427
11034483
# -*- coding: utf-8 -*- """ Theming constants """ def FOREGROUND(): return 0 def BACKGROUND(): return 1 # for pop up window CAPTION = 2 BORDER = 3 """ Format of theme configuration Name, color_pair, foreground, background If foreground == 0, color can be edited If > 0, get color from list item referred to by num...
kolibri/core/lessons/migrations/0004_nullable_created_by_assigned_by.py
MBKayro/kolibri
545
11034501
<filename>kolibri/core/lessons/migrations/0004_nullable_created_by_assigned_by.py # -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2021-10-19 20:54 from __future__ import unicode_literals import django.db.models.deletion from django.conf import settings from django.db import migrations from django.db import mo...
tests/test_extension.py
sprinkle1502/mopidy-musicbox-webclient
278
11034558
import unittest from unittest import mock from mopidy_musicbox_webclient import Extension class ExtensionTests(unittest.TestCase): def test_get_default_config(self): ext = Extension() config = ext.get_default_config() assert "[musicbox_webclient]" in config assert "enabled = tru...
pyfacebook/api/facebook/resource/video.py
sns-sdks/python-facebook
181
11034561
""" Apis for video """ from typing import Dict, Optional, Union import pyfacebook.utils.constant as const from pyfacebook.api.base_resource import BaseResource from pyfacebook.models.video import Video from pyfacebook.utils.params_utils import enf_comma_separated class FacebookVideo(BaseResource): def get_i...
4_Shallownet_fastai/shallownet_cifar.py
Sara-Rajaee/Deep_learning_explorations
154
11034598
<gh_stars>100-1000 # USAGE """ python shallownet_cifar.py \ --input_path "../data/cifar10" \ --output_path "./" \ --epochs 5 \ --learning_rate 1e-2\ --batch_size 64 """ # Import the necessary packages import click import numpy as np import matplotlib.pyplot as plt from shallownet import * from fastai.vision import Cla...
src/api2.py
codexgigassys/codex-backend
161
11034615
<reponame>codexgigassys/codex-backend #!/usr/bin/env python # Copyright (C) 2016 <NAME>. # This file is part of CodexGigas - https://github.com/codexgigassys/ # See the file 'LICENSE' for copying permission. from gevent import monkey import gevent import os import json import copy import argparse import tempfile import...
sources/decompose-transformed-components.py
googlefonts/Inconsolata
787
11034681
#MenuTitle: Decompose Transformed Components """TTFautohint doesn't like components which have been flipped""" def find_transformed_component_glyphs(font): found = set() for idx, master in enumerate(font.masters): for glyph in font.glyphs: components = glyph.layers[idx].components for comp in components: ...
tests/test_space_ops.py
PhotonSpheres/manim
9,497
11034696
import numpy as np from manim import cartesian_to_spherical, spherical_to_cartesian def test_polar_coords(): a = np.array([1, 1, 0]) b = (2, np.pi / 2, np.pi / 2) assert all( np.round(cartesian_to_spherical(a), 4) == np.round([2 ** 0.5, np.pi / 4, np.pi / 2], 4), ) assert all(np.r...
Python3/838.py
rakhi2001/ecom7
854
11034700
__________________________________________________________________________________________________ sample 84 ms submission class Solution: def pushDominoes(self, dominoes: str) -> str: res = '' count = 0 for d in dominoes: if d == '.': count += 1 elif ...
tests/packagedcode/data/pypi/setup.py-versions/certifi-2020.6.20/setup.py
s4-2/scancode-toolkit
1,511
11034722
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import with_statement import re import os import sys # While I generally consider it an antipattern to try and support both # setuptools and distutils with a single setup.py, in this specific instance # where certifi is a dependency of setuptools, it can cr...
cflearn/api/cv/data/transforms/pt.py
carefree0910/carefree-learn
400
11034734
<filename>cflearn/api/cv/data/transforms/pt.py from typing import Any from typing import Tuple from typing import Union from torchvision.transforms import transforms from torchvision.transforms import InterpolationMode from .general import NoBatchTransforms from .....data import Transforms @Transforms.register("to_t...
shopify_auth/cookies_middleware.py
iamprayush/django-shopify-auth
118
11034742
import logging from ua_parser import user_agent_parser def is_mac_os_10_14(os): return "Mac OS X" in os["family"] and os["major"] == "10" and os["minor"] == "14" def is_ios_12(os): return "iOS" in os["family"] and os["major"] == "12" def is_safari(browser): return browser["family"] == "Safari" def s...
function/python/brightics/function/textanalytics/test/tfidf_test.py
parkjh80/studio
202
11034745
<reponame>parkjh80/studio """ Copyright 2019 Samsung SDS 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 a...
app/demo/countries/migrations/0017_country1_country2_country3_country4_country5_country6.py
sesostris/django-material-admin
270
11034746
<gh_stars>100-1000 # Generated by Django 3.0 on 2019-12-12 20:35 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('countries', '0016_person_smart'), ] operations = [ migrations.CreateModel( name='Country1', fields=...
utils/tokenization_utils.py
t-minski/qagnn
322
11034747
<filename>utils/tokenization_utils.py from transformers import PreTrainedTokenizer import os import nltk import json from tqdm import tqdm import spacy EOS_TOK = '<EOS>' UNK_TOK = '<UNK>' PAD_TOK = '<PAD>' SEP_TOK = '<SEP>' EXTRA_TOKS = [EOS_TOK, UNK_TOK, PAD_TOK, SEP_TOK] class WordTokenizer(PreTrainedTokenizer): ...
ding/interaction/exception/__init__.py
LuciusMos/DI-engine
464
11034761
<filename>ding/interaction/exception/__init__.py from .base import ResponseException from .master import MasterErrorCode, get_master_exception_by_error, MasterResponseException, MasterSuccess, \ MasterChannelInvalid, MasterChannelNotGiven, MasterMasterTokenInvalid, MasterMasterTokenNotGiven, \ MasterSelfTokenIn...
alipay/aop/api/domain/AlipayEbppInvoiceOpenRedCreateModel.py
antopen/alipay-sdk-python-all
213
11034799
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.GeneralInvoiceItem import GeneralInvoiceItem class AlipayEbppInvoiceOpenRedCreateModel(object): def __init__(self): self._alipay_user_id = None self._auto_fil...