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 |
|---|---|---|---|---|
fixit/common/pseudo_rule.py | sk-/Fixit | 313 | 20919 | <filename>fixit/common/pseudo_rule.py<gh_stars>100-1000
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import abc
import ast
import io
import tokenize
from pathlib import Path
from typing i... |
homeschool/referrals/tests/test_models.py | chriswedgwood/homeschool | 154 | 20920 | <reponame>chriswedgwood/homeschool<filename>homeschool/referrals/tests/test_models.py
from homeschool.referrals.tests.factories import ReferralFactory
from homeschool.test import TestCase
class TestReferral(TestCase):
def test_factory(self):
referral = ReferralFactory()
assert referral.referring_... |
tests/storage/psql_dos/migrations/django_branch/test_0043_default_link_label.py | mkrack/aiida-core | 153 | 20951 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
ds2/sorting/bubblesort.py | aslisabanci/datastructures | 159 | 20959 | def bubblesort(L):
keepgoing = True
while keepgoing:
keepgoing = False
for i in range(len(L)-1):
if L[i]>L[i+1]:
L[i], L[i+1] = L[i+1], L[i]
keepgoing = True
|
src/westpa/core/reweight/__init__.py | burntyellow/adelman_ci | 140 | 20973 | <filename>src/westpa/core/reweight/__init__.py
'''
Function(s) for the postanalysis toolkit
'''
import logging
log = logging.getLogger(__name__)
from . import _reweight
from ._reweight import (stats_process, reweight_for_c)
from .matrix import FluxMatrix
|
eval_odom.py | nikola3794/kitti-odom-eval | 110 | 20987 | # Copyright (C) <NAME> 2019. All rights reserved.
import argparse
from kitti_odometry import KittiEvalOdom
parser = argparse.ArgumentParser(description='KITTI evaluation')
parser.add_argument('--result', type=str, required=True,
help="Result directory")
parser.add_argument('--align', type=str,
... |
src/cd.py | laura-rieger/deep-explanation-penalization | 105 | 20989 | <reponame>laura-rieger/deep-explanation-penalization
#original from https://github.com/csinva/hierarchical-dnn-interpretations/blob/master/acd/scores/cd.py
import torch
import torch.nn.functional as F
from copy import deepcopy
from torch import sigmoid
from torch import tanh
import numpy as np
stabilizing_constant... |
pysparkling/sql/expressions/literals.py | ptallada/pysparkling | 260 | 20996 | from ..utils import AnalysisException
from .expressions import Expression
class Literal(Expression):
def __init__(self, value):
super().__init__()
self.value = value
def eval(self, row, schema):
return self.value
def __str__(self):
if self.value is True:
retur... |
samples/cordic/cordic_golden.py | hj424/heterocl | 236 | 21018 | <reponame>hj424/heterocl
import numpy as np
golden = np.array([
[100.0, 100.0],
[206.226840616, 179.610387213],
[1190.25124092, 1197.15702025],
[1250.76639667, 1250.3933971],
[1261.76760093, 1250.17718583],
[1237.4846285, 1237.56490579],
[1273.56730356, 1266.82141705],
[1272.899992, 1259.9258911... |
angrmanagement/ui/menus/disasm_insn_context_menu.py | yuzeming/angr-management | 474 | 21059 | from functools import partial
from typing import Callable
from typing import TYPE_CHECKING
from ...config import Conf
from .menu import Menu, MenuEntry, MenuSeparator
if TYPE_CHECKING:
from ...ui.views.disassembly_view import DisassemblyView
class DisasmInsnContextMenu(Menu):
"""
Dissembly Instruction's ... |
release/stubs.min/Autodesk/Revit/DB/Structure/__init___parts/AnalyticalModelStick.py | htlcnn/ironpython-stubs | 182 | 21079 | class AnalyticalModelStick(AnalyticalModel,IDisposable):
"""
An element that represents a stick in the structural analytical model.
Could be one of beam,brace or column type.
"""
def Dispose(self):
""" Dispose(self: Element,A_0: bool) """
pass
def GetAlignmentMethod(self,selector):
"""
GetA... |
custom/abt/reports/tests/test_fixture_utils.py | dimagilg/commcare-hq | 471 | 21090 | import doctest
from nose.tools import assert_equal, assert_true
from corehq.apps.fixtures.models import (
FieldList,
FixtureDataItem,
FixtureItemField,
)
from custom.abt.reports import fixture_utils
from custom.abt.reports.fixture_utils import (
dict_values_in,
fixture_data_item_to_dict,
)
def t... |
cosypose/simulator/__init__.py | ompugao/cosypose | 202 | 21112 | <filename>cosypose/simulator/__init__.py
from .body import Body
from .camera import Camera
from .base_scene import BaseScene
from .caching import BodyCache, TextureCache
from .textures import apply_random_textures
|
samples/vsphere/vcenter/setup/datacenter.py | restapicoding/VMware-SDK | 589 | 21116 | <gh_stars>100-1000
"""
* *******************************************************
* Copyright (c) VMware, Inc. 2016-2018. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
* WARRANTIES OR CONDITION... |
tests/test_year_2018.py | l0pht511/jpholiday | 179 | 21148 | <filename>tests/test_year_2018.py
# coding: utf-8
import datetime
import unittest
import jpholiday
class TestYear2018(unittest.TestCase):
def test_holiday(self):
"""
2018年祝日
"""
self.assertEqual(jpholiday.is_holiday_name(datetime.date(2018, 1, 1)), '元日')
self.assertEqual(j... |
src/python/pants/option/options_fingerprinter_test.py | bastianwegge/pants | 1,806 | 21158 | # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pathlib import Path
import pytest
from pants.option.custom_types import (
DictValueComponent,
ListValueComponent,
UnsetBool,
dict_with_files_option,
dir_option,
... |
scaffoldgraph/analysis/enrichment.py | trumanw/ScaffoldGraph | 121 | 21161 | <filename>scaffoldgraph/analysis/enrichment.py
"""
scaffoldgraph.analysis.enrichment
Module contains an implementation of Compound Set Enrichment from the papers:
- Compound Set Enrichment: A Novel Approach to Analysis of Primary HTS Data.
- Mining for bioactive scaffolds with scaffold networks: Improved compound set ... |
python/brunel/magics.py | Ross1503/Brunel | 306 | 21163 | # Copyright (c) 2015 IBM Corporation and others.
#
# 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... |
lte/gateway/python/magma/enodebd/tr069/tests/models_tests.py | Aitend/magma | 849 | 21185 | <reponame>Aitend/magma
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASI... |
main.py | Lasx/gb688_downloader | 119 | 21191 | <reponame>Lasx/gb688_downloader<filename>main.py<gh_stars>100-1000
from standard import HDB, NatureStd
if __name__ == "__main__":
hb = HDB('hbba')
db = HDB('dbba')
data = db.search('政务云工程评价指标体系及方法')
print(data)
# first_record = data["records"][0]
# name = f'{first_record["code"]}({first_record... |
notebook/dict_keys_values_items.py | vhn0912/python-snippets | 174 | 21196 | <filename>notebook/dict_keys_values_items.py
d = {'key1': 1, 'key2': 2, 'key3': 3}
for k in d:
print(k)
# key1
# key2
# key3
for k in d.keys():
print(k)
# key1
# key2
# key3
keys = d.keys()
print(keys)
print(type(keys))
# dict_keys(['key1', 'key2', 'key3'])
# <class 'dict_keys'>
k_list = list(d.keys())
prin... |
flows/tests/settings.py | sergioisidoro/django-flows | 104 | 21197 | <reponame>sergioisidoro/django-flows
import django
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_APPS = ['flows', 'flows.statestore.tests', 'django_nose']
SECRET_KEY = 'flow_tests'
if django.VERSION < (1, 6):
TEST_RUNNER = 'django.te... |
python/craftassist/ttad/generation_dialogues/build_scene_flat_script.py | satyamedh/craftassist | 626 | 21217 | <reponame>satyamedh/craftassist
if __name__ == "__main__":
import argparse
import pickle
import os
from tqdm import tqdm
from build_scene import *
from block_data import COLOR_BID_MAP
BLOCK_DATA = pickle.load(
open("/private/home/aszlam/minecraft_specs/block_images/block_data", "rb"... |
modules/transfer/scripts/info.py | sishuiliunian/falcon-plus | 7,208 | 21218 | <gh_stars>1000+
import requests
# Copyright 2017 Xiaomi, 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 applica... |
stix_shifter_modules/secretserver/stix_transmission/delete_connector.py | grimmjow8/stix-shifter | 129 | 21232 | from stix_shifter_utils.modules.base.stix_transmission.base_delete_connector import BaseDeleteConnector
class DeleteConnector(BaseDeleteConnector):
def __init__(self, api_client):
self.api_client = api_client
def delete_query_connection(self, search_id):
return {"success": True}
|
tests/test_crud/conftest.py | amisadmin/fastapi_amis_admin | 166 | 21241 | <filename>tests/test_crud/conftest.py<gh_stars>100-1000
import pytest
from tests.test_crud.main import app
@pytest.fixture(scope='session', autouse=True)
def startup():
import asyncio
# asyncio.run(app.router.startup())
loop = asyncio.get_event_loop()
loop.run_until_complete(app.router.startup())
|
src/settings.py | MichaelJWelsh/bot-evolution | 151 | 21294 | <reponame>MichaelJWelsh/bot-evolution
"""
This module contains the general settings used across modules.
"""
FPS = 60
WINDOW_WIDTH = 1100
WINDOW_HEIGHT = 600
TIME_MULTIPLIER = 1.0
|
src/compas_rhino/utilities/misc.py | XingxinHE/compas | 235 | 21305 | <gh_stars>100-1000
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
try:
basestring
except NameError:
basestring = str
import os
import sys
import ast
from compas_rhino.forms import TextForm
from compas_rhino.forms import ImageForm
import System
i... |
test/nn/test_nonlinearities_fliprotations.py | steven-lang/e2cnn | 356 | 21342 | <gh_stars>100-1000
import unittest
from unittest import TestCase
from e2cnn.nn import *
from e2cnn.gspaces import *
import random
class TestNonLinearitiesFlipRotations(TestCase):
def test_dihedral_norm_relu(self):
N = 8
g = FlipRot2dOnR2(N)
r = FieldType(g, list(g.represent... |
tests/test_private_storage.py | glasslion/django-qiniu-storage | 209 | 21365 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, print_function
from datetime import datetime
import os
from os.path import dirname, join
import sys
import time
import unittest
import uuid
import logging
LOGGING_FORMAT = '\n%(levelname)s %(asctime)s %(message)s'
logging.basicConfig(lev... |
grr/core/grr_response_core/lib/rdfvalue_test.py | khanhgithead/grr | 4,238 | 21380 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Tests for utility classes."""
import datetime
import sys
import unittest
from absl import app
from absl.testing import absltest
from grr_response_core.lib import rdfvalue
from grr.test_lib import test_lib
long_string = (
"迎欢迎\n"
"Lorem ipsum dolor sit amet... |
pyclustering/nnet/som.py | JosephChataignon/pyclustering | 1,013 | 21403 | """!
@brief Neural Network: Self-Organized Feature Map
@details Implementation based on paper @cite article::nnet::som::1, @cite article::nnet::som::2.
@authors <NAME> (<EMAIL>)
@date 2014-2020
@copyright BSD-3-Clause
"""
import math
import random
import matplotlib.pyplot as plt
import pyclusterin... |
sktime/clustering/evaluation/_plot_clustering.py | marcio55afr/sktime | 5,349 | 21405 | # -*- coding: utf-8 -*-
"""Cluster plotting tools"""
__author__ = ["<NAME>", "<NAME>"]
__all__ = ["plot_cluster_algorithm"]
import pandas as pd
from sktime.clustering.base._typing import NumpyOrDF
from sktime.clustering.base.base import BaseClusterer
from sktime.clustering.partitioning._lloyds_partitioning import (
... |
pyramda/logic/any_pass.py | sergiors/pyramda | 124 | 21415 | <filename>pyramda/logic/any_pass.py
from pyramda.function.curry import curry
from pyramda.function.always import always
from pyramda.iterable.reduce import reduce
from .either import either
@curry
def any_pass(ps, v):
return reduce(either, always(False), ps)(v)
|
test/unit/test_params.py | davvil/sockeye | 1,117 | 21448 | <reponame>davvil/sockeye<gh_stars>1000+
# Copyright 2017--2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.amazon.c... |
examples/python/django/load-generator.py | ScriptBox99/pyroscope | 5,751 | 21458 | import random
import requests
import time
HOSTS = [
'us-east-1',
'us-west-1',
'eu-west-1',
]
VEHICLES = [
'bike',
'scooter',
'car',
]
if __name__ == "__main__":
print(f"starting load generator")
time.sleep(15)
print('done sleeping')
while True:
host = HOSTS[random.rand... |
rnn/chatbot/chatbot.py | llichengtong/yx4 | 128 | 21467 | # coding=utf8
import logging
import os
import random
import re
import numpy as np
import tensorflow as tf
from seq2seq_conversation_model import seq2seq_model
from seq2seq_conversation_model import data_utils
from seq2seq_conversation_model import tokenizer
from seq2seq_conversation_model.seq2seq_conversation_model imp... |
app/services/articles.py | StanislavRud/api-realword-app-test | 1,875 | 21477 | <filename>app/services/articles.py<gh_stars>1000+
from slugify import slugify
from app.db.errors import EntityDoesNotExist
from app.db.repositories.articles import ArticlesRepository
from app.models.domain.articles import Article
from app.models.domain.users import User
async def check_article_exists(articles_repo: ... |
tests/unit/schemas/test_base_schema_class.py | gamechanger/dusty | 421 | 21524 | from unittest import TestCase
from schemer import Schema, Array, ValidationException
from dusty.schemas.base_schema_class import DustySchema, DustySpecs
from ...testcases import DustyTestCase
class TestDustySchemaClass(TestCase):
def setUp(self):
self.base_schema = Schema({'street': {'type': basestring},... |
DEQModel/utils/debug.py | JunLi-Galios/deq | 548 | 21546 | import torch
from torch.autograd import Function
class Identity(Function):
@staticmethod
def forward(ctx, x, name):
ctx.name = name
return x.clone()
def backward(ctx, grad):
import pydevd
pydevd.settrace(suspend=False, trace_only_current_thread=True)
grad_temp = gr... |
Configuration/ProcessModifiers/python/trackingMkFitTobTecStep_cff.py | Purva-Chaudhari/cmssw | 852 | 21568 | import FWCore.ParameterSet.Config as cms
# This modifier sets replaces the default pattern recognition with mkFit for tobTecStep
trackingMkFitTobTecStep = cms.Modifier()
|
Trakttv.bundle/Contents/Libraries/Shared/plugin/scrobbler/handlers/playing.py | disrupted/Trakttv.bundle | 1,346 | 21590 | from plugin.scrobbler.core import SessionEngine, SessionHandler
@SessionEngine.register
class PlayingHandler(SessionHandler):
__event__ = 'playing'
__src__ = ['create', 'pause', 'stop', 'start']
__dst__ = ['start', 'stop']
@classmethod
def process(cls, session, payload):
# Handle media c... |
samples/features/sql-big-data-cluster/security/encryption-at-rest-external-key-provider/kms_plugin_app/custom_akv.py | aguzev/sql-server-samples | 4,474 | 21592 | <reponame>aguzev/sql-server-samples<filename>samples/features/sql-big-data-cluster/security/encryption-at-rest-external-key-provider/kms_plugin_app/custom_akv.py
# Placeholder for adding logic specific to application
# and backend key store.
#
import os
import json
import sys
from azure.identity import DefaultAzureCred... |
data_managers/data_manager_gatk_picard_index_builder/data_manager/data_manager_gatk_picard_index_builder.py | supernord/tools-iuc | 142 | 21612 | <gh_stars>100-1000
#!/usr/bin/env python
# <NAME>.
# Uses fasta sorting functions written by <NAME>.
import json
import optparse
import os
import shutil
import subprocess
import sys
import tempfile
CHUNK_SIZE = 2**20
DEFAULT_DATA_TABLE_NAME = "fasta_indexes"
def get_id_name(params, dbkey, fasta_description=None):
... |
django_for_startups/django_customizations/drf_customizations.py | Alex3917/django_for_startups | 102 | 21613 | # Standard Library imports
# Core Django imports
# Third-party imports
from rest_framework import permissions
from rest_framework.throttling import UserRateThrottle, AnonRateThrottle
# App imports
class BurstRateThrottle(UserRateThrottle):
scope = 'burst'
class SustainedRateThrottle(UserRateThrottle):
sc... |
communications/migrations/0002_auto_20190902_1759.py | shriekdj/django-social-network | 368 | 21619 | <reponame>shriekdj/django-social-network
# Generated by Django 2.2.4 on 2019-09-02 11:59
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_M... |
tests/resources/test_codegen/template.py | come2ry/atcoder-tools | 313 | 21638 | <reponame>come2ry/atcoder-tools<filename>tests/resources/test_codegen/template.py
#!/usr/bin/env python3
import sys
def solve(${formal_arguments}):
return
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_to... |
archived-stock-trading-bot-v1/utils/alerts.py | Allcallofduty10/stock-trading-bot | 101 | 21642 | import os
from sys import platform
def say_beep(n: int):
for i in range(0, n):
if platform == "darwin":
os.system("say beep")
|
test/PySrc/tools/collect_tutorials.py | lifubang/live-py-plugin | 224 | 21681 | import json
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, FileType
from pathlib import Path
def main():
parser = ArgumentParser(description='Collect markdown files, and write JSON.',
formatter_class=ArgumentDefaultsHelpFormatter)
project_path = Path(__file__).... |
aim/pytorch.py | avkudr/aim | 2,195 | 21718 | <reponame>avkudr/aim
# Alias to SDK PyTorch utils
from aim.sdk.adapters.pytorch import track_params_dists, track_gradients_dists # noqa
|
diagrams/alibabacloud/analytics.py | bry-c/diagrams | 17,037 | 21728 | <reponame>bry-c/diagrams
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _AlibabaCloud
class _Analytics(_AlibabaCloud):
_type = "analytics"
_icon_dir = "resources/alibabacloud/analytics"
class AnalyticDb(_Analytics):
_icon = "analytic-db.png"
class ClickHouse(_Analy... |
test/python/echo_hi_then_error.py | WrkMetric/Python--NodeJS | 1,869 | 21732 | <reponame>WrkMetric/Python--NodeJS
print('hi')
raise Exception('fibble-fah') |
ansible/utils/check_droplet.py | louis-pre/NewsBlur | 3,073 | 21743 | <reponame>louis-pre/NewsBlur
import sys
import time
import digitalocean
import subprocess
def test_ssh(drop):
droplet_ip_address = drop.ip_address
result = subprocess.call(f"ssh -o StrictHostKeyChecking=no root@{droplet_ip_address} ls", shell=True)
if result == 0:
return True
return False
TOKE... |
tests/test_paddle.py | ankitshah009/MMdnn | 3,442 | 21772 | from __future__ import absolute_import
from __future__ import print_function
import os
import sys
from conversion_imagenet import TestModels
from conversion_imagenet import is_paddle_supported
def get_test_table():
return { 'paddle' : {
'resnet50' : [
TestModels.onnx_emit,
... |
development_playgrounds/transformation_planar_flow_test.py | ai-di/Brancher | 208 | 21795 | <filename>development_playgrounds/transformation_planar_flow_test.py
import matplotlib.pyplot as plt
import numpy as np
import torch
from brancher.variables import ProbabilisticModel
from brancher.standard_variables import NormalVariable, DeterministicVariable, LogNormalVariable
import brancher.functions as BF
from br... |
samples/archive/stream/stream.py | zzzDavid/heterocl | 236 | 21838 | import heterocl as hcl
hcl.init()
target = hcl.Platform.xilinx_zc706
initiation_interval = 4
a = hcl.placeholder((10, 20), name="a")
b = hcl.placeholder((10, 20), name="b")
c = hcl.placeholder((10, 20), name="c")
d = hcl.placeholder((10, 20), name="d")
e = hcl.placeholder((10, 20), name="e")
def add_mul(a, b, c, d,... |
reagent/test/training/test_qrdqn.py | dmitryvinn/ReAgent | 1,156 | 21846 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import unittest
import torch
from reagent.core.parameters import EvaluationParameters, RLParameters
from reagent.core.types import FeatureData, DiscreteDqnInput, ExtraData
from reagent.evaluation.evaluator import get_metric... |
qcodes/tests/test_sweep_values.py | riju-pal/QCoDeS_riju | 223 | 21853 | <filename>qcodes/tests/test_sweep_values.py
import pytest
from qcodes.instrument.parameter import Parameter
from qcodes.instrument.sweep_values import SweepValues
from qcodes.utils.validators import Numbers
@pytest.fixture(name='c0')
def _make_c0():
c0 = Parameter('c0', vals=Numbers(-10, 10), get_cmd=None, set... |
tools/SDKTool/src/WrappedDeviceAPI/deviceAPI/mobileDevice/android/plugin/Platform_plugin/PlatformWeTest/__init__.py | Passer-D/GameAISDK | 1,210 | 21855 | <reponame>Passer-D/GameAISDK<filename>tools/SDKTool/src/WrappedDeviceAPI/deviceAPI/mobileDevice/android/plugin/Platform_plugin/PlatformWeTest/__init__.py
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU Ge... |
t/unit/utils/test_div.py | kaiix/kombu | 1,920 | 21864 | <reponame>kaiix/kombu<gh_stars>1000+
import pickle
from io import BytesIO, StringIO
from kombu.utils.div import emergency_dump_state
class MyStringIO(StringIO):
def close(self):
pass
class MyBytesIO(BytesIO):
def close(self):
pass
class test_emergency_dump_state:
def test_dump(self... |
release/stubs.min/System/Net/__init___parts/TransportContext.py | htlcnn/ironpython-stubs | 182 | 21866 | <filename>release/stubs.min/System/Net/__init___parts/TransportContext.py<gh_stars>100-1000
class TransportContext(object):
""" The System.Net.TransportContext class provides additional context about the underlying transport layer. """
def GetChannelBinding(self,kind):
"""
GetChannelBinding(self: TransportCon... |
third_party/pyth/p2w_autoattest.py | dendisuhubdy/wormhole | 695 | 21880 | <reponame>dendisuhubdy/wormhole
#!/usr/bin/env python3
# This script sets up a simple loop for periodical attestation of Pyth data
from pyth_utils import *
from http.client import HTTPConnection
from http.server import HTTPServer, BaseHTTPRequestHandler
import json
import os
import re
import subprocess
import time
i... |
milking_cowmask/data_sources/imagenet_data_source.py | deepneuralmachine/google-research | 23,901 | 21891 | <reponame>deepneuralmachine/google-research<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.apac... |
StockAnalysisSystem/ui/Extension/recycled/announcement_downloader.py | SleepySoft/StockAnalysisSystem | 138 | 21895 | <reponame>SleepySoft/StockAnalysisSystem<filename>StockAnalysisSystem/ui/Extension/recycled/announcement_downloader.py<gh_stars>100-1000
import time
import urllib
import random
import logging
import requests
import datetime
from os import sys, path, makedirs
from PyQt5.QtCore import Qt, QTimer, QDateTime
from PyQt5.Qt... |
python/src/main/python/pygw/query/aggregation_query_builder.py | radiant-maxar/geowave | 280 | 21900 | <reponame>radiant-maxar/geowave
#
# Copyright (c) 2013-2020 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the accompanying materials are made available
# under the terms of the ... |
uwsgi/unacc/poc.py | nobgr/vulhub | 9,681 | 21902 | #!/usr/bin/python
# coding: utf-8
######################
# Uwsgi RCE Exploit
######################
# Author: <EMAIL>
# Created: 2017-7-18
# Last modified: 2018-1-30
# Note: Just for research purpose
import sys
import socket
import argparse
import requests
def sz(x):
s = hex(x if isinstance(x, int) else len(x))[2... |
align/pnr/write_constraint.py | ALIGN-analoglayout/ALIGN-public | 119 | 21925 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 13 14:50:24 2021
@author: kunal001
"""
import pathlib
import pprint
import json
import logging
from ..schema import constraint
logger = logging.getLogger(__name__)
pp = pprint.PrettyPrinter(indent=4)
class PnRConstraintWriter:
... |
tests/test_prns.py | mfkiwl/laika-gnss | 365 | 21933 | <gh_stars>100-1000
import unittest
from laika.helpers import get_constellation, get_prn_from_nmea_id, \
get_nmea_id_from_prn, NMEA_ID_RANGES
SBAS_DATA = [
['S01', 33],
['S02', 34],
['S10', 42],
['S22', 54],
['S23', 55],
['S32', 64],
['S33', 120],
['S64', 151... |
lib/exaproxy/configuration.py | oriolarcas/exaproxy | 124 | 21955 | <gh_stars>100-1000
# encoding: utf-8
"""
configuration.py
Created by <NAME> on 2011-11-29.
Copyright (c) 2011-2013 Exa Networks. All rights reserved.
"""
# NOTE: reloading mid-program not possible
import os
import sys
import logging
import pwd
import math
import socket
import struct
_application = None
_config = ... |
kili/mutations/project_version/fragments.py | ASonay/kili-playground | 214 | 21964 | <reponame>ASonay/kili-playground
"""
Fragments of project version mutations
"""
PROJECT_VERSION_FRAGMENT = '''
content
id
name
projectId
'''
|
packnet_sfm/loggers/wandb_logger.py | asmith9455/packnet-sfm | 982 | 22004 | # Copyright 2020 Toyota Research Institute. All rights reserved.
# Adapted from Pytorch-Lightning
# https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/loggers/wandb.py
from argparse import Namespace
from collections import OrderedDict
import numpy as np
import torch.nn as nn
import w... |
desktop/core/ext-py/Mako-1.0.7/test/test_cmd.py | kokosing/hue | 5,079 | 22008 | from __future__ import with_statement
from contextlib import contextmanager
from test import TemplateTest, eq_, raises, template_base, mock
import os
from mako.cmd import cmdline
class CmdTest(TemplateTest):
@contextmanager
def _capture_output_fixture(self, stream="stdout"):
with mock.patch("sys.%s" % ... |
sphinx-sources/Examples/Commands/LensFresnel_Convert.py | jccmak/lightpipes | 132 | 22010 | from LightPipes import *
import matplotlib.pyplot as plt
def TheExample(N):
fig=plt.figure(figsize=(11,9.5))
ax1 = fig.add_subplot(221)
ax2 = fig.add_subplot(222)
ax3 = fig.add_subplot(223)
ax4 = fig.add_subplot(224)
labda=1000*nm;
size=10*mm;
f1=10*m
f2=1.11111111*m
z=1.0*... |
cpu_ver/funkyyak/tests/test_util.py | bigaidream-projects/drmad | 119 | 22035 | <gh_stars>100-1000
import numpy as np
import itertools as it
from funkyyak import grad
from copy import copy
def nd(f, *args):
unary_f = lambda x : f(*x)
return unary_nd(unary_f, args)
def unary_nd(f, x):
eps = 1e-4
if isinstance(x, np.ndarray):
nd_grad = np.zeros(x.shape)
for dims in ... |
auto_ml/_version.py | amlanbanerjee/auto_ml | 1,671 | 22042 | <filename>auto_ml/_version.py
__version__ = "2.9.10"
|
lib/roi_data/minibatch.py | BarneyQiao/pcl.pytorch | 233 | 22056 | <reponame>BarneyQiao/pcl.pytorch<gh_stars>100-1000
import numpy as np
import numpy.random as npr
import cv2
from core.config import cfg
import utils.blob as blob_utils
def get_minibatch_blob_names(is_training=True):
"""Return blob names in the order in which they are read by the data loader.
"""
# data b... |
parallelformers/policies/gptj.py | Oaklight/parallelformers | 454 | 22059 | <reponame>Oaklight/parallelformers
# Copyright 2021 TUNiB 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... |
deep-rl/lib/python2.7/site-packages/OpenGL/GL/ATI/text_fragment_shader.py | ShujaKhalid/deep-rl | 210 | 22065 | '''OpenGL extension ATI.text_fragment_shader
This module customises the behaviour of the
OpenGL.raw.GL.ATI.text_fragment_shader to provide a more
Python-friendly API
Overview (from the spec)
The ATI_fragment_shader extension exposes a powerful fragment
processing model that provides a very general means of expr... |
powerline/lib/watcher/stat.py | MrFishFinger/powerline | 11,435 | 22089 | <gh_stars>1000+
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
from threading import RLock
from powerline.lib.path import realpath
class StatFileWatcher(object):
def __init__(self):
self.watches = {}
self.lock = RLock()
def watch(... |
braintree/apple_pay_card.py | futureironman/braintree_python | 182 | 22109 | <filename>braintree/apple_pay_card.py
import braintree
from braintree.resource import Resource
class ApplePayCard(Resource):
"""
A class representing Braintree Apple Pay card objects.
"""
class CardType(object):
"""
Contants representing the type of the credit card. Available types are... |
posthog/migrations/0087_fix_annotation_created_at.py | avoajaugochukwu/posthog | 7,409 | 22155 | # Generated by Django 3.0.7 on 2020-10-14 07:46
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("posthog", "0086_team_session_recording_opt_in"),
]
operations = [
migrations.AlterField(
model_name... |
api/tests/opentrons/protocol_engine/execution/test_run_control_handler.py | mrod0101/opentrons | 235 | 22179 | <reponame>mrod0101/opentrons
"""Run control side-effect handler."""
import pytest
from decoy import Decoy
from opentrons.protocol_engine.state import StateStore
from opentrons.protocol_engine.actions import ActionDispatcher, PauseAction
from opentrons.protocol_engine.execution.run_control import RunControlHandler
from... |
pmlearn/mixture/tests/test_dirichlet_process.py | john-veillette/pymc-learn | 187 | 22208 | import unittest
import shutil
import tempfile
import numpy as np
# import pandas as pd
# import pymc3 as pm
# from pymc3 import summary
# from sklearn.mixture import BayesianGaussianMixture as skBayesianGaussianMixture
from sklearn.model_selection import train_test_split
from pmlearn.exceptions import NotFittedError
... |
utils/utils.py | cheng052/H3DNet | 212 | 22210 | <reponame>cheng052/H3DNet<gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
def conv3x3x3(in_planes, out_planes, stride):
# 3x3x3 convolution with padding
return nn.Conv3d(
in_planes,
out_planes,
kernel_size=3,
stride=stride,
padding=1)... |
tests/datasets/test_tonas.py | lucaspbastos/mirdata | 224 | 22239 | import numpy as np
from tests.test_utils import run_track_tests
from mirdata import annotations
from mirdata.datasets import tonas
TEST_DATA_HOME = "tests/resources/mir_datasets/tonas"
def test_track():
default_trackid = "01-D_AMairena"
dataset = tonas.Dataset(TEST_DATA_HOME)
track = dataset.track(defa... |
pyleus/configuration.py | earthmine/pyleus | 166 | 22245 | """Configuration defaults and loading functions.
Pyleus will look for configuration files in the following file paths in order
of increasing precedence. The latter configuration overrides the previous one.
#. /etc/pyleus.conf
#. ~/.config/pyleus.conf
#. ~/.pyleus.conf
You can always specify a configuration file when... |
pymic/transform/threshold.py | HiLab-git/PyMIC | 147 | 22249 | <reponame>HiLab-git/PyMIC
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import torch
import json
import math
import random
import numpy as np
from scipy import ndimage
from pymic.transform.abstract_transform import AbstractTransform
from pymic.util.image_process import *
class ChannelWiseTh... |
reconstruction_model.py | JungahYang/Deep3DFaceReconstruction | 1,424 | 22261 | <gh_stars>1000+
import tensorflow as tf
import face_decoder
import networks
import losses
from utils import *
###############################################################################################
# model for single image face reconstruction
##############################################################... |
integration_tests/test_test_oracle_tax.py | weblucas/mseg-semantic | 391 | 22266 | <reponame>weblucas/mseg-semantic
#!/usr/bin/python3
from pathlib import Path
from types import SimpleNamespace
from mseg_semantic.scripts.collect_results import parse_result_file
from mseg_semantic.tool.test_oracle_tax import test_oracle_taxonomy_model
REPO_ROOT_ = Path(__file__).resolve().parent.parent
# Replace ... |
docs/OOPS/Accessing_pvt_var2.py | munyumunyu/Python-for-beginners | 158 | 22270 | '''
To have a error free way of accessing and updating private variables, we create specific methods for this.
Those methods which are meant to set a value to a private variable are called setter methods and methods
meant to access private variable values are called getter methods.
The below code is an example of g... |
test-framework/test-suites/integration/tests/list/test_list_repo.py | sammeidinger/stack | 123 | 22272 | import json
class TestListRepo:
def test_invalid(self, host):
result = host.run('stack list repo test')
assert result.rc == 255
assert result.stderr.startswith('error - ')
def test_args(self, host, add_repo):
# Add a second repo so we can make sure it is skipped
add_repo('test2', 'test2url')
# Run list... |
src/ralph/api/__init__.py | DoNnMyTh/ralph | 1,668 | 22300 | from ralph.api.serializers import RalphAPISerializer
from ralph.api.viewsets import RalphAPIViewSet, RalphReadOnlyAPIViewSet
from ralph.api.routers import router
__all__ = [
'RalphAPISerializer',
'RalphAPIViewSet',
'RalphReadOnlyAPIViewSet',
'router',
]
|
bnpy/data/GroupXData.py | raphael-group/bnpy | 184 | 22307 | <reponame>raphael-group/bnpy<filename>bnpy/data/GroupXData.py
'''
Classes
-----
GroupXData
Data object for holding a dense matrix X of real 64-bit floats,
organized contiguously based on provided group structure.
'''
import numpy as np
from collections import namedtuple
from bnpy.data.XData import XData
from b... |
numba/cuda/simulator/cudadrv/error.py | auderson/numba | 6,620 | 22333 | class CudaSupportError(RuntimeError):
pass
|
BiBloSA/exp_SICK/src/evaluator.py | mikimaus78/ml_monorepo | 116 | 22344 | from configs import cfg
from src.utils.record_log import _logger
import numpy as np
import tensorflow as tf
import scipy.stats as stats
class Evaluator(object):
def __init__(self, model):
self.model = model
self.global_step = model.global_step
## ---- summary----
self.build_summar... |
pytorch_translate/tasks/translation_from_pretrained_xlm.py | dzhulgakov/translate | 748 | 22345 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) 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. An additional grant of patent rights
# can be found in the PATENTS file in the same dire... |
drugresnet/seya/layers/memnn2.py | Naghipourfar/CCLE | 429 | 22346 | <gh_stars>100-1000
import theano.tensor as T
import keras.backend as K
from keras.layers.core import LambdaMerge
from keras import initializations
class MemN2N(LambdaMerge):
def __init__(self, layers, output_dim, input_dim, input_length,
memory_length, hops=3, bow_mode="bow", mode="adjacent",
... |
Segnet/训练.py | 1044197988/- | 186 | 22354 | #coding=utf-8
import matplotlib
matplotlib.use("Agg")
import tensorflow as tf
import argparse
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D,MaxPooling2D,UpSampling2D,BatchNormalization,Reshape,Permute,Activation
from tensorflow.keras.utils imp... |
Python/295. FindMedianFromDataStream.py | nizD/LeetCode-Solutions | 263 | 22355 | <reponame>nizD/LeetCode-Solutions<filename>Python/295. FindMedianFromDataStream.py<gh_stars>100-1000
"""
Problem:
--------
Design a data structure that supports the following two operations:
- `void addNum(int num)`: Add a integer number from the data stream to the data structure.
- `double findMedian()`: Return the ... |
openproblems/data/human_blood_nestorowa2016.py | bendemeo/SingleCellOpenProblems | 134 | 22356 | from . import utils
import os
import scanpy as sc
import scprep
import tempfile
URL = "https://ndownloader.figshare.com/files/25555751"
@utils.loader
def load_human_blood_nestorowa2016(test=False):
"""Download Nesterova data from Figshare."""
if test:
# load full data first, cached if available
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.