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
components/isceobj/IsceProc/runOffoutliers.py
vincentschut/isce2
1,133
12666911
<filename>components/isceobj/IsceProc/runOffoutliers.py #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Copyright 2013 California Institute of Technology. ALL RIGHTS RESERVED. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in co...
src/lib/output/json.py
security-geeks/userline
255
12666941
<reponame>security-geeks/userline # # Author: <NAME> (aka sch3m4) # @sch3m4 # https://github.com/thiber-org/userline # import json from lib import config class JSON(): def __init__(self,fd,duplicate=False): self.fd = fd self.duplicate = duplicate def add_sequence(self,event): evt = [] aux ...
data/micro-benchmark/parameters/imported_call/main.py
vitsalis/pycg-evaluation
121
12666956
from to_import import func def param_func(): pass func(param_func)
function/python/brightics/function/classification/test/xgb_classification_test.py
parkjh80/studio
202
12666971
<reponame>parkjh80/studio """ Copyright 2019 Samsung SDS 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...
libraries/botbuilder-dialogs/botbuilder/dialogs/memory/scopes/conversation_memory_scope.py
Fl4v/botbuilder-python
388
12667043
<reponame>Fl4v/botbuilder-python<gh_stars>100-1000 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from botbuilder.core import ConversationState from botbuilder.dialogs.memory import scope_path from .bot_state_memory_scope import BotStateMemoryScope class ConversationMe...
examples/subparsers/subparsers_example.py
idoby/SimpleParsing
150
12667044
<filename>examples/subparsers/subparsers_example.py from dataclasses import dataclass from typing import Union from pathlib import Path from simple_parsing import ArgumentParser, subparsers @dataclass class Train: """Example of a command to start a Training run.""" # the training directory train_dir: Pat...
dnachisel/reports/SpecAnnotationsTranslator.py
simone-pignotti/DnaChisel
124
12667074
<gh_stars>100-1000 from ..biotools import find_specification_label_in_feature from .tools import install_extras_message DFV_AVAILABLE = False try: from dna_features_viewer import BiopythonTranslator DFV_AVAILABLE = True except ImportError: class BiopythonTranslator: "Class unavailable. Install DN...
mythril/laser/plugin/plugins/plugin_annotations.py
kalloc/mythril
1,887
12667103
<filename>mythril/laser/plugin/plugins/plugin_annotations.py<gh_stars>1000+ from mythril.laser.ethereum.state.annotation import ( StateAnnotation, MergeableStateAnnotation, ) from copy import copy from typing import Dict, List, Set import logging log = logging.getLogger(__name__) class MutationAnnotation(St...
flask_accepts/decorators/__init__.py
cafetodev/flask_accepts
170
12667110
from .decorators import accepts, responds # noqa
setup/apps.py
SlapBass/nx-portal
115
12667124
<filename>setup/apps.py from django.apps import AppConfig class SetupConfig(AppConfig): name = 'setup'
Demo/simple.py
reqa/python-ldap
299
12667132
import sys,getpass import ldap #l = ldap.open("localhost", 31001) l = ldap.open("marta.it.uq.edu.au") login_dn = "cn=root,ou=CSEE,o=UQ,c=AU" login_pw = getpass.getpass("Password for %s: " % login_dn) l.simple_bind_s(login_dn, login_pw) # # create a new sub organisation # try: dn = "ou=CSEE,o=UQ,c=AU" print(...
kornia/utils/draw.py
saurabhya/kornia
418
12667141
from typing import List, Optional, Tuple, Union import torch from torch import Tensor from kornia.testing import KORNIA_CHECK, KORNIA_CHECK_SHAPE # TODO: implement width of the line def _draw_pixel(image: torch.Tensor, x: int, y: int, color: torch.Tensor) -> None: r"""Draws a pixel into an image. Args: ...
tests/openbb_terminal/core/log/collection/test_logging_clock.py
tehcoderer/GamestonkTerminal
255
12667178
<filename>tests/openbb_terminal/core/log/collection/test_logging_clock.py from datetime import datetime import pytest from openbb_terminal.core.log.collection import logging_clock clock = logging_clock.LoggingClock() now = datetime.now() def mock_next(**_): raise NotImplementedError @pytest.mark.parametrize( ...
discodo/client/http.py
eunwoo1104/discodo
105
12667187
import logging from ..errors import HTTPException from .models import ensureQueueObjectType log = logging.getLogger("discodo.client.http") class HTTPClient: def __init__(self, client): self.VoiceClient = client self.Node = client.Node self.loop = client.Node.loop @property def h...
Lib/rubicon/objc/__init__.py
snazari/Pyto
701
12667202
# Examples of valid version strings # __version__ = '1.2.3.dev1' # Development release 1 # __version__ = '1.2.3a1' # Alpha Release 1 # __version__ = '1.2.3b1' # Beta Release 1 # __version__ = '1.2.3rc1' # RC Release 1 # __version__ = '1.2.3' # Final Release # __version__ = '1.2.3.post1' # Post Release...
test cases/python/3 cython/cytest.py
kira78/meson
4,047
12667205
#!/usr/bin/env python3 from storer import Storer s = Storer() if s.get_value() != 0: raise SystemExit('Initial value incorrect.') s.set_value(42) if s.get_value() != 42: raise SystemExit('Setting value failed.') try: s.set_value('not a number') raise SystemExit('Using wrong argument type did not f...
tests/components/evil_genius_labs/test_init.py
MrDelik/core
30,023
12667251
"""Test evil genius labs init.""" import pytest from homeassistant import config_entries from homeassistant.components.evil_genius_labs import PLATFORMS @pytest.mark.parametrize("platforms", [PLATFORMS]) async def test_setup_unload_entry(hass, setup_evil_genius_labs, config_entry): """Test setting up and unloadi...
excel4lib/sheet/__init__.py
aaaddress1/boobsnail
169
12667260
<reponame>aaaddress1/boobsnail<filename>excel4lib/sheet/__init__.py from .cell import * from .worksheet import *
binproperty/views.py
wh8983298/GreaterWMS
1,063
12667267
<gh_stars>1000+ from rest_framework import viewsets from .models import ListModel from . import serializers from utils.page import MyPageNumberPagination from rest_framework.filters import OrderingFilter from django_filters.rest_framework import DjangoFilterBackend from .filter import Filter class APIViewSet(viewsets....
package/tests/database/test_settings.py
R-fred/awesome-streamlit
1,194
12667277
<filename>package/tests/database/test_settings.py<gh_stars>1000+ """In this module we test that there is a module settings and is has the required attributes and functionality""" from awesome_streamlit.database import settings def test_github(): """Test that there is a GITHUB_URL Setting""" assert settings.GI...
demo/seg_scripts.py
ebrahimebrahim/easyreg
107
12667288
<filename>demo/seg_scripts.py import os import sys import torch from easyreg.piplines import run_one_task import argparse from task import ModelTask class SegmentationTraining(): def __init__(self, args): self.args = args def _set_environment(self): sys.path.insert(0,os.path.abspath('..')) ...
src/deepke/name_entity_re/few_shot/__init__.py
johncolezhang/DeepKE
710
12667292
from .models import * from .module import * from .utils import *
lib/models/invert.py
conan7882/CNN-Visualization
201
12667297
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: invert.py # Author: <NAME> <<EMAIL>> import tensorflow as tf import numpy as np from tensorcv.models.base import BaseModel class InvertCNN(BaseModel): def __init__(self, im_h, im_w, im_c, input_mean=0, input_std=1.0, mean_list=None): init = tf.rando...
src/main/resources/resource/Intro/Servo01_stop.py
holgerfriedrich/myrobotlab
179
12667315
######################################### # Servo01_stop.py # categories: intro # more info @: http://myrobotlab.org/service/Intro ######################################### # uncomment for virtual hardware # Platform.setVirtual(True) # Every settings like limits / port number / controller are saved after initial use #...
tests/unit/helloworld/multimodal/conftest.py
Rohitpandit021/jina
15,179
12667339
import os import pytest @pytest.fixture(autouse=True) def setup_hellworld_env(tmpdir): os.environ['HW_WORKDIR'] = str(tmpdir) yield os.environ.pop("HW_WORKDIR")
utest/test/keywords/test_firefox_profile_parsing.py
hugovk/SeleniumLibrary
792
12667379
import os import unittest from approvaltests.approvals import verify_all from approvaltests.reporters.generic_diff_reporter_factory import ( GenericDiffReporterFactory, ) from robot.utils import WINDOWS from selenium import webdriver from SeleniumLibrary.keywords import WebDriverCreator class FireFoxProfilePars...
ModelConf.py
woailaosang/NeuronBlocks
1,257
12667412
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. import codecs import json import os import tempfile import random import string import copy import torch import logging import shutil from losses.BaseLossConf import BaseLossConf #import traceback from settings import Langua...
core/models.py
vlafranca/stream_framework_example
102
12667485
from django.db import models from django.conf import settings from django.utils.timezone import make_naive import pytz class BaseModel(models.Model): class Meta: abstract = True class Item(BaseModel): user = models.ForeignKey(settings.AUTH_USER_MODEL) image = models.ImageField(upload_to='items'...
pkg_pytorch/blendtorch/btt/finder.py
kongdai123/pytorch-blender
381
12667486
import os import subprocess import re import shutil import logging import tempfile from pathlib import Path logger = logging.getLogger('blendtorch') script = r''' import zmq ''' def discover_blender(additional_blender_paths=None): '''Return Blender info as dict with keys `path`, `major`, `minor`.''' my_env...
cacreader/swig-4.0.2/Examples/python/import_packages/split_modules/vanilla_split/pkg1/__init__.py
kyletanyag/LL-Smartcard
1,031
12667516
# killroy was here
t/base_test.py
orioledb/orioledb
947
12667523
#!/usr/bin/env python3 # coding: utf-8 import unittest import testgres import sys import os import random import string import time import hashlib import base64 import inspect from threading import Thread from testgres.enums import NodeStatus from testgres.consts import PG_CONF_FILE class BaseTest(unittest.TestCase)...
test/jinja2.test_pytorch.py
hughperkins/pytorch
513
12667558
<reponame>hughperkins/pytorch<filename>test/jinja2.test_pytorch.py<gh_stars>100-1000 # {{header1}} # {{header2}} from __future__ import print_function, division import PyTorch import numpy import inspect from test.test_helpers import myeval, myexec {%- set types = [ {'Real': 'Long','real': 'long'}, {'Real': ...
typed_python/compiler/tests/alternative_compilation_test.py
APrioriInvestments/typed_python
105
12667588
<reponame>APrioriInvestments/typed_python # Copyright 2017-2019 typed_python 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...
test/integration/test_object_labels.py
jonaslalin/label-maker
428
12667589
<gh_stars>100-1000 """Test that the following CLI command returns the expected outputs label-maker labels -d integration-od -c test/fixtures/integration/config.integration.object_detection.json""" import unittest from os import makedirs from shutil import copyfile, rmtree import subprocess import numpy as np class Te...
reproducibility.py
liaopeiyuan/ml-arsenal-public
280
12667592
from dependencies import random, np, torch, os from settings import * print("Fixing random seed for reproducibility...") SEED = 35202 #123 #35202 #int(time.time()) # random.seed(SEED) np.random.seed(SEED) torch.manual_seed(SEED) torch.cuda.manual_seed_all(SEED) print ('\tSetting random seed to {}.'.format(SEED)) p...
atlas/backbone2d.py
GainiK/Atlas-1
1,571
12667603
<reponame>GainiK/Atlas-1 # from Detectron2: (https://github.com/facebookresearch/detectron2) import numpy as np import torch from torch import nn from torch.nn import functional as F from detectron2.layers import Conv2d, get_norm from detectron2.modeling.backbone import build_backbone as d2_build_backbone import fvco...
octohatrack.py
LABHR/octohatrack
143
12667652
<reponame>LABHR/octohatrack import octohatrack octohatrack.main()
events/forms.py
buketkonuk/pythondotorg
911
12667663
<reponame>buketkonuk/pythondotorg from django import forms from django.conf import settings from django.contrib.sites.models import Site from django.core.mail import send_mail from django.template import loader def set_placeholder(value): return forms.TextInput(attrs={'placeholder': value, 'required': 'required...
pudzu/sandbox/markov.py
Udzu/pudzu
119
12667702
import argparse import bisect import functools import itertools import operator as op import pickle import random import string import sys import unicodedata from collections import Counter # Simple Markov n-gram based generator. def generate_ngrams(iterable, n): """Generator that yields n-grams from a sequence....
src/main/python/smart/analyze_events_v2.py
cday97/beam
123
12667767
<reponame>cday97/beam<filename>src/main/python/smart/analyze_events_v2.py import json import plotly.graph_objects as go import pandas as pd import os from jsonmerge import merge def get_pooling_metrics(_data): count_of_multi_passenger_pool_trips = 0 count_of_one_passenger_pool_trips = 0 count_of_solo_trip...
nni/nas/benchmarks/utils.py
sky-dust-intelligence-bv/nni
2,305
12667814
<reponame>sky-dust-intelligence-bv/nni<gh_stars>1000+ # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import functools import json import os from playhouse.sqlite_ext import SqliteExtDatabase from nni.common.blob_utils import load_or_download_file from .constants import DB_URLS, DATABASE_DI...
pysparkling/sql/tests/expressions/test_mappers.py
ptallada/pysparkling
260
12667825
from unittest import TestCase from pysparkling.utils import MonotonicallyIncreasingIDGenerator class MonotonicallyIncreasingIDGeneratorTests(TestCase): def test_init_ok(self): sut = MonotonicallyIncreasingIDGenerator(0) self.assertEqual(sut.value, -1) # Shouldn't we throw an error here? ...
aiohttp_admin/resource.py
asvetlov/aiohttp_admin
221
12667853
<reponame>asvetlov/aiohttp_admin from abc import abstractmethod, ABCMeta from .security import Permissions, require from .utils import json_response, validate_query class AbstractResource(metaclass=ABCMeta): def __init__(self, *, primary_key, resource_name=None): class_name = self.__class__.__name__.low...
src/genie/libs/parser/nxos/tests/ShowModule/cli/equal/golden_output2_expected.py
balmasea/genieparser
204
12667913
<filename>src/genie/libs/parser/nxos/tests/ShowModule/cli/equal/golden_output2_expected.py expected_output = { "slot": { "lc": { "1": { "16x400G Ethernet Module": { "hardware": "3.1", "mac_address": "bc-4a-56-ff-fa-5b to bc-4a-56-ff-fb-dd",...
python/sorting/Randomized Pivot QuickSort.py
jigneshoo7/AlgoBook
191
12667950
<reponame>jigneshoo7/AlgoBook # Python implementation Randomized Pivot QuickSort using Lomuto's partition Scheme. # Contributed by @ddhira123 # References: GeeksforGeeks import random ''' The function which implements QuickSort. array : array to be sorted. start : starting index of the array. stop : ending index of ...
holoviews/tests/element/test_comparisoncomposite.py
TheoMathurin/holoviews
864
12667965
<gh_stars>100-1000 """ Test cases for the Comparisons class over the composite types: Layout (the + operator) Overlay (the * operator) HoloMaps are not tested in this file. """ from holoviews import Element from holoviews.element.comparison import ComparisonTestCase class CompositeComparisonTestCase(ComparisonT...
spack/package.py
zmxdream/FlexFlow
455
12667996
<gh_stars>100-1000 # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) # ---------------------------------------------------------------------------- # If you submit this pac...
jack/io/embeddings/__init__.py
elyase/jack
192
12668009
# -*- coding: utf-8 -*- from jack.io.embeddings.embeddings import Embeddings, load_embeddings from jack.io.embeddings.glove import load_glove __all__ = [ 'Embeddings', 'load_embeddings' 'load_word2vec', 'get_word2vec_vocabulary', 'load_glove', ]
toad/cli.py
Padfoot-ted/toad
325
12668058
""" toad command line application """ import argparse from .commands import get_plugins def add_sub(parsers, config): """add sub parser by config """ info = config.get('info', {}) args = config.get('args', []) defaults = config.get('defaults', None) sub_parser = parsers.add_parser(**info) ...
Geometry/HcalEventSetup/python/HcalGeometry_cfi.py
ckamtsikis/cmssw
852
12668061
import FWCore.ParameterSet.Config as cms HcalHardcodeGeometryEP = cms.ESProducer("HcalHardcodeGeometryEP" , UseOldLoader = cms.bool(False) )
calvin/tests/test_codegen.py
gabrielcercel/calvin-base
334
12668084
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # 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 ...
tensorboard/plugins/audio/audio_demo.py
Digitaltransform/tensorboard
6,139
12668131
# Copyright 2017 The TensorFlow 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 required by applica...
src/utils_ui.py
maiki/k3x
188
12668147
<gh_stars>100-1000 # utils_ui.py # # MIT License # # Copyright (c) 2020 <NAME> <<EMAIL>> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation th...
src/tensorflow2.x-python-tutorial/binary-text-classification.py
pepure/SciSharp-Stack-Examples
197
12668152
import matplotlib.pyplot as plt import os import re import shutil import string import tensorflow as tf from tensorflow.keras import layers from tensorflow.keras import losses from tensorflow.keras import preprocessing from tensorflow.keras.layers.experimental.preprocessing import TextVectorization import os os.enviro...
codes/python/advanced/tfrecords.py
agnes-yang/TensorFlow-Course
7,040
12668238
<gh_stars>1000+ # -*- coding: utf-8 -*- """TFRecords.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1p-Nz6v3CyqKSc-QazX1FgvZkamt5T-uC """ import tensorflow as tf from tensorflow import keras import numpy as np # Load MNIST data (x_train, y_trai...
bin/warm_up_cache.py
thenetcircle/dino
150
12668253
import logging import os import sys from dino.config import ConfigKeys from dino.environ import env DEFAULT_DAYS = 31 logger = logging.getLogger('warm_up_cache.py') try: days = env.config.get(ConfigKeys.WARMUP_DAYS, domain=ConfigKeys.CACHE_SERVICE, default=-1) if days != -1: try: days =...
notebook/scipy_sparse_convert.py
vhn0912/python-snippets
174
12668338
<reponame>vhn0912/python-snippets<filename>notebook/scipy_sparse_convert.py from scipy.sparse import csr_matrix, lil_matrix l = [[0, 10, 20], [30, 0, 0], [0, 0, 0]] csr = csr_matrix(l) print(csr) # (0, 1) 10 # (0, 2) 20 # (1, 0) 30 print(type(csr)) # <class 'scipy.sparse.csr.csr_matrix'> lil = csr.t...
amodem/tests/test_calib.py
Matthew-MK/amodem
766
12668389
from amodem import calib from amodem import common from amodem import config from io import BytesIO import numpy as np import random import pytest import mock config = config.fastest() class ProcessMock: def __init__(self): self.buf = BytesIO() self.stdin = self self.stdout = self ...
tests/data/src/compilewheel/simple/__init__.py
rsumnerz/pip
7,089
12668429
def spam(gen): yield from gen
Support/Scripts/start-android-emulator.py
cclauss/ds2
225
12668438
#!/usr/bin/env python3 ## ## Copyright (c) 2014-present, Facebook, Inc. ## All rights reserved. ## ## This source code is licensed under the University of Illinois/NCSA Open ## Source 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...
tools/perf/contrib/cluster_telemetry/loading_ct.py
zealoussnow/chromium
14,668
12668543
<gh_stars>1000+ # Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from contrib.cluster_telemetry import loading_base_ct # pylint: disable=protected-access class LoadingClusterTelemetry(loading_base_ct._Loadi...
2018/finals/web-mitigator/app/main.py
iicarus-bit/google-ctf
2,757
12668557
#!/usr/bin/python # Copyright 2018 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
detector/common/gt_transformer.py
qiu9yu/Lets_OCR
671
12668578
<reponame>qiu9yu/Lets_OCR ### # transform original gt to location gt ### import os def rawGT_to_locGT(in_path, out_path): if not os.path.exists(out_path): os.mkdir(out_path) files_list = os.listdir(in_path) for name in files_list: in_file = os.path.join(in_path, name) out_file =...
Lib/test/test_compiler/testcorpus/32_func_global_nested.py
diogommartins/cinder
1,886
12668640
<gh_stars>1000+ def foo(): global bar def bar(): pass
tests/catalyst/contrib/utils/test_pandas.py
gr33n-made/catalyst
2,693
12668644
# flake8: noqa # import pandas as pd # import pytest # # from catalyst.contrib.utils.pandas import ( # folds_to_list, # split_dataframe_on_stratified_folds, # ) # # # def test_folds_to_list(): # """@TODO: Docs. Contribution is welcome.""" # assert folds_to_list("1,2,1,3,4,2,4,6") == [1, 2, 3, 4, 6] # ...
o365spray/core/utils/defaults.py
hackedbyagirl/o365spray
341
12668655
#!/usr/bin/env python3 from datetime import datetime # Get the current time in YYMMDDHHMM format to append # to file names to keep each run distinct F_TIME = datetime.now().strftime("%y%m%d%H%M") class DefaultFiles: """Global output file name defaults""" # Log and valid output files LOG_FILE = "raw.log...
tests/unit/mock_logs.py
senstb/aws-elastic-beanstalk-cli
110
12668657
<reponame>senstb/aws-elastic-beanstalk-cli<filename>tests/unit/mock_logs.py<gh_stars>100-1000 # Copyright 2018 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 L...
usaspending_api/references/v1/serializers.py
g4brielvs/usaspending-api
217
12668671
from rest_framework import serializers from usaspending_api.common.serializers import LimitableSerializer from usaspending_api.references.models import Cfda, ObjectClass, RefProgramActivity, SubtierAgency, ToptierAgency class ToptierAgencySerializer(LimitableSerializer): class Meta: model = ToptierAgency ...
data/transcoder_evaluation_gfg/python/LEXICOGRAPHICAL_CONCATENATION_SUBSTRINGS_STRING.py
mxl1n/CodeGen
241
12668688
# Copyright (c) 2019-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. # def f_gold ( s ) : n = len ( s ) ; sub_count = ( n * ( n + 1 ) ) // 2 ; arr = [ 0 ] * sub_count ; index = 0 ; ...
tests/config.py
timgates42/tasktiger
1,143
12668690
import os # How much to delay scheduled tasks for testing purposes. # Note that on macOS Catalina, when using an unsigned Python version, taskgated # (com.apple.securityd) needs to approve launching the process. We therefore # need ample time here (> 0.3s) in order to prevent test failures. DELAY = 0.4 # Redis databa...
system/models/storage.py
z1pti3/jimi
111
12668699
<filename>system/models/storage.py from pathlib import Path import csv import json import jimi class _storageTrigger(jimi.trigger._trigger): storage_id = str() file_type = "csv" def doCheck(self): self.result = { "events" : [], "var" : {}, "plugin" : {} } storageFile = jimi.storage._stora...
e2e/cli/mount/operation/pyfs.py
ZMaratovna/cloud-pipeline
126
12668703
<reponame>ZMaratovna/cloud-pipeline from ..utils import execute def mkdir(folder_path, recursive=False): execute('mkdir ' + ('-p ' if recursive else ' ') + ('"%s" ' % folder_path)) def rm(item_path, recursive=False, force=False, under=False): execute('rm ' + ('-r ' if rec...
ambari-common/src/main/python/resource_management/libraries/execution_command/module_configs.py
samyzh/ambari
1,664
12668709
<gh_stars>1000+ #!/usr/bin/env python """ 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 ...
util/config.py
urootcom/TSDK
331
12668722
# coding:utf-8 # 目的:作为统一的配置加载,由这个来控制配置文件的更新以及导出 # 第一:文件检查,首先检查有没有配置文件对象,如果没有下载配置文件然后更新文件对象 # 第二:时间判断,请求文件获取到请求的缓存时间然后比对文件的创建时间,如果比创建时间大那么启动更新 import datetime import pathlib import os class FileUpdate(object): def __init__(self): self.time = datetime.datetime.now() def __get__(self,instance,instanc...
etc/pending_ugens/Pitch.py
butayama/supriya
191
12668724
<gh_stars>100-1000 import collections from supriya.enums import CalculationRate from supriya.synthdefs import MultiOutUGen class Pitch(MultiOutUGen): """ :: >>> source = supriya.ugens.In.ar(bus=0) >>> pitch = supriya.ugens.Pitch.ar( ... amp_threshold=0.01, ... clar=0,...
paas-ce/paas/esb/components/bk/apis/fta/fta_component.py
renmcc/bk-PaaS
767
12668757
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
bravado/_equality_util.py
educatedguessing/bravado
600
12668760
# -*- coding: utf-8 -*- from itertools import chain import typing from six import iterkeys def are_objects_equal(obj1, obj2, attributes_to_ignore=None): # type: (typing.Any, typing.Any, typing.Optional[typing.Set[typing.Text]]) -> bool """ Helper method that checks if two objects are the same. This i...
kicost/currency_converter/currency_tables.py
karlp/KiCost
338
12668783
<reponame>karlp/KiCost<gh_stars>100-1000 #!/usr/bin/python3 # -*- coding: utf-8 -*- currency_symbols = {'AUD': 'A$', 'BGN': 'BGN', 'BRL': 'R$', 'CAD': 'CA$', 'CHF': 'CHF', 'CNY': 'CN¥', 'CZK': 'CZK', ...
compiler/bitcells/replica_bitcell_1port.py
im-world/OpenRAM
335
12668805
<reponame>im-world/OpenRAM<filename>compiler/bitcells/replica_bitcell_1port.py # See LICENSE for licensing information. # # Copyright (c) 2016-2021 Regents of the University of California and The Board # of Regents for the Oklahoma Agricultural and Mechanical College # (acting for and on behalf of Oklahoma State Univer...
scripts/type_extractor/optimize_jsons.py
mehrdad-shokri/retdec
4,816
12668807
#!/usr/bin/env python3 """1. Substitutes SHA1 hash in JSONs with natural numbers. C types in different files will have different keys, therefore you shoud not try to merge them! 2. Removes qualifier types. """ import multiprocessing import sys from type_extractor.arg_parser import get_arg_parser_for_optimize_jsons fr...
panoptic_mapping_utils/src/rio/rio_player.py
YuePanEdward/panoptic_mapping
101
12668832
<filename>panoptic_mapping_utils/src/rio/rio_player.py #!/usr/bin/env python3 import os from struct import pack, unpack import json import numpy as np import rospy from cv_bridge import CvBridge import tf import tf2_ros import cv2 from sensor_msgs.msg import Image, PointCloud2, PointField from geometry_msgs.msg impo...
ObjectOrientedProgramming/IdeFiles/3b_answer_python_package/distributions/__init__.py
vmukund100/dsnd_vm
1,030
12668842
from .Gaussiandistribution import Gaussian
test_python_toolbox/test_dict_tools/test_remove_keys.py
hboshnak/python_toolbox
119
12668873
<filename>test_python_toolbox/test_dict_tools/test_remove_keys.py # Copyright 2009-2017 <NAME>. # This program is distributed under the MIT license. import numbers from python_toolbox.dict_tools import remove_keys def test(): '''Test the basic workings of `sum_dicts`.''' origin_dict = {1: 2, 3: 4, 5: 6, 7: ...
docs/components_page/components/spinner/size.py
glsdown/dash-bootstrap-components
776
12668889
import dash_bootstrap_components as dbc from dash import html spinners = html.Div( [ dbc.Spinner(size="sm"), html.Hr(), dbc.Spinner(spinner_style={"width": "3rem", "height": "3rem"}), ] )
algorithms/countingsort1.py
gajubadge11/HackerRank-1
340
12668923
#!/bin/python3 import sys def countingSort(arr): output = [0] * (max(arr) + 1) for el in arr: output[el] += 1 return output if __name__ == "__main__": n = int(input().strip()) arr = list(map(int, input().strip().split(' '))) result = countingSort(arr) print (" ".join...
python/example_code/lookoutvision/datasets.py
cfuerst/aws-doc-sdk-examples
5,166
12669000
<gh_stars>1000+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """ Amazon lookout for Vision dataset code examples used in the service documentation: https://docs.aws.amazon.com/lookout-for-vision/latest/developer-guide/model-create-dataset.html Shows how to c...
server/ai/src/test_ttldict.py
doneva593/wifisystem
4,349
12669010
import time from ttldict import TTLDict def test_ttldict(): d=TTLDict(ttl=1) d['foo']='bar' assert 'foo' in d assert d['foo'] == 'bar' time.sleep(1) assert 'foo' not in d
Noise Reduction Script/Noise Reduction Script.py
avinashkranjan/PraticalPythonProjects
930
12669050
<gh_stars>100-1000 # Spectral Subtraction: Method used for noise reduction import scipy.io.wavfile as wav import numpy as np import matplotlib.pyplot as plt file = input("Enter the file path: ") sr, data = wav.read(file) fl = 400 #frame_length frames = [] #empty list for i in range(0,int(len(data)/(int(fl/2))-1)): ...
examples/salttiger.py
alphardex/looter
145
12669052
<reponame>alphardex/looter """ salttiger上的免费国外编程电子书 """ import os from pprint import pprint import looter as lt domain = 'https://salttiger.com' def crawl(url): tree = lt.fetch(url) items = tree.css('ul.car-monthlisting li') total = [] for item in items: data = {} data['name'] = item....
core/python/src/nao/cli.py
tensorlang/nao
332
12669065
<reponame>tensorlang/nao<filename>core/python/src/nao/cli.py<gh_stars>100-1000 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import datetime import argparse import json import pprint import re import sys import traceback import gc fr...
questions/55366046/main.py
sesu089/stackoverflow
302
12669092
<gh_stars>100-1000 from PyQt5 import QtCore, QtGui, QtWidgets, QtSvg class PianoKey(QtWidgets.QGraphicsRectItem): def __init__(self, black=False, rect = QtCore.QRectF(), parent=None): super(PianoKey, self).__init__(rect, parent) self.m_pressed = False self.m_selectedBrush = QtGui.QBrush() self.m_brush = QtGu...
fewshots/data/load.py
bertinetto/r2d2
111
12669140
import os import numpy as np import torch from functools import partial from torchnet.transform import compose from torchnet.dataset import ListDataset, TransformDataset from fewshots.data.base import convert_dict, CudaTransform, EpisodicBatchSampler from fewshots.data.setup import setup_images from fewshots.data.cach...
floss/render/default.py
mandiant/flare-floss
145
12669220
<gh_stars>100-1000 # Copyright (C) 2022 Mandiant, Inc. All Rights Reserved. import io import textwrap import collections from typing import List, Tuple, Union import tabulate import floss.utils as util import floss.logging_ from floss.render import Verbosity from floss.results import AddressType, StackString, TightS...
src/django-nonrel/tests/regressiontests/urlpatterns_reverse/views.py
adamjmcgrath/glancydesign
790
12669245
from django.http import HttpResponse def empty_view(request, *args, **kwargs): return HttpResponse('') def kwargs_view(request, arg1=1, arg2=2): return HttpResponse('') def absolute_kwargs_view(request, arg1=1, arg2=2): return HttpResponse('') class ViewClass(object): def __call__(self, request, *ar...
rls/nn/learningrates.py
StepNeverStop/RLs
371
12669291
<reponame>StepNeverStop/RLs #!/usr/bin/env python3 # encoding: utf-8 from torch.optim import lr_scheduler LR_REGISTER = {} LR_REGISTER['lambda'] = lambda optimizer, max_step: lr_scheduler.LambdaLR( optimizer, lr_lambda=lambda step: max(0, 1 - step / max_step)) LR_REGISTER['step'] = lr_scheduler.StepLR LR_REGISTER...
main.py
karan306/aml
303
12669316
<filename>main.py import numpy as np import tensorflow as tf from trainer import * from trainer256 import * from config import get_config from utils import prepare_dirs_and_logger, save_config import pdb, os def main(config): prepare_dirs_and_logger(config) if config.gpu>-1: os.environ["CUDA_DEVICE_...
manage.py
billboggs/elasticsearch-HQ
2,026
12669320
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'royrusso' import os import sys from flask_migrate import MigrateCommand from flask_script import Command, Manager, Option, Server as _Server from elastichq import create_app from elastichq.globals import db, socketio manager = Manager(create_app) class ...
projects/Python/tests/test_send_receive.py
kokizzu/FastBinaryEncoding
563
12669325
import proto from proto import proto from unittest import TestCase class MySender(proto.Sender): def on_send(self, buffer, offset, size): # Send nothing... return 0 class MyReceiver(proto.Receiver): def __init__(self): super().__init__() self._order = False self._ba...
tools/copy_recursive.py
cdavis5e/wine-mono
179
12669338
<gh_stars>100-1000 # Copy a directory recursively WITHOUT the race condition in cp -r. # This also ignores symbolic links. import errno import os import shutil import sys if sys.version_info.major >= 3: file_exists_error = FileExistsError def is_file_exists_error(e): return True else: file_exists_error = OSErro...
self_driving/ml_training/util.py
cclauss/self_driving_pi_car
724
12669400
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import tensorflow as tf import numpy as np command2int = {"up": 0, "left": 1, "right": 2} int2command = {i[1]: i[0] for i in command2int.items()} def run_test(testClass): """ Function to run all the tests from a class of tests. :param testCl...