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
tests/agent/samples/process_agent.py
bbhunter/ostorlab
113
12676587
<filename>tests/agent/samples/process_agent.py<gh_stars>100-1000 """Sample agents that implements the process method, listen to ping messages and sends them back.""" import datetime import logging from ostorlab.agent import agent, message as agent_message logger = logging.getLogger(__name__) class ProcessTestAgent...
tests/unit/test_expression_tree/test_printing/test_print_name.py
manjunathnilugal/PyBaMM
330
12676589
""" Tests for the print_name.py """ import unittest import pybamm class TestPrintName(unittest.TestCase): def test_prettify_print_name(self): param = pybamm.LithiumIonParameters() param1 = pybamm.standard_variables param2 = pybamm.LeadAcidParameters() # Test PRINT_NAME_OVERRIDES ...
utils/check_dependencies.py
aguilajesus/dtformats
702
12676592
<reponame>aguilajesus/dtformats #!/usr/bin/env python # -*- coding: utf-8 -*- """Script to check for the availability and version of dependencies.""" import sys # Change PYTHONPATH to include dependencies. sys.path.insert(0, '.') import utils.dependencies # pylint: disable=wrong-import-position if __name__ == '__...
Question_81_90/answers/answer_85.py
nuck555/ImageProcessing100Wen
3,482
12676596
import cv2 import numpy as np import matplotlib.pyplot as plt from glob import glob # Dicrease color def dic_color(img): img //= 63 img = img * 64 + 32 return img # Database def get_DB(): # get training image path train = glob("dataset/train_*") train.sort() # prepare database db = np...
vint/linting/formatter/statistic_formatter.py
mosheavni/vint
538
12676667
from typing import List, Dict, Any # noqa: F401 from vint.linting.formatter.formatter import Formatter class StatisticFormatter(Formatter): def format_violations(self, violations): # type: (List[Dict[str, Any]]) -> str violations_count = len(violations) output = super(StatisticFormatter, self)....
reddit2telegram/channels/r_biganimetiddies/app.py
mainyordle/reddit2telegram
187
12676678
#encoding:utf-8 # Write here subreddit name. Like this one for /r/BigAnimeTiddies. subreddit = 'BigAnimeTiddies' # This is for your public telegram channel. t_channel = '@r_BigAnimeTiddies' def send_post(submission, r2t): return r2t.send_simple(submission)
tests/test_implementations/test_sqlalchemy/api_test/test_delete_many_api.py
aebrahim/FastAPIQuickCRUD
123
12676685
import json from collections import OrderedDict from starlette.testclient import TestClient from src.fastapi_quickcrud import sqlalchemy_to_pydantic from src.fastapi_quickcrud.crud_router import crud_router_builder from src.fastapi_quickcrud.misc.type import CrudMethods from tests.test_implementations.test_sqlalchemy....
scripts/generate_requirements_rtd.py
sreeja97/pystiche
129
12676696
import configparser import re from os import path try: import light_the_torch as ltt import yaml assert ltt.__version__ >= "0.2" except (ImportError, AssertionError): msg = "Please install pyyaml and light-the-torch>=0.2 prior to running this." raise RuntimeError(msg) DEPS_SUBSTITUTION_PATTERN =...
gryphon/execution/controllers/balance.py
qiquanzhijia/gryphon
1,109
12676697
from gryphon.execution.lib.exchange_color import exchange_color from gryphon.lib.exchange.exchange_factory import * from gryphon.lib.logger import get_logger from gryphon.lib.models.exchange import Balance from gryphon.lib import session logger = get_logger(__name__) def balance_requests(exchanges): balance_requ...
prometheus_fastapi_instrumentator/__init__.py
chbndrhnns/prometheus-fastapi-instrumentator
223
12676707
<filename>prometheus_fastapi_instrumentator/__init__.py # Copyright © 2020 <NAME> <<EMAIL>> # Licensed under Apache License 2.0 <http://www.apache.org/licenses/LICENSE-2.0> from .instrumentation import PrometheusFastApiInstrumentator Instrumentator = PrometheusFastApiInstrumentator
titus/titus/inspector/defs.py
jmilleralpine/hadrian
127
12676710
#!/usr/bin/env python # Copyright (C) 2014 Open Data ("Open Data" refers to # one or more of the following companies: Open Data Partners LLC, # Open Data Research LLC, or Open Data Capital LLC.) # # This file is part of Hadrian. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this...
lib/python2.7/site-packages/django/utils/feedgenerator.py
bop/bauhaus
285
12676719
""" Syndication feed generation library -- used for generating RSS, etc. Sample usage: >>> from django.utils import feedgenerator >>> feed = feedgenerator.Rss201rev2Feed( ... title="Poynter E-Media Tidbits", ... link="http://www.poynter.org/column.asp?id=31", ... description="A group Weblog by the sharpes...
skhep/utils/exceptions.py
AdvaitDhingra/scikit-hep
150
12676740
<filename>skhep/utils/exceptions.py<gh_stars>100-1000 # -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license, see LICENSE. """ Submodule for useful exceptions =============================== .. note:: not meant for user code in general, though possible. """ # Definition of handy colours for printing _d...
cubi_tk/__init__.py
eudesbarbosa/cubi-tk
132
12676747
<gh_stars>100-1000 from ._version import get_versions # type: ignore __version__ = get_versions()["version"] del get_versions
src/ralph/data_importer/fields.py
pinoatrome/ralph
1,668
12676751
import logging from djmoney.money import Money from import_export import fields from ralph.settings import DEFAULT_CURRENCY_CODE logger = logging.getLogger(__name__) class ThroughField(fields.Field): def __init__( self, through_model, through_from_field_name, through_to_field_name, attribute=N...
lte/gateway/c/core/oai/tasks/s1ap/messages/asn1/asn1tostruct.py
Aitend/magma
849
12676755
<reponame>Aitend/magma<gh_stars>100-1000 # # Copyright (c) 2015, EURECOM (www.eurecom.fr) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the abov...
dizoo/box2d/lunarlander/envs/__init__.py
LuciusMos/DI-engine
464
12676763
<reponame>LuciusMos/DI-engine from .lunarlander_env import LunarLanderEnv
python36/12_val/BCC97_simulation.py
aborodya/dawp
484
12676781
<reponame>aborodya/dawp # # Monte Carlo Simulation of BCC97 Model # 12_val/BCC97_simulation.py # # (c) Dr. <NAME> # Derivatives Analytics with Python # import sys import math import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt sys.path.append('11_cal') from H93_calibration import S0, kappa_r, th...
onmt/decoders/cnn_decoder.py
TAEYOUNG-SYG/OpenNMT-py
194
12676796
<reponame>TAEYOUNG-SYG/OpenNMT-py """ Implementation of the CNN Decoder part of "Convolutional Sequence to Sequence Learning" """ import torch import torch.nn as nn import onmt.modules from onmt.decoders.decoder import DecoderState from onmt.utils.misc import aeq from onmt.utils.cnn_factory import shape_transform, G...
koalixcrm/crm/factories/factory_task_link_type.py
Cataldir/koalixcrm
290
12676817
# -*- coding: utf-8 -*- import factory from koalixcrm.crm.models import TaskLinkType class RelatedToTaskLinkTypeFactory(factory.django.DjangoModelFactory): class Meta: model = TaskLinkType django_get_or_create = ('title',) title = "Is related to" description = "This task is related with ...
django_filters/fields.py
jvacek/django-filter
2,512
12676836
<reponame>jvacek/django-filter from collections import namedtuple from datetime import datetime, time from django import forms from django.utils.dateparse import parse_datetime from django.utils.encoding import force_str from django.utils.translation import gettext_lazy as _ from .conf import settings from .constants...
jaqs/research/signaldigger/performance.py
WestXu/JAQS
602
12676845
<filename>jaqs/research/signaldigger/performance.py # encoding: utf-8 import numpy as np import pandas as pd import scipy.stats as scst import statsmodels.api as sm from jaqs.trade.common import CALENDAR_CONST def calc_signal_ic(signal_data): """ Computes the Spearman Rank Correlation based Information Coef...
Src/StdLib/Lib/test/test_compare.py
cwensley/ironpython2
2,293
12676863
<filename>Src/StdLib/Lib/test/test_compare.py import unittest from test import test_support class Empty: def __repr__(self): return '<Empty>' class Coerce: def __init__(self, arg): self.arg = arg def __repr__(self): return '<Coerce %s>' % self.arg def __coerce__(self, other):...
sdfrenderer/deepsdf/workspace.py
TRI-ML/sdflabel
105
12676869
<filename>sdfrenderer/deepsdf/workspace.py #!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. # Source: https://github.com/facebookresearch/DeepSDF import json import os import torch from torch import nn model_params_subdir = "ModelParameters" optimizer_params_subdir = "OptimizerParameters...
flask_oauthlib/contrib/client/signals.py
PCMan/flask-oauthlib
1,292
12676873
from flask.signals import Namespace __all__ = ['request_token_fetched'] _signals = Namespace() request_token_fetched = _signals.signal('request-token-fetched')
script/key_scaner.py
yutiansut/Personae
1,046
12676887
# coding=utf-8 import sys import os if __name__ == '__main__': start_ip, end_ip = sys.argv[1], sys.argv[2] split_start_ip = start_ip.split('.') split_end_ip = end_ip.split('.') ip_list_str = "" ip_base = split_start_ip[0] + '.' + split_start_ip[1] + '.' + split_start_ip[2] + '.' ip_count...
conanfile.py
Naios/Continue.cpp
745
12676892
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from conans import ConanFile, tools def get_version(): git = tools.Git() try: return git.run("describe --tags --abbrev=0") except: return None class ContinuableConan(ConanFile): name = "continuable" version = get_version() license...
tools/generate_codemeta.py
stevemats/mne-python
1,953
12676893
<reponame>stevemats/mne-python<filename>tools/generate_codemeta.py import os import subprocess from datetime import date from mne import __version__ as release_version # NOTE: ../codemeta.json should not be continuously updated. Run this script # only at release time. # add to these as necessary compound_surnam...
pypy2.7/module/_multiprocess/test/test_semaphore.py
UniverseFly/multiprocess
356
12676919
<filename>pypy2.7/module/_multiprocess/test/test_semaphore.py import sys from _multiprocess.interp_semaphore import ( RECURSIVE_MUTEX, SEMAPHORE) class AppTestSemaphore: spaceconfig = dict(usemodules=('_multiprocess', 'thread', 'signal', 'select', ...
baidu/part_params.py
LBinsky/spiders
324
12676928
<filename>baidu/part_params.py import execjs def get_params(data=None): with open('params.js', 'r')as f: content = f.read() ctx = execjs.compile(content) if data: result = ctx.call('result', data) else: result = ctx.call('result') return result def get_dv(): ...
tensorflow_probability/python/distributions/johnson_su_test.py
jakee417/probability-1
3,670
12676934
<reponame>jakee417/probability-1<filename>tensorflow_probability/python/distributions/johnson_su_test.py # Copyright 2020 The TensorFlow Probability 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 ...
packages/regression_model/regression_model/processing/errors.py
avkmal/deploying-machine-learning-models
477
12676936
class BaseError(Exception): """Base package error.""" class InvalidModelInputError(BaseError): """Model input contains an error."""
lib/dataset/argoverse_convertor.py
decisionforce/mmTransformer
199
12676961
import os import pickle import re import sys from typing import Any, Dict, List import numpy as np import pandas as pd from argoverse.data_loading.argoverse_forecasting_loader import \ ArgoverseForecastingLoader from argoverse.map_representation.map_api import ArgoverseMap from tqdm import tqdm from .preprocess_u...
picam.py
PiSimo/PiCamNN
111
12676968
#!/usr/bin/python3 import cv2 import time import threading import subprocess import numpy as np from sys import exit from os import system from keras import backend as K from keras.models import load_model from yad2k.models.keras_yolo import yolo_eval, yolo_head ''' ---# GLOBAL VARIABLES #--- ''' #USER SETTINGS : ma...
examples/custom_code/client.py
koskotG/ebonite
270
12676971
import sys import requests def main(): try: value = int(sys.argv[1]) except (IndexError, ValueError): print(f'Usage: {sys.argv[0]} [integer]') return payload = {'vector': {'values': [{'value': value}]}} r = requests.post('http://localhost:9000/predict', json=payload) r.rai...
src/oci/data_integration/models/create_connection_from_object_storage.py
Manny27nyc/oci-python-sdk
249
12676990
# coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
src/model/ResNet.py
alpayuz/DeepDeblur-PyTorch
158
12676998
<reponame>alpayuz/DeepDeblur-PyTorch<filename>src/model/ResNet.py import torch.nn as nn from . import common def build_model(args): return ResNet(args) class ResNet(nn.Module): def __init__(self, args, in_channels=3, out_channels=3, n_feats=None, kernel_size=None, n_resblocks=None, mean_shift=True): ...
PyFin/Analysis/DataProviders/__init__.py
rpatil524/Finance-Python
325
12677002
# -*- coding: utf-8 -*- u""" Created on 2015-8-19 @author: cheng.li """ from PyFin.Analysis.DataProviders.DataProviders import DataProvider __all__ = ['DataProvider']
tests/test_sleeping.py
MarkusH/kopf
1,038
12677025
import asyncio import pytest from kopf.engines.sleeping import sleep_or_wait async def test_the_only_delay_is_awaited(timer): with timer: unslept = await asyncio.wait_for(sleep_or_wait(0.10), timeout=1.0) assert 0.10 <= timer.seconds < 0.11 assert unslept is None async def test_the_shortest_del...
Chapter08/models.py
yoyboy/Software-Architecture-with-Python
103
12677038
# Code Listing #1 """ Glossary models - Showing django admin view """ from django.db import models class GlossaryTerm(models.Model): """ Model for describing a glossary word (term) """ term = models.CharField(max_length=1024) meaning = models.CharField(max_length=1024) meaning_html = models.Ch...
zentral/contrib/munki/forms.py
janheise/zentral
634
12677058
<reponame>janheise/zentral<filename>zentral/contrib/munki/forms.py<gh_stars>100-1000 from django import forms from zentral.core.probes.forms import BaseCreateProbeForm from zentral.utils.forms import CommaSeparatedQuotedStringField from .models import Configuration, Enrollment, PrincipalUserDetectionSource from .probes...
tinymongo/results.py
sumants-dev/tinymongo
177
12677079
<filename>tinymongo/results.py """Result class definitions.""" class _WriteResult(object): """Base class for write result classes.""" def __init__(self, acknowledged=True): self.acknowledged = acknowledged # here only to PyMongo compat class InsertOneResult(_WriteResult): """The return type fo...
code/source/inception/inception_score_tf.py
alexban94/msci_project
1,086
12677085
<gh_stars>1000+ # Code derived from https://github.com/openai/improved-gan/tree/master/inception_score from __future__ import absolute_import from __future__ import division from __future__ import print_function import os.path import sys import tarfile import numpy as np from six.moves import urllib import tensorflow...
gooey/gui/components/options/options.py
Jacke/Gooey
13,430
12677091
from gooey.gui.components.filtering.prefix_filter import PrefixTokenizers def _include_layout_docs(f): """ Combines the layout_options docsstring with the wrapped function's doc string. """ f.__doc__ = (f.__doc__ or '') + LayoutOptions.__doc__ return f def _include_global_option_docs(f): ...
src/macad_gym/core/utils/map_explore.py
SHITIANYU-hue/macad-gym
201
12677109
#!/usr/bin/env python # Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. import glob import os import sys import itertools try: sys.path.append( ...
imperative/python/test/unit/functional/test_functional_distributed_axis.py
Olalaye/MegEngine
5,168
12677115
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
nova/virt/disk/vfs/api.py
zjzh/nova
1,874
12677141
# Copyright 2012 Red Hat, 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, so...
data_pipeline/tools/redshift_sql_to_avsc.py
poros/data_pipeline
110
12677200
# -*- coding: utf-8 -*- # Copyright 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 or ag...
tests/functional/backward_compatibility/black_box.py
obilaniu/orion
177
12677202
#!/usr/bin/env python # -*- coding: utf-8 -*- """Simple one dimensional example with noise level for a possible user's script.""" import argparse import random from orion.client import report_results def function(x, noise): """Evaluate partial information of a quadratic.""" z = (x - 34.56789) * random.gauss(...
core/tests/test_polypod/test_main/test_main_container.py
admariner/polyaxon
3,200
12677204
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, 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 ...
src/untp/dataparse.py
justbilt/TextureUnPacker
161
12677206
#!/usr/bin/env python # coding=utf-8 # Python 2.7.3 import os import json from parse import parse from plistlib import readPlist from pprint import pprint def parse_file(_filepath, _config=None, _extra_data_receiver=None): path,name = os.path.split(_filepath) pre,ext = os.path.splitext(name) if ext == ".plis...
auth/test/test_cookie.py
giuseppe/quay
2,027
12677213
import uuid from flask_login import login_user from app import LoginWrappedDBUser from data import model from auth.cookie import validate_session_cookie from test.fixtures import * def test_anonymous_cookie(app): assert validate_session_cookie().missing def test_invalidformatted_cookie(app): # "Login" wit...
pinout/components/pinlabel.py
j0ono0/pinout-diagram
304
12677228
<reponame>j0ono0/pinout-diagram import copy from pinout.core import SvgShape, Group, Rect, Text, BoundingCoords, Coords from pinout.components import leaderline as lline from pinout import config class Body(SvgShape): """Graphical shape that makes up the body of a pinlabel.""" def __init__(self, x, y, width,...
var/spack/repos/builtin/packages/ck/package.py
kkauder/spack
2,360
12677303
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Ck(MavenPackage): """CK calculates class-level and metric-level code metrics in Java p...
omega_miya/plugins/omega_sign_in/utils.py
rinrini001/omega-miya
120
12677306
<reponame>rinrini001/omega-miya """ @Author : Ailitonia @Date : 2021/08/27 0:48 @FileName : utils.py @Project : nonebot2_miya @Description : 签到素材合成工具 @GitHub : https://github.com/Ailitonia @Software : PyCharm """ import os import random import asyncio import aiofiles.o...
tools/coverage/coverage_diff.py
zmxdream/Paddle
17,085
12677323
#!/usr/bin/env python # -*- coding: utf-8 -*- # 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/...
models/model_3/model_3.py
tangmingsh/image_classifier
175
12677341
model = Sequential() model.add(Conv2D(32, (3, 3), input_shape=input_shape)) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Conv2D(64, (3, 3))) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Conv2D(128, (3, 3))) model.add(Activation('relu'...
paraphraser/inference.py
mahmoudeid789/paraphraser
371
12677381
import tensorflow as tf from embeddings import load_sentence_embeddings from preprocess_data import preprocess_batch from six.moves import input from lstm_model import lstm_model import numpy as np from pprint import pprint as pp class Paraphraser(object): '''Heart of the paraphraser model. This class loads the ...
install salabim from github.py
akharitonov/salabim
151
12677396
<gh_stars>100-1000 import sys import site import shutil import hashlib import base64 from pathlib import Path import configparser import urllib.request import urllib.error def _install(files, url=None): """ install one file package from GitHub or current directory Parameters ---------...
service/workflow/workflow_permission_service.py
SuperLeilia/loonflow
1,541
12677412
<reponame>SuperLeilia/loonflow from apps.workflow.models import WorkflowUserPermission from service.account.account_base_service import account_base_service_ins from service.base_service import BaseService from service.common.common_service import common_service_ins from service.common.constant_service import constant_...
shopify/resources/report.py
butlertron/shopify_python_api
828
12677416
<filename>shopify/resources/report.py from ..base import ShopifyResource class Report(ShopifyResource): pass
alg/time_series_deconfounder/rmsn/libs/model_rnn.py
loramf/mlforhealthlabpub
171
12677437
""" CODE ADAPTED FROM: https://github.com/sjblim/rmsn_nips_2018 Implementation of Recurrent Marginal Structural Networks (R-MSNs): <NAME>, <NAME>, <NAME>, "Forecasting Treatment Responses Over Time Using Recurrent Marginal Structural Networks", Advances in Neural Information Processing Systems, 2018. """ import tenso...
WAF/WAF-Enhanced-Replicator/wafget.py
thmasgq/aws-support-tools
1,038
12677441
<reponame>thmasgq/aws-support-tools # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 #!/usr/bin/env python3 # Modules importing from __future__ import print_function import os, sys import waffun as function import boto3 import zipfile # Global Constants limit...
GCL/losses/bootstrap.py
lem0nle/PyGCL
361
12677456
import torch import torch.nn.functional as F from .losses import Loss class BootstrapLatent(Loss): def __init__(self): super(BootstrapLatent, self).__init__() def compute(self, anchor, sample, pos_mask, neg_mask=None, *args, **kwargs) -> torch.FloatTensor: anchor = F.normalize(anchor, dim=-1,...
yawast/__init__.py
Prodject/yawast
200
12677463
# Copyright (c) 2013 - 2020 <NAME> and Contributors. # This file is part of YAWAST which is released under the MIT license. # See the LICENSE file or go to https://yawast.org/license/ for full license details. try: from ._version import __version__ __all__ = ["__version__"] del _version # remove to av...
TFRecModel/src/com/sparrowrecsys/offline/tensorflow/EmbeddingMLP.py
sunbuhui/SparrowRecSys
1,748
12677467
import tensorflow as tf # Training samples path, change to your local path training_samples_file_path = tf.keras.utils.get_file("trainingSamples.csv", "file:///Users/zhewang/Workspace/SparrowRecSys/src/main" "/res...
opendatatools/amac/amac_agent.py
jjcc/OpenData
1,179
12677522
# encoding: UTF-8 from urllib.parse import urlencode from bs4 import BeautifulSoup import datetime import time from opendatatools.common import RestAgent import pandas as pd import json import math import random class AMACAgent(RestAgent): def __init__(self): RestAgent.__init__(self) self.add_hea...
igibson/utils/data_utils/sampling_task/batch_sampling_saver.py
mamadbiabon/iGibson
360
12677525
<filename>igibson/utils/data_utils/sampling_task/batch_sampling_saver.py import argparse import os import subprocess import bddl def main(): parser = argparse.ArgumentParser() parser.add_argument("--max_trials", type=int, default=1, help="Maximum number of trials to try sampling.") parser.add_argument( ...
saleor/graphql/core/__init__.py
elwoodxblues/saleor
15,337
12677529
from . import fields # noqa
mlflow/entities/metric.py
akarloff/mlflow
10,351
12677540
from mlflow.entities._mlflow_object import _MLflowObject from mlflow.protos.service_pb2 import Metric as ProtoMetric class Metric(_MLflowObject): """ Metric object. """ def __init__(self, key, value, timestamp, step): self._key = key self._value = value self._timestamp = times...
tools/bin/pythonSrc/pychecker-0.8.18/test_input/test56.py
YangHao666666/hawq
450
12677572
<reponame>YangHao666666/hawq 'doc' from import56a import Foo def x(): print Foo
ners/utils/geometry.py
dumpmemory/ners
156
12677583
""" Utilities for various geometric operations. """ import numpy as np import pytorch3d import torch import torch.nn.functional as F from pytorch3d.utils import ico_sphere def random_rotation(device=None): quat = torch.randn(4, device=device) quat /= quat.norm() return pytorch3d.transforms.quaternion_to_m...
src/watchpoints/ast_monkey.py
KikeM/watchpoints
357
12677597
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/gaogaotiantian/watchpoints/blob/master/NOTICE.txt import ast import sys def ast_parse_node(node): """ :param ast.Node node: an ast node representing an expression of variable :return ast.No...
cinder/tests/unit/volume/drivers/dell_emc/vnx/fake_exception.py
lightsey/cinder
571
12677604
<reponame>lightsey/cinder # Copyright (c) 2016 EMC Corporation. # 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/LICE...
autoPyTorch/components/preprocessing/feature_preprocessing/fast_ica.py
mens-artis/Auto-PyTorch
1,657
12677609
import torch import warnings import ConfigSpace import ConfigSpace.hyperparameters as CSH import ConfigSpace.conditions as CSC from autoPyTorch.utils.config_space_hyperparameter import get_hyperparameter from autoPyTorch.components.preprocessing.preprocessor_base import PreprocessorBase class FastICA(PreprocessorBa...
rotkehlchen/tests/unit/test_etherscan.py
rotkehlchenio/rotkehlchen
137
12677650
from rotkehlchen.externalapis.etherscan import _hashes_tuple_to_list def test_hashes_tuple_to_list(): hashes = {('0x1', 1), ('0x2', 2), ('0x3', 3), ('0x4', 4), ('0x5', 5)} assert _hashes_tuple_to_list(hashes) == ['0x1', '0x2', '0x3', '0x4', '0x5']
python/replicate/exceptions.py
kennyworkman/replicate
810
12677677
from . import constants class DoesNotExist(Exception): pass class ReadError(Exception): pass class WriteError(Exception): pass class RepositoryConfigurationError(Exception): pass class IncompatibleRepositoryVersion(Exception): pass class CorruptedRepositorySpec(Exception): pass cla...
kpm/console.py
ericchiang/kpm
121
12677696
<gh_stars>100-1000 import json import subprocess import random import logging logger = logging.getLogger(__name__) class KubernetesExec(object): def __init__(self, rcname, cmd='sh', namespace="default", container=None, kind="rc"): self.rcname = rcname self.namespace = namespace self.comm...
venv/Lib/site-packages/folium/plugins/boat_marker.py
star10919/drf
5,451
12677707
# -*- coding: utf-8 -*- from folium.elements import JSCSSMixin from folium.map import Marker from folium.utilities import parse_options from jinja2 import Template class BoatMarker(JSCSSMixin, Marker): """Add a Marker in the shape of a boat. Parameters ---------- location: tuple of length 2, defaul...
venv/Lib/site-packages/nbconvert/utils/tests/test_pandoc.py
ajayiagbebaku/NFL-Model
1,367
12677717
"""Test Pandoc module""" #----------------------------------------------------------------------------- # Copyright (C) 2014 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #----------------------------...
vt/client.py
Dmenifee23-star/vt-py
208
12677735
<filename>vt/client.py<gh_stars>100-1000 # Copyright © 2019 The vt-py 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/LICENS...
python/introduction-to-regex.py
gajubadge11/HackerRank-1
340
12677737
<filename>python/introduction-to-regex.py<gh_stars>100-1000 #!/usr/bin/env python3 import re if __name__ == "__main__": t = int(input().strip()) pattern = '^[+-]?[0-9]*\.[0-9]+$' for _ in range(t): print(bool(re.match(pattern, input())))
pyteal/compiler/compiler.py
spapasoteriou/pyteal
184
12677751
<filename>pyteal/compiler/compiler.py from typing import List, Tuple, Set, Dict, Optional, cast from ..types import TealType from ..ast import ( Expr, Return, Seq, ScratchSlot, SubroutineDefinition, SubroutineDeclaration, ) from ..ir import Mode, TealComponent, TealOp, TealBlock, TealSimpleBloc...
sdks/python/apache_beam/examples/sql_taxi.py
hengfengli/beam
5,279
12677781
<filename>sdks/python/apache_beam/examples/sql_taxi.py # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache...
models/Lightweight/MobileNetV2.py
Dou-Yu-xuan/deep-learning-visal
150
12677806
import torch import torch.nn as nn import torchvision from functools import reduce def Conv3x3BNReLU(in_channels,out_channels,stride,groups): return nn.Sequential( nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=3, stride=stride, padding=1, groups=groups), nn.Batc...
airbyte-integrations/connectors/source-freshdesk/unit_tests/test_call_credit.py
OTRI-Unipd/OTRI-airbyte
6,215
12677826
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # import time from source_freshdesk.utils import CallCredit def test_consume_one(): """Multiple consumptions of 1 cred will reach limit""" credit = CallCredit(balance=3, reload_period=1) ts_1 = time.time() for i in range(4): credit....
tools/accuracy_checker/tests/test_onnx_launcher.py
APrigarina/open_model_zoo
1,031
12677832
""" Copyright (c) 2018-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 required by applicable law or agreed to in wri...
test/sanity/document-start-end/test.py
frank-dspeed/nw.js
27,296
12677843
import time import os import sys from selenium import webdriver from selenium.webdriver.chrome.options import Options sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from nw_util import * chrome_options = Options() chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__f...
f5/multi_device/test/unit/test_trust_domain.py
nghia-tran/f5-common-python
272
12677856
# Copyright 2015-2016 F5 Networks 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 ...
reader/slqa/predictor.py
wsdm/RCZoo
166
12677872
#!/usr/bin/env python3 # Copyright 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """DrQA Document Reader predictor""" import logging from multiprocessing import Pool as ProcessPool from mult...
tools/azure-sdk-tools/packaging_tools/conf.py
rsdoherty/azure-sdk-for-python
2,728
12677877
import logging from pathlib import Path from typing import Dict, Any import pytoml as toml _LOGGER = logging.getLogger(__name__) CONF_NAME = "sdk_packaging.toml" _SECTION = "packaging" # Default conf _CONFIG = { "package_name": "packagename", "package_nspkg": "packagenspkg", "package_pprint_name": "MySe...
tests/pypokerengine/engine/round_manager_test.py
stupps/PyPokerEngine
479
12677884
from tests.base_unittest import BaseUnitTest from mock import patch from pypokerengine.engine.round_manager import RoundManager from pypokerengine.engine.game_evaluator import GameEvaluator from pypokerengine.engine.poker_constants import PokerConstants as Const from pypokerengine.engine.player import Player from pypok...
tests/observation/test_processing_of_namespaces.py
tavaresrodrigo/kopf
855
12677888
<reponame>tavaresrodrigo/kopf<gh_stars>100-1000 import asyncio import async_timeout import pytest from kopf._cogs.structs.bodies import RawBody, RawEvent from kopf._cogs.structs.references import Insights from kopf._core.reactor.observation import process_discovered_namespace_event async def test_initial_listing_is...
alibi_detect/cd/tensorflow/mmd.py
sugatoray/alibi-detect
1,227
12677890
<filename>alibi_detect/cd/tensorflow/mmd.py import logging import numpy as np import tensorflow as tf from typing import Callable, Dict, Optional, Tuple, Union from alibi_detect.cd.base import BaseMMDDrift from alibi_detect.utils.tensorflow.distance import mmd2_from_kernel_matrix from alibi_detect.utils.tensorflow.kern...
Lib/test/test_email/test_pickleable.py
shawwn/cpython
52,316
12677898
<gh_stars>1000+ import unittest import textwrap import copy import pickle import email import email.message from email import policy from email.headerregistry import HeaderRegistry from test.test_email import TestEmailBase, parameterize @parameterize class TestPickleCopyHeader(TestEmailBase): header_factory = He...
tests/test_serial/test_arduinocore.py
AFTC-1/Arduino-rpi
178
12677946
import common from nanpy.arduinotree import ArduinoTree from nose.tools import eq_ from nose.tools import ok_ def setup(): common.setup() def test(): a = ArduinoTree() eq_(a.core.digitalPinToBitMask(2), 4) eq_(a.core.digitalPinToPort(2), 4) eq_(a.core.digitalPinToTimer(2), 0) eq_(a.core.anal...
examples/tabular/higgs/interpret.py
Locust2520/path_explain
145
12677971
import tensorflow as tf import numpy as np from path_explain.utils import set_up_environment from path_explain.path_explainer_tf import PathExplainerTF from preprocess import higgs_dataset from train import build_model from absl import app from absl import flags FLAGS = flags.FLAGS flags.DEFINE_integer('num_examples...
legacy/datasources/base_datasource.py
ParikhKadam/zenml
1,275
12677979
# Copyright (c) ZenML GmbH 2020. 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 applica...
gtfspy/networks.py
Leo-Ryu/gtfspy
118
12678000
<reponame>Leo-Ryu/gtfspy<filename>gtfspy/networks.py import networkx import pandas as pd from math import isnan from gtfspy import route_types from gtfspy.util import wgs84_distance, graph_node_attrs from warnings import warn ALL_STOP_TO_STOP_LINK_ATTRIBUTES = [ "capacity_estimate", "duration_min", "duration_max",...
src/test/tests/simulation/domainbounds.py
visit-dav/vis
226
12678016
# ---------------------------------------------------------------------------- # CLASSES: nightly # # Test Case: domainbounds.py # # Tests: libsim - connecting to simulation and retrieving data from it. # mesh - 3D rectilinear mesh # # Programmer: <NAME> # Date: June 17, 2014 # # Modif...