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 |
|---|---|---|---|---|
ffmpeg-3.2.5/tools/zmqshell.py | huyu0415/FFmpeg | 3,645 | 22362 | <gh_stars>1000+
#!/usr/bin/env python2
import sys, zmq, cmd
class LavfiCmd(cmd.Cmd):
prompt = 'lavfi> '
def __init__(self, bind_address):
context = zmq.Context()
self.requester = context.socket(zmq.REQ)
self.requester.connect(bind_address)
cmd.Cmd.__init__(self)
def onecm... |
qinhaifang/src/evalTools/script/convert_label_map_to_geojson.py | SpaceNetChallenge/BuildingFootprintDetectors | 161 | 22364 | <gh_stars>100-1000
#!/usr/bin/env python
# encoding=gbk
"""
Convert mask to geojson format
"""
import os
import os.path
import re
import logging
import logging.config
from multiprocessing import Pool
import skimage.io as sk
import numpy as np
import scipy.io as sio
import setting
from spaceNet import geoTools as gT
... |
gabbi/tests/test_driver.py | scottwallacesh/gabbi | 145 | 22388 | #
# 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
# distributed under... |
mayan/apps/web_links/migrations/0004_make_labes_unique.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 22404 | <reponame>nattangwiwat/Mayan-EDMS-recitation<filename>mayan/apps/web_links/migrations/0004_make_labes_unique.py
from django.db import migrations
def operation_make_labels_unique(apps, schema_editor):
WebLink = apps.get_model(app_label='web_links', model_name='WebLink')
for web_link in WebLink.objects.using(s... |
DeepRTS/__init__.py | cair/deep-rts | 144 | 22424 | try:
from DeepRTS import Engine
except ImportError:
import Engine
try:
from DeepRTS.Engine import Map, UnitManager, Constants, Player
from DeepRTS.Engine import Constants
except ImportError:
from Engine import Map, UnitManager, Constants, Player, Constants
|
rlzoo/common/build_rlbench_env.py | tensorlayer/RLzoo | 750 | 22427 | <reponame>tensorlayer/RLzoo
import sys
from collections import OrderedDict
import numpy as np
from gym import spaces
from pyrep.const import RenderMode
from pyrep.objects.dummy import Dummy
from pyrep.objects.vision_sensor import VisionSensor
from rlbench.environment import Environment
from rlbench.action_m... |
habitat_baselines/utils/gym_adapter.py | srama2512/habitat-api | 355 | 22439 | <gh_stars>100-1000
#!/usr/bin/env python3
# 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.
from typing import Any, Dict, Optional, Union
import gym
import numpy as np
from gym import spaces
... |
python/akg/ms/utils.py | tianjiashuo/akg | 286 | 22442 | <filename>python/akg/ms/utils.py
# Copyright 2019-2021 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 r... |
visualize/usecases/get_user_info.py | RevanthRyo/Alize | 160 | 22446 | <filename>visualize/usecases/get_user_info.py
import requests
from django.conf import settings
from visualize.utils.api import Client
class GetUserInfo(object):
"""
GetUserInfo :
params : username
response :
{
"login": "torvalds",
"id": 1024025,
"avatar_url": "https://avatars0.githubusercon... |
blocks/bricks/sequence_generators.py | KIKOcaoyue/blocks | 1,067 | 22558 | """Sequence generation framework.
Recurrent networks are often used to generate/model sequences.
Examples include language modelling, machine translation, handwriting
synthesis, etc.. A typical pattern in this context is that
sequence elements are generated one often another, and every generated
element is fed back in... |
buildroot/support/testing/tests/init/test_busybox.py | rbrenton/hassos | 617 | 22609 | <gh_stars>100-1000
import infra.basetest
from tests.init.base import InitSystemBase as InitSystemBase
class InitSystemBusyboxBase(InitSystemBase):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
# BR2_TARGET_ROOTFS_TAR is not set
"""
def check_init(self):
super(InitSyst... |
download_stats.py | zhengsipeng/kinetics-downloader | 263 | 22611 | import argparse, os
import lib.config as config
import lib.utils as utils
def count_present_and_missing(cls, directory, metadata):
"""
Count present and missing videos for a class based on metadata.
:param cls: The class. If None, count all videos (used for testing videos - no classes).
:param direc... |
cdlib/evaluation/comparison.py | xing-lab-pitt/cdlib | 248 | 22620 | import numpy as np
from cdlib.evaluation.internal import onmi
from cdlib.evaluation.internal.omega import Omega
from nf1 import NF1
from collections import namedtuple, defaultdict
__all__ = [
"MatchingResult",
"normalized_mutual_information",
"overlapping_normalized_mutual_information_LFK",
"overlappin... |
textclf/tester/dl_tester.py | lswjkllc/textclf | 146 | 22644 | <reponame>lswjkllc/textclf<gh_stars>100-1000
import torch
from transformers import BertTokenizer
from .base_tester import Tester
from textclf.utils.raw_data import create_tokenizer
from textclf.utils.create import create_instance
from textclf.config import DLTesterConfig
from textclf.data.dictionary import Dictionary
... |
ch10/myproject_virtualenv/src/django-myproject/myproject/settings/production.py | PacktPublishing/Django-3-Web-Development-Cookbook | 159 | 22663 | from ._base import *
DEBUG = False
WEBSITE_URL = "https://example.com" # without trailing slash
MEDIA_URL = f"{WEBSITE_URL}/media/"
|
tools/generate_things/generate_navigation.py | akalenuk/wordsandbuttons | 367 | 22675 | <reponame>akalenuk/wordsandbuttons
import os
import subprocess
PAGES_DIR = "../../pages"
keyword_note = {
'tutorials': '',
'demos': '',
'quizzes': '',
'mathematics': '',
'algorithms': '',
'programming': 'By the way, if you prefer books to blogs, <a href="https://wordsandbuttons.online/SYTYKC.pdf">there is a free book... |
test-framework/test-suites/integration/tests/add/test_add_host_bonded.py | knutsonchris/stacki | 123 | 22691 | <filename>test-framework/test-suites/integration/tests/add/test_add_host_bonded.py
import json
from textwrap import dedent
import pytest
@pytest.mark.usefixtures("add_host_with_interface")
class TestAddHostBonded:
def test_no_hosts(self, host):
result = host.run('stack add host bonded')
assert result.rc == 255
... |
tests/test_connect.py | mkniewallner/edgedb-python | 214 | 22706 | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2016-present MagicStack Inc. and the EdgeDB 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... |
anchore/anchore-modules/queries/show-familytree.py | berez23/anchore | 401 | 22729 | #!/usr/bin/env python
import sys
import os
import re
import json
import traceback
import anchore.anchore_utils
# main routine
try:
config = anchore.anchore_utils.init_query_cmdline(sys.argv, "params: all\nhelp: shows dockerfile lines.")
except Exception as err:
print str(err)
sys.exit(1)
if not config:... |
h2o-py/tests/testdir_jira/pyunit_pubdev_7353_reset_threshold.py | vishalbelsare/h2o-3 | 6,098 | 22741 | import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.gbm import H2OGradientBoostingEstimator
from h2o.utils.model_utils import reset_model_threshold
def test_reset_threshold():
"""
Test the model threshold can be reset.
Performance metric should be recalc... |
tests/mixins.py | jarkkorantala/sqlalchemy-utils | 879 | 22758 | import pytest
import sqlalchemy as sa
class ThreeLevelDeepOneToOne(object):
@pytest.fixture
def Catalog(self, Base, Category):
class Catalog(Base):
__tablename__ = 'catalog'
id = sa.Column('_id', sa.Integer, primary_key=True)
category = sa.orm.relationship(
... |
src/triage/experiments/singlethreaded.py | josephbajor/triage_NN | 160 | 22777 | from triage.experiments import ExperimentBase
class SingleThreadedExperiment(ExperimentBase):
def process_query_tasks(self, query_tasks):
self.feature_generator.process_table_tasks(query_tasks)
def process_matrix_build_tasks(self, matrix_build_tasks):
self.matrix_builder.build_all_matrices(ma... |
mmtbx/bulk_solvent/f_model_all_scales.py | dperl-sol/cctbx_project | 155 | 22809 | <reponame>dperl-sol/cctbx_project
from __future__ import absolute_import, division, print_function
from cctbx.array_family import flex
from cctbx import adptbx
from mmtbx import bulk_solvent
from cctbx.array_family import flex
from cctbx import adptbx
import mmtbx
from libtbx import group_args
import mmtbx.arrays
impor... |
notebooks/shared/ipypublish/export_plugins/html_standard.py | leonbett/debuggingbook | 728 | 22813 | #!/usr/bin/env python
"""html in standard nbconvert format
"""
from ipypublish.html.create_tpl import create_tpl
from ipypublish.html.standard import content
from ipypublish.html.standard import content_tagging
from ipypublish.html.standard import document
from ipypublish.html.standard import inout_prompt
from ipypubl... |
scripts/issues/issue6.py | slamer59/awesome-panel | 179 | 22840 | <filename>scripts/issues/issue6.py
import panel as pn
def main():
text_error = """
This is not formatted correctly by Markdown due to the indentation!"""
text_ok = """
This is formatted correctly by Markdown!
"""
app = pn.Column(
pn.pane.Markdown(text_error),
pn.pane.HTML(
... |
pycon/tutorials/urls.py | azkarmoulana/pycon | 154 | 22850 | <gh_stars>100-1000
from django.conf.urls import url, patterns
from .views import tutorial_email, tutorial_message
urlpatterns = patterns("", # flake8: noqa
url(r"^mail/(?P<pk>\d+)/(?P<pks>[0-9,]+)/$", tutorial_email, name="tutorial_email"),
url(r"^message/(?P<pk>\d+)/$", tutorial_message, name="tutorial_messa... |
src/past/types/oldstr.py | kianmeng/python-future | 908 | 22899 | """
Pure-Python implementation of a Python 2-like str object for Python 3.
"""
from numbers import Integral
from past.utils import PY2, with_metaclass
if PY2:
from collections import Iterable
else:
from collections.abc import Iterable
_builtin_bytes = bytes
class BaseOldStr(type):
def __instancecheck_... |
src/falconpy/quick_scan.py | CrowdStrike/falconpy | 111 | 22906 | """Falcon Quick Scan API Interface Class
_______ __ _______ __ __ __
| _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----.
|. 1___| _| _ | | | | _ | 1___| _| _| | <| -__|
|. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____|
|: 1 | ... |
scripts/lc/ARES/testing/run_rose_tool.py | ouankou/rose | 488 | 22914 | <gh_stars>100-1000
#!/usr/bin/env python
"""Runs a ROSE tool. If the tool does not return status 0, then runs the
corresponding non-ROSE compiler. Records whether the tool succeeded, in
passed.txt and failed.txt, but always returns status 0.
"""
import argparse
import inspect
import os
from support.local_logging im... |
test/auth/test_client_credentials.py | membranepotential/mendeley-python-sdk | 103 | 22916 | from oauthlib.oauth2 import InvalidClientError, MissingTokenError
import pytest
from test import configure_mendeley, cassette
def test_should_get_authenticated_session():
mendeley = configure_mendeley()
auth = mendeley.start_client_credentials_flow()
with cassette('fixtures/auth/client_credentials/get_a... |
tests/settings.py | matrixorz/firefly | 247 | 22951 | <reponame>matrixorz/firefly
# coding=utf-8
DEBUG = True
TESTING = True
SECRET_KEY = 'secret_key for test'
# mongodb
MONGODB_SETTINGS = {
'db': 'firefly_test',
'username': '',
'password': '',
'host': '127.0.0.1',
'port': 27017
}
# redis cache
CACHE_TYPE = 'redis'
CACHE_REDIS_HOST = '127.0.0.1'
CAC... |
gan/kdd_utilities.py | mesarcik/Efficient-GAN-Anomaly-Detection | 408 | 22973 | import tensorflow as tf
"""Class for KDD10 percent GAN architecture.
Generator and discriminator.
"""
learning_rate = 0.00001
batch_size = 50
layer = 1
latent_dim = 32
dis_inter_layer_dim = 128
init_kernel = tf.contrib.layers.xavier_initializer()
def generator(z_inp, is_training=False, getter=None, reuse=False):
... |
cocotb/_py_compat.py | lavanyajagan/cocotb | 350 | 22980 | # Copyright (c) cocotb contributors
# 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 above copyright
# notice, this list of conditions a... |
digits/inference/__init__.py | PhysicsTeacher13/Digits-NVIDIA | 111 | 22992 | <filename>digits/inference/__init__.py
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from .images import ImageInferenceJob
from .job import InferenceJob
__all__ = [
'InferenceJob',
'ImageInferenceJob',
]
|
app/cli/plugin/__init__.py | lonless0/flask_project | 786 | 23011 | <reponame>lonless0/flask_project<gh_stars>100-1000
from .generator import generate
from .init import init
|
examples/panflute/myemph.py | jacobwhall/panflute | 361 | 23020 | #!/usr/bin/env python
import panflute as pf
"""
Pandoc filter that causes emphasis to be rendered using
the custom macro '\myemph{...}' rather than '\emph{...}'
in latex. Other output formats are unaffected.
"""
def latex(s):
return pf.RawInline(s, format='latex')
def myemph(e, doc):
if type(e)==pf.Emph a... |
src/python/grpcio_tests/tests/interop/_intraop_test_case.py | txl0591/grpc | 117 | 23038 | <reponame>txl0591/grpc<filename>src/python/grpcio_tests/tests/interop/_intraop_test_case.py
# Copyright 2015 gRPC 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.a... |
tests/test_sagemaker/test_sagemaker_processing.py | gtourkas/moto | 5,460 | 23047 | import boto3
from botocore.exceptions import ClientError
import datetime
import pytest
from moto import mock_sagemaker
from moto.sts.models import ACCOUNT_ID
FAKE_ROLE_ARN = "arn:aws:iam::{}:role/FakeRole".format(ACCOUNT_ID)
TEST_REGION_NAME = "us-east-1"
class MyProcessingJobModel(object):
def __init__(
... |
descarteslabs/workflows/models/tests/test_tile_url.py | descarteslabs/descarteslabs-python | 167 | 23057 | import pytest
import datetime
import json
import functools
from urllib.parse import urlencode, parse_qs
from descarteslabs.common.graft import client as graft_client
from ... import types
from .. import tile_url
def test_url():
base = "foo"
base_q = base + "?"
url = functools.partial(tile_url.tile_url... |
census_data_downloader/tables/medianage.py | JoeGermuska/census-data-downloader | 170 | 23091 | #! /usr/bin/env python
# -*- coding: utf-8 -*
import collections
from census_data_downloader.core.tables import BaseTableConfig
from census_data_downloader.core.decorators import register
@register
class MedianAgeDownloader(BaseTableConfig):
PROCESSED_TABLE_NAME = 'medianage'
UNIVERSE = "total population"
... |
HetSANN_MRV/execute_sparse.py | xhhszc/hetsann | 116 | 23097 | import os
import time
import random
import scipy.sparse as sp
import numpy as np
import tensorflow as tf
import argparse
from models import SpHGAT
from utils import process
parser = argparse.ArgumentParser()
parser.add_argument('--dataset', help='Dataset.', default='imdb', type=str)
parser.add_argument('--epochs', he... |
exercises/de/test_01_07.py | Jette16/spacy-course | 2,085 | 23147 | def test():
assert "spacy.load" in __solution__, "Rufst du spacy.load auf?"
assert nlp.meta["lang"] == "de", "Lädst du das korrekte Modell?"
assert nlp.meta["name"] == "core_news_sm", "Lädst du das korrekte Modell?"
assert "nlp(text)" in __solution__, "Verarbeitest du den Text korrekt?"
assert "prin... |
abm-predator-prey.py | RachidStat/PyCX | 176 | 23148 | import pycxsimulator
from pylab import *
import copy as cp
nr = 500. # carrying capacity of rabbits
r_init = 100 # initial rabbit population
mr = 0.03 # magnitude of movement of rabbits
dr = 1.0 # death rate of rabbits when it faces foxes
rr = 0.1 # reproduction rate of rabbits
f_init = 30 # initial fox population
... |
ml_collections/config_dict/tests/frozen_config_dict_test.py | wyddmw/ViT-pytorch-1 | 311 | 23152 | # Copyright 2021 The ML Collections 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... |
tests/test_utils.py | Guillerbr/python-pagseguro | 115 | 23199 | # -*- coding: utf-8 -*-
import datetime
from pagseguro.utils import (is_valid_cpf, is_valid_cnpj, is_valid_email,
parse_date)
from pagseguro.exceptions import PagSeguroValidationError
import pytest
from dateutil.tz import tzutc
def test_is_valid_email():
valid = '<EMAIL>'
valid2... |
tests/perf/test-prop-write.py | wenq1/duktape | 4,268 | 23201 | <reponame>wenq1/duktape
def test():
obj = { 'xxx1': 1, 'xxx2': 2, 'xxx3': 4, 'xxx4': 4, 'foo': 123 }
i = 0
while i < 1e7:
obj['foo'] = 234
obj['foo'] = 234
obj['foo'] = 234
obj['foo'] = 234
obj['foo'] = 234
obj['foo'] = 234
obj['foo'] = 234
obj... |
clickhouse_driver/numpy/result.py | fasttrack-solutions/clickhouse-driver | 823 | 23202 | <reponame>fasttrack-solutions/clickhouse-driver<filename>clickhouse_driver/numpy/result.py<gh_stars>100-1000
from itertools import chain
import numpy as np
import pandas as pd
from pandas.api.types import union_categoricals
from ..progress import Progress
from ..result import QueryResult
class NumpyQueryResult(Quer... |
micropsi_core/world/island/__init__.py | brucepro/micropsi2 | 119 | 23207 | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
"""
__author__ = 'joscha'
__date__ = '03.08.12'
|
src/tests/t_kadm5_hook.py | tizenorg/platform.upstream.krb5 | 372 | 23231 | <reponame>tizenorg/platform.upstream.krb5<gh_stars>100-1000
#!/usr/bin/python
from k5test import *
plugin = os.path.join(buildtop, "plugins", "kadm5_hook", "test",
"kadm5_hook_test.so")
hook_krb5_conf = {
'all' : {
"plugins" : {
"kadm5_hook" : {
"module" :... |
recipes/LibriParty/generate_dataset/get_dataset_from_metadata.py | JasonSWFu/speechbrain | 3,913 | 23244 | """
LibriParty Dataset creation by using official metadata.
Author
------
<NAME>, 2020
<NAME>, 2020
"""
import os
import sys
import speechbrain as sb
from hyperpyyaml import load_hyperpyyaml
from speechbrain.utils.data_utils import download_file
from local.create_mixtures_from_metadata import create_mixture
import js... |
fugue/column/functions.py | kvnkho/fugue | 547 | 23273 | from typing import Any, Optional
import pyarrow as pa
from fugue.column.expressions import (
ColumnExpr,
_FuncExpr,
_to_col,
function,
)
from triad import Schema
def coalesce(*args: Any) -> ColumnExpr:
"""SQL ``COALESCE`` function
:param args: If a value is not :class:`~fugue.column.expressi... |
packages/core/minos-microservice-networks/tests/test_networks/test_exceptions.py | sorasful/minos-python | 247 | 23285 | import unittest
from minos.common import (
MinosException,
)
from minos.networks import (
MinosNetworkException,
)
class TestExceptions(unittest.TestCase):
def test_type(self):
self.assertTrue(issubclass(MinosNetworkException, MinosException))
if __name__ == "__main__":
unittest.main()
|
python/caliper-reader/setup.py | slabasan/Caliper | 220 | 23296 | <filename>python/caliper-reader/setup.py<gh_stars>100-1000
# Copyright (c) 2020-20201, Lawrence Livermore National Security, LLC.
# See top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import setuptools
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__)... |
programming_fundamentals/python_part_2/common_vars.py | tobaidullah/2 | 629 | 23297 | #! /usr/bin/env python
"""
Learning Series: Network Programmability Basics
Module: Programming Fundamentals
Lesson: Python Part 2
Author: <NAME> <<EMAIL>>
common_vars.py
Illustrate the following concepts:
- Code reuse
imported into other examples
"""
shapes = ["square", "triangle", "circle"]
books = [
{
... |
contrib/stack/stripmapStack/unpackFrame_risat_raw.py | vincentschut/isce2 | 1,133 | 23311 | #!/usr/bin/env python3
import isce
from isceobj.Sensor import createSensor
import shelve
import argparse
import os
from isceobj.Util import Poly1D
from isceobj.Planet.AstronomicalHandbook import Const
from mroipac.dopiq.DopIQ import DopIQ
import copy
def cmdLineParse():
'''
Command line parser.
'''
... |
test/unit/agent/common/util/text.py | dp92987/nginx-amplify-agent | 308 | 23340 | <reponame>dp92987/nginx-amplify-agent
# -*- coding: utf-8 -*-
from hamcrest import *
from test.base import BaseTestCase
from amplify.agent.common.util.text import (
decompose_format, parse_line, parse_line_split
)
__author__ = "<NAME>"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__license__... |
test/adb_test.py | bugobliterator/python-adb | 1,549 | 23341 | <reponame>bugobliterator/python-adb
#!/usr/bin/env python
# Copyright 2014 Google 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/licen... |
memory/test/test_memory.py | MaxGreil/hail | 789 | 23374 | import unittest
import uuid
from memory.client import MemoryClient
from hailtop.aiocloud.aiogoogle import GoogleStorageAsyncFS
from hailtop.config import get_user_config
from hailtop.utils import async_to_blocking
from gear.cloud_config import get_gcp_config
PROJECT = get_gcp_config().project
class BlockingMemoryC... |
audiomate/processing/pipeline/onset.py | CostanzoPablo/audiomate | 133 | 23377 | import librosa
import numpy as np
from . import base
from . import spectral
class OnsetStrength(base.Computation):
"""
Compute a spectral flux onset strength envelope.
Based on http://librosa.github.io/librosa/generated/librosa.onset.onset_strength.html
Args:
n_mels (int): Number of mel ban... |
vdvae_flax/blocks.py | shaun95/google-research | 23,901 | 23395 | <reponame>shaun95/google-research
# coding=utf-8
# Copyright 2021 DeepMind Technologies Limited and 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:/... |
play-1.2.4/python/Lib/site-packages/Rpyc/Utils/Discovery.py | AppSecAI-TEST/restcommander | 550 | 23416 | <reponame>AppSecAI-TEST/restcommander<gh_stars>100-1000
"""
Discovery: broadcasts a query, attempting to discover all running RPyC servers
over the local network/specific subnet.
"""
import socket
import select
import struct
__all__ = ["discover_servers"]
UDP_DISCOVERY_PORT = 18813
QUERY_MAGIC = "RPYC_QUERY"
MAX_DGRA... |
tests/python/benchmarks/two_neighborhood_bench.py | sid17/weaver | 163 | 23453 | <gh_stars>100-1000
#! /usr/bin/env python
#
# ===============================================================
# Description: Two neighborhood benchmark
#
# Created: 2014-03-21 13:39:06
#
# Author: <NAME>, <EMAIL>
#
# Copyright (C) 2013-2014, Cornell University, see the LICENSE
# ... |
src/warp/yul/AstTools.py | sambarnes/warp | 414 | 23485 | from __future__ import annotations
import re
from typing import Union
import warp.yul.ast as ast
from warp.yul.AstVisitor import AstVisitor
from warp.yul.WarpException import WarpException
class AstParser:
def __init__(self, text: str):
self.lines = text.splitlines()
if len(self.lines) == 0:
... |
models/ffn_ace.py | MilesQLi/Theano-Lights | 313 | 23495 | import theano
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams
from theano.tensor.nnet.conv import conv2d
from theano.tensor.signal.downsample import max_pool_2d
from theano.tensor.shared_randomstreams import RandomStreams
import numpy as np
from toolbox import *
from modelbase import *
... |
Extensions/BabaGUI/config.py | siva-msft/baba-is-auto | 108 | 23498 | import pygame
FPS = 60
BLOCK_SIZE = 48
COLOR_BACKGROUND = pygame.Color(0, 0, 0)
|
examples/pincell_depletion/restart_depletion.py | norberto-schmidt/openmc | 262 | 23512 | <reponame>norberto-schmidt/openmc<filename>examples/pincell_depletion/restart_depletion.py
import openmc
import openmc.deplete
import matplotlib.pyplot as plt
###############################################################################
# Load previous simulation results
########################... |
001-050/029-divide-two-integers.py | bbram10/leetcode-master | 134 | 23549 | <reponame>bbram10/leetcode-master
"""
STATEMENT
Divide two integers without using multiplication, division and mod operator.
CLARIFICATIONS
- Do I have to handle 32-bit integer overflow? Yes, return the MAX_INT in that case.
- Can the divisor be zero? Yes, return the MAX_INT.
EXAMPLES
34/3 -> 11
COMMENTS
- This solu... |
saleor/app/tests/test_models.py | fairhopeweb/saleor | 15,337 | 23570 | from ...app.models import App
from ...webhook.event_types import WebhookEventType
def test_qs_for_event_type(payment_app):
qs = App.objects.for_event_type(WebhookEventType.PAYMENT_AUTHORIZE)
assert len(qs) == 1
assert qs[0] == payment_app
def test_qs_for_event_type_no_payment_permissions(payment_app):
... |
extra_tests/ctypes_tests/test_unions.py | nanjekyejoannah/pypy | 333 | 23607 | import sys
from ctypes import *
def test_getattr():
class Stuff(Union):
_fields_ = [('x', c_char), ('y', c_int)]
stuff = Stuff()
stuff.y = ord('x') | (ord('z') << 24)
if sys.byteorder == 'little':
assert stuff.x == b'x'
else:
assert stuff.x == b'z'
def test_union_of_struct... |
helios/workflows/__init__.py | thiagosfs/helios-server | 525 | 23617 | """
Helios Election Workflows
"""
from helios.datatypes import LDObjectContainer
class WorkflowObject(LDObjectContainer):
pass
|
src/genie/libs/parser/linux/route.py | balmasea/genieparser | 204 | 23633 | """route.py
Linux parsers for the following commands:
* route
"""
# python
import re
# metaparser
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Schema, Any, Optional
from netaddr import IPAddress, IPNetwork
# =======================================================
# Sch... |
chapter-7/chassis/demo.py | wallacei/microservices-in-action-copy | 115 | 23634 | import json
import datetime
import requests
from nameko.web.handlers import http
from nameko.timer import timer
from statsd import StatsClient
from circuitbreaker import circuit
class DemoChassisService:
name = "demo_chassis_service"
statsd = StatsClient('localhost', 8125, prefix='simplebank-demo')
@htt... |
tests/frontend/detector/test_fast.py | swershrimpy/gtsfm | 122 | 23641 | <reponame>swershrimpy/gtsfm<gh_stars>100-1000
"""Tests for frontend's FAST detector class.
Authors: <NAME>
"""
import unittest
import tests.frontend.detector.test_detector_base as test_detector_base
from gtsfm.frontend.detector.fast import Fast
class TestFast(test_detector_base.TestDetectorBase):
"""Test class ... |
tests/test_cli.py | KoichiYasuoka/pynlpir | 537 | 23643 | """Unit tests for pynlpir's cli.py file."""
import os
import shutil
import stat
import unittest
try:
from urllib.error import URLError
from urllib.request import urlopen
except ImportError:
from urllib2 import URLError, urlopen
from click.testing import CliRunner
from pynlpir import cli
TEST_DIR = os.pat... |
tutorials/W0D1_PythonWorkshop1/solutions/W0D1_Tutorial1_Solution_93456241.py | eduardojdiniz/CompNeuro | 2,294 | 23683 |
# Set random number generator
np.random.seed(2020)
# Initialize step_end, n, t_range, v and i
step_end = int(t_max / dt)
n = 50
t_range = np.linspace(0, t_max, num=step_end)
v_n = el * np.ones([n, step_end])
i = i_mean * (1 + 0.1 * (t_max / dt)**(0.5) * (2 * np.random.random([n, step_end]) - 1))
# Loop for step_end ... |
mlcomp/db/core/options.py | sUeharaE4/mlcomp | 166 | 23714 | class PaginatorOptions:
def __init__(
self,
page_number: int,
page_size: int,
sort_column: str = None,
sort_descending: bool = None
):
self.sort_column = sort_column
self.sort_descending = sort_descending
self.page_number = page_number
self... |
api/client/src/pcluster_client/sigv4_auth.py | maclema/aws-parallelcluster | 415 | 23726 | """Sigv4 Signing Support"""
# Copyright 2021 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.com/apache2.0/
#
# or i... |
rules/starlark_configurations/cc_test/defs.bzl | CyberFlameGO/examples | 572 | 23772 | # We can transition on native options using this
# //command_line_option:<option-name> syntax
_BUILD_SETTING = "//command_line_option:test_arg"
def _test_arg_transition_impl(settings, attr):
_ignore = (settings, attr)
return {_BUILD_SETTING: ["new arg"]}
_test_arg_transition = transition(
implementation ... |
db_pool/mysql/base.py | GiftLee/devops | 300 | 23860 | # -*- coding: utf-8 -*-
"""
查看 django.db.backends.mysql.base.by 源码发现 django 连接 mysql 时没有使用连接池,
导致每次数据库操作都要新建新的连接并查询完后关闭,更坑的是按照 django 的官方文档设置
CONN_MAX_AGE 参数是为了复用连接,然后设置了 CONN_MAX_AGE 后,每个新连接查询完后并不
会 close 掉,而是一直在那占着。如果在高并发模式下,很容易出现 too many connections
错误。故重写 mysql 连接库,实现连接池功能。
"""
from django.core.exceptions import I... |
src/test/tests/hybrid/missingdata.py | visit-dav/vis | 226 | 23869 | # ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: missingdata.py
#
# Tests: missing data
#
# Programmer: <NAME>
# Date: Thu Jan 19 09:49:15 PST 2012
#
# Modifications:
#
# -------------------------------------------------------------------... |
RecoLocalCalo/HGCalRecProducers/python/HeterogeneousHEBRecHitGPUtoSoA_cfi.py | Purva-Chaudhari/cmssw | 852 | 23944 | import FWCore.ParameterSet.Config as cms
HEBRecHitGPUtoSoAProd = cms.EDProducer('HEBRecHitGPUtoSoA',
HEBRecHitGPUTok = cms.InputTag('HEBRecHitGPUProd'))
|
pythonx/lints/vim/vint.py | maralla/validator.vim | 255 | 23953 | <reponame>maralla/validator.vim
# -*- coding: utf-8 -*-
from validator import Validator
class VimVint(Validator):
__filetype__ = 'vim'
checker = 'vint'
args = '-w --no-color'
regex = r"""
.+?:
(?P<lnum>\d+):
(?P<col>\d+):
\s(?P<text>.+)"""
|
examples/python/qiskit_integration.py | CQCL/pytket | 249 | 23960 | <reponame>CQCL/pytket
# # Integrating `pytket` into Qiskit software
# In this tutorial, we will focus on:
# - Using `pytket` for compilation or providing devices/simulators within Qiskit workflows;
# - Adapting Qiskit code to use `pytket` directly.
# This example assumes some familiarity with the Qiskit algorithms li... |
cfgs/config.py | Pandinosaurus/yolo2-pytorch | 1,663 | 23967 | <gh_stars>1000+
import os
from .config_voc import * # noqa
from .exps.darknet19_exp1 import * # noqa
def mkdir(path, max_depth=3):
parent, child = os.path.split(path)
if not os.path.exists(parent) and max_depth > 1:
mkdir(parent, max_depth-1)
if not os.path.exists(path):
os.mkdir(path)
... |
cinder/tests/unit/policies/test_volume.py | arunvinodqmco/cinder | 571 | 23999 | <gh_stars>100-1000
#
# 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... |
gff/Scripts/gff/gff_to_genbank.py | bgruening/bcbb | 339 | 24011 | <reponame>bgruening/bcbb
#!/usr/bin/env python
"""Convert a GFF and associated FASTA file into GenBank format.
Usage:
gff_to_genbank.py <GFF annotation file> [<FASTA sequence file> <molecule type>]
FASTA sequence file: input sequences matching records in GFF. Optional if sequences
are in the GFF
molecule typ... |
third_party/pdfium/build/gyp_pdfium.py | satorumpen/node-pdfium-native | 303 | 24056 | <reponame>satorumpen/node-pdfium-native
# Copyright 2014 PDFium 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
path = os.path.abspath(os.path.split(__file__)[0])
execfile(os.path.join(path, 'gyp_pdfium'))
|
backdoors/shell/__pupy/pupy/packages/src/VideoCapture/src/fixhtml.py | mehrdad-shokri/backdoorme | 796 | 24080 | <filename>backdoors/shell/__pupy/pupy/packages/src/VideoCapture/src/fixhtml.py
import os, string
oldWin = '''span {
font-family: Verdana;
background: #e0e0d0;
font-size: 10pt;
}
</style>
</head>
<body bgcolor="#e0e0d0">
'''
oldLinux = '''span {
font-family: Verdana;
background: #e0e0d0;
font-size: 13pt;
}
</sty... |
plugin/CustomerSupportArchive/chipDiagnostics/tools/flowcorr.py | iontorrent/TS | 125 | 24107 | import os
import numpy as np
from . import imtools, datprops
from .datfile import DatFile
from .chiptype import ChipType
moduleDir = os.path.abspath( os.path.dirname( __file__ ) )
class FlowCorr:
def __init__( self, chiptype, xblock=None, yblock=None, rootdir='.', method='' ):
'''
Initialize a fl... |
addons/mendeley/tests/test_serializer.py | gaybro8777/osf.io | 628 | 24138 | # -*- coding: utf-8 -*-
"""Serializer tests for the Mendeley addon."""
import pytest
from addons.base.tests.serializers import CitationAddonSerializerTestSuiteMixin
from addons.base.tests.utils import MockFolder
from addons.mendeley.tests.factories import MendeleyAccountFactory
from addons.mendeley.serializer import M... |
src/sage/coding/information_set_decoder.py | UCD4IDS/sage | 1,742 | 24143 | # -*- coding: utf-8 -*-
r"""
Information-set decoding for linear codes
Information-set decoding is a probabilistic decoding strategy that
essentially tries to guess `k` correct positions in the received word,
where `k` is the dimension of the code. A codeword agreeing with the
received word on the guessed position can... |
mayo/session/train.py | deep-fry/mayo | 110 | 24147 | import math
import tensorflow as tf
from mayo.log import log
from mayo.util import (
Percent, memoize_method, memoize_property, object_from_params)
from mayo.session.base import SessionBase
class Train(SessionBase):
mode = 'train'
def __init__(self, config):
super().__init__(config)
sel... |
siem_integrations/clx_query_service/clxquery/apps.py | mdemoret-nv/clx | 143 | 24158 | <reponame>mdemoret-nv/clx<gh_stars>100-1000
from django.apps import AppConfig
class ClxQueryConfig(AppConfig):
name = "clxquery"
|
kolibri/plugins/utils/options.py | MBKayro/kolibri | 545 | 24180 | import copy
import logging
import warnings
from kolibri.plugins.registry import registered_plugins
logger = logging.getLogger(__name__)
def __validate_config_option(
section, name, base_config_spec, plugin_specs, module_path
):
# Raise an error if someone tries to overwrite a base option
# except for th... |
pydeps/__main__.py | miketheman/pydeps | 981 | 24194 | <filename>pydeps/__main__.py<gh_stars>100-1000
from .pydeps import pydeps
pydeps()
|
tests/data/custom_loader2.py | cambiegroup/aizynthfinder | 219 | 24207 | <gh_stars>100-1000
def extract_smiles():
return ["c1ccccc1", "Cc1ccccc1", "c1ccccc1", "CCO"]
|
tools/find_protoc.py | Kill-Console/xresloader | 219 | 24227 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import stat
protoc_exec = None
def find_protoc():
global protoc_exec
if protoc_exec is not None:
return protoc_exec
script_dir = os.path.dirname(os.path.realpath(__file__))
if sys.platform[0:5].lower() == "linux":
protoc_ex... |
data/test/test_queue.py | giuseppe/quay | 2,027 | 24231 | <filename>data/test/test_queue.py
import json
import time
import pytest
from contextlib import contextmanager
from datetime import datetime, timedelta
from functools import wraps
from data.database import QueueItem
from data.queue import (
WorkQueue,
MINIMUM_EXTENSION,
queue_items_locked,
queue_items... |
tools/external_converter_v2/parser/operations/op_io.py | pangge/Anakin | 533 | 24234 | #! /usr/bin/env python
# Copyright (c) 2017, Cuichaowen. All rights reserved.
# -*- coding: utf-8 -*-
# ops helper dictionary
class Dictionary(object):
"""
Dictionary for op param which needs to be combined
"""
def __init__(self):
self.__dict__ = {}
def set_attr(self, **kwargs):
... |
classes/dns.py | double-beep/SmokeDetector | 464 | 24269 | import dns
import dns.resolver
import dns.rdatatype
def dns_resolve(domain: str) -> list:
addrs = []
resolver = dns.resolver.Resolver(configure=False)
# Default to Google DNS
resolver.nameservers = ['8.8.8.8', '8.8.4.4']
try:
for answer in resolver.resolve(domain, 'A').response.answer:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.