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
park/envs/circuit/simulator/circuit/rater.py
utkarsh5k/park
180
11057813
import numpy as np from park.envs.circuit.simulator.utility.misc import AttrDict __all__ = ['Rater'] class Rater(object): __SCALES__ = { 'linear': lambda a, b: a / b, 'log': lambda a, b: np.log10(a) / np.log10(b) } def __init__(self, score_fail, *, centralized_target=False): sel...
mmaction/models/detectors/two_stage.py
arpanmangal/coinaction
1,929
11057814
import torch.nn as nn from .base import BaseDetector from .test_mixins import RPNTestMixin, BBoxTestMixin from .. import builder from ..registry import DETECTORS from mmaction.core.bbox2d import (bbox2roi, bbox2result, build_assigner, build_sampler) @DETECTORS.register_module class ...
scribe/__init__.py
rakeshvar/captcha_ctc
255
11057828
from .ascii import ascii_alphabet from .hindu import hindu_alphabet
attributionpriors/mnist/mnist_model.py
ch6845/attributionpriors
105
11057893
<reponame>ch6845/attributionpriors # Code gratuitously stolen from: # https://github.com/hwalsuklee/tensorflow-mnist-cnn from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import tensorflow.contrib.slim as slim FLAGS = tf.app.flags.FLA...
scattertext/topicmodel/__init__.py
shettyprithvi/scattertext
1,823
11057935
<filename>scattertext/topicmodel/__init__.py from .SentencesForTopicModeling import SentencesForTopicModeling
unicorn/bindings/python/setup.py
clayne/unicorn_pe
491
11057969
<reponame>clayne/unicorn_pe #!/usr/bin/env python # Python binding for Unicorn engine. <NAME> <<EMAIL>> from __future__ import print_function import glob import os import subprocess import shutil import sys import platform from distutils import log from distutils.core import setup from distutils.util import get_platf...
Remoting/Views/Testing/Python/SpreadSheetViewPartialArrays.py
xj361685640/ParaView
815
11057971
<filename>Remoting/Views/Testing/Python/SpreadSheetViewPartialArrays.py from paraview.simple import * from paraview import smtesting smtesting.ProcessCommandLineArguments() sphere = Sphere(ThetaResolution=3, PhiResolution=3) cal1 = Calculator(Input=sphere, ResultArrayName="Var1", Function="1") cal2 = Calculator(Input=...
examples/pcb_example.py
Dheeraj8383/pcb-tools
223
11057986
#! /usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2016 <NAME> <<EMAIL>> # 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 re...
gryphon/lib/models/datum.py
qiquanzhijia/gryphon
1,109
11057989
<reponame>qiquanzhijia/gryphon from collections import defaultdict from datetime import datetime import json import uuid from cdecimal import Decimal from sqlalchemy import ForeignKey, Column, Integer, Unicode, DateTime, UnicodeText, Numeric from gryphon.lib.models.base import Base from gryphon.lib.session import com...
nmtpy/models/attention_wmt.py
lium-lst/nmtpy
144
11058000
<reponame>lium-lst/nmtpy # -*- coding: utf-8 -*- from ..iterators.fusion import FusionIterator from .attention import Model as Attention # Same model as attention but using FusionIterator # Purpose was to train a monomodal system using the same .pkl # files prepared for multimodal Task 2 system. # # FIXME: Not tested ...
anytree/dotexport.py
odidev/anytree
700
11058010
<reponame>odidev/anytree<gh_stars>100-1000 import warnings from anytree.exporter.dotexporter import DotExporter class RenderTreeGraph(DotExporter): def __init__(self, *args, **kwargs): """Legacy. Use :any:`anytree.exporter.DotExporter` instead.""" warnings.warn( ("anytree.RenderTreeG...
leaf/rbac/functions/group.py
guiqiqi/leaf
119
11058014
"""用户组操作的相关函数集合""" from typing import List from bson import ObjectId from .. import error from ..model.group import Group class Create: """创建用户组的静态函数集合""" class Retrieve: """查询用户组的静态函数集合""" @staticmethod def byid(groupid: ObjectId) -> Group: """通过用户组 ID 查找用户组记录""" # pylint: disab...
unsplash/stat.py
videowala/python-unsplash
124
11058043
<reponame>videowala/python-unsplash<gh_stars>100-1000 from unsplash.client import Client from unsplash.models import Stat as StatModel class Stat(Client): """Unsplash Stat operations.""" def __init__(self, **kwargs): super(Stat, self).__init__(**kwargs) def total(self): """ Get a...
tests/functional/selected_resources/test_selected_resources.py
tomasfarias/dbt-core
799
11058054
import pytest from dbt.tests.util import run_dbt from tests.functional.selected_resources.fixtures import ( on_run_start_macro_assert_selected_models_expected_list, my_model1, my_model2, my_snapshot, ) @pytest.fixture(scope="class") def macros(): return { "assert_selected_models_expected_l...
WebMirror/management/rss_parser_funcs/feed_parse_extractTrungNguyen.py
fake-name/ReadableWebProxy
193
11058181
def extractTrungNguyen(item): """ """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if 'Bringing the Farm to Live in Another World' in item['title'] or 'Bringing the Farm...' in item['title']: return bui...
qiskit/result/mitigation/base_readout_mitigator.py
Roshan-Thomas/qiskit-terra
1,599
11058252
<gh_stars>1000+ # This code is part of Qiskit. # # (C) Copyright IBM 2021 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications o...
esphome/components/ble_rssi/sensor.py
OttoWinter/esphomeyaml
249
11058254
import esphome.codegen as cg import esphome.config_validation as cv from esphome.components import sensor, esp32_ble_tracker from esphome.const import ( CONF_SERVICE_UUID, CONF_MAC_ADDRESS, DEVICE_CLASS_SIGNAL_STRENGTH, STATE_CLASS_MEASUREMENT, UNIT_DECIBEL, ) DEPENDENCIES = ["esp32_ble_tracker"] ...
sionna/channel/tr38901/uma_scenario.py
NVlabs/sionna
163
11058307
# # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # """3GPP TR39.801 urban macrocell (UMa) channel model""" import tensorflow as tf from sionna import SPEED_OF_LIGHT from sionna.utils import log10 from . import SystemLevelSc...
Morse code with Python unary + and - operators.py
DazEB2/SimplePyScripts
117
11058320
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Morse code with Python unary + and - operators""" # SOURCE: https://habrahabr.ru/post/349776/ # SOURCE: https://gist.github.com/Saluev/c07bef8ffa7290345b0c816fed2ca418 MORSE_ALPHABET = { "А": ".-", "Б": "-...", "В": ".--", "Г": "--.", "Д": "-.."...
src/python/nimbusml/internal/entrypoints/models_crossvalidatordatasetsplitter.py
michaelgsharp/NimbusML
134
11058329
<gh_stars>100-1000 # - Generated by tools/entrypoint_compiler.py: do not edit by hand """ Models.CrossValidatorDatasetSplitter """ import numbers from ..utils.entrypoints import EntryPoint from ..utils.utils import try_set, unlist def models_crossvalidatordatasetsplitter( data, train_data, t...
tests/dags/pydag/py_but_dummy.py
chriscardillo/gusty
103
11058338
<reponame>chriscardillo/gusty<filename>tests/dags/pydag/py_but_dummy.py # --- # operator: airflow.operators.dummy.DummyOperator # --- print("another one")
examples/corpus_stats.py
wilson-santos-87/plyara
127
11058371
<reponame>wilson-santos-87/plyara<gh_stars>100-1000 """Example script that demonstrates using plyara.""" import argparse import operator import plyara def example(): """Execute the example code.""" parser = argparse.ArgumentParser() parser.add_argument('file', metavar='FILE', help='File containing YARA r...
.modules/.recon-ng/modules/recon/profiles-profiles/profiler.py
termux-one/EasY_HaCk
1,103
11058386
<gh_stars>1000+ from recon.core.module import BaseModule from recon.mixins.threads import ThreadingMixin import urllib class Module(BaseModule, ThreadingMixin): meta = { 'name': 'OSINT HUMINT Profile Collector', 'author':'<NAME> (@WebBreacher)', 'description': 'Takes each username from the...
libcity/model/traffic_demand_prediction/STG2Seq.py
moghadas76/test_bigcity
221
11058472
<gh_stars>100-1000 from logging import getLogger import torch from torch import nn import torch.nn.functional as F import numpy as np from scipy.sparse.linalg import eigs from libcity.model import loss from libcity.model.abstract_traffic_state_model import AbstractTrafficStateModel def scaled_laplacian(w): w = w....
examples/raycaster/raycaster/camera.py
salt-die/nurses_2
171
11058480
import asyncio import numpy as np def rotation_matrix(theta): """ Returns a 2-dimensional rotation array of a given angle. Notes ----- Matrix multiplication of a rotation matrix with a camera's plane will rotate the plane. """ x = np.cos(theta) y = np.sin(theta) return np.arr...
src/enamlnative/widgets/popup_window.py
codelv/enaml-native
237
11058495
<reponame>codelv/enaml-native<filename>src/enamlnative/widgets/popup_window.py """ Copyright (c) 2017, <NAME>. Distributed under the terms of the MIT License. The full license is in the file LICENSE, distributed with this software. Created on Mar 17, 2018 @author: jrm """ from atom.api import ( Typed, ForwardTy...
easyfsl/data_tools/task_sampler.py
lnowakow/easy-few-shot-learning
208
11058556
import random from typing import List, Tuple import torch from torch.utils.data import Sampler, Dataset class TaskSampler(Sampler): """ Samples batches in the shape of few-shot classification tasks. At each iteration, it will sample n_way classes, and then sample support and query images from these class...
luz_asm_sim/lib/simlib/peripheral/debugqueue.py
eliben/luz-cpu
135
11058574
# Simulates a "debug queue" peripheral. # This peripheral can be written to by the user's program. It # saves all the words that were written in a FIFO queue that can # be accessed by the simulator at any time, for debugging # purposes. # # Luz micro-controller simulator # <NAME> (C) 2008-2010 from .peripheral import P...
tests/bugs/run_benchmark_M1Comp_MNB71_18.py
shaido987/pyaf
377
11058585
<filename>tests/bugs/run_benchmark_M1Comp_MNB71_18.py import pandas as pd import numpy as np import pyaf.Bench.TS_datasets as tsds import pyaf.Bench.MComp as mcomp import warnings with warnings.catch_warnings(): warnings.simplefilter("error") tester1 = mcomp.cMComp_Tester(tsds.load_M1_comp() , "M1_COMP"); ...
lightnion/http/__init__.py
pthevenet/lightnion
120
11058593
import collections import requests import json headers = {'Content-Type': 'application/json'} import lightnion as lnn import lightnion.proxy from . import polling, websocket, ntor class channel(collections.namedtuple('channel', ['id', 'guard', 'middle', 'exit'])): pass def client(host, port=80, *, io, pref...
4-python/bracketexpansion.py
KefengTeng/nwkauto
153
11058641
# Credit for this exercise goes to <NAME> - he has # been fighting the good fight for the automation community # for a long time. See video: https://vimeo.com/119996709 # Part of stdlib (comes with Python) import itertools # 3rd party lib (install via pip) from bracket_expansion import * # I called it ifac...
gluoncv/data/transforms/video.py
Kh4L/gluon-cv
5,447
11058678
<reponame>Kh4L/gluon-cv # pylint: disable=missing-docstring,arguments-differ,line-too-long """Extended image transformations to video transformations. Code adapted from: https://github.com/bryanyzhu/two-stream-pytorch https://github.com/facebookresearch/SlowFast """ from __future__ import division import random import ...
client/python/ovmsclient/samples/utils/resnet_utils.py
IntelAI/OpenVINO-model-server
305
11058697
<filename>client/python/ovmsclient/samples/utils/resnet_utils.py # # 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/licens...
v2/sock_nonblock.py
Dilepa/micropython-async
443
11058717
# sock_nonblock.py Illustration of the type of code required to use nonblocking # sockets. It is not a working demo and probably has silly errors. # It is intended as an outline of requirements and also to illustrate some of the # nasty hacks required on current builds of ESP32 firmware. Platform detection is # done at...
seahub/organizations/forms.py
samuelduann/seahub
420
11058736
<gh_stars>100-1000 # Copyright (c) 2012-2016 Seafile Ltd. """ Forms and validation code for organization user registration. """ import re from django import forms from django.utils.translation import ugettext_lazy as _ import seaserv from seahub.base.accounts import User from seahub.base.fields import LowerCaseCharF...
homeassistant/components/laundrify/binary_sensor.py
liangleslie/core
30,023
11058743
<filename>homeassistant/components/laundrify/binary_sensor.py """Platform for binary sensor integration.""" from __future__ import annotations import logging from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, BinarySensorEntity, ) from homeassistant.config_entries import ConfigEntry...
runtimes/alibi-detect/mlserver_alibi_detect/cd/runtime.py
alexander-manley/MLServer
191
11058750
from mlserver_alibi_detect.runtime import AlibiDetectRuntime from mlserver_alibi_detect.errors import InvalidAlibiDetector from mlserver.utils import get_model_uri from alibi_detect.utils.saving import load_detector import pickle class AlibiDriftDetectRuntime(AlibiDetectRuntime): """ Implementation of the MLM...
desktop/core/ext-py/nose-1.3.7/unit_tests/test_capture_plugin.py
kokosing/hue
5,079
11058760
<gh_stars>1000+ # -*- coding: utf-8 -*- import sys import unittest from optparse import OptionParser from nose.config import Config from nose.plugins.capture import Capture class TestCapturePlugin(unittest.TestCase): def setUp(self): self._stdout = sys.stdout def tearDown(self): sys.stdout = ...
nlpcda/example.py
blmoistawinde/nlpcda
959
11058806
<filename>nlpcda/example.py #!/usr/bin/python # -*- coding: utf-8 -*- from nlpcda import Randomword from nlpcda import Similarword from nlpcda import Homophone from nlpcda import RandomDeleteChar from nlpcda import Ner from nlpcda import CharPositionExchange from nlpcda import baidu_translate from nlpcda import Equiva...
grow/extensions/core/routes_extension_test.py
akashkalal/grow
335
11058813
<filename>grow/extensions/core/routes_extension_test.py """Tests for routes extensions.""" import unittest from grow.extensions.core import routes_extension class RoutesExtensionTestCase(unittest.TestCase): """Test the routes extension.""" def test_something(self): """?""" pass
python/tree/leetocde/binary_tree_postorder_traversal.py
googege/algo-learn
153
11058879
# 二叉树的后序遍历 class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: # 递归 def postorderTraversal_1(self, root: TreeNode) -> List[int]: def dfs(node, res): if node: dfs(...
python/lbann/onnx/l2o/util.py
jonesholger/lbann
194
11058884
<filename>python/lbann/onnx/l2o/util.py def parseSpatialAttribute(params, attr, dims, defVal): if params.has_vectors: s = getattr(params, attr) if s == "": return [defVal]*dims return list(map(int, s.split(" "))) else: return [getattr(params, "{}_i".format(attr))]*dim...
docs/examples/bipartite/bipartite.py
uluturki/Mathematics-of-Epidemics-on-Networks
136
11058907
import EoN import networkx as nx import random import matplotlib.pyplot as plt G= nx.bipartite.configuration_model([1,11]*2000, [3]*8000) #the graph now consists of two parts. The first part has 2000 degree 1 nodes #and 2000 degree 11 nodes. The second has 8000 degree 3 nodes. #there are 24000 edges in the network....
eset_crackme/loaders/ida_loader_drv_vm.py
fengjixuchui/ida_haru
144
11058908
<gh_stars>100-1000 import idaapi import ida_segment from idc import * from struct import * DATA_SEG_START = 0x10000 # may be changed def accept_file(li, filename): sig = int16(li.read(2)) if sig in [0x3713, 0x481c, 0x1337]: return {'format': "ESET Crackme driver VM program"} else: return 0...
data/unified_datasets/metalwoz/preprocess.py
ljw23/ConvLab-2
339
11058960
<filename>data/unified_datasets/metalwoz/preprocess.py import json import os from zipfile import ZipFile, ZIP_DEFLATED import json_lines dataset = 'metalwoz' self_dir = os.path.dirname(os.path.abspath(__file__)) DATA_PATH = os.path.join(os.path.dirname(os.path.dirname(self_dir)), 'data') # origin_data_dir = os.path....
optbinning/binning/multidimensional/cp_2d.py
jensgk/optbinning
207
11058971
""" Generalized assigment problem: solve constrained optimal 2D binning problem. Constraint programming implementation. """ # <NAME> <<EMAIL>> # Copyright (C) 2021 import numpy as np from ortools.sat.python import cp_model class Binning2DCP: def __init__(self, monotonic_trend_x, monotonic_trend_y, min_n_bins, ...
cycada/data/cityscapes.py
peterzcc/cycada_release
532
11059007
<reponame>peterzcc/cycada_release import os.path import sys import numpy as np import torch import torch.utils.data as data from PIL import Image from .data_loader import register_data_params, register_dataset_obj from .data_loader import DatasetParams ignore_label = 255 id2label = {-1: ignore_label, 0: ignore_labe...
recipes/Python/437072_script_generate_print_perfect/recipe-437072.py
tdiprima/code
2,023
11059045
<gh_stars>1000+ # Filename: perfect.py a = True n = 0 while a == True: # To loop the following commands running = True while running == True: r = 0 n = n+ 1 for x in range(1,n + 1): if n%x == 0: # To determine the factors of n ...
health_check/contrib/migrations/apps.py
erdos4d/django-health-check
739
11059086
<filename>health_check/contrib/migrations/apps.py from django.apps import AppConfig from health_check.plugins import plugin_dir class HealthCheckConfig(AppConfig): name = "health_check.contrib.migrations" def ready(self): from .backends import MigrationsHealthCheck plugin_dir.register(Migra...
scripts/generate_workers.py
hollerith/hipsterter
410
11059090
""" This scripts generate `amount` random workers distributed according to a define skill level distribution. It then prints out the string representations of the workers to be imported into The Founder. """ import json import random mu = 5. sigma = 5. iters = 10000 amount = 120 attr_prob = 0.2 # load names with ope...
coeus.py
Gagarinwjj/Coeus
139
11059111
<reponame>Gagarinwjj/Coeus # coding: utf-8 from utils.manager import Manager __author__ = 'deff' import sys import os if len(sys.argv) < 1: print("usage:python coeus.py sdk_path [-d]") print("-d means delete temp file.") print("sdk_path: aar or jar or apk") sys.exit(0) sdk_path = sys.argv[1] if not...
osf/migrations/0136_add_datacite_file_metadata_schema.py
gaybro8777/osf.io
628
11059119
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-08-16 19:24 from __future__ import unicode_literals import json import logging from django.db import migrations logger = logging.getLogger(__file__) def add_datacite_schema(state, schema): FileMetadataSchema = state.get_model('osf', 'filemetadatasch...
cms/test_utils/project/brokenpluginapp/cms_plugins.py
samirasnoun/django_cms_gallery_image
5,659
11059150
<reponame>samirasnoun/django_cms_gallery_image import nonexistingmodule # nopyflakes
core/utils.py
fakegit/CNN_keras
283
11059167
<filename>core/utils.py import os import cv2 import numpy as np from core import preprocess APPEARED_LETTERS = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ] CAT2CHR = dict(zip(range(len...
gargoyle/testutils.py
Raekkeri/gargoyle
177
11059168
""" gargoyle.testutils ~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ from functools import wraps from gargoyle import gargoyle class SwitchContextManager(object): """ Allows temporarily enabling or disabling a switch. Ideal for testing....
apps/addresses/enums.py
goztrk/django-htk
206
11059172
<reponame>goztrk/django-htk # Python Standard Library Imports from enum import Enum class AddressUnitType(Enum): NONE = 0 APT = 1 FLOOR = 2 HASH = 3 SUITE = 4 UNIT = 5
pydiffvg/pixel_filter.py
AntonBiryukovUofC/diffvg
488
11059175
<filename>pydiffvg/pixel_filter.py import torch import pydiffvg class PixelFilter: def __init__(self, type, radius = torch.tensor(0.5)): self.type = type self.radius = radius
doc/gendocs.py
takipsizad/pyjs
739
11059183
#!/usr/bin/env python2 import sys from epydoc import cli from os import path out = path.dirname(path.abspath(__file__)) def gen_api_docs(): sys.argv += [ '--parse-only', '--name', 'Pyjs', '--url', 'http://pyjs.org', '-o', path.join(out, 'api'), '--exclude', 'pyjamas.raphae...
api/src/opentrons/protocol_engine/clients/__init__.py
anuwrag/opentrons
235
11059190
"""ProtocolEngine clients.""" from .sync_client import SyncClient from .transports import AbstractSyncTransport, ChildThreadTransport __all__ = ["SyncClient", "AbstractSyncTransport", "ChildThreadTransport"]
pycuber/formula/formula.py
GProulx/PyCuber
199
11059204
<reponame>GProulx/PyCuber from collections.abc import MutableSequence from abc import ABCMeta from functools import wraps, total_ordering SKIP = "SKIP" MOVE = "MOVE" FORMULA = "FORMULA" # This is for mirroring STAYS_WHEN_MIRROR = { "LR": ["x", "M"], "UD": ["y", "E"], "FB": ["z", "S"], } class FormulaMe...
osf/migrations/0054_add_file_version_indices.py
gaybro8777/osf.io
628
11059239
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-09-11 18:14 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('osf', '0053_nodelog_faster_index'), ] operations = [ migrations.RunSQL([ ...
repo_utils/test_files/external/fakeRM.py
wwliao/truvari
145
11059240
#!/bin/env python3 import sys ans = """ bit perc perc perc query position in query matching repeat position in repeat score div. del. ins. sequence begin end (left) repeat class/family begin end (left) 129 16.6 0.0 5.4 1028 2 176 (0) C ALUJO SINE/Alu ...
kam1n0-clients/ida-plugin/Kam1n0/forms/SelectionForm.py
ghalipm/Kam1n0-Community
276
11059243
# ******************************************************************************* # * Copyright 2017 McGill University 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 ...
tests/camera.py
gumbald/photobooth
105
11059261
<filename>tests/camera.py #!/usr/bin/env python import picamera from time import sleep camera = picamera.PiCamera() camera.start_preview() sleep(3) camera.capture('image.jpg') camera.stop_preview()
tests/test_pycrypto.py
karthik20122001/docker-python
2,030
11059282
import unittest from Crypto.Hash import SHA256 class TestPycrypto(unittest.TestCase): def test_digest(self): hash = SHA256.new() hash.update('message'.encode('utf-8')) h = hash.digest() self.assertEqual(h, b'\xabS\n\x13\xe4Y\x14\x98+y\xf9\xb7\xe3\xfb\xa9\x94\xcf\xd1\xf3\xfb"\xf7\x1...
gobbli/test/util.py
awesome-archive/gobbli
276
11059295
<reponame>awesome-archive/gobbli from pathlib import Path from typing import Any import pytest from gobbli.dataset.base import BaseDataset from gobbli.experiment.base import BaseExperiment from gobbli.model.base import BaseModel from gobbli.model.bert import BERT from gobbli.model.fasttext import FastText, FastTextCh...
paper/plot-exome-dn-summary.py
zihhuafang/slivar_vep105
162
11059316
import pandas as pd import seaborn as sns from matplotlib import pyplot as plt import sys import numpy as np colors = sns.color_palette("Set1", 12) c = 0.5 colors = [(c, c, c), (c, c, c)] dfo = pd.read_csv(sys.argv[1], sep="\t", index_col=0) df = dfo.melt(value_name="number_of_variants") df.number_of_variants +=...
visualDet3D/data/__init__.py
jovialio/visualDet3D
250
11059328
<reponame>jovialio/visualDet3D from .kitti.dataset import mono_dataset, depth_mono_dataset
tests/test_identifiers.py
s-weigand/darglint
405
11059334
<reponame>s-weigand/darglint from unittest import TestCase import random from darglint.parse.identifiers import ( Path, ) from darglint.node import ( CykNode, ) from darglint.token import ( Token, TokenType, ) # The below methods made defining children # much more concise for tests. def _l(node): ...
manila/policies/security_service.py
openstack/manila
159
11059341
# 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 # d...
v1/training/gen_data_bar.py
tai271828/musegan
1,119
11059354
from __future__ import division from __future__ import print_function import os import numpy as np from os import listdir from os.path import isfile, join import sys import scipy.io as sio import scipy.sparse import json PATH_SEG = 'structure/labs' ROOT_TRACKS = 'tracks' PATH_INSTRU_ACT = join(ROOT_TRACKS, 'act_in...
tests/client/test_get_max_gas.py
kanzure/eth-testrpc
164
11059390
<reponame>kanzure/eth-testrpc<gh_stars>100-1000 def test_get_max_gas(client): assert client.get_max_gas() == 4000000
Rhino/Rhino_PasteFromExternal.py
morphingdesign/OD_CopyPasteExternal
278
11059396
<filename>Rhino/Rhino_PasteFromExternal.py import Rhino, tempfile, os import scriptcontext import System.Guid def buildODMesh(): file = tempfile.gettempdir() + os.sep + "ODVertexData.txt" #open the temp file if os.path.exists(file): f = open(file) lines = f.readlines() f.close() ve...
libs/fuel/fuel/__init__.py
dendisuhubdy/attention-lvcsr
767
11059399
<reponame>dendisuhubdy/attention-lvcsr import fuel.version from fuel.config_parser import config # noqa __version__ = fuel.version.version
Python/Merkle-Hellman_cryptosystem.py
saurabhcommand/Hello-world
1,428
11059401
from functools import reduce from itertools import compress from math import gcd from random import randint, shuffle def egcd(a, b): if a == 0: return b, 0, 1 else: g, x, y = egcd(b % a, a) return g, y - (b // a) * x, x def mulinv(b, n): g, x, _ = egcd(b, n) if g == 1: ...
glazier/lib/actions/googet_test.py
TsekNet/glazier
1,233
11059412
<filename>glazier/lib/actions/googet_test.py # Copyright 2019 Google LLC. 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....
zfit/minimizers/base_tf.py
simonthor/zfit
129
11059442
# Copyright (c) 2021 zfit from typing import Iterable, Optional import tensorflow as tf from ..core.interfaces import ZfitIndependentParameter, ZfitLoss from ..util.exception import OperationNotAllowedError from .baseminimizer import BaseStepMinimizer, minimize_supports class WrapOptimizer(BaseStepMinimizer): ...
parsifal/settings/tests.py
ShivamPytho/parsifal
342
11059461
<reponame>ShivamPytho/parsifal<filename>parsifal/settings/tests.py # flake8: noqa from .base import * PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] GOOGLE_RECAPTCHA_ENABLED = False
svosrc/8x8font.py
DavidJRichards/SimpleVOut
168
11059466
<reponame>DavidJRichards/SimpleVOut #!/usr/bin/python from __future__ import division from __future__ import print_function # 8x8font.png is the "8x8 Bitmapped Font" by <NAME> # License: This font is free to use for any purpose. # http://overcode.yak.net/12 from PIL import Image verbose_output = False im = Image.o...
notebooks-text-format/pixel_cnn_vq_vae.py
arpitvaghela/probml-notebooks
166
11059474
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.11.3 # kernelspec: # display_name: Python 3 # name: python3 # --- # + [markdown] id="QJzbCJZ9sIoX" # ## VQ-VAE and Pixel CNN # # Code: https://...
harness/determined/keras/_tensorboard_callback.py
gh-determined-ai/determined
1,729
11059516
import logging from typing import Any from determined.keras import callbacks class TFKerasTensorBoard(callbacks.TensorBoard): def __init__(self, *args: Any, **kwargs: Any): logging.warning( "det.keras.TFKerasTensorBoard is a deprecated name for " "det.keras.callbacks.TensorBoard, ...
guillotina/tests/cache/test_cache_memory.py
rboixaderg/guillotina
173
11059558
from guillotina.component import get_utility from guillotina.contrib.cache.strategy import BasicCache from guillotina.db.transaction import Transaction from guillotina.interfaces import ICacheUtility from guillotina.tests import mocks from guillotina.tests.utils import create_content from unittest import mock from unit...
demosaicnet/modules.py
MohamadHMousavi/demosaicnet
140
11059581
<gh_stars>100-1000 """Models for [Gharbi2016] Deep Joint demosaicking and denoising.""" import os from collections import OrderedDict from pkg_resources import resource_filename import numpy as np import torch as th import torch.nn as nn __all__ = ["BayerDemosaick", "XTransDemosaick"] _BAYER_WEIGHTS = resource_fil...
docker/examples/reuters/microservice/build_model.py
smsahu/seldon-server
1,645
11059587
import json import codecs import os docs = [] for filename in os.listdir("reuters-21578-json/data/full"): f = open("reuters-21578-json/data/full/"+filename) js = json.load(f) for j in js: if 'topics' in j and 'body' in j: d = {} d["id"] = j['id'] d["text"] = j['...
cyclegan/data/cityscapes.py
Luodian/MADAN
150
11059600
import numpy as np ignore_label = 255 id2label = {-1: ignore_label, 0: ignore_label, 1: ignore_label, 2: ignore_label, 3: ignore_label, 4: ignore_label, 5: ignore_label, 6: ignore_label, 7: 0, 8: 1, 9: ignore_label, 10: ignore_label, 11: 2, 12: 3, 13: 4, 14: ignore_label, 15: ignore...
server_python/index.py
dkvirus/py-novel
145
11059653
from flask import Flask, jsonify, request from flask_cors import CORS from reptile.db import Db from lxml import etree import requests import re import config import time import uuid app = Flask(__name__) # 加载配置文件 app.config.from_object(config) CORS(app, supports_credentials=True) ''' 首页:测试页面 ''' @app.route('/') def ...
runway/__init__.py
scroix/MUNIT-runway
109
11059664
<gh_stars>100-1000 from .model import RunwayModel from .data_types import * from .__version__ import __version__ __defaultmodel__ = RunwayModel() setup = __defaultmodel__.setup command = __defaultmodel__.command run = __defaultmodel__.run
up/tasks/cls/models/postprocess/cls_postprocess.py
ModelTC/EOD
196
11059665
import torch.nn as nn import torch.nn.functional as F from up.utils.general.registry_factory import MODULE_ZOO_REGISTRY from up.utils.model import accuracy as A from up.models.losses import build_loss __all__ = ['BaseClsPostProcess'] @MODULE_ZOO_REGISTRY.register('base_cls_postprocess') class BaseClsPostProcess(nn.M...
jnpr/openclos/cli.py
rohitt29/OpenClos
114
11059666
#------------------------------------------------------------------------------ # cli.py #------------------------------------------------------------------------------ ''' @author : rgiyer Date : October 20th, 2014 This module is responsible for instantiating Python's standard CLI framew...
tests/util/test_build_dataflow.py
AlexMontgomerie/finn
283
11059682
<filename>tests/util/test_build_dataflow.py<gh_stars>100-1000 # Copyright (c) 2020, Xilinx # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the abov...
tools/test-collection-create/test-collection-create.py
chlige/arvados
222
11059685
#!/usr/bin/env python3 # # Copyright (C) The Arvados Authors. All rights reserved. # # SPDX-License-Identifier: CC-BY-SA-3.0 import argparse import logging import random import string import sys import arvados import arvados.collection logger = logging.getLogger('arvados.test_collection_create') logger.setLevel(logg...
pymysqlreplication/bitmap.py
bbotte/mysqlbinlog_flashback
1,880
11059705
<reponame>bbotte/mysqlbinlog_flashback # -*- coding: utf-8 -*- bitCountInByte = [ 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2...
buildroot/support/testing/tests/package/sample_python_pytest_asyncio.py
inverse/operating-system
349
11059725
<filename>buildroot/support/testing/tests/package/sample_python_pytest_asyncio.py import asyncio import pytest x = 1 @pytest.fixture() def f1(): global x x = 2 yield 15 x = 3 @pytest.mark.asyncio async def test_1(): assert x == 1 @pytest.mark.asyncio async def test_2(f1): assert x == 2 ...
tests/terraform/checks/resource/gcp/test_CloudStorageLogging.py
kylelaker/checkov
4,013
11059745
import unittest import hcl2 from checkov.common.models.enums import CheckResult from checkov.terraform.checks.resource.gcp.CloudStorageLogging import check class TestCloudStorageLogging(unittest.TestCase): def test_failure(self): hcl_res = hcl2.loads(""" resource "google_storage_bucket" "loggin...
tests/datatypes/test_bool.py
jacebrowning/voc
850
11059779
<reponame>jacebrowning/voc<filename>tests/datatypes/test_bool.py from .. utils import TranspileTestCase, UnaryOperationTestCase, BinaryOperationTestCase, InplaceOperationTestCase class BoolTests(TranspileTestCase): def test_setattr(self): self.assertCodeExecution(""" x = True try:...
cubes/datastructures.py
digitalsatori/cubes
1,020
11059798
# -*- coding=utf -*- """ cubes.datastructures ~~~~~~~~~~~~~~~~~~~~~ Utility data structures. """ from collections import MutableMapping import sys __all__ = [ "AttributeGetter", "AttributeDictMixin", "AttributeDict", "DictAttribute", "FlatAccessDict", ] # Helper class for Python a...
integration_test/testarcci.py
lynix94/nbase-arc
176
11059818
#!/usr/bin/env python # # Copyright 2015 Naver Corp. # # 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 ...
tests/test_regressions.py
emekdahl/fal
360
11059820
from fal import FalDbt from pathlib import Path import os import pandas as pd profiles_dir = os.path.join(Path.cwd(), "tests/mock/mockProfile") project_dir = os.path.join(Path.cwd(), "tests/mock") # https://github.com/fal-ai/fal/issues/154 def test_write_to_source_not_processing_jinja(): faldbt = FalDbt( ...
torchMoji/api/dataset_emojize.py
UmaTaru/run
163
11059849
<filename>torchMoji/api/dataset_emojize.py # -*- coding: utf-8 -*- """ Uses torchMoji to predict emojis for a dataset and save the softmax outputs to a file. """ from __future__ import print_function, division, unicode_literals from io_utils import load_pickle, dump_pickle from torchMoji.torchmoji.sentence_tokenizer...
tests/conftest.py
Texopolis/gaphor
867
11059862
from gaphor.conftest import Case, case, test_models