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
samples/snippets/feature_store_service/create_entity_type_sample.py
lclc19/python-aiplatform
180
12707330
<gh_stars>100-1000 # Copyright 2021 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-2.0 # # Unless required by applicable law or agr...
pyramda/relation/min.py
sergiors/pyramda
124
12707335
<reponame>sergiors/pyramda from pyramda.function.curry import curry import builtins @curry def min(xs): return builtins.min(xs)
setup.py
djm/python-scrapyd-api
233
12707350
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from setuptools import setup from setuptools.command.test import test as TestCommand readme = open('README.md').read() history = open('HISTORY.md').read() class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) ...
rest-service/manager_rest/test/endpoints/test_deployment_update_step_extraction.py
cloudify-cosmo/cloudify-manager
124
12707371
<reponame>cloudify-cosmo/cloudify-manager import json import unittest from manager_rest.test.attribute import attr from manager_rest.test.base_test import LATEST_API_VERSION from manager_rest.storage import models from manager_rest.deployment_update.step_extractor import ( PROPERTY, PROPERTIES, OUTPUT, OUTPUTS, W...
QT_Py_NeoPixels/code.py
gamblor21/Adafruit_Learning_System_Guides
665
12707377
<filename>QT_Py_NeoPixels/code.py<gh_stars>100-1000 """Basic NeoPixel LED animations for the QT Py.""" import time import board from rainbowio import colorwheel import neopixel # Update this to match the pin to which you connected the NeoPixels pixel_pin = board.A3 # Update this to match the number of NeoPixels connec...
maya/Tests/mayaReload_test.py
ryu-sw/alembic
921
12707386
<reponame>ryu-sw/alembic<gh_stars>100-1000 ##-***************************************************************************** ## ## Copyright (c) 2009-2011, ## <NAME>, Inc. and ## Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd. ## ## All rights reserved. ## ## Redistribution and use in sour...
etcmodel/models/wikihop/wikihop_eval.py
deepneuralmachine/google-research
23,901
12707414
<filename>etcmodel/models/wikihop/wikihop_eval.py # coding=utf-8 # Copyright 2021 The Google Research 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/li...
samcli/lib/iac/constants.py
torresxb1/aws-sam-cli
2,959
12707415
""" General IaC constants """ PARAMETER_OVERRIDES = "parameter_overrides" GLOBAL_PARAMETER_OVERRIDES = "global_parameter_overrides"
samples/CSP/sco2_analysis_python_V2/example/mspt_default_generate_sco2_udpc.py
jkelroy/SAM
219
12707420
################################################## ## Set relative file paths ## import csv import sys import os import numpy as np import json absFilePath = os.path.abspath(__file__) fileDir = os.path.dirname(os.path.abspath(__file__)) parentDir = os.path.dirname(fileDir) newPath = os.path.join(parentDir, 'core') s...
Paddle_Enterprise_CaseBook/Waybill_Information_Extraction/run_ernie.py
wwhio/awesome-DeepLearning
1,150
12707485
<gh_stars>1000+ import paddle import paddle.nn as nn import paddlenlp from functools import partial from paddlenlp.datasets import MapDataset from paddlenlp.data import Stack, Tuple, Pad from paddlenlp.layers import LinearChainCrf, ViterbiDecoder, LinearChainCrfLoss from paddlenlp.metrics import ChunkEvaluator from ut...
excel4lib/lang/excel4_translator.py
aaaddress1/boobsnail
169
12707497
<gh_stars>100-1000 from excel4lib.config import * from excel4lib.config.excel4_translator_config import Excel4MissingTranslationLevel from excel4lib.utils import * from excel4lib.exception import * class Excel4Translator(object): ''' `Excel4Translator` class allows to translate english formulas to another lan...
mayan/apps/locales/forms.py
nattangwiwat/Mayan-EDMS-recitation
343
12707506
<gh_stars>100-1000 from django import forms from mayan.apps.views.forms import DetailForm from .models import UserLocaleProfile class LocaleProfileForm(forms.ModelForm): class Meta: fields = ('language', 'timezone') model = UserLocaleProfile widgets = { 'language': forms.Sele...
2021_04_28/dojo_test.py
devppjr/dojo
114
12707523
import unittest from dojo import criar_fita, main, pinta_fita class DojoTest(unittest.TestCase): def test_main(self): self.assertEqual(main(4, [1]), 3) def test_main_outro(self): self.assertEqual(main(13, [2, 3, 6]), 3) def test_main_outro(self): self.assertEqual(main(10, [9, 10]...
plots/chapter5.py
haeseung81/PyTorchStepByStep
170
12707548
import numpy as np import matplotlib.pyplot as plt plt.style.use('fivethirtyeight') def plot_images(images, targets, n_plot=30): n_rows = n_plot // 10 + ((n_plot % 10) > 0) fig, axes = plt.subplots(n_rows, 10, figsize=(15, 1.5 * n_rows)) axes = np.atleast_2d(axes) for i, (image, target) in enumerate(z...
tests/test/plugin/test_isolation_update.py
ActorForth/brownie
1,595
12707552
#!/usr/bin/python3 import json from pathlib import Path import pytest test_source = """ def test_stuff(BrownieTester, accounts): c = accounts[0].deploy(BrownieTester, True) c.doNothing({'from': accounts[0]})""" def test_update_no_isolation(plugintester): result = plugintester.runpytest() result.ass...
utils/convert-pokec.py
wangxiaoyunanne/GraphDefense
140
12707555
import os import sys import h5py import numpy as np import pandas as pd import networkx as nx from convert import make_adjacency, make_sparse_adjacency, save_problem, spadj2edgelist np.random.seed(123) def load_ages(path): ages = pd.read_csv(path, header=None, sep='\t') ages.columns = ('id', 'age') a...
paasta_tools/broadcast_log_to_services.py
sobolevn/paasta
1,711
12707586
#!/usr/bin/env python # Copyright 2015-2016 Yelp 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 ...
android/toolchains/emulator/toolchain.bzl
artem-zinnatullin/rules_android
140
12707641
# Copyright 2019 The Bazel 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 applicable la...
tests/data/expected/main/main_openapi_http_refs/output.py
adaamz/datamodel-code-generator
891
12707655
# generated by datamodel-codegen: # filename: https://example.com/refs.yaml # timestamp: 2019-07-26T00:00:00+00:00 from __future__ import annotations from typing import Optional from pydantic import AnyUrl, BaseModel, Field, conint class Problem(BaseModel): detail: Optional[str] = Field( None, ...
slimta/logging/log.py
slimta/python-slimta
141
12707695
# Copyright (c) 2020 <NAME> # # 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 restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, ...
tdc/test/dev_tests/chem_utils_test/test_molconverter.py
Shicheng-Guo/TDC
577
12707696
# -*- coding: utf-8 -*- from __future__ import division from __future__ import print_function import os import sys import unittest import shutil # temporary solution for relative imports in case TDC is not installed # if TDC is installed, no need to use the following line sys.path.append(os.path.abspath(os.path.joi...
soundata/jams_utils.py
lucaspbastos/soundata
177
12707699
"""Utilities for converting soundata Annotation classes to jams format. """ import logging import os from typing import Callable, List from typing_extensions import ParamSpecKwargs import jams import librosa from soundata import annotations def jams_converter( audio_path=None, spectrogram_path=None, metadata=No...
Python3/940.py
rakhi2001/ecom7
854
12707704
<gh_stars>100-1000 __________________________________________________________________________________________________ sample 36 ms submission from collections import defaultdict class Solution: def distinctSubseqII(self, S: str) -> int: total = 1 dic = defaultdict(int) m = 10 ** 9 + 7 ...
tests/test_observable/test_debounce.py
mmpio/RxPY
4,342
12707705
<gh_stars>1000+ import unittest from rx import empty, never, throw, operators as _ from rx.testing import TestScheduler, ReactiveTest on_next = ReactiveTest.on_next on_completed = ReactiveTest.on_completed on_error = ReactiveTest.on_error subscribe = ReactiveTest.subscribe subscribed = ReactiveTest.subscribed dispose...
curlylint/rules/meta_viewport/meta_viewport.py
adamchainz/curlylint
155
12707709
from curlylint import ast from curlylint.check_node import CheckNode, build_tree from curlylint.issue import Issue META_VIEWPORT = "meta_viewport" RULE = { "id": "meta_viewport", "type": "accessibility", "docs": { "description": "The `viewport` meta tag should not use `user-scalable=no`, and `maxi...
functest/func_materials.py
Luvideria/lightmetrica-v3
101
12707728
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.3.3 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # Materials # # This te...
spyder/plugins/completion/providers/languageserver/widgets/messagebox.py
Earthman100/spyder
7,956
12707753
<reponame>Earthman100/spyder # -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """Language Server Protocol message boxes.""" # Standard library imports import os # Third party imports from qtpy.QtCore import Signal...
esphome/components/lock/__init__.py
OttoWinter/esphomeyaml
249
12707761
import esphome.codegen as cg import esphome.config_validation as cv from esphome import automation from esphome.automation import Condition, maybe_simple_id from esphome.components import mqtt from esphome.const import ( CONF_ID, CONF_ON_LOCK, CONF_ON_UNLOCK, CONF_TRIGGER_ID, CONF_MQTT_ID, ) from es...
aiomcache/pool.py
lexdene/aiomcache
121
12707784
<filename>aiomcache/pool.py import asyncio from collections import namedtuple __all__ = ['MemcachePool'] _connection = namedtuple('connection', ['reader', 'writer']) class MemcachePool: def __init__(self, host, port, *, minsize, maxsize, loop=None): loop = loop if loop is not None else asyncio.get_eve...
Tests/cu2qu/cli_test.py
odidev/fonttools
2,705
12707790
<reponame>odidev/fonttools import os import pytest import py ufoLib2 = pytest.importorskip("ufoLib2") from fontTools.cu2qu.ufo import CURVE_TYPE_LIB_KEY from fontTools.cu2qu.cli import main DATADIR = os.path.join(os.path.dirname(__file__), 'data') TEST_UFOS = [ py.path.local(DATADIR).join("RobotoSubset-Regula...
matchzoo/utils/__init__.py
ChrisRBXiong/MatchZoo-py
468
12707792
from .one_hot import one_hot from .tensor_type import TensorType from .list_recursive_subclasses import list_recursive_concrete_subclasses from .parse import parse_loss, parse_activation, parse_metric, parse_optimizer from .average_meter import AverageMeter from .timer import Timer from .early_stopping import EarlyStop...
transistor/workers/workgroup.py
awesome-archive/transistor
232
12707800
<reponame>awesome-archive/transistor # -*- coding: utf-8 -*- """ transistor.workers.workgroup ~~~~~~~~~~~~ This module implements WorkGroup. See transistor.workers.__init__ for more notes on this module. :copyright: Copyright (C) 2018 by BOM Quote Limited :license: The MIT License, see LICENSE for more details. ~~~~~~...
tests/__init__.py
phillips96/similarity
706
12707872
from pathlib import Path CURRRENT_DIR = Path(__file__).parent.absolute() DATA_DIR = CURRRENT_DIR / 'data/'
BiBloSA/exp_SST/src/model/template.py
mikimaus78/ml_monorepo
319
12707922
<gh_stars>100-1000 from configs import cfg from src.utils.record_log import _logger import tensorflow as tf import numpy as np from abc import ABCMeta, abstractmethod class ModelTemplate(metaclass=ABCMeta): def __init__(self, token_emb_mat, glove_emb_mat, tds, cds, tl, scope): self.scope = scope s...
mmrotate/core/evaluation/__init__.py
Justice-Eternal/mmrotate
449
12707926
# Copyright (c) OpenMMLab. All rights reserved. from .eval_map import eval_rbbox_map __all__ = ['eval_rbbox_map']
Design/146. LRU Cache.py
beckswu/Leetcode
138
12707927
<reponame>beckswu/Leetcode<gh_stars>100-1000 #python OrderedDict class LRUCache: def __init__(self, capacity: int): self.cache = collections.OrderedDict() self.capacity = capacity def get(self, key: int) -> int: if key not in self.cache: return -1 val = self.cac...
tests/components/google_travel_time/test_config_flow.py
MrDelik/core
30,023
12707950
"""Test the Google Maps Travel Time config flow.""" import pytest from homeassistant import config_entries, data_entry_flow from homeassistant.components.google_travel_time.const import ( ARRIVAL_TIME, CONF_ARRIVAL_TIME, CONF_AVOID, CONF_DEPARTURE_TIME, CONF_DESTINATION, CONF_LANGUAGE, CONF...
src/pymap3d/tests/test_time.py
wrlssqi/pymap3d
116
12707964
<filename>src/pymap3d/tests/test_time.py import pytest from pytest import approx from datetime import datetime from pymap3d.timeconv import str2dt import pymap3d.sidereal as pms t0 = datetime(2014, 4, 6, 8) def test_juliantime(): assert pms.juliandate(t0) == approx(2.456753833333e6) def test_types(): np =...
t/o_tables_test.py
rohankumardubey/orioledb
947
12707980
#!/usr/bin/env python3 # coding: utf-8 import unittest import testgres from .base_test import BaseTest from .base_test import ThreadQueryExecutor from testgres.enums import NodeStatus class OTablesTest(BaseTest): def assertTblCount(self, size): self.assertEqual(size, self.node.execute('postgres', ...
Lib/test/dtracedata/gc.py
shawwn/cpython
52,316
12707982
import gc def start(): gc.collect(0) gc.collect(1) gc.collect(2) l = [] l.append(l) del l gc.collect(2) gc.collect() start()
tests/unit/bivariate/test_independence.py
yzR1991/Copulas
235
12708009
from unittest import TestCase import numpy as np from copulas.bivariate.independence import Independence class TestIndependence(TestCase): def test___init__(self): """Independence copula can be instantiated directly.""" # Setup / Run instance = Independence() # Check as...
examples/save_views.py
larsoner/PySurfer
158
12708036
<filename>examples/save_views.py """ =================== Save a set of views =================== Save some views in png files. """ from surfer import Brain print(__doc__) sub = 'fsaverage' hemi = 'lh' surf = 'inflated' brain = Brain(sub, hemi, surf) ################################################################...
Bot/cogs/welcome.py
Shuri2060/Nurevam
145
12708038
from .utils import utils from discord.ext import commands import traceback import datetime import discord class Welcome(commands.Cog): #Allow to welcome new members who join guild. If it enable, will send them a message. def __init__(self,bot): self.bot = bot self.redis = bot.db.redis async de...
tests/unit_tests/prepare_email/test_body_header_extraction.py
Erfard/melusine
300
12708056
import pandas as pd import numpy as np from melusine.prepare_email.body_header_extraction import extract_last_body from melusine.prepare_email.body_header_extraction import extract_body from melusine.prepare_email.body_header_extraction import extract_header structured_body = [ { "meta": {"date": None, "f...
RecoParticleFlow/PFTracking/python/particleFlowDisplacedVertexCandidate_cfi.py
ckamtsikis/cmssw
852
12708067
<gh_stars>100-1000 import FWCore.ParameterSet.Config as cms particleFlowDisplacedVertexCandidate = cms.EDProducer("PFDisplacedVertexCandidateProducer", # The track collection use for the fitting. May be any collection. # The only condition is that it shall contain the hit pattern information trackCollect...
hpOneView/resources/servers/id_pools.py
doziya/hpeOneView
107
12708178
<gh_stars>100-1000 # -*- coding: utf-8 -*- ### # (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP # # 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 restriction, inc...
tests/test_cardxml.py
kvazario/python-hearthstone
233
12708181
from hearthstone import cardxml def test_cardxml_load(): cardid_db, _ = cardxml.load() dbf_db, _ = cardxml.load_dbf() assert cardid_db assert dbf_db for card_id, card in cardid_db.items(): assert dbf_db[card.dbf_id].id == card_id for dbf_id, card in dbf_db.items(): assert cardid_db[card.id].dbf_id == dbf...
moto/kinesisvideoarchivedmedia/__init__.py
gtourkas/moto
5,460
12708199
<gh_stars>1000+ from .models import kinesisvideoarchivedmedia_backends from ..core.models import base_decorator kinesisvideoarchivedmedia_backend = kinesisvideoarchivedmedia_backends["us-east-1"] mock_kinesisvideoarchivedmedia = base_decorator(kinesisvideoarchivedmedia_backends)
samples/vmc/networks_nsxt/hello_world.py
VictorGardi/vsphere-automation-sdk-python
589
12708208
#!/usr/bin/env python """ * ******************************************************* * Copyright (c) VMware, Inc. 2019. All Rights Reserved. * SPDX-License-Identifier: MIT * ******************************************************* * * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT * WARRANTIES OR CONDITIONS...
benchmarks/exps/old/card275.py
SymbioticLab/Salus
104
12708214
# -*- coding: future_fstrings -*- # # Copyright 2019 <NAME> <<EMAIL>> # # This file is part of Salus # (see https://github.com/SymbioticLab/Salus). # # 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 Lice...
b2fuse/cached_bucket.py
sondree/b2_fuse
253
12708271
#!/usr/bin/env python # -*- coding: utf-8 -*- #The MIT License (MIT) #Copyright (c) 2015 <NAME> #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 restriction, including without limitati...
mppsolar/protocols/jk232.py
kchiem/mpp-solar
132
12708279
<filename>mppsolar/protocols/jk232.py import logging from .abstractprotocol import AbstractProtocol from .protocol_helpers import crcJK232 as crc log = logging.getLogger("jk232") # Read basic information and status # DD A5 03 00 FF FD 77 # start bit 0xDD # status 0xA5 means read, status 0x5A means write. # comman...
scripts/update_vcpkg_baseline.py
manjunathnilugal/PyBaMM
330
12708286
""" Automatically update the baseline of vcpkg-configuration.json """ import json import os import pybamm def update_baseline(): """ Opens vcpkg-configuration.json and updates the baseline with the latest commit id """ # Get latest commit id from pybamm-team/sundials-vcpkg-registry cmd = "git ls...
DQM/SiStripMonitorClient/scripts/DeadROCCounter_Phase1.py
Purva-Chaudhari/cmssw
852
12708321
#!/usr/bin/env python3 from __future__ import print_function from ROOT import TFile, gStyle,gPad ,TObject, TCanvas, TH1, TH1F, TH2F, TLegend, TPaletteAxis, TList, TLine, TAttLine, TF1,TAxis import re import sys, string def getRunNumber(filename): global runNumber pos=filename.find("__") runNumber=int(filen...
design/satellite_is_sunlit.py
facorazza/python-skyfield
765
12708354
<gh_stars>100-1000 """Verdict: light-time delay from the Sun can be neglected in is_sunlit()! For the Sun's position from Earth, does calling observe() really make enough difference to justify the expense? Here we take two approaches to answering the question: we compare the difference every day over 40 years, and th...
esphome/components/display/__init__.py
OttoWinter/esphomeyaml
249
12708356
import esphome.codegen as cg import esphome.config_validation as cv from esphome import core, automation from esphome.automation import maybe_simple_id from esphome.const import ( CONF_AUTO_CLEAR_ENABLED, CONF_ID, CONF_LAMBDA, CONF_PAGES, CONF_PAGE_ID, CONF_ROTATION, CONF_FROM, CONF_TO, ...
desktop/core/ext-py/xlwt-1.3.0/tests/utils.py
zhoudahong/hue
5,079
12708402
import os from os.path import join, dirname, abspath, isdir def in_tst_dir(filename): return join(dirname(abspath(__file__)), filename) def in_tst_output_dir(filename): output_dir = join(dirname(abspath(__file__)), 'output') if not isdir(output_dir): os.mkdir(output_dir, 0o755) return join(out...
dml/NN/neuralNetwork.py
justdark/dml
708
12708470
''' the whole structure of dml.NN is just like DeepLearnToolbox(https://github.com/rasmusbergpalm/DeepLearnToolbox) I think the whole architecture of it is clear and easy to understand so I copy it to python I also recommend UFLDL(http://ufldl.stanford.edu/wiki/index.php/UFLDL_Tutorial) to learn Neural Network ...
components/iscesys/Parsers/rdf/language/grammar/syntax.py
vincentschut/isce2
1,133
12708507
<reponame>vincentschut/isce2 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Copyright 2014 California Institute of Technology. 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. ...
vislab/datasets/behance.py
hertzmann/vislab
113
12708544
<gh_stars>100-1000 """ Code to call the Behance API to construct a dataset. """ #import os import sys import requests import bs4 import pandas as pd #import numpy as np import random import vislab tags = ['photo','blue','car','chinese ink','colored pencil','colors','comic', 'fashion illustration','graphics',...
susi_linux/ui/animators.py
swipswaps/susi_linux
2,191
12708628
import math import cairo import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GLib # nopep8 class Animator(Gtk.DrawingArea): def __init__(self, **properties): super().__init__(**properties) self.set_size_request(200, 80) self.connect("draw", self.do_drawing) G...
neural_compressor/experimental/nas/nas.py
intel/neural-compressor
172
12708680
#!/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.apache.org/licenses/LICENSE-2.0 # # Unl...
scripts/build_single_hop_qa_data.py
luxuantao/golden-retriever
195
12708681
<filename>scripts/build_single_hop_qa_data.py from collections import Counter from copy import copy import json from tqdm import tqdm from search.search import bulk_text_query from utils.general import chunks def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument('split', choi...
challenges/Single-Sign-On/poller/for-release/machine.py
pingjuiliao/cb-multios
473
12708723
<filename>challenges/Single-Sign-On/poller/for-release/machine.py #!/usr/bin/env python # # Copyright (C) 2014 Narf Industries <<EMAIL>> # # 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 with...
Python/example.py
tsadakane/TIGRE
326
12708773
<gh_stars>100-1000 from __future__ import division from __future__ import print_function import numpy as np import tigre import tigre.algorithms as algs from tigre.utilities import sample_loader from tigre.utilities.Measure_Quality import Measure_Quality import tigre.utilities.gpu as gpu import matplotlib.pyp...
test/common.py
pencc/bfs
3,106
12708785
<reponame>pencc/bfs<gh_stars>1000+ """ Copyright (c) 2016, Baidu.com, Inc. All Rights Reserved Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. """ import subprocess import filecmp import os import time import nose.tools import json import commands import string from c...
src/clusterfuzz/_internal/protos/untrusted_runner_pb2_grpc.py
mspectorgoogle/clusterfuzz
5,023
12708808
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
recipes/Python/576939_Convert_Dictionary_to_XML/recipe-576939.py
tdiprima/code
2,023
12708818
def dict2xml(dict, xml = ''): for key,value in dict.iteritems(): exec 'content = '+ {'str': 'value', 'dict': 'dict2xml(value)'}[type(value).__name__] xml += '<%s>%s</%s>' % (key, str(content), key) return xml
hypertunity/trial.py
LaudateCorpus1/hypertunity
130
12708826
"""A wrapper class for conducting multiple experiments, scheduling jobs and saving results. """ from typing import Callable, Type, Union from hypertunity import optimisation, reports, utils from hypertunity.domain import Domain from hypertunity.optimisation import Optimiser from hypertunity.reports import Reporter fr...
convlab2/task/multiwoz/generate_goals.py
ljw23/ConvLab-2
339
12708868
<reponame>ljw23/ConvLab-2 """ generate user goal for collecting new multiwoz data """ from convlab2.task.multiwoz.goal_generator import GoalGenerator from convlab2.util.file_util import read_zipped_json import random import numpy as np import json import datetime from pprint import pprint def extract_slot_combinatio...
lib/python/batch_sim/scoring_functions/buoy.py
leozz37/makani
1,178
12708873
# Copyright 2020 Makani Technologies LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
Lib/test/_typed_dict_helper.py
oleksandr-pavlyk/cpython
52,316
12708877
"""Used to test `get_type_hints()` on a cross-module inherited `TypedDict` class This script uses future annotations to postpone a type that won't be available on the module inheriting from to `Foo`. The subclass in the other module should look something like this: class Bar(_typed_dict_helper.Foo, total=False): ...
hoomd/metal/pair.py
XT-Lee/hoomd-blue
204
12708915
<filename>hoomd/metal/pair.py # Copyright (c) 2009-2021 The Regents of the University of Michigan # This file is part of the HOOMD-blue project, released under the BSD 3-Clause License. R""" Metal pair potentials. """ from hoomd.md import force from hoomd.md import nlist as nl # to avoid naming conflicts import hoom...
env/Lib/site-packages/OpenGL/raw/GLES2/OES/geometry_shader.py
5gconnectedbike/Navio2
210
12708922
<filename>env/Lib/site-packages/OpenGL/raw/GLES2/OES/geometry_shader.py '''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays # Code generation uses this from OpenGL.raw.GLES2 import _types as _cs # End users want this... from OpenGL.raw.GLES2._types import * from OpenGL.raw...
test/units/test_oci_autonomous_data_warehouse.py
slmjy/oci-ansible-modules
106
12708927
<filename>test/units/test_oci_autonomous_data_warehouse.py<gh_stars>100-1000 # Copyright (c) 2018, 2019, 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/license...
acoular/version.py
ishine/acoular
294
12708944
# coding=UTF-8 #------------------------------------------------------------------------------ # Copyright (c) 2007-2021, Acoular Development Team. #------------------------------------------------------------------------------ # separate file to find out about version without importing the acoular lib __author_...
shadowproxy/proxies/socks/server.py
xiaoshihu/shadowproxy
180
12708976
from ...protocols import socks4, socks5 from ...utils import run_parser_curio from ..base.server import ProxyBase class SocksProxy(ProxyBase): proto = "SOCKS" def __init__(self, bind_addr, auth=None, via=None, plugin=None, **kwargs): self.bind_addr = bind_addr self.auth = auth self.vi...
delta/data/task/base_speech_task.py
didichuxing/delta
1,442
12708984
<filename>delta/data/task/base_speech_task.py # Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd. # 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 Licens...
s3prl/pretrain/distiller/dataset.py
Hem7513/s3prl
856
12709005
<reponame>Hem7513/s3prl<gh_stars>100-1000 """ Dataset for distiller Author: <NAME> (https://github.com/vectominist) """ import os import random import numpy as np import pandas as pd import torch from torch.nn.utils.rnn import pad_sequence from torch.utils.data.dataset import Dataset import torchaudio HALF_BA...
dataloader/dataset/SKU110K-R/rotate_augment.py
PauliKarl/RotationDetection
850
12709026
<reponame>PauliKarl/RotationDetection # -*- coding:utf-8 -*- import os import sys from multiprocessing import Pool import cv2 import imgaug as ia from imgaug import augmenters as iaa import numpy as np import PIL from PIL import Image PIL.Image.MAX_IMAGE_PIXELS = 200000000 process_num = 64 ia.seed(1) def preproces...
tests/test_galton_dataset.py
mtreviso/lxmls-toolkit
183
12709034
import sys import os import pytest from numpy import array, array_equal, allclose import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from lxmls.readers import galton tolerance = 1e-5 @pytest.fixture(scope='module') def galton_data(): return galton.load() def test_galton_data(galton_data)...
src/aprl/visualize/make_videos.py
fkamrani/adversarial-policies
211
12709047
<reponame>fkamrani/adversarial-policies<filename>src/aprl/visualize/make_videos.py<gh_stars>100-1000 """Generate videos for adversaries and standard baselines.""" import logging import os import os.path as osp from sacred import Experiment from sacred.observers import FileStorageObserver from aprl.common.utils impor...
angr/engines/pcode/arch/ArchPcode_SuperH_BE_32_SH_1.py
matthewpruett/angr
6,132
12709052
<reponame>matthewpruett/angr<gh_stars>1000+ ### ### This file was automatically generated ### from archinfo.arch import register_arch, Endness, Register from .common import ArchPcode class ArchPcode_SuperH_BE_32_SH_1(ArchPcode): name = 'SuperH:BE:32:SH-1' pcode_arch = 'SuperH:BE:32:SH-1' description = '...
ops.py
carrenD/cross-modality-UDA
211
12709063
import tensorflow as tf import pdb def _phase_shift(I, r, batch_size = 10): # Helper function with main phase shift operation # pdb.set_trace() _, a, b, c = I.get_shape().as_list() X = tf.reshape(I, (batch_size, a, b, r, r)) X = tf.transpose(X, (0, 1, 2, 4, 3)) # bsize, a, b, 1, 1 X = tf.split(X...
Python3/468.py
rakhi2001/ecom7
854
12709080
<reponame>rakhi2001/ecom7 __________________________________________________________________________________________________ sample 24 ms submission class Solution: def validIPAddress(self, IP: str) -> str: def checkIPv4(IP): IPList = IP.split('.') if l...
envi/tests/msp430/isetc.py
rnui2k/vivisect
716
12709085
from envi.archs.msp430.regs import * checks = [ # SETC ( 'SETC', { 'regs': [], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "12d3", 'data': "" }, { 'regs': [], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 1), (SR_V, 0)], 'code': "12d3", 'data': "" } ), ]
release/stubs.min/Tekla/Structures/ModelInternal_parts/dotRebarEndDetailStrip_t.py
htlcnn/ironpython-stubs
182
12709108
<reponame>htlcnn/ironpython-stubs class dotRebarEndDetailStrip_t(object): # no doc RebarHookData=None RebarStrip=None RebarThreading=None
algorithms/happy-ladybugs.py
gajubadge11/HackerRank-1
340
12709129
<gh_stars>100-1000 #!/bin/python3 import os import sys from collections import Counter # # Complete the happyLadybugs function below. # def is_happy(b): if b[0] != b[1] or b[-1] != b[-2]: return False for ind in range(1, len(b)-1): if b[ind] != b[ind-1] and b[ind] != b[ind+1]: ret...
metrics/webqsp/evaluator.py
HKUNLP/UnifiedSKG
191
12709182
<reponame>HKUNLP/UnifiedSKG # encoding=utf8 from collections import defaultdict from metrics.webqsp.utils import * from rdflib.graph import Graph kg_files = [f"third_party/webqsp/freebase150k_part{i}.txt" for i in range(3)] kg_str = "".join([open(f).read() for f in kg_files]) g = Graph() g.parse(data=kg_st...
tests/test_dummy.py
gabrielDonnantuoni/drf-nested-routers
1,254
12709185
from django.test import TestCase class TestDummy(TestCase): def test_one_plus_one(self): assert 1 + 1 == 2
library/oci_volume_group_facts.py
slmjy/oci-ansible-modules
106
12709190
<reponame>slmjy/oci-ansible-modules #!/usr/bin/python # Copyright (c) 2018, 2019, 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...
lona/__init__.py
fscherf/lona
155
12709195
<filename>lona/__init__.py from .exceptions import * # NOQA: F403 from .routing import MATCH_ALL, Route from .errors import * # NOQA: F403 from .view import LonaView from .app import LonaApp VERSION = (1, 8, 5) VERSION_STRING = '.'.join(str(i) for i in VERSION)
torchbenchmark/models/tacotron2/utils.py
Chillee/benchmark
384
12709223
<filename>torchbenchmark/models/tacotron2/utils.py import numpy as np from scipy.io.wavfile import read import torch from pathlib import Path def get_mask_from_lengths(lengths): max_len = torch.max(lengths).item() ids = torch.arange(0, max_len, device=lengths.device) mask = (ids < lengths.unsqueeze(1)).bo...
samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_dog.py
JigarJoshi/openapi-generator
11,868
12709236
<filename>samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_dog.py # coding: utf-8 """ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 ...
cup/log.py
liu0208xuan/CUP
900
12709255
<reponame>liu0208xuan/CUP<filename>cup/log.py #!/usr/bin/python # -*- coding: utf-8 -* # Copyright: [CUP] - See LICENSE for details. # Authors: <NAME> (@mythmgn), """ :description: common log related module """ from __future__ import print_function __all__ = [ 'debug', 'info', 'warn', 'critical', 'init_com...
demo/bs4_quotes.py
ssatyam4753/sukhoi
1,010
12709280
<gh_stars>1000+ """ This example extract just the quotes, you end up with a structure like: [quote0, quote1, ...] Note: It uses beautifulsoup4 :) """ from sukhoi import MinerBS4, core class QuoteMiner(MinerBS4): def run(self, dom): elems = dom.find_all('div', {'class':'quote'}) self.extend(li...
fedml_api/standalone/hierarchical_fl/client.py
xuwanwei/FedML
1,120
12709294
import copy import torch from fedml_api.standalone.fedavg.client import Client class Client(Client): def train(self, global_round_idx, group_round_idx, w): self.model.load_state_dict(w) self.model.to(self.device) if self.args.client_optimizer == "sgd": optimizer = torch.optim...
platform/mcu/haas1000/prebuild/data/python-apps/driver/spi/main.py
NEXTLEO/AliOS-Things
4,538
12709301
<reponame>NEXTLEO/AliOS-Things<filename>platform/mcu/haas1000/prebuild/data/python-apps/driver/spi/main.py from driver import SPI print("-------------------spi test--------------------") spi = SPI() spi.open("SPI0") readBuf = bytearray(3) writeBuf = bytearray([0x9f]) print(writeBuf) print(readBuf) value = spi.sendRec...
qt__pyqt__pyside__pyqode/pyqt5__QWebEnginePage__Client_sync.py
DazEB2/SimplePyScripts
117
12709319
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' from PyQt5.QtWidgets import QApplication from PyQt5.QtCore import QUrl from PyQt5.QtWebEngineWidgets import QWebEnginePage class Client(QWebEnginePage): def __init__(self, urls): self.app = QApplication([]) super().__init__...
Python/benchmarking/image_capture.py
felixbinder/tdw
307
12709341
from argparse import ArgumentParser from benchmark_utils import PATH from benchmarker import Benchmarker from platform import system """ Image capture benchmarks """ def granular(): output = "| Test | FPS |\n| --- | --- |\n" rows = [] b.start() rows.append(b.run(boxes=True, images...