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
exchanges/exchange.py
Kaoschuks/cryptobot
178
12682026
<filename>exchanges/exchange.py import datetime from api import utils from abc import ABC, abstractmethod from twisted.internet import reactor from strategies.strategy import Strategy from models.order import Order class Exchange(ABC): currency: str asset: str strategy: Strategy def __init__(self, ke...
src/nodes/corenodes/adjust/__init__.py
Correct-Syntax/GimelStudio
134
12682042
<reponame>Correct-Syntax/GimelStudio from .brightness_contrast_node import BrightnessContrastNode
models/position_enc.py
sorrowyn/C-Tran
104
12682045
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ Various positional encodings for the transformer. """ import math import torch from torch import nn from pdb import set_trace as stop class PositionEmbeddingSine(nn.Module): """ This is a more standard version of the position embeddin...
alipay/aop/api/domain/RelateInputInvoiceOrderDTO.py
alipay/alipay-sdk-python-all
213
12682054
<filename>alipay/aop/api/domain/RelateInputInvoiceOrderDTO.py<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.InputInvoiceBillLinkOrderDTO import InputInvoiceBillLinkOrderDTO from alipay.aop.api.domain.MultiCurr...
niftynet/contrib/niftyreg_image_resampling/setup.py
tdml13/NiftyNet
1,403
12682079
from __future__ import print_function import os import os.path as osp import platform from setuptools import setup, Extension, Command from setuptools.command.build_ext import build_ext from shutil import which import subprocess as sp import sys __CMAKE_OVERRIDE_FLAGS__ = {} class CMakeExtension(Extension): def...
tests/unit/confidant/services/keymanager_test.py
chadwhitacre/confidant
1,820
12682084
<filename>tests/unit/confidant/services/keymanager_test.py from confidant.services import keymanager def test_get_key_id(mocker): mocker.patch('confidant.services.keymanager._KEY_METADATA', {}) mock_auth_client = mocker.Mock() mock_auth_client.describe_key = mocker.Mock( return_value={'KeyMetadata...
lib/grizzled/grizzled/db/dbgadfly.py
MiCHiLU/google_appengine_sdk
790
12682088
<reponame>MiCHiLU/google_appengine_sdk # $Id: f25618704b7ebe12c191cc1a51055c26db731b85 $ """ Gadfly extended database driver. """ __docformat__ = "restructuredtext en" # --------------------------------------------------------------------------- # Imports # -----------------------------------------------------------...
scripts/generate-fidl-tags.py
allansrc/fuchsia
210
12682097
#!/usr/bin/env python3.8 # Copyright 2020 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ This tool uses the contents of fidlc .json files to create tags for .fidl files. When run via fx fidltags, it looks in the exist...
pyzoo/zoo/orca/data/elastic_search.py
limn2o4/analytics-zoo
2,970
12682105
<reponame>limn2o4/analytics-zoo # # Copyright 2018 Analytics Zoo Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
tutorial/plot_getting_data.py
jiduque/scikit-fda
147
12682114
""" Getting the data ================ In this section, we will dicuss how to get functional data to use in scikit-fda. We will briefly describe the :class:`~skfda.representation.grid.FDataGrid` class, which is the type that scikit-fda uses for storing and working with functional data in discretized form. We will discu...
frameworks/pytorch/examples/5_transformer.py
Michoumichmich/antares
132
12682132
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import torch from torch.contrib.antares.custom_op import CustomOp device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu") dtype = torch.float32 kwargs = {'dtype': dtype, 'device': de...
cdec-corpus/xml-tok.py
muyeby/Eval-Gen
114
12682156
#!/usr/bin/env python import os import re import subprocess import sys # Tokenize XML files with tokenize-anything.sh # in: <seg id="963"> The earnings on its 10-year bonds are 28.45%. </seg> # out: <seg id="963"> The earnings on its 10 - year bonds are 28.45 % . </seg> def escape(s): return s.replace('&', '&am...
models/SPH3D_modelnet.py
GaHooooo/SPH3D-GCN
153
12682168
<reponame>GaHooooo/SPH3D-GCN import tensorflow as tf import sys import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) sys.path.append(os.path.join(BASE_DIR, '../utils')) import sph3gcn_util as s3g_util def normalize_xyz(points): points -= tf.reduce_mean(points,axis=1,keepdims=...
extract__one_file_exe__pyinstaller/_source_test_file.py
DazEB2/SimplePyScripts
117
12682193
<gh_stars>100-1000 # uncompyle6 version 3.7.2 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] # Embedded file name: extract__one_file_exe__pyinstaller\_test_file.py __author__ = 'ipetrash' def say(): print('Hello World!') if __name__ == '_...
mmfewshot/classification/apis/inference.py
BIGWangYuDong/mmfewshot
376
12682211
# Copyright (c) OpenMMLab. All rights reserved. from typing import Dict, List, Optional, Tuple, Union import mmcv import numpy as np import torch import torch.nn as nn from mmcls.core.visualization import imshow_infos from mmcls.datasets.pipelines import Compose from mmcls.models import build_classifier from mmcv.para...
homeassistant/auth/providers/legacy_api_password.py
MrDelik/core
30,023
12682218
""" Support Legacy API password auth provider. It will be removed when auth system production ready """ from __future__ import annotations from collections.abc import Mapping import hmac from typing import Any, cast import voluptuous as vol from homeassistant.core import callback from homeassistant.data_entry_flow ...
csbdeep/models/care_upsampling.py
Takuya1031/CSBDeep
205
12682229
from __future__ import print_function, unicode_literals, absolute_import, division import numpy as np from scipy.ndimage.interpolation import zoom from .care_standard import CARE from ..data import PercentileNormalizer, PadAndCropResizer from ..utils import _raise, axes_dict class UpsamplingCARE(CARE): """CARE ...
tests/integration-tests.py
jcatana/gpu-feature-discovery
120
12682233
#!/usr/bin/env python3 import docker import os import re import sys import shutil import tempfile import time def get_expected_labels_regexs(): with open("./expected-output.txt") as f: expected_labels = f.readlines() expected_labels = [x.strip() for x in expected_labels] return [re.compi...
runtime/translation/models/gnmt_large/gpus=8/gnmt_large.py
NestLakerJasonLIN/pipedream
273
12682236
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import torch from .stage0 import Stage0 from .stage1 import Stage1 from .stage2 import Stage2 from .stage3 import Stage3 from .stage4 import Stage4 from .stage5 import Stage5 from .stage6 import Stage6 from .stage7 import Stage7 class GNMT16Part...
tools/condlanenet/curvelanes/test_curvelanes_dataset.py
Yibin122/conditional-lane-detection
232
12682264
<gh_stars>100-1000 import argparse import os import mmcv import cv2 import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt from mmdet.datasets import build_dataloader, build_dataset from mmdet.utils.general_utils import mkdir from tools.condlanenet.common import COLORS def parse_args(): parser...
vqgan_clip/grad.py
aman-tiwari/vqgan-clip
130
12682267
<reponame>aman-tiwari/vqgan-clip<filename>vqgan_clip/grad.py import torch from torch import nn, optim from torch.nn import functional as F from torch_optimizer import DiffGrad, AdamP, RAdam class ReplaceGrad(torch.autograd.Function): @staticmethod def forward(ctx, x_forward, x_backward): ctx.shape = x...
SimPEG/electromagnetics/utils/waveform_utils.py
Prithwijit-Chak/simpeg
358
12682268
<reponame>Prithwijit-Chak/simpeg import numpy as np from scipy.constants import mu_0, epsilon_0 # useful params def omega(freq): """Angular frequency, omega""" return 2.0 * np.pi * freq def k(freq, sigma, mu=mu_0, eps=epsilon_0): """ Eq 1.47 - 1.49 in Ward and Hohmann """ w = omega(freq) alp = w ...
src/devpy/__init__.py
sametmax/devpy
161
12682278
<filename>src/devpy/__init__.py<gh_stars>100-1000 import devpy from .log import autolog # noqa from .tb import color_traceback # noqa __version__ = "0.1.8" def dev_mode(color_traceback=True, autolog=True): # noqa if color_traceback: devpy.color_traceback() if autolog: return devpy.autolog...
env/lib/python3.8/site-packages/pandas/tests/frame/methods/test_diff.py
acrucetta/Chicago_COVI_WebApp
1,738
12682281
<filename>env/lib/python3.8/site-packages/pandas/tests/frame/methods/test_diff.py import numpy as np import pytest import pandas as pd from pandas import DataFrame, Series, Timestamp, date_range import pandas._testing as tm class TestDataFrameDiff: def test_diff(self, datetime_frame): the_diff = datetime...
tests/test_overwritting.py
wetgi/lagom
109
12682282
<reponame>wetgi/lagom import pytest from lagom import Container from lagom.exceptions import DuplicateDefinition class InitialDep: pass class SomeMockForTesting(InitialDep): pass class SomeMockThatDoesntEventExtend: pass def test_deps_can_be_overridden_by_a_child_class(container: Container): co...
fortnitepy/ext/commands/help.py
gfdb/fortnitepy
127
12682291
""" The MIT License (MIT) Copyright (c) 2015-present Rapptz 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, merg...
docs/_data/project_scrapper.py
tre3x/awesomeScripts
245
12682298
from bs4 import BeautifulSoup import requests url = "https://github.com/Py-Contributors/awesomeScripts/blob/master/README.md" page = requests.get(url) pagetext = page.text def save_project(): soup = BeautifulSoup(pagetext, "lxml") table = soup.find("table") list_of_rows = [] for row in table.findAll...
pymagnitude/third_party/allennlp/modules/matrix_attention/legacy_matrix_attention.py
tpeng/magnitude
1,520
12682310
<filename>pymagnitude/third_party/allennlp/modules/matrix_attention/legacy_matrix_attention.py<gh_stars>1000+ from __future__ import absolute_import import torch #overrides from allennlp.modules.similarity_functions.dot_product import DotProductSimilarity from allennlp.modules.similarity_functions.similarity_function...
third_party/protobuf/3.6.1/python/mox.py
sevki/bazel
4,071
12682316
#!/usr/bin/python2.4 # # Copyright 2008 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 o...
jarbas/core/migrations/0002_add_indexes.py
vbarceloscs/serenata-de-amor
3,001
12682324
<reponame>vbarceloscs/serenata-de-amor # -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-09-08 10:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0001_initial'), ] operations = [ ...
tools/mo/openvino/tools/mo/utils/ir_reader/extenders/variadic_split_extender.py
ryanloney/openvino-1
1,127
12682337
<reponame>ryanloney/openvino-1 # Copyright (C) 2018-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.tools.mo.utils.graph import Node from openvino.tools.mo.utils.ir_reader.extender import Extender class VariadicSplit_extender(Extender): op = 'VariadicSplit' @staticmethod def e...
Bit Manipulation/476. Number Complement.py
beckswu/Leetcode
138
12682342
<filename>Bit Manipulation/476. Number Complement.py class Solution: def findComplement(self, num: int) -> int: res =i = 0 while num: if not num & 1: res |= 1 << i num = num >> 1 i += 1 return res class Solution: def findComplement(sel...
ctools/worker/agent/base_agent.py
XinyuJing/DI-star
267
12682355
<gh_stars>100-1000 from abc import ABC import copy from collections import OrderedDict from typing import Any, Union, Optional, Dict, List import torch from .agent_plugin import register_plugin class BaseAgent(ABC): r""" Overview: the base agent class Interfaces: __init__, forward, mode...
recipes/crashpad/all/conanfile.py
rockandsalt/conan-center-index
562
12682361
<filename>recipes/crashpad/all/conanfile.py from conans import AutoToolsBuildEnvironment, ConanFile, tools from conans.errors import ConanInvalidConfiguration from contextlib import contextmanager import os import textwrap required_conan_version = ">=1.33.0" class CrashpadConan(ConanFile): name = "crashpad" ...
scripts/run_music_transformer.py
HalleyYoung/musicautobot
402
12682367
<gh_stars>100-1000 import music21 import torch import numpy as np try: from apex.optimizers import FusedAdam except: from torch.optim import Adam as FusedAdam from fastai.distributed import * from fastai.callbacks import SaveModelCallback from fastai.text.models.transformer import * import sys sys.path.insert(0, '....
custom_components/ble_monitor/ble_parser/helpers.py
avidit/hass
383
12682398
<filename>custom_components/ble_monitor/ble_parser/helpers.py """Helpers for bleparser""" from uuid import UUID def to_uuid(uuid: str) -> str: """Return formatted UUID""" return str(UUID(''.join(f'{i:02X}' for i in uuid))) def to_mac(addr: str) -> str: """Return formatted MAC address""" return ':'.j...
torchnlp/samplers/balanced_sampler.py
jmribeiro/PyTorch-NLP
2,125
12682399
from torchnlp._third_party.weighted_random_sampler import WeightedRandomSampler from torchnlp.utils import identity class BalancedSampler(WeightedRandomSampler): """ Weighted sampler with respect for an element's class. Args: data (iterable) get_class (callable, optional): Get the class of a...
subsync/media.py
tympanix/subsync
108
12682401
<gh_stars>100-1000 import os import librosa import subprocess import tempfile import io import pysrt from pysrt import SubRipTime import string import random import chardet import re from datetime import timedelta import numpy as np import sklearn from .ffmpeg import Transcode from .log import logger class Media: ...
PypeS/pypewrapper.py
michelebucelli/vmtk
217
12682405
<filename>PypeS/pypewrapper.py #!/usr/bin/env python ## Program: PypeS ## Module: $RCSfile: pype.py,v $ ## Language: Python ## Date: $Date: 2006/07/07 10:45:42 $ ## Version: $Revision: 1.18 $ ## Copyright (c) <NAME>, <NAME>. All rights reserved. ## See LICENSE file for details. ## This software...
scripts/tag_datasets.py
pplonski/automlbenchmark
282
12682410
<filename>scripts/tag_datasets.py<gh_stars>100-1000 import sys sys.path.append("D:\\repositories/openml-python") import openml if __name__ == '__main__': suite = openml.study.get_suite(218) tag = 'study_218' for taskid in suite.tasks: print('collecting t/', taskid) task = openml.tasks.get_...
mudpi/extensions/mqtt/__init__.py
icyspace/mudpi-core
163
12682412
<gh_stars>100-1000 """ MQTT Extension Includes interfaces for redis to get data from events. """ import time import paho.mqtt.client as mqtt from mudpi.extensions import BaseExtension class Extension(BaseExtension): namespace = 'mqtt' update_interval = 1 def init(self, config): """ P...
src/fireo/fields/text_field.py
isaacna/FireO
231
12682417
<gh_stars>100-1000 from fireo.fields import errors from fireo.fields.base_field import Field import re class TextField(Field): """Text field for Models Define text for models allowed_attributes = ['max_length', 'to_lowercase'] Examples -------- class User(Model): age = Tex...
lib/utils/extract_tpelog.py
NelsonDaniel/SiamDW
772
12682430
<reponame>NelsonDaniel/SiamDW<filename>lib/utils/extract_tpelog.py # -*- coding:utf-8 -*- # ! ./usr/bin/env python # __author__ = 'zzp' import shutil import argparse import numpy as np parser = argparse.ArgumentParser(description='Analysis siamfc tune results') parser.add_argument('--path', default='logs/gene_adjust...
mistral/db/sqlalchemy/migration/alembic_migrations/versions/040_add_tables_for_dynamic_action_definitions_and_code_sources.py
shubhamdang/mistral
205
12682432
<reponame>shubhamdang/mistral<filename>mistral/db/sqlalchemy/migration/alembic_migrations/versions/040_add_tables_for_dynamic_action_definitions_and_code_sources.py # Copyright 2020 Nokia Software. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with ...
02-HelloRDD/HelloRDD.py
IAmZero247/pyspark-learning
105
12682445
import sys from pyspark import SparkConf from collections import namedtuple from pyspark.sql import SparkSession from lib.logger import Log4j SurveyRecord = namedtuple("SurveyRecord", ["Age", "Gender", "Country", "State"]) if __name__ == "__main__": conf = SparkConf() \ .setMaster("local[3]") \ ...
nvtabular/io/fsspec_utils.py
NVIDIA/NVTabular
543
12682457
<gh_stars>100-1000 # # Copyright (c) 2021, NVIDIA 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 applic...
hwt/hdl/types/typeCast.py
ufo2011/hwt
134
12682478
from typing import Optional, Any from hwt.hdl.types.defs import INT, STR, BOOL, SLICE, FLOAT64 from hwt.hdl.types.hdlType import HdlType from hwt.hdl.value import HValue from hwt.hdl.variables import SignalItem from hwt.synthesizer.interfaceLevel.mainBases import InterfaceBase defaultPyConversions = { int: INT, ...
drive/snippets/drive-v3/app_data_snippet/list_appdata.py
himanshupr2627/python-samples
479
12682513
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
src/django_otp/models.py
jaap3/django-otp
318
12682518
from datetime import timedelta from django.apps import apps from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.utils import timezone from django.utils.functional import cached_property from .util import random_number_token class DeviceMana...
train.py
zhechen/PLARD
122
12682536
import sys, os import torch import visdom import argparse import numpy as np import logging import torch.nn as nn import torch.nn.functional as F import torchvision.models as models from torch.autograd import Variable from torch.utils import data from tqdm import tqdm import collections from ptsemseg.models import ge...
model/conv/MBConv.py
Nitin-Mane/External-Attention-pytorch
4,466
12682545
import math from functools import partial import torch from torch import nn from torch.nn import functional as F class SwishImplementation(torch.autograd.Function): @staticmethod def forward(ctx, i): result = i * torch.sigmoid(i) ctx.save_for_backward(i) return result @staticmetho...
dataset_preprocessing/camelyon17/generate_all_patch_coords.py
caglasozen/wilds
355
12682551
# Code adapted from https://github.com/liucong3/camelyon17 # and https://github.com/cv-lee/Camelyon17 import openslide import cv2 import numpy as np import pandas as pd import os import csv import argparse from tqdm import tqdm from xml.etree.ElementTree import parse from PIL import Image PATCH_LEVEL ...
sample_selfie_segmentation.py
karaage0703/mediapipe-python-sample
164
12682577
<reponame>karaage0703/mediapipe-python-sample #!/usr/bin/env python # -*- coding: utf-8 -*- import copy import argparse import cv2 as cv import numpy as np import mediapipe as mp from utils import CvFpsCalc def get_args(): parser = argparse.ArgumentParser() parser.add_argument("--device", type=int, default...
python/rikai/spark/sql/codegen/sklearn.py
changhiskhan/rikai
111
12682595
# Copyright 2021 Rikai Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
okta/models/verify_factor_request.py
corylevine/okta-sdk-python
145
12682608
<reponame>corylevine/okta-sdk-python<gh_stars>100-1000 # flake8: noqa """ Copyright 2020 - Present Okta, 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-...
pylayers/gui/PylayersGui.py
usmanwardag/pylayers
143
12682610
<gh_stars>100-1000 # -*- coding: utf-8 -*- """ PyLayers GUI .. autommodule:: :members: To run this code. type python PylayersGui.py """ from pylayers.simul.link import * import pylayers.util.pyutil as pyu import pylayers.signal.standard as std from pylayers.util.project import * import json # TEST import...
frechet_audio_distance/fad_utils.py
deepneuralmachine/google-research
23,901
12682614
<gh_stars>1000+ # 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/licenses/LICENSE-2.0 # # Unless requ...
docs/tutorials/detection/demo_ssd.py
Kh4L/gluon-cv
5,447
12682618
<reponame>Kh4L/gluon-cv<filename>docs/tutorials/detection/demo_ssd.py """01. Predict with pre-trained SSD models ========================================== This article shows how to play with pre-trained SSD models with only a few lines of code. First let's import some necessary libraries: """ from gluoncv import mo...
cocos/tests/test_numerics/test_statistics/test_rng/test_gamma_rng.py
michaelnowotny/cocos
101
12682636
import pytest import cocos.numerics as cn from cocos.tests.test_numerics.test_statistics.utilities import perform_ks_test n_kolmogorov_smirnov = 1500000 test_data = [(1, 2, n_kolmogorov_smirnov), (2, 2, n_kolmogorov_smirnov), (3, 2, n_kolmogorov_smirnov), (5, 1, n_kolmogorov_sm...
scripts/automation/trex_control_plane/interactive/trex/utils/filters.py
timgates42/trex-core
956
12682684
def shallow_copy(x): return type(x)(x) class ToggleFilter(object): """ This class provides a "sticky" filter, that works by "toggling" items of the original database on and off. """ def __init__(self, db_ref, show_by_default=True): """ Instantiate a ToggleFilter object :p...
src/dataprotection/azext_dataprotection/vendored_sdks/dataprotection/models/_data_protection_client_enums.py
haroonf/azure-cli-extensions
207
12682687
<reponame>haroonf/azure-cli-extensions<filename>src/dataprotection/azext_dataprotection/vendored_sdks/dataprotection/models/_data_protection_client_enums.py # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed ...
tests/st/ops/ascend/test_aicpu_ops/test_gather_d.py
GuoSuiming/mindspore
3,200
12682690
<filename>tests/st/ops/ascend/test_aicpu_ops/test_gather_d.py # Copyright 2020 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/...
examples/draw_a_cat.py
jontonsoup4/ascii_art
199
12682700
<filename>examples/draw_a_cat.py<gh_stars>100-1000 from ascii_art.ascii_art import ASCIIArt, ASCIIPicture # ASCII drawing picture = ASCIIArt('cat', 2).draw_ascii(curve=1) ASCIIPicture(picture).save('cat_scale2_draw_ascii.png') with open('cat_scale2_draw.txt', 'w') as f: f.write(''.join(picture)) picture = ASCIIAr...
src/debugpy/_vendored/pydevd/tests_python/resources/_debugger_case_local_variables3.py
r3m0t/debugpy
695
12682707
class MyDictSubclass(dict): def __init__(self): dict.__init__(self) self.var1 = 10 self['in_dct'] = 20 def __str__(self): ret = [] for key, val in sorted(self.items()): ret.append('%s: %s' % (key, val)) ret.append('self.var1: %s' % (self.var1,)) ...
wandb/vendor/prompt_toolkit/layout/dimension.py
dreamflasher/client
6,989
12682738
""" Layout dimensions are used to give the minimum, maximum and preferred dimensions for containers and controls. """ from __future__ import unicode_literals __all__ = ( 'LayoutDimension', 'sum_layout_dimensions', 'max_layout_dimensions', ) class LayoutDimension(object): """ Specified dimension (...
nuplan/database/nuplan_db/scenario_tag.py
motional/nuplan-devkit
128
12682739
<reponame>motional/nuplan-devkit<filename>nuplan/database/nuplan_db/scenario_tag.py from __future__ import annotations # postpone evaluation of annotations import logging from typing import Any from sqlalchemy import Column, inspect from sqlalchemy.orm import relationship from sqlalchemy.schema import ForeignKey fro...
face_sdk/api_usage/face_crop.py
weihaoxie/FaceX-Zoo
1,329
12682746
<filename>face_sdk/api_usage/face_crop.py """ @author: <NAME>, <NAME> @date: 20201015 @contact: <EMAIL> """ import sys sys.path.append('.') import logging mpl_logger = logging.getLogger('matplotlib') mpl_logger.setLevel(logging.WARNING) import logging.config logging.config.fileConfig("config/logging.conf") logger = lo...
examples/pxScene2d/external/libnode-v6.9.0/deps/v8/tools/gcmole/download_gcmole_tools.py
madanagopaltcomcast/pxCore
5,964
12682753
#!/usr/bin/env python # Copyright 2016 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import re import subprocess GCMOLE_PATH = os.path.dirname(os.path.abspath(__file__)) SHA1_PATH = os.path.join(GCMOLE_PATH,...
tests/orm/relations/test_relation.py
wjzero/orator
1,484
12682761
<gh_stars>1000+ # -*- coding: utf-8 -*- import pendulum from flexmock import flexmock, flexmock_teardown from ... import OratorTestCase from orator.query.builder import QueryBuilder from orator.orm.builder import Builder from orator.orm.model import Model from orator.orm.relations import HasOne class OrmRelationTe...
mono/model/mono_baseline/net.py
Jenaer/FeatDepth
179
12682782
<gh_stars>100-1000 from __future__ import absolute_import, division, print_function import torch import torch.nn.functional as F import torch.nn as nn from .layers import SSIM, Backproject, Project from .depth_encoder import DepthEncoder from .depth_decoder import DepthDecoder from .pose_encoder import PoseEncoder fro...
unittest_reinvent/running_modes/reinforcement_tests/test_margin_guard.py
lilleswing/Reinvent-1
183
12682790
<filename>unittest_reinvent/running_modes/reinforcement_tests/test_margin_guard.py import unittest from unittest.mock import Mock import torch import numpy as np from running_modes.reinforcement_learning.margin_guard import MarginGuard class MarginGuardStoreTest(unittest.TestCase): def setUp(self) -> None: ...
conftest.py
mrclary/spyder-terminal
169
12682802
<filename>conftest.py<gh_stars>100-1000 # -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # """ Configuration file for Pytest NOTE: DO NOT add fixtures here. It could generate problems with QtAwesome being called before a QApplication is created. ""...
tests/common/gcp_api/appengine_test.py
aarontp/forseti-security
921
12682816
<gh_stars>100-1000 # Copyright 2017 The Forseti Security 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 # # Un...
hyperbolic/datasets/process_meetup.py
deepneuralmachine/google-research
23,901
12682825
# 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/licenses/LICENSE-2.0 # # Unless required by applicab...
src/lib/py_compile.py
DTenore/skulpt
2,671
12682832
import _sk_fail; _sk_fail._("py_compile")
apps/micro_razers/tests/run_tests.py
JensUweUlrich/seqan
409
12682834
#!/usr/bin/env python2 """Execute the tests for micro_razers. The golden test outputs are generated by the script generate_outputs.sh. You have to give the root paths to the source and the binaries as arguments to the program. These are the paths to the directory that contains the 'projects' directory. Usage: run_...
pyxl/codec/register_invertible.py
gvanrossum/pyxl3
150
12682839
import codecs def search_function(encoding): if encoding != 'pyxl': return None from pyxl.codec.transform import ( pyxl_encode, pyxl_decode, PyxlIncrementalDecoderInvertible, PyxlIncrementalEncoder, PyxlStreamReaderInvertible, PyxlStreamWriter, ) return codecs.CodecInfo( name...
test/python/test_logsoftmax.py
avijit-chakroborty/ngraph-bridge
142
12682840
# ============================================================================== # Copyright 2018-2020 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://ww...
objectModel/Python/tests/samples/test_create_manifest.py
rt112000/CDM
884
12682856
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. import os import unittest from typing import cast from cdm.enums import CdmStatusLevel, CdmObjectType from cdm.objectmodel import CdmCorpusDefinition, CdmEntityDef...
yabgp/message/keepalive.py
mengjunyi/yabgp
203
12682860
# Copyright 2015 Cisco Systems, Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
scanpy/tests/external/test_scrublet.py
mrland99/scanpy
1,171
12682894
import pytest import scanpy as sc import scanpy.external as sce from anndata.tests.helpers import assert_equal def test_scrublet(): """ Test that Scrublet run works. Check that scrublet runs and detects some doublets. """ pytest.importorskip("scrublet") adata = sc.datasets.pbmc3k() sce....
GitRangerLiu/0000/img_addnum.py
saurabh896/python-1
3,976
12682896
<gh_stars>1000+ from PIL import Image, ImageDraw, ImageFont def img_addnum(img_name, num): im = Image.open(img_name) draw = ImageDraw.Draw(im) #width and height w = im.width; h = im.height; print h, w #load font #fnt = ImageFont.load_default() fnt = ImageFont.truetype('arial....
python_toolbox/reasoned_bool.py
hboshnak/python_toolbox
119
12682899
<gh_stars>100-1000 # Copyright 2009-2017 <NAME>. # This program is distributed under the MIT license. class ReasonedBool: ''' A variation on `bool` that also gives a `.reason`. This is useful when you want to say "This is False because... (reason.)" Unfortunately this class is not a subclass of `boo...
model/db/zd_qconf_agent.py
knightoning/zkdash
748
12682916
#!/usr/bin/env python # -*- coding: utf-8 -*- # pylint: disable=invalid-name """ Copyright (c) 2014,掌阅科技 All rights reserved. 摘 要: zd_qconf_agent.py 创 建 者: zhuangshixiong 创建日期: 2015-08-26 """ from peewee import CharField from peewee import IntegerField from peewee import SQL from model.db.base import ZKDASH_DB, En...
pytrait/errors.py
tushar-deepsource/pytrait
115
12682937
class PytraitError(RuntimeError): pass class DisallowedInitError(PytraitError): pass class NonMethodAttrError(PytraitError): pass class MultipleImplementationError(PytraitError): pass class InheritanceError(PytraitError): pass class NamingConventionError(PytraitError): pass
ch2_seldon_examples/train_pipeline.py
gabrielclimb/intro-to-ml-with-kubeflow-examples
150
12682956
<reponame>gabrielclimb/intro-to-ml-with-kubeflow-examples import kfp.dsl as dsl import kfp.gcp as gcp import kfp.onprem as onprem from string import Template import json @dsl.pipeline(name='Simple sci-kit KF Pipeline', description='A simple end to end sci-kit seldon kf pipeline') def mnist_train_pipeli...
inference.py
Na-Z/Atlas
1,571
12683013
# Copyright 2020 Magic Leap, 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...
llvm/bindings/python/llvm/tests/test_bitreader.py
medismailben/llvm-project
4,812
12683015
<reponame>medismailben/llvm-project from __future__ import print_function from .base import TestBase from ..core import OpCode from ..core import MemoryBuffer from ..core import PassRegistry from ..core import Context from ..core import Module from ..bit_reader import parse_bitcode class TestBitReader(TestBase): ...
main_lapwgan.py
AnimatedRNG/pytorch-LapSRN
270
12683025
import argparse, os import pdb import torch import math, random import torch.backends.cudnn as cudnn import torch.nn as nn import torch.optim as optim from torch.autograd import Variable from torch.utils.data import DataLoader from lapsrn_wgan import _netG, _netD, L1_Charbonnier_loss from dataset import Datas...
rl_coach/tests/memories/test_differential_neural_dictionary.py
jl45621/coach
1,960
12683039
# nasty hack to deal with issue #46 import os import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) import pytest import numpy as np import time from rl_coach.memories.non_episodic.differentiable_neural_dictionary import QDND import tensorflow as tf NUM_ACTIONS = 3 NUM_DND_ENTRIES_...
detectron2/model_zoo/model_zoo.py
AlanDecode/detectron2
201
12683046
# Copyright (c) Facebook, Inc. and its affiliates. import os from typing import Optional import pkg_resources import torch from detectron2.checkpoint import DetectionCheckpointer from detectron2.config import CfgNode, LazyConfig, get_cfg, instantiate from detectron2.modeling import build_model class _ModelZooUrls(ob...
mindarmour/adv_robustness/detectors/ensemble_detector.py
mindspore-ai/mindarmour
139
12683070
<reponame>mindspore-ai/mindarmour # Copyright 2019 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 # # Unless requi...
setup.py
PLMZ/nb2xls
144
12683079
from distutils.util import convert_path from setuptools import setup, find_packages module = 'nb2xls' # get version from __meta__ meta_ns = {} path = convert_path(module+'/__meta__.py') with open(path) as meta_file: exec(meta_file.read(), meta_ns) # read requirements.txt with open('requirements.txt', 'r') as f: ...
integration_tests/samples/socket_mode/bolt_adapter/base_handler.py
priya1puresoftware/python-slack-sdk
2,486
12683084
import logging from threading import Event from slack_sdk.socket_mode.client import BaseSocketModeClient from slack_sdk.socket_mode.request import SocketModeRequest from slack_bolt import App class BaseSocketModeHandler: app: App # type: ignore client: BaseSocketModeClient def handle(self, client: Bas...
tests/test_reloader.py
Varriount/sanic
4,959
12683085
<filename>tests/test_reloader.py import os import secrets import sys from contextlib import suppress from subprocess import PIPE, Popen, TimeoutExpired from tempfile import TemporaryDirectory from textwrap import dedent from threading import Timer from time import sleep import pytest # We need to interrupt the auto...
tests/internal/test_xdg.py
grdorin/mopidy
6,700
12683088
import os import pathlib from unittest import mock import pytest from mopidy.internal import xdg @pytest.fixture def environ(): patcher = mock.patch.dict(os.environ, clear=True) yield patcher.start() patcher.stop() def test_cache_dir_default(environ): assert xdg.get_dirs()["XDG_CACHE_DIR"] == ( ...
tests/spot/margin/test_margin_interest_history.py
Banging12/binance-connector-python
512
12683089
import responses from binance.spot import Spot as Client from tests.util import random_str from urllib.parse import urlencode from tests.util import mock_http_response mock_item = {"key_1": "value_1", "key_2": "value_2"} mock_exception = {"code": -1, "msg": "error message"} key = random_str() secret = random_str() ...
tests/common/test_responses.py
mumtozvalijonov/fastapi_contrib
504
12683112
#!/usr/bin/env python # -*- coding: utf-8 -*- from fastapi_contrib.common.responses import UJSONResponse def test_ujson_response_helps_with_slashes(): url = "http://hello.world/endpoint/?key=value" json = UJSONResponse().render(content={"url": url}) assert json == f'{{"url":"{url}"}}'.encode('utf-8')
assets/scripts/voronoi-svg.py
ford442/oglplu2
103
12683135
#!/usr/bin/python3 # coding: UTF-8 # Copyright <NAME>. # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt import os import sys import math import numpy import random import argparse import multiprocessing # ----------...
ffn/utils/vector_pb2.py
pgunn/ffn
266
12683137
# Copyright 2017 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...