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
manila/share/drivers/inspur/instorage/cli_helper.py
gouthampacha/manila
159
12746364
<filename>manila/share/drivers/inspur/instorage/cli_helper.py # Copyright 2019 Inspur Corp. # 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://...
tests/interpretability/test_saliency_maps_gat.py
LarsNeR/stellargraph
2,428
12746365
<reponame>LarsNeR/stellargraph # -*- coding: utf-8 -*- # # Copyright 2018-2020 Data61, CSIRO # # 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 # #...
examples/tensorflow/pruning/resnet_v2/benchmark.py
mdfaijul/neural-compressor
172
12746378
import tensorflow from tensorflow.keras.datasets import cifar10 from tensorflow import keras import numpy as np num_classes = 10 class EvalDataset(object): def __init__(self, batch_size=100): (x_train, y_train), (x_test, y_test) = cifar10.load_data() x_train = x_train.astype('float32') / 255 ...
lib/spack/external/archspec/cpu/schema.py
kkauder/spack
2,360
12746379
# Copyright 2019-2020 Lawrence Livermore National Security, LLC and other # Archspec Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) """Global objects with the content of the microarchitecture JSON file and its schema """ import json import os.path try...
tests/framework/AnalyticModels/optimizing/diagonal_valley_stochastic.py
rinelson456/raven
159
12746399
<reponame>rinelson456/raven # Copyright 2017 Battelle Energy Alliance, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
language_modeling/language_utils.py
coasxu/FedMA
254
12746420
<gh_stars>100-1000 # Modified from: https://github.com/litian96/FedProx/blob/master/flearn/utils/language_utils.py # credit goes to: <NAME> (litian96 @ GitHub) """Utils for language models.""" import re import numpy as np import torch # ------------------------ # utils for shakespeare dataset ALL_LETTERS = "\n !\"...
homeassistant/components/alarmdecoder/const.py
MrDelik/core
30,023
12746436
<reponame>MrDelik/core """Constants for the AlarmDecoder component.""" CONF_ALT_NIGHT_MODE = "alt_night_mode" CONF_AUTO_BYPASS = "auto_bypass" CONF_CODE_ARM_REQUIRED = "code_arm_required" CONF_DEVICE_BAUD = "device_baudrate" CONF_DEVICE_PATH = "device_path" CONF_RELAY_ADDR = "zone_relayaddr" CONF_RELAY_CHAN = "zone_re...
ocs_ci/ocs/bucket_utils.py
annagitel/ocs-ci
130
12746437
""" Helper functions file for working with object buckets """ import logging import os import shlex from uuid import uuid4 import boto3 from botocore.handlers import disable_signing from ocs_ci.framework import config from ocs_ci.ocs import constants from ocs_ci.ocs.exceptions import TimeoutExpiredError, UnexpectedBe...
paper_experiments/utils/tracker.py
noskill/JRMOT_ROS
112
12746447
# vim: expandtab:ts=4:sw=4 from __future__ import absolute_import import numpy as np import pdb from . import kf_2d, kf_3d, double_measurement_kf, imm from . import linear_assignment from . import iou_matching from .track import Track from . import JPDA_matching from . import tracking_utils import math from nn_matching...
zarr/tests/test_info.py
parthxtripathi/zarr-python
203
12746462
import numcodecs import pytest import zarr from zarr.util import InfoReporter @pytest.mark.parametrize('array_size', [10, 15000]) def test_info(array_size): # setup g = zarr.group(store=dict(), chunk_store=dict(), synchronizer=zarr.ThreadSynchronizer()) g.create_group('foo') z = g...
test/functional/tests/io_class/io_class_common.py
Ostrokrzew/open-cas-linux
139
12746476
<filename>test/functional/tests/io_class/io_class_common.py # # Copyright(c) 2019-2021 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause-Clear # from api.cas import casadm from api.cas import ioclass_config from api.cas.cache_config import ( CacheLineSize, CacheMode, CleaningPolicy, SeqCutOffPo...
salt/modules/rebootmgr.py
tomdoherty/salt
9,425
12746483
""" :maintainer: <NAME> <<EMAIL>> :maturity: new :depends: None :platform: Linux .. versionadded:: 3004 """ import logging import re import salt.exceptions log = logging.getLogger(__name__) def __virtual__(): """rebootmgrctl command is required.""" if __utils__["path.which"]("rebootmgrc...
tests/test_perspective_queue.py
sguzman/castero
483
12746494
<reponame>sguzman/castero<filename>tests/test_perspective_queue.py import os from unittest import mock from castero.config import Config from castero.episode import Episode from castero.feed import Feed from castero.player import Player from castero.queue import Queue my_dir = os.path.dirname(os.path.realpath(__file_...
media/mca/structgen.py
rio-31/android_frameworks_base-1
164
12746510
<gh_stars>100-1000 #!/usr/bin/env python # # Copyright (C) 2011 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
src/appengine/libs/query/base.py
ABHIsHEk122811/clusterfuzz
5,023
12746546
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
tensorflow_forward_ad/setup_cbfs.py
renmengye/tensorflow-forward-ad
147
12746567
<reponame>renmengye/tensorflow-forward-ad #!/usr/bin/env python from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext import numpy setup( cmdclass={'build_ext': build_ext}, ext_modules=[ Extension( "cbfs", sources=["cbfs.pyx"], i...
tests/providers/google/cloud/transfers/test_gdrive_to_gcs.py
npodewitz/airflow
8,092
12746584
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
RecoLocalCalo/EcalRecProducers/test/testMultipleEcalRecoLocal_cfg.py
ckamtsikis/cmssw
852
12746608
<filename>RecoLocalCalo/EcalRecProducers/test/testMultipleEcalRecoLocal_cfg.py import FWCore.ParameterSet.Config as cms process = cms.Process("RECO2") process.load('Configuration.StandardSequences.Services_cff') process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventConte...
featuretools/tests/primitive_tests/primitives_to_install/custom_mean.py
Featuretools/featuretools
4,299
12746614
from woodwork.column_schema import ColumnSchema from featuretools.primitives.base import AggregationPrimitive class CustomMean(AggregationPrimitive): name = "custom_mean" input_types = [ColumnSchema(semantic_tags={"numeric"})] return_type = ColumnSchema(semantic_tags={"numeric"})
parallel_wavegan/utils/utils.py
A-Quarter-Mile/ParallelWaveGAN
1,023
12746627
<gh_stars>1000+ # -*- coding: utf-8 -*- # Copyright 2019 <NAME> # MIT License (https://opensource.org/licenses/MIT) """Utility functions.""" import fnmatch import logging import os import sys import tarfile from distutils.version import LooseVersion from filelock import FileLock import h5py import numpy as np imp...
Codeforces/9A.py
Shaswat-2203/HacktoberfestForBeginners
115
12746631
s = input() y = s[0] w = s[2] if int(y) > int(w): p = 7 - int(y) else: p = 7 - int(w) if p == 1: print('1/6') if p == 2: print('1/3') if p == 3: print('1/2') if p == 4: print('2/3') if p == 5: print('5/6') if p == 6: print('1/1')
forms-flow-api/migrations/versions/166054bd81b5_allow_modified_date_as_nullable.py
andrepestana-aot/forms-flow-ai
132
12746637
<filename>forms-flow-api/migrations/versions/166054bd81b5_allow_modified_date_as_nullable.py """allow modified date as nullable Revision ID: 166054bd81b5 Revises: <PASSWORD> Create Date: 2021-10-11 03:47:20.983464 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revisio...
pyjokes/jokes_it.py
r0d0dendr0n/pyjokes
293
12746646
# -*- coding: utf-8 -*- """ Jokes from stackoverflow - provided under CC BY-SA 3.0 http://stackoverflow.com/questions/234075/what-is-your-best-programmer-joke?page=4&tab=votes#tab-top """ neutral = [ "Trionfalmente, Beth ha rimosso Python 2.7 dal server nel 2020.'Finalmente!' ha detto con gioia, solo per vedere l...
submission/migrations/0002_auto_20170509_1203.py
lizehongss/oj_backend
5,237
12746652
<reponame>lizehongss/oj_backend<gh_stars>1000+ # -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2017-05-09 12:03 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('submission', '0001_initial'), ] opera...
butterfree/transform/utils/date_range.py
fossabot/butterfree
208
12746657
"""Utils for date range generation.""" from datetime import datetime from typing import Union from pyspark.sql import DataFrame, functions from butterfree.clients import SparkClient from butterfree.constants import DataType from butterfree.constants.columns import TIMESTAMP_COLUMN def get_date_range( client: S...
src/http_server.py
Tomasz-Kluczkowski/celery-exporter
132
12746659
<gh_stars>100-1000 from threading import Thread import kombu.exceptions from flask import Blueprint, Flask, current_app, request from loguru import logger from prometheus_client.exposition import choose_encoder from waitress import serve blueprint = Blueprint("celery_exporter", __name__) @blueprint.route("/") def i...
Alignment/CommonAlignmentProducer/python/ALCARECOTkAlCosmics_cff.py
ckamtsikis/cmssw
852
12746678
# Author : <NAME> # Date : July 19th, 2007 # last update: $Date: 2010/03/17 18:17:34 $ by $Author: mussgill $ import FWCore.ParameterSet.Config as cms # DCS partitions # "EBp","EBm","EEp","EEm","HBHEa","HBHEb","HBHEc","HF","HO","RPC" # "DT0","DTp","DTm","CSCp","CSCm","CASTOR","TIBTID","TOB","TECp","TECm" ...
configs/fp16/faster_rcnn_r50_fpn_fp16_1x_coco.py
evgps/mmdetection_trashcan
426
12746687
_base_ = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py' # fp16 settings fp16 = dict(loss_scale=512.)
elliot/recommender/latent_factor_models/MF/__init__.py
gategill/elliot
175
12746723
<filename>elliot/recommender/latent_factor_models/MF/__init__.py from .matrix_factorization import MF
examples/low_level/create_a_view_low_level.py
pingod/python-jenkins_api
556
12746744
""" A low level example: This is how JenkinsAPI creates views """ from __future__ import print_function import json import requests url = 'http://localhost:8080/createView' str_view_name = "blahblah123" params = {} # {'name': str_view_name} headers = {'Content-Type': 'application/x-www-form-urlencoded'} data = { ...
lib/tool_shed/test/functional/test_1460_data_managers.py
quacksawbones/galaxy-1
1,085
12746769
import logging from ..base.twilltestcase import common, ShedTwillTestCase log = logging.getLogger(__name__) category_name = 'Test 1460 Data Manager' category_description = 'Test script 1460 for testing Data Managers' data_manager_repository_name = 'data_manager_1460' data_manager_repository_description = 'Repository...
evosax/utils/es_logger.py
mahi97/evosax
102
12746776
<reponame>mahi97/evosax import pickle import jax import jax.numpy as jnp import chex from functools import partial class ESLog(object): def __init__( self, num_dims: int, num_generations: int, top_k: int, maximize: bool ): """Simple jittable logging tool for ES rollouts.""" self.num_di...
test/programytest/clients/restful/flask/viber/test_client.py
cdoebler1/AIML2
345
12746803
<filename>test/programytest/clients/restful/flask/viber/test_client.py import logging import unittest.mock from viberbot import Api from viberbot.api.user_profile import UserProfile from viberbot.api.viber_requests import ViberConversationStartedRequest from viberbot.api.viber_requests import ViberFailedRequest from v...
scenic/projects/baselines/bert/bert_base_model.py
techthiyanes/scenic
688
12746804
<filename>scenic/projects/baselines/bert/bert_base_model.py """Base class for models working with bert.""" from typing import Callable, Dict, Optional, Tuple, Union from flax.training import common_utils import jax import jax.numpy as jnp import numpy as np from scenic.model_lib.base_models import base_model from sce...
aliyun-python-sdk-cloudmarketing/aliyunsdkcloudmarketing/request/v20180910/DescribeFileRequest.py
yndu13/aliyun-openapi-python-sdk
1,001
12746811
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
cpmpy/cpmpy_hakank.py
hakank/hakank
279
12746828
""" This package includes my constraints/utilities/etc for cpmpy. This cpmpy model was written by <NAME> (<EMAIL>) See also my cpmpy page: http://hakank.org/cpmpy/ """ import sys, math, re import itertools import numpy as np from functools import reduce from cpmpy import * from cpmpy.expressions.globalconstraint...
VulnerableScan/migrations/0005_vulnerablescantasks_notice.py
b0bac/ApolloScanner
289
12746834
# Generated by Django 4.0.1 on 2022-03-14 10:45 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('VulnerableScan', '0004_remove_exploitregister_file_object_and_more'), ] operations = [ migrations.AddField( model_name='vulnerab...
Codes/Python32/Lib/test/subprocessdata/sigchild_ignore.py
eyantra/FireBird_Swiss_Knife
12,496
12746836
import signal, subprocess, sys # On Linux this causes os.waitpid to fail with OSError as the OS has already # reaped our child process. The wait() passing the OSError on to the caller # and causing us to exit with an error is what we are testing against. signal.signal(signal.SIGCHLD, signal.SIG_IGN) subprocess.Popen([...
dvc/command/remove.py
lucasalavapena/dvc
9,136
12746862
<reponame>lucasalavapena/dvc<filename>dvc/command/remove.py import argparse import logging from dvc.command import completion from dvc.command.base import CmdBase, append_doc_link from dvc.exceptions import DvcException logger = logging.getLogger(__name__) class CmdRemove(CmdBase): def run(self): for ta...
models/tacotron.py
dieserRobin/ForwardTacotron
556
12746866
from pathlib import Path from typing import Union, Dict, Any, Tuple import torch import torch.nn as nn import torch.nn.functional as F from models.common_layers import CBHG from utils.text.symbols import phonemes class Encoder(nn.Module): def __init__(self, embed_dims, num_chars, cbhg_channels, K, num_highways,...
coding_assignments/solutions/assignment_helper.py
evelynmitchell/qml-mooc
200
12746871
<reponame>evelynmitchell/qml-mooc import itertools import numpy as np import scipy import socket import subprocess import time def get_free_port(): sock = socket.socket() sock.bind(('', 0)) port = sock.getsockname()[1] sock.close() return port def init_qvm_and_quilc(qvm_executable="qvm", quilc_e...
07. Chapter_7/pytorch/random_access.py
Mikma03/High-performance-Python
223
12746882
import time from functools import partial import torch def timer(fxn, max_time=5): N = 0 total_time = 0 fxn() while total_time < max_time: start = time.perf_counter() fxn() total_time += time.perf_counter() - start N += 1 return total_time / N def task(A, target)...
tests/utils.py
pyGrowler/Growler
806
12746895
<filename>tests/utils.py # # tests/utils # """ Useful functions for all tests """ import asyncio import pytest from growler.aio.http_protocol import GrowlerHTTPProtocol import growler def random_port(): from random import randint return randint(1024, 2**16) @asyncio.coroutine def setup_test_server(unused_tc...
release/stubs.min/Rhino/DocObjects/__init___parts/ObjectMaterialSource.py
htlcnn/ironpython-stubs
182
12746896
class ObjectMaterialSource(Enum,IComparable,IFormattable,IConvertible): """ Defines enumerated values for the source of material of single objects. enum ObjectMaterialSource,values: MaterialFromLayer (0),MaterialFromObject (1),MaterialFromParent (3) """ def __eq__(self,*args): """ x.__eq__(y) <==> x...
RecoLocalMuon/GEMRecHit/python/gemLocalReco_cff.py
ckamtsikis/cmssw
852
12746912
import FWCore.ParameterSet.Config as cms from RecoLocalMuon.GEMRecHit.gemRecHits_cfi import * from RecoLocalMuon.GEMSegment.gemSegments_cfi import * gemLocalRecoTask = cms.Task(gemRecHits,gemSegments) gemLocalReco = cms.Sequence(gemLocalRecoTask)
Potatso/Library/ShadowPath/ShadowPath/shadowsocks-libev/src/ssrlink.py
ilioner/WCPotatso
168
12746919
#!/usr/bin/python # -*- coding: UTF-8 -*- import traceback import random import getopt import sys import json import base64 def to_bytes(s): if bytes != str: if type(s) == str: return s.encode('utf-8') return s def to_str(s): if bytes != str: if type(s) == bytes: return s.decode('utf-8') return s def ...
interpolation/cartesian.py
vishalbelsare/interpolation.py
110
12746958
""" Filename: cartesian.py Authors: <NAME> Implements cartesian products and regular cartesian grids. """ import numpy from numba import njit def cartesian(nodes, order="C"): """Cartesian product of a list of arrays Parameters: ----------- nodes: (list of 1d-arrays) order: ('C' or 'F') order i...
libs/box_utils/iou.py
khanfarhan10/R2CNN_Faster-RCNN_Tensorflow
629
12746968
<filename>libs/box_utils/iou.py # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf def iou_calculate(boxes_1, boxes_2): ''' :param boxes_1: [N, 4] [ymin, xmin, ymax, xmax] :param boxes_2: [M, 4] [...
dirigible/sheet/dependency_graph.py
EnoX1/dirigible-spreadsheet
168
12746982
# Copyright (c) 2010 Resolver Systems Ltd, PythonAnywhere LLP # See LICENSE.md # from threading import Lock from .errors import report_cell_error, CycleError class Node(object): def __init__(self, location, children=None, parents=None): self.location = location self.children = children if childr...
.github/workflows/get_revision.py
MrBartusek/TwitchIO
514
12746983
import requests def getrev(): resp = requests.get("https://pypi.org/pypi/TwitchIO/json") data = resp.json()["releases"] pre = max(data).split("b") final = f"{pre[0]}b{int(pre[1]) + 1}" return final print(getrev())
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
Polidea/SiriusObfuscator
427
12746989
<gh_stars>100-1000 """Test that forward declaration of a data structure gets resolved correctly.""" from __future__ import print_function import os import time import lldb from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil class ForwardDeclarationTestCase(TestBase): mydir = TestB...
tests/test_reindex.py
a1346054/tldr.py
210
12746997
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import import os from os import path import shutil from basic import BasicTestCase class TestReindex(BasicTestCase): def setUp(self): super(TestReindex, self).setUp() # Add a new page. self.page_path = path.j...
project/path.py
ProfesseurGibaud/TestSite
304
12747013
# coding: utf-8 """ This module contains all the paths for alls this project's directories, that we created dynamically. All paths are absolute, without symlink and in unicode. We also add the 'apps' and 'libs' directories to the PYTHON PATH, which will make the imports much easier. """ impo...
artemis/remote/file_system.py
peteroconnor-bc/artemis
235
12747020
from __future__ import print_function import os from ConfigParser import NoSectionError, NoOptionError import paramiko from artemis.config import get_artemis_config_value from artemis.fileman.config_files import get_config_value from artemis.remote.utils import get_ssh_connection def check_config_file(ip_address,f...
Grab/parse_onlinemultfilmy.py
DazEB2/SimplePyScripts
117
12747050
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # Поиск мультсериалов 16+ # Пример сериала: 'http://onlinemultfilmy.ru/bratya-ventura/' import time from grab import Grab g = Grab() # Перебор страниц с мультами for i in range(1, 82 + 1): url_page = 'http://onlinemultfilmy.ru/multserialy/...
Regression/Linear Regression.py
yanding/Stock-Analysis
357
12747056
<reponame>yanding/Stock-Analysis<filename>Regression/Linear Regression.py<gh_stars>100-1000 # Linear Regression for Stock based on Date # Currently only works for month # http://scikit-learn.org/stable/auto_examples/linear_model/plot_ols.html#example-linear-model-plot-ols-py import csv import numpy as np from sklearn ...
samples/switch-commands/aci-show-vlan-ext.py
richardstrnad/acitoolkit
351
12747080
<gh_stars>100-1000 #!/usr/bin/env python """ This application replicates the switch CLI command 'show vlan info' It largely uses raw queries to the APIC API """ from acitoolkit import Credentials, Session from tabulate import tabulate def show_vlan_brief(apic, node_ids): """ show vlan brief :param apic: S...
pymatgen/analysis/solar/tests/test_slme.py
exenGT/pymatgen
921
12747083
<gh_stars>100-1000 import os import unittest import warnings from pymatgen.analysis.solar.slme import optics, slme from pymatgen.util.testing import PymatgenTest class SolarTest(PymatgenTest): _multiprocess_shared_ = True def setUp(self): warnings.simplefilter("ignore") def tearDown(self): ...
hummingbot/core/data_type/order_book_row.py
BGTCapital/hummingbot
3,027
12747097
<reponame>BGTCapital/hummingbot #!/usr/bin/env python from collections import namedtuple from decimal import Decimal class OrderBookRow(namedtuple("_OrderBookRow", "price, amount, update_id")): """ Used to apply changes to OrderBook. OrderBook classes uses float internally for better performance over Decimal...
kopf/_cogs/structs/__init__.py
tavaresrodrigo/kopf
1,038
12747106
""" All the functions to manipulate the resource fields, state changes, etc. Grouped by the type of the fields and the purpose of the manipulation. Used in the handling routines to check if there were significant changes at all (i.e. not our own internal and system changes, like the uids, links, etc), and to get the ...
test/test_tokens.py
robbm1/pyleri
106
12747123
<reponame>robbm1/pyleri import unittest import os import sys if os.environ.get('USELIB') != '1': sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) from pyleri import ( KeywordError, create_grammar, Tokens, ) # nopep8 class TestTokens(unittest.TestCase): def test_tokens(self): ...
python-threatexchange/threatexchange/content_type/video.py
b-bold/ThreatExchange
997
12747156
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ Wrapper around the video content type. """ import typing as t from ..signal_type import raw_text, trend_query, url, md5, video_tmk_pdqf from ..signal_type.signal_base import SignalType from .content_base import ContentTyp...
ui/pypesvds/lib/extras/pdflib/pycdb.py
onfire73/pypeskg
117
12747175
#!/usr/bin/env python # # pycdb.py - Python implementation of cdb and tcdb # # by <NAME> # * public domain * # import sys, os from struct import pack, unpack from array import array # calc hash value with a given key def cdbhash(s, n=5381L): return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffffL, s, n) if...
leonardo/module/media/widget/vectorgraphics/util.py
timgates42/django-leonardo
102
12747193
<gh_stars>100-1000 import xml.parsers.expat from decimal import Decimal from django.conf import settings from django.template.loader import render_to_string import xml.dom.minidom import pprint pp = pprint.PrettyPrinter(indent=1, width=20).pprint def autofill_svg_size(sender, **kwargs): if not kwargs['instance'...
geonotebook/vis/ktile/handler.py
irina694/earth-science-notebook
1,076
12747210
<filename>geonotebook/vis/ktile/handler.py from concurrent.futures import ThreadPoolExecutor from datetime import datetime, timedelta import json from ModestMaps.Core import Coordinate from notebook.base.handlers import IPythonHandler from tornado import concurrent, ioloop from tornado import gen from tornado import w...
jnpr/openclos/trapd.py
rohitt29/OpenClos
114
12747233
<gh_stars>100-1000 ''' Created on Nov. 06, 2014 @author: yunli ''' from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher from pysnmp.carrier.asynsock.dgram import udp from pyasn1.codec.ber import decoder from pysnmp.proto import api from threading import Thread, Event import logging import util import signa...
CalibPPS/ESProducers/test/ppsTimingCalibrationAnalyzer_cfg.py
ckamtsikis/cmssw
852
12747238
<filename>CalibPPS/ESProducers/test/ppsTimingCalibrationAnalyzer_cfg.py import FWCore.ParameterSet.Config as cms process = cms.Process('test') # minimum logging process.MessageLogger = cms.Service("MessageLogger", cerr = cms.untracked.PSet( enable = cms.untracked.bool(False) ), cout = cms.untracke...
supervisor/dbus/network/interface.py
pnjongang/supervisor
597
12747257
<filename>supervisor/dbus/network/interface.py """NetworkInterface object for Network Manager.""" from typing import Optional from ...utils.dbus import DBus from ..const import ( DBUS_ATTR_ACTIVE_CONNECTION, DBUS_ATTR_DEVICE_INTERFACE, DBUS_ATTR_DEVICE_TYPE, DBUS_ATTR_DRIVER, DBUS_ATTR_MANAGED, ...
src/apifuzz.py
Boyploy/IMF
108
12747259
# Copyright (c) 2017 <NAME> and <NAME> at SoftSec, KAIST # # See the file LICENCE for copying permission. import basic import hook import utils import log import const import sys import time import argparse import os from multiprocessing import Pool from model import Model class ApiFuzz: def __init__(self): ...
src/app/beer_garden/api/http/handlers/v1/admin.py
ExpressHermes/beer-garden
230
12747272
# -*- coding: utf-8 -*- from brewtils.errors import ModelValidationError from brewtils.models import Operation from brewtils.schema_parser import SchemaParser from beer_garden.api.http.base_handler import BaseHandler class AdminAPI(BaseHandler): async def patch(self): """ --- summary: Ini...
corehq/apps/user_importer/helpers.py
andyasne/commcare-hq
471
12747277
from dimagi.utils.parsing import string_to_boolean from corehq.apps.custom_data_fields.models import PROFILE_SLUG from corehq.apps.user_importer.exceptions import UserUploadError from corehq.apps.users.audit.change_messages import UserChangeMessage from corehq.apps.users.model_log import UserModelAction from corehq.a...
c2nl/config.py
kopf-yhs/ncscos
131
12747282
""" Implementation of all available options """ from __future__ import print_function """Model architecture/optimization options for Seq2seq architecture.""" import argparse import logging logger = logging.getLogger(__name__) # Index of arguments concerning the core model architecture MODEL_ARCHITECTURE ...
tools/mkowners/mkowners.py
txl0591/grpc
117
12747287
#!/usr/bin/env python3 # Copyright 2017 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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
third_party/boto/manage/test_manage.py
stdft112/depot_tools
2,151
12747291
from boto.manage.server import Server from boto.manage.volume import Volume import time print '--> Creating New Volume' volume = Volume.create() print volume print '--> Creating New Server' server_list = Server.create() server = server_list[0] print server print '----> Waiting for Server to start up' while server.st...
tests/test_snapshot.py
kklein/icontract
244
12747300
# pylint: disable=missing-docstring # pylint: disable=invalid-name # pylint: disable=unnecessary-lambda # pylint: disable=unused-argument # pylint: disable=no-self-use import textwrap import unittest from typing import List, Optional # pylint: disable=unused-import import icontract import tests.error class TestOK(u...
polylearn/kernels.py
JDechery/polylearn
237
12747310
# Author: <NAME> <<EMAIL>> # License: Simplified BSD from sklearn.metrics.pairwise import polynomial_kernel from sklearn.utils.extmath import safe_sparse_dot from scipy.sparse import issparse import numpy as np def safe_power(X, degree=2): """Element-wise power supporting both sparse and dense data. Parame...
python/ql/test/library-tests/examples/custom-sanitizer/test.py
vadi2/codeql
4,036
12747315
<filename>python/ql/test/library-tests/examples/custom-sanitizer/test.py def random_choice(): return bool(GLOBAL_UNKOWN_VAR) def is_safe(arg): return UNKNOWN_FUNC(arg) def true_func(): return True def test_basic(): s = TAINTED_STRING if is_safe(s): ensure_not_tainted(s) else: ...
pydis_site/apps/resources/apps.py
Robin5605/site
700
12747322
<reponame>Robin5605/site from django.apps import AppConfig class ResourcesConfig(AppConfig): """AppConfig instance for Resources app.""" name = 'resources'
spikeinterface/core/unitsaggregationsorting.py
khl02007/spikeinterface
116
12747324
<filename>spikeinterface/core/unitsaggregationsorting.py from typing import List, Union import numpy as np from .basesorting import BaseSorting, BaseSortingSegment class UnitsAggregationSorting(BaseSorting): """ Class that handles aggregating units from different sortings, e.g. from different channel groups...
worldengine/generation.py
ctittel/worldengine
946
12747325
import numpy from noise import snoise2 from worldengine.model.world import Step from worldengine.simulations.basic import find_threshold_f from worldengine.simulations.hydrology import WatermapSimulation from worldengine.simulations.irrigation import IrrigationSimulation from worldengine.simulations.humidity import H...
components/isceobj/Scene/Track.py
vincentschut/isce2
1,133
12747336
<reponame>vincentschut/isce2<filename>components/isceobj/Scene/Track.py #!/usr/bin/env python3 # #Copyright 2010, by the California Institute of Technology. #ALL RIGHTS RESERVED. #United States Government Sponsorship acknowledged. #Any commercial use must be negotiated with the Office of #Technology Transfer at the Cal...
ShuffleNetV2.ExLarge/network.py
PeterouZh/ShuffleNet-Series
1,382
12747360
<reponame>PeterouZh/ShuffleNet-Series import torch import torch.nn as nn class Conv_BN_ReLU(nn.Module): def __init__(self, in_channel, out_channel, k_size, stride=1, padding=0, groups=1, has_bn=True, has_relu=True, gaussian_init=False): super(Conv_BN_ReLU, self).__init__() self.c...
sdk/python/pulumi_azure/kusto/_inputs.py
henriktao/pulumi-azure
109
12747404
<filename>sdk/python/pulumi_azure/kusto/_inputs.py # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping,...
hubspot/crm/quotes/api/__init__.py
fakepop/hubspot-api-python
117
12747414
from __future__ import absolute_import # flake8: noqa # import apis into api package from hubspot.crm.quotes.api.associations_api import AssociationsApi from hubspot.crm.quotes.api.basic_api import BasicApi from hubspot.crm.quotes.api.batch_api import BatchApi from hubspot.crm.quotes.api.search_api import SearchApi
tests/test_queries.py
matchup-ir/whooshy
270
12747416
<gh_stars>100-1000 from __future__ import with_statement import copy import pytest from whoosh import fields, qparser, query from whoosh.compat import b, u from whoosh.filedb.filestore import RamStorage from whoosh.qparser import QueryParser from whoosh.query import And from whoosh.query import AndMaybe from whoosh.q...
src/imitation_frames.py
akolishchak/doom-net-pytorch
143
12747435
# # imitation_frames.py, doom-net # # Created by <NAME> on 01/21/17. # import os import time import h5py import torch import torch.nn as nn import torch.optim as optim from device import device import argparse from doom_instance import * from aac import BaseModel def data_generator(args, screens, variables, labels, e...
main/signals.py
curenamo/ssmreleva
123
12747459
<reponame>curenamo/ssmreleva from django.contrib.auth.models import User from django.db.models.signals import post_save def set_api_permissions(sender, instance=None, created=False, **kwargs): from utils.user_auth import set_api_permissions_for_user if created: set_api_permissions_for_user(instance) p...
monai/losses/tversky.py
dylanbuchi/MONAI
2,971
12747475
<reponame>dylanbuchi/MONAI<gh_stars>1000+ # Copyright 2020 - 2021 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless requ...
verde/tests/test_scipy.py
fatiando/verde
415
12747489
<reponame>fatiando/verde # Copyright (c) 2017 The Verde Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause # # This code is part of the Fatiando a Terra project (https://www.fatiando.org) # """ Test the scipy based interpolator. """ import warnings import num...
setup.py
DataCanvasIO/Cooka
222
12747521
#!/usr/bin/env python # -*- coding: utf-8 -*- from os.path import join as pjoin import shutil from setuptools import setup, find_packages import distutils.cmd import distutils.log import subprocess from os import path as P try: execfile except NameError: def execfile(fname, globs, locs=None): locs = l...
tests/riscv/APIs/api_getPageInfo_01_force.py
noahsherrill/force-riscv
111
12747523
# # Copyright (C) [2020] Futurewei Technologies, Inc. # # FORCE-RISCV is 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 # # THIS SOFTWARE IS PR...
deepscm/experiments/medical/ukbb/sem_vi/base_sem_experiment.py
biomedia-mira/deepscm
183
12747525
<reponame>biomedia-mira/deepscm<gh_stars>100-1000 import pyro from typing import Mapping from pyro.infer import SVI, TraceGraph_ELBO from pyro.nn import pyro_method from pyro.optim import Adam from torch.distributions import Independent import torch from pyro.distributions.torch_transform import ComposeTransformModu...
src/prefect/cli/kv_store.py
concreted/prefect
8,633
12747635
<reponame>concreted/prefect<filename>src/prefect/cli/kv_store.py import sys import click from prefect import config from prefect.backend import kv_store from prefect.backend.kv_store import NON_CLOUD_BACKEND_ERROR_MESSAGE from prefect.cli.build_register import ( handle_terminal_error, TerminalError, log_ex...
.modules/.CMSeeK/deepscans/joom/check_debug.py
termux-one/EasY_HaCk
1,103
12747636
#!/usr/bin/python3 # -*- coding: utf-8 -*- # This is a part of CMSeeK, check the LICENSE file for more information # Copyright (c) 2018 Tuhinshubhra import cmseekdb.basic as cmseek # I know there is no reason at all to create a separate module for this.. there's something that's going to be added here so.. trust me! d...
core/tests/test_polyaxonfile/test_patch_specification.py
admariner/polyaxon
3,200
12747643
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
src/lib/trains/train_factory.py
EvelynYihuiYang/MCMOT
306
12747665
from __future__ import absolute_import from __future__ import division from __future__ import print_function from .mot import MotTrainer train_factory = { 'mot': MotTrainer, }
lib/pose/hrnet/pose_estimation/gen_kpts.py
aibodygym/GAST-Net-3DPoseEstimation
235
12747673
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys import os import os.path as osp import argparse import time import numpy as np from tqdm import tqdm import json import torch import torch.backends.cudnn as cudnn import cv2 import _init_paths from ...
octopus/tests/BTC/test_explorer.py
SillyTin/octopus
212
12747714
from octopus.platforms.BTC.explorer import BitcoinExplorerRPC from octopus.platforms.BTC.explorer import RPC_USER, RPC_PASSWORD, RPC_HOST import unittest class BitcoinExplorerTestCase(unittest.TestCase): explorer = BitcoinExplorerRPC(host=('%s:%s@%s' % (RPC_USER, RPC_PASSWORD, RPC_HOST))) blockhash = '0000...
tests/test_parameters.py
compose-x/troposphere
4,573
12747725
import unittest from troposphere import Parameter, Ref class TestInitArguments(unittest.TestCase): def test_title_max_length(self): title = "i" * 256 with self.assertRaises(ValueError): Parameter(title, Type="String") def test_ref_can_be_requested(self): param = Parameter...
netket/graph/__init__.py
gpescia/MyNetKet
352
12747783
<gh_stars>100-1000 # Copyright 2021 The NetKet Authors - All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...