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
extension_management/01_ManageExtensions.py
IBM/api-samples
172
12788993
<reponame>IBM/api-samples<filename>extension_management/01_ManageExtensions.py<gh_stars>100-1000 #!/usr/bin/env python3 # In this sample you will see how to manage extensions using the REST API. # The sample contains uploading extension, installing extension, checking # installing task and delete extension. import j...
tests/agent_tests.py
tomakehurst/saboteur
258
12789023
from saboteur.agent import SaboteurWebApp import json import unittest from test_utils import MockShell from saboteur.apicommands import FAULT_TYPES, alphabetical_keys def post_request(params): return request('POST', params) def delete_request(): return {'path': '/', 'method': 'DELETE'} def req...
OpenMatch/modules/encoders/positional_encoder.py
vishalbelsare/OpenMatch
403
12789038
import torch import torch.nn as nn class PositionalEncoder(nn.Module): def __init__( self, embed_dim: int, max_len: int = 512 ) -> None: super(PositionalEncoder, self).__init__() self._embed_dim = embed_dim self._max_len = max_len self._embed_matrix = to...
lldb/test/API/tools/lldb-server/TestGdbRemoteProcessInfo.py
mkinsner/llvm
2,338
12789058
import gdbremote_testcase import lldbgdbserverutils from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class TestGdbRemoteProcessInfo(gdbremote_testcase.GdbRemoteTestCaseBase): mydir = TestBase.compute_mydir(__file__) def test_qProcessInfo_retur...
chembl_webresource_client/scripts/chembl_m2t.py
RowAnalytics/chembl_webresource_client
248
12789074
#!/usr/bin/env python from __future__ import print_function __author__ = 'mnowotka' # ---------------------------------------------------------------------------------------------------------------------- import sys import argparse from chembl_webresource_client.scripts.utils import get_serializer, chembl_id_regex,...
tools/bin/pythonSrc/PSI-0.3b2_gp/psi/_version.py
YangHao666666/hawq
450
12789081
# The MIT License # # Copyright (C) 2007 <NAME> # # Copyright (C) 2008-2009 <NAME> # # Copyright (C) 2008-2009 Abilisoft Ltd. # # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restr...
general/chainerrl/baselines/train_dqfd.py
marioyc/baselines
127
12789107
"""original source: https://github.com/chainer/chainerrl/pull/480 MIT License Copyright (c) Preferred Networks, Inc. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals from __future__ import absolute_import from builtins import * from future import stand...
pymclevel/id_definitions_2.py
bennettdc/MCEdit-Unified
237
12789111
<gh_stars>100-1000 import os import json from logging import getLogger import collections #from pymclevel import MCEDIT_DEFS, MCEDIT_IDS #import pymclevel import re #import id_definitions log = getLogger(__name__) def get_deps(base_version, file_name): deps = [base_version] print "Base: {}".format(base_versio...
Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkProducerFilter_cff.py
malbouis/cmssw
852
12789133
<reponame>malbouis/cmssw import FWCore.ParameterSet.Config as cms #------------------------------------------------ #AlCaReco filtering for HCAL isotrk: #------------------------------------------------ from Calibration.HcalAlCaRecoProducers.alcaHcalIsotrkProducer_cfi import * from Calibration.HcalAlCaRecoProducers.a...
{{cookiecutter.project_slug}}/backend/app/app/core/config.py
abnerjacobsen/full-stack
516
12789141
<filename>{{cookiecutter.project_slug}}/backend/app/app/core/config.py import os def getenv_boolean(var_name, default_value=False): result = default_value env_value = os.getenv(var_name) if env_value is not None: result = env_value.upper() in ("TRUE", "1") return result API_V1_STR = "/api/v1...
terrascript/provider/hashicorp/googleworkspace.py
mjuenema/python-terrascript
507
12789147
# terrascript/provider/hashicorp/googleworkspace.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:17:22 UTC) import terrascript class googleworkspace(terrascript.Provider): """terraform-provider-googleworkspace""" __description__ = "terraform-provider-googleworkspace" __namespace__ = "h...
prompt_tuning/data/preprocessors_test.py
dumpmemory/prompt-tuning
108
12789192
<reponame>dumpmemory/prompt-tuning # Copyright 2022 Google. # # 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 applicabl...
neural_compressor/ux/components/model/shape.py
intel/neural-compressor
172
12789198
<gh_stars>100-1000 # -*- coding: utf-8 -*- # Copyright (c) 2021 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 r...
tools/build/v2/test/testing_primitives.py
mike-code/boost_1_38_0
130
12789231
#!/usr/bin/python # Copyright 2002 <NAME> # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) import BoostBuild import re def match_re(actual, expected): return re.match(expected, actual, re.DOTALL) != None t = BoostBu...
tests/losses/test_neuralndcg.py
almajo/allRank
473
12789249
<filename>tests/losses/test_neuralndcg.py<gh_stars>100-1000 import math from functools import partial from pytest import approx from allrank.data.dataset_loading import PADDED_Y_VALUE from tests.losses.utils import neuralNDCG_wrap, ndcg_wrap test_cases = [{"stochastic": False, "transposed": False}, {"...
PyObjCTest/test_nsbitmapimagerep.py
Khan/pyobjc-framework-Cocoa
132
12789323
<reponame>Khan/pyobjc-framework-Cocoa from PyObjCTools.TestSupport import * import objc import array import sys from objc import YES, NO from AppKit import * try: unicode except NameError: unicode = str try: long except NameError: long = int class TestNSBitmapImageRep(TestCase): def testInstant...
apps/async_task/utils.py
goztrk/django-htk
206
12789356
<reponame>goztrk/django-htk # Python Standard Library Imports import base64 import json def build_async_task_result(content, content_type, filename): """Builds an Async Task result from JSON This is necessary if we want to return multiple values, as the result by default is just a plain string. """ p...
foliant/preprocessors/base.py
foliant-docs/foliant
105
12789371
import re from logging import Logger from typing import Dict import yaml OptionValue = int or float or bool or str class BasePreprocessor(): '''Base preprocessor. All preprocessors must inherit from this one.''' # pylint: disable=too-many-instance-attributes defaults = {} tags = () @staticmetho...
tests/common/test_op/ascend/fake_quant_with_min_max_args.py
tianjiashuo/akg
286
12789408
<reponame>tianjiashuo/akg<gh_stars>100-1000 # Copyright 2020-2021 Huawei Technologies Co., Ltd # # 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 #...
analytics/object/language.py
dpatel257/Smart-City-Sample
126
12789412
#!/usr/bin/python3 text={ "object-detection": "object-detection", "svcq-counting": "svcq-counting", }
rollbar/contrib/django/tests.py
arthurio/pyrollbar
177
12789424
""" Unit tests """ from django.test import TestCase from django.conf import settings class BasicTests(TestCase): def test_configuration(self): """ Test that the configuration is sane. """ self.assertTrue('ROLLBAR' in dir(settings), msg='The ROLLBAR setting is not present...
integration_test/test_heartbeat_checker.py
lynix94/nbase-arc
176
12789486
<gh_stars>100-1000 # # Copyright 2015 <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/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
pyxtal/miscellaneous/bugs/bug.py
ubikpt/PyXtal
127
12789507
from pyxtal import pyxtal from ase.io import read from ase.spacegroup.symmetrize import prep_symmetry from spglib import get_symmetry_dataset #ans1 = get_symmetry_dataset(s, symprec=1e-2) #print(ans1) s = pyxtal() s.from_seed('bug.vasp', tol=1e-2) print(s) #s1=s.subgroup(eps=0.1, group_type='t+k', max_cell=4) #for a ...
server/zmq_server_pirate.py
merlinran/acorn-precision-farming-rover
143
12789533
<gh_stars>100-1000 """ ********************************************************************* This file is part of: The Acorn Project https://wwww.twistedfields.com/research ********************************************************************* Copyright (c) 2019-2...
fastmri_recon/evaluate/scripts/dealiasing_eval.py
samiulshuvo/fastmri-reproducible-benchmark
105
12789560
<gh_stars>100-1000 import os from tqdm import tqdm from fastmri_recon.config import * from fastmri_recon.data.datasets.fastmri_pyfunc import train_masked_kspace_dataset_from_indexable as singlecoil_dataset from fastmri_recon.evaluate.metrics.np_metrics import METRIC_FUNCS, Metrics from fastmri_recon.models.subclassed...
recipes/opencolorio/all/conanfile.py
rockandsalt/conan-center-index
562
12789567
from conans import ConanFile, CMake, tools import os required_conan_version = ">=1.33.0" class OpenColorIOConan(ConanFile): name = "opencolorio" description = "A color management framework for visual effects and animation." license = "BSD-3-Clause" homepage = "https://opencolorio.org/" url = "htt...
python/pythonstartup.py
andrewpsp/dotfiles
249
12789575
def _init(): import atexit import os import sys try: import readline except Exception: readline = None import types import time import uuid import json import pprint import hashlib import subprocess import datetime try: import __builtin__ ...
mixly_arduino/sample/mixpy/海龟画图/py/海龟画图04盛开的向日葵_01太阳公公.py
wecake/Mixly_Arduino
118
12789617
import turtle tina= turtle.Turtle() tina.pencolor("#ffcc33") tina.fillcolor("#ffcc33") tina.pensize(5) tina.begin_fill() tina.circle (80,360) tina.end_fill() tina.penup() tina.goto(-40,100) tina.pendown() tina.pencolor("#000000") tina.setheading(30) tina.circle ((-30),60) tina.penup() tina.goto(20,100) tina.pendown() ...
checkov/arm/registry.py
pmalkki/checkov
4,013
12789647
<reponame>pmalkki/checkov from checkov.arm.base_registry import Registry arm_resource_registry = Registry() arm_parameter_registry = Registry()
Python/other/sudoku_backtracking.py
zhcet19/NeoAlgo-1
897
12789672
<filename>Python/other/sudoku_backtracking.py def solve(board, i=0, j=0): i,j = nextCell(board, i, j) if i == -1: return True for e in range(1,10): if isValid(board,i,j,e): board[i][j] = e if solve(board, i, j): ...
tools/SDKTool/src/ui/tree/ai_tree/action_dqn_data.py
Passer-D/GameAISDK
1,210
12789707
<filename>tools/SDKTool/src/ui/tree/ai_tree/action_dqn_data.py # -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making GameAISDK available. This source code file is licensed under the GNU General Public License Version 3. For full details, please refer to the file "LICENSE.txt" wh...
problems/bubble-sort/bubble-sort.py
vidyadeepa/the-coding-interview
1,571
12789711
<reponame>vidyadeepa/the-coding-interview def bubblesort(l): """ Runtime: O(n^2) """ last = len(l)-1 for i in range(last): for j in range(i+1, last): if l[i] > l[j]: l[i], l[j] = l[j], l[i] return l print bubblesort([8,2,4,7,9,0,1,4,5,7,8,9]) print bubblesort...
become_yukarin/dataset/utility.py
nameless-writer/become-yukarin
562
12789731
<gh_stars>100-1000 import math import fastdtw import numpy _logdb_const = 10.0 / numpy.log(10.0) * numpy.sqrt(2.0) # should work on torch and numpy arrays def _sqrt(x): isnumpy = isinstance(x, numpy.ndarray) isscalar = numpy.isscalar(x) return numpy.sqrt(x) if isnumpy else math.sqrt(x) if isscalar else ...
snapx/setup.py
ruth-ann/snap-python
242
12789772
from setuptools import setup, find_packages if __name__ == "__main__": setup( name="snapx", author="<EMAIL>", version="0.0.1", packages=find_packages(), description="""SnapX: An experimental SNAP API with NetworkX-like interface""" )
23_yolov3-nano/01_float32/03_weight_quantization.py
khanfarhan10/PINTO_model_zoo
1,529
12789793
### tf-nightly-2.2.0.dev20200418 import tensorflow as tf # Weight Quantization - Input/Output=float32 converter = tf.lite.TFLiteConverter.from_saved_model('./saved_model') converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE] converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS,tf.lite.OpsSe...
tests/simple/test_simple.py
iklasky/timemachines
253
12789798
<gh_stars>100-1000 from timemachines.skaters.simple.movingaverage import precision_ema_ensemble, aggressive_ema_ensemble SIMPLE_TO_TEST = [ precision_ema_ensemble, aggressive_ema_ensemble ] from timemachines.inclusion.sklearninclusion import using_sklearn if using_sklearn: from timemachines.skatertools.evaluatio...
devops/__init__.py
crazypenguin/devops
300
12789900
<gh_stars>100-1000 from __future__ import absolute_import, unicode_literals from .celery import app as celery_app # from .job import scheduler # 第一个获取到文件锁的进程执行任务后,如果在运行中途进程关闭重新启动了一个新的,则依然会多次执行 __all__ = ['celery_app'] # __all__ = ['celery_app', 'scheduler'] # import pymysql # pymysql.install_as_MySQLdb()
webservices/common/models/costs.py
18F/openFEC
246
12790045
from sqlalchemy.dialects.postgresql import TSVECTOR from .base import db class CommunicationCost(db.Model): __tablename__ = 'ofec_communication_cost_mv' sub_id = db.Column(db.Integer, primary_key=True) original_sub_id = db.Column('orig_sub_id', db.Integer, index=True) candidate_id = db.Column('cand_...
atlas/foundations_rest_api/src/foundations_rest_api/filters/null_filter.py
DeepLearnI/atlas
296
12790072
<reponame>DeepLearnI/atlas from foundations_rest_api.filters.api_filter_mixin import APIFilterMixin class NullFilter(APIFilterMixin): def __call__(self, result, params): if result and isinstance(result, list): new_params = {key: value for key, value in params.items() if key.endswith('_isnull'...
devserver/modules/profile.py
leture/django-devserver
467
12790098
from devserver.modules import DevServerModule from devserver.utils.time import ms_from_timedelta from devserver.settings import DEVSERVER_AUTO_PROFILE from datetime import datetime import functools import gc class ProfileSummaryModule(DevServerModule): """ Outputs a summary of cache events once a response i...
code/config.py
SimonSuster/rc-cnn-dailymail
325
12790106
import theano import argparse _floatX = theano.config.floatX def str2bool(v): return v.lower() in ('yes', 'true', 't', '1', 'y') def get_args(): parser = argparse.ArgumentParser() parser.register('type', 'bool', str2bool) # Basics parser.add_argument('--debug', type='...
html_parsing/get_price_game/from_gama-gama.py
DazEB2/SimplePyScripts
117
12790122
<gh_stars>100-1000 #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # Основа взята из http://stackoverflow.com/a/37755811/5909792 def get_html(url): from PyQt5.QtCore import QUrl from PyQt5.QtWidgets import QApplication from PyQt5.QtWebEngineWidgets import QWebEnginePage class ...
shap/plots/_utils.py
willianfco/shap
16,097
12790129
from .. import Explanation from ..utils import OpChain from . import colors import numpy as np def convert_color(color): try: color = pl.get_cmap(color) except: pass if color == "shap_red": color = colors.red_rgb elif color == "shap_blue": color = colors.blue_rgb ...
src/third_party/swiftshader/third_party/subzero/pydir/run-pnacl-sz.py
rhencke/engine
2,151
12790141
#!/usr/bin/env python2 import argparse import itertools import os import re import subprocess import sys import tempfile from utils import FindBaseNaCl, GetObjdumpCmd, shellcmd def TargetAssemblerFlags(target, sandboxed): # TODO(reed kotler). Need to find out exactly we need to # add here for Mips32. flags = ...
examples/dataflow-python-examples/streaming-examples/slowlychanging-sideinput/sideinput_refresh/dofns.py
ruchirjain86/professional-services
2,116
12790156
# Copyright 2020 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
backend/apps/mails/views.py
KuanWeiLee/froggy-service
174
12790157
<gh_stars>100-1000 from django.shortcuts import redirect from django.urls import reverse from rest_framework.viewsets import ModelViewSet from rest_framework.decorators import action from rest_framework.permissions import IsAdminUser from .models import SendGridMail from .serializers import SendGridMailSerializer cla...
contrib/cookiecutter/ckan_extension/{{cookiecutter.project}}/ckanext/{{cookiecutter.project_shortname}}/logic/schema.py
gg2/ckan
2,805
12790222
<reponame>gg2/ckan import ckan.plugins.toolkit as tk def {{cookiecutter.project_shortname}}_get_sum(): not_empty = tk.get_validator("not_empty") convert_int = tk.get_validator("convert_int") return { "left": [not_empty, convert_int], "right": [not_empty, convert_int] }
lpot/utils/logger.py
intelkevinputnam/lpot-docs
172
12790244
<reponame>intelkevinputnam/lpot-docs #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2021 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.ap...
gimp-plugins/PD-Denoising-pytorch/utils.py
sunlin7/GIMP-ML
1,077
12790254
<reponame>sunlin7/GIMP-ML import math import torch import torch.nn as nn import numpy as np # from skimage.measure.simple_metrics import compare_psnr from torch.autograd import Variable import cv2 import scipy.ndimage import scipy.io as sio # import matplotlib as mpl # mpl.use('Agg') # import matplotlib.pyplot as plt ...
seq2seq/corpus.py
shinoyuki222/torch-light
310
12790271
import torch import argparse import logging from utils import corpora2idx, normalizeString from const import * class Dictionary(object): def __init__(self): self.word2idx = { WORD[BOS]: BOS, WORD[EOS]: EOS, WORD[PAD]: PAD, WORD[UNK]: UNK } s...
third_party/upb/docs/render.py
echo80313/grpc
515
12790279
<reponame>echo80313/grpc<gh_stars>100-1000 #!/usr/bin/env python3 import subprocess import sys import shutil import os if len(sys.argv) < 2: print("Must pass a filename argument") sys.exit(1) in_filename = sys.argv[1] out_filename = in_filename.replace(".in.md", ".md") out_dir = in_filename.replace(".in.md",...
tools/real_world_impact/nsfw_urls.py
zealoussnow/chromium
14,668
12790301
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """NSFW urls in the Alexa top 2000 sites.""" nsfw_urls = set([ "http://xhamster.com/", "http://xvideos.com/", "http://livejasmin.com/", "http://pornh...
python/keepsake/version.py
jsemric/keepsake
810
12790337
# This file is auto-generated by the root Makefile. Do not edit manually. version = "0.4.2"
beartype_test/a00_unit/a00_util/cache/test_utilcachecall.py
posita/beartype
1,056
12790348
<gh_stars>1000+ #!/usr/bin/env python3 # --------------------( LICENSE )-------------------- # Copyright (c) 2014-2021 Beartype authors. # See "LICENSE" for further details. ''' **Beartype callable caching utility unit tests.** This submodule unit tests the public API of the private :mod:`be...
tests/integration/test_networks.py
unparalleled-js/ape
210
12790410
<filename>tests/integration/test_networks.py import pytest from eth_typing import HexStr @pytest.mark.parametrize("block_id", ("latest", 0, "0", "0x0", HexStr("0x0"))) def test_get_block(eth_tester_provider, block_id): latest_block = eth_tester_provider.get_block(block_id) # Each parameter is the same as req...
alipay/aop/api/domain/AlipayUserApplepayProvisioningbundleCreateModel.py
antopen/alipay-sdk-python-all
213
12790420
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayUserApplepayProvisioningbundleCreateModel(object): def __init__(self): self._alipay_user_identifier = None @property def alipay_user_identifier(self): return self._...
examples/house-credit-default/get_input.py
wqruan/tf-encrypted
825
12790428
"""CLI for data preparation and processing.""" import argparse from utils import data_prep from utils import read_one_row from utils import save_input parser = argparse.ArgumentParser() parser.add_argument( "--save_row", type=int, default="0", help="Saves a single row to a file defaults to row 0", ) p...
evaluation/datasets/test_datasets.py
hsiehkl/pdffigures2
296
12790469
import unittest import math import datasets from pdffigures_utils import get_num_pages_in_pdf class TestDataset(unittest.TestCase): def test_pages_annotated_consistency(self): for dataset in datasets.DATASETS.values(): dataset = dataset() pages_annotated = dataset.get_annotated_pa...
mmdet/core/anchor/__init__.py
MinliangLin/TSD
454
12790473
from .anchor_generator import AnchorGenerator from .anchor_target import anchor_inside_flags, anchor_target, images_to_levels, unmap from .guided_anchor_target import ga_loc_target, ga_shape_target from .point_generator import PointGenerator from .point_target import point_target __all__ = [ "AnchorGenerator", ...
scrubadub/filth/date_of_birth.py
datascopeanalytics/scrubadub
190
12790533
import random import datetime import dateparser from faker import Faker from .base import Filth class DateOfBirthFilth(Filth): type = 'date_of_birth' min_age_years = 18 max_age_years = 100 @staticmethod def generate(faker: Faker) -> str: """Generates an example of this ``Filth`` type, us...
scripts/kopf/example.py
victoriouscoder/oreilly-kubernetes
323
12790545
<gh_stars>100-1000 import kopf @kopf.on.create('oreilly.com', 'v1alpha1', 'book') def create_fn(spec, **kwargs): print(f"And here we are! Creating: {spec}") return {'message': 'hello world'} # will be the new status <EMAIL>('<EMAIL>', 'v1alpha1', 'book') #def update_fn(old, new, diff, **kwargs): # print(...
Chapter10/clean_sample.py
fbitti/Bioinformatics-with-Python-Cookbook-Second-Edition
244
12790549
<reponame>fbitti/Bioinformatics-with-Python-Cookbook-Second-Edition<gh_stars>100-1000 import sys sys.stdout.write('ID_1 ID_2 missing\n0 0 0 \n') for line in sys.stdin: ind = line.rstrip() sys.stdout.write('%s %s 0\n' % (ind, ind))
xv_leak_tools/scriptlets/command_line_for_pid.py
UAEKondaya1/expressvpn_leak_testing
219
12790558
#!/usr/bin/env python3 import argparse import sys import psutil from wrap_scriptlet import wrap_scriptlet def run(): parser = argparse.ArgumentParser() parser.add_argument('pid') args = parser.parse_args(sys.argv[1:]) process = psutil.Process(int(args.pid)) return process.cmdline() sys.exit(wra...
addons/Sprytile-6b68d00/rx/linq/observable/dowhile.py
trisadmeslek/V-Sekai-Blender-tools
733
12790564
from rx.core import Observable from rx.internal import extensionmethod @extensionmethod(Observable) def do_while(self, condition): """Repeats source as long as condition holds emulating a do while loop. Keyword arguments: condition -- {Function} The condition which determines if the source will b...
tests/missing_data/test_missing_data_air_passengers_None_None.py
shaido987/pyaf
377
12790570
<filename>tests/missing_data/test_missing_data_air_passengers_None_None.py import tests.missing_data.test_missing_data_air_passengers_generic as gen gen.test_air_passengers_missing_data(None, None)
vivit.py
rishikksh20/ViViT-pytorch
204
12790612
<filename>vivit.py import torch from torch import nn, einsum import torch.nn.functional as F from einops import rearrange, repeat from einops.layers.torch import Rearrange from module import Attention, PreNorm, FeedForward import numpy as np class Transformer(nn.Module): def __init__(self, dim, depth, heads, dim_h...
tests/test_engine.py
adithyavis/pywarm
194
12790680
<reponame>adithyavis/pywarm<filename>tests/test_engine.py # 08-31-2019; """ Test cases for warm.engine. """ import torch import torch.nn as nn import torch.nn.functional as F import copy from pathlib import Path import sys sys.path.append(str(Path(__file__).parent.parent)) from warm import engine def test_set_get_def...
vega/trainer/callbacks/hccl.py
This-50m/vega
724
12790682
<filename>vega/trainer/callbacks/hccl.py<gh_stars>100-1000 # -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it wi...
sbin/db_mgmt_cwe.py
AlexFaraino/cve-search
377
12790718
<gh_stars>100-1000 #!/usr/bin/env python3 # # Import script of NIST CWE Common Weakness Enumeration. # # Until now, the import is only import Weakness description. # # The format is the following: # # { "_id" : ObjectId("52b70521b261026f36818515"), "weaknessabs" : "Variant", # "name" : "ASP.NET Misconfiguration: Missin...
pseudo/middlewares/standard_middleware.py
mifieldxu/pseudo-lang
661
12790741
from pseudo.middlewares.middleware import Middleware from pseudo.pseudo_tree import Node class StandardMiddleware(Middleware): ''' changes standard_iterable_call in return to a special type used by go ''' @classmethod def process(cls, tree): return cls().transform(tree) def trans...
conf.py
evhub/coconut
3,624
12790748
<reponame>evhub/coconut<gh_stars>1000+ #!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------------------------------------------------- # INFO: # ------------------------------------------------------------------------------------------------------...
cscs-checks/libraries/magma/magma_checks.py
CLIP-HPC/reframe
167
12790785
<gh_stars>100-1000 # Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich) # ReFrame Project Developers. See the top-level LICENSE file for details. # # SPDX-License-Identifier: BSD-3-Clause import reframe as rfm import reframe.utility.sanity as sn @rfm.simple_test class MagmaCheck(rfm.Regressio...
tests/core/validation/test_transaction_validation.py
dbfreem/py-evm
1,641
12790789
<reponame>dbfreem/py-evm import pytest from eth.vm.forks.london.transactions import UnsignedDynamicFeeTransaction from eth.vm.forks.berlin.transactions import UnsignedAccessListTransaction from eth_utils import ValidationError @pytest.mark.parametrize( "unsigned_access_list_transaction,is_valid", ( ...
the-cloudwatch-dashboard/python/app.py
mttfarmer/serverless
1,627
12790794
<reponame>mttfarmer/serverless #!/usr/bin/env python3 from aws_cdk import core from the_cloudwatch_dashboard.the_cloudwatch_dashboard_stack import TheCloudwatchDashboardStack app = core.App() TheCloudwatchDashboardStack(app, "the-cloudwatch-dashboard") app.synth()
inst/python/python_predict.py
cynthiayang525/PatientLevelPrediction
141
12790810
<reponame>cynthiayang525/PatientLevelPrediction<gh_stars>100-1000 # apply random forest model on new data #=============================================================== # INPUT: # 1) location of new data # 2) location of model # # OUTPUT: # it returns a file with indexes merged with prediction for test index - name...
postgres-debezium-ksql-elasticsearch/python_kafka_notify.py
alonsoir/examples-2
1,150
12790834
<reponame>alonsoir/examples-2<gh_stars>1000+ # rmoff / 13 Jun 2018 from slackclient import SlackClient from confluent_kafka import Consumer, KafkaError import json import time import os,sys token = os.environ.get('SLACK_API_TOKEN') if token is None: print('\n\n*******\nYou need to set your Slack API token in the SLAC...
alipay/aop/api/response/AlipayEcoDoctemplateSettingurlQueryResponse.py
antopen/alipay-sdk-python-all
213
12790842
<filename>alipay/aop/api/response/AlipayEcoDoctemplateSettingurlQueryResponse.py #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class AlipayEcoDoctemplateSettingurlQueryResponse(AlipayResponse): def __init__(self): super(Alipay...
test/manual/annotations/test_list_annotations.py
membranepotential/mendeley-python-sdk
103
12790848
<reponame>membranepotential/mendeley-python-sdk<filename>test/manual/annotations/test_list_annotations.py from test import get_user_session, cassette, sleep from test.resources.documents import create_document, delete_all_documents def test_should_list_annotations(): session = get_user_session() delete_all_do...
applications/tensorflow2/image_classification/custom_exceptions.py
payoto/graphcore_examples
260
12790850
# Copyright (c) 2021 Graphcore Ltd. All rights reserved. class UnsupportedFormat(TypeError): pass class DimensionError(ValueError): pass class MissingArgumentException(ValueError): pass class InvalidPrecisionException(NameError): pass class UnallowedConfigurationError(ValueError): pass
examples/s3-2017/rtu2a.py
pgaulon/minicps
119
12790899
<reponame>pgaulon/minicps """ rtu2a.py """ from minicps.devices import RTU from utils import STATE, RTU2A_PROTOCOL from utils import RTU_PERIOD_SEC from utils import IP # rtu2a tags from utils import CO_0_2a, CO_1_2a, CO_2_2a, CO_3_2a from utils import HR_0_2a, HR_1_2a, HR_2_2a from utils import wadi1, wadi1_bin im...
backend/www/photo_store.py
sleepingAnt/viewfinder
645
12790902
# Copyright 2012 Viewfinder Inc. All Rights Reserved. """HTTP request handler for serving viewfinder photo image file assets. In case of a local file store, permissions for the current user and the requested photo are verified and the requester is redirected to the FileObjectStoreHandler. For an s3 file store, permi...
docs/examples/fig6p24.py
uluturki/Mathematics-of-Epidemics-on-Networks
136
12790938
import networkx as nx import EoN from collections import defaultdict import matplotlib.pyplot as plt import scipy import random colors = ['#5AB3E6','#FF2000','#009A80','#E69A00', '#CD9AB3', '#0073B3','#F0E442'] rho = 0.01 Nbig=500000 Nsmall = 5000 tau =0.4 gamma = 1. def poisson(): return scipy.random.poisson(5)...
crank/net/module/mlfb.py
abeersaqib/crank
162
12790955
<reponame>abeersaqib/crank<filename>crank/net/module/mlfb.py #! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright (c) 2021 <NAME> <<EMAIL>> # # Distributed under terms of the MIT license. """ """ import librosa import scipy.signal import torch import torch.nn as nn class MLFBLayer(torch.nn...
library/keystone_service_provider.py
pgraziano/ursula
193
12790992
<reponame>pgraziano/ursula<gh_stars>100-1000 #!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2016, 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/licen...
tests/__init__.py
lpnueg4/-logzero
1,091
12790998
<filename>tests/__init__.py # -*- coding: utf-8 -*- """Unit test package for logzero."""
solver/spoof.py
juandesant/astrometry.net
460
12791022
<reponame>juandesant/astrometry.net # This file is part of the Astrometry.net suite. # Licensed under a 3-clause BSD style license - see LICENSE try: import pyfits except ImportError: try: from astropy.io import fits as pyfits except ImportError: raise ImportError("Cannot import either pyfit...
products/ui/llbuildui/model.py
uraimo/swift-llbuild
1,034
12791034
import struct from sqlalchemy import * from sqlalchemy.orm import relation, relationship from sqlalchemy.ext.declarative import declarative_base # DB Declaration Base = declarative_base() class KeyName(Base): __tablename__ = "key_names" id = Column(Integer, nullable=False, primary_key=True) name = Colu...
ldap2pg/defaults.py
ng-pe/ldap2pg
151
12791043
from itertools import chain from textwrap import dedent from .utils import string_types shared_queries = dict( datacl=dedent("""\ WITH grants AS ( SELECT (aclexplode(datacl)).grantee AS grantee, (aclexplode(datacl)).privilege_type AS priv FROM pg_catalog.pg_database WHERE da...
python/veles/tests/data/test_repack.py
pombredanne/veles
918
12791058
<reponame>pombredanne/veles<gh_stars>100-1000 # Copyright 2017 CodiLime # # 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...
service-configs/zabbix/partitioning/zabbix-partitioning.py
digideskio/adminscripts
110
12791064
<gh_stars>100-1000 #!/usr/bin/python import psycopg2 from optparse import OptionParser tables = { 'history':'daily', 'history_sync':'daily', 'history_uint':'daily', 'history_uint_sync':'daily', 'history_str':'daily', 'history_str_sync':'daily', 'history_log':'daily', 'history_text':'daily', 'trend...
tests/test_timer_dec.py
pnpnpn/timy
300
12791103
<gh_stars>100-1000 from unittest import mock from timy import timer from timy.settings import timy_config @mock.patch('timy.output') def test_timer_no_tracking(p_output): timy_config.tracking = False @timer() def func(): pass func() p_output.assert_not_called() @mock.patch('timy.outpu...
src/word_fix.py
thoppe/orthographic-pedant
155
12791148
<reponame>thoppe/orthographic-pedant<gh_stars>100-1000 import os, json, logging, glob, codecs, os, time, subprocess from contextlib import contextmanager import requests logging.basicConfig(level=logging.INFO) logging.getLogger("requests").setLevel(logging.WARNING) FLAG_fork = True FLAG_delete = True fork_sleep_time ...
udatetime/_pure.py
kashnick/udatetime
244
12791149
<reponame>kashnick/udatetime from datetime import tzinfo, timedelta, datetime as dt_datetime from time import time, gmtime from math import floor, ceil DATE_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%f' class TZFixedOffset(tzinfo): def __init__(self, offset): self.offset = offset def utcoffset(self, dt=None...
datasets/check_utils.py
AkshatShetty101/dmm-8803
247
12791171
import math import time import pickle import sys import os import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from datasets.data_utils import project_image_to_rect, compute_box_3d def adjust_coord_for_view(points): return points[:, [2, 0, 1]] * np.array([1, -1, -1]) def...
source/grammar/openqasm_reference_parser/exceptions.py
shiyunon/openqasm
603
12791229
<gh_stars>100-1000 __all__ = ["Qasm3ParserError"] class Qasm3ParserError(Exception): pass
examples/internationalisation/testLangs.py
tgolsson/appJar
666
12791245
<filename>examples/internationalisation/testLangs.py import sys sys.path.append("../../") from appJar import gui def press(btn): app.changeLanguage(btn) app=gui() app.showSplash() app.addLabel("l1", "default text") app.addButtons(["English", "Korean", "French"], press) app.addLabel("l2", "default text") app.addL...
Chapter 2/computational_graph.py
shantam21/Deep-Learning-with-TensorFlow-2-and-Keras
267
12791256
<reponame>shantam21/Deep-Learning-with-TensorFlow-2-and-Keras<gh_stars>100-1000 import tensorflow.compat.v1 as tf tf.disable_v2_behavior() in_a = tf.placeholder(dtype=tf.float32, shape=(2)) def model(x): with tf.variable_scope("matmul"): W = tf.get_variable("W", initializer=tf.ones(shape=(2,2))) b = tf.get_...
docqa/triviaqa/build_complete_vocab.py
Willyoung2017/doc-qa
422
12791269
import argparse from os.path import exists from docqa.triviaqa.build_span_corpus import TriviaQaOpenDataset from docqa.triviaqa.evidence_corpus import get_evidence_voc """ Build vocab of all words in the triviaqa dataset, including all documents and all train questions. """ def main(): parser = argparse.Argume...
cellphonedb/utils/dataframe_functions.py
chapuzzo/cellphonedb
278
12791290
<gh_stars>100-1000 import pandas as pd from cellphonedb.utils import dataframe_format def dataframes_has_same_data(dataframe1: pd.DataFrame, dataframe2: pd.DataFrame, round_decimals: bool = False) -> pd.DataFrame: dataframe1 = dataframe1.copy(deep=True) dataframe2 = dataframe2.co...
scanpy/datasets/__init__.py
mkmkryu/scanpy2
1,171
12791330
"""Builtin Datasets. """ from ._datasets import ( blobs, burczynski06, krumsiek11, moignard15, paul15, toggleswitch, pbmc68k_reduced, pbmc3k, pbmc3k_processed, visium_sge, ) from ._ebi_expression_atlas import ebi_expression_atlas