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
wlscrape.py
bontchev/wlscrape
110
12653902
<gh_stars>100-1000 #!/usr/bin/env python from __future__ import print_function from lxml import html import itertools import argparse import requests import json import wget import sys import os __author__ = "<NAME> <<EMAIL>>" __license__ = "GPL" __VERSION__ = "1.07" site = "https://wikileaks.org" area = "/akp-email...
server/jobs/assign_grading_queues.py
okpy/ok
148
12653908
from server import jobs, utils from server.constants import STAFF_ROLES from server.models import Assignment, GradingTask, User @jobs.background_job def assign_grading_queues(assignment_id, staff, kind): logger = jobs.get_job_logger() cid = jobs.get_current_job().course_id assign = Assignment.query.filt...
FWCore/Integration/test/testSeriesOfProcessesPROD_cfg.py
ckamtsikis/cmssw
852
12653922
# This configuration is designed to be run as the second # in a series of cmsRun processes. The process it configures # will read a file in streamer format and produces two root # files. # For later event selection tests these paths are run: # path p1 1:25 pass # path p2 pass 51:60 # Checks the path names retur...
python/pycylon/examples/dataframe/concat.py
deHasara/cylon
229
12653930
<reponame>deHasara/cylon<filename>python/pycylon/examples/dataframe/concat.py ## # 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 requir...
core/alert.py
murtazakan/Nettacker
884
12653932
<filename>core/alert.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from core import color from core.messages import load_message from core.time import now message_cache = load_message().messages def run_from_api(): """ check if framework run from API to prevent any alert Returns: ...
harness/determined/common/declarative_argparse.py
RAbraham/determined
1,729
12653945
import functools import itertools from argparse import SUPPRESS, ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace from typing import Any, Callable, List, NamedTuple, Optional, Tuple, cast def make_prefixes(desc: str) -> List[str]: parts = desc.split("|") ret = [parts[0]] for part in parts[1:]: ...
extraPackages/pyzmq-17.1.2/examples/security/grasslands.py
dolboBobo/python3_ios
130
12653990
#!/usr/bin/env python ''' No protection at all. All connections are accepted, there is no authentication, and no privacy. This is how ZeroMQ always worked until we built security into the wire protocol in early 2013. Internally, it uses a security mechanism called "NULL". Author: <NAME> ''' import zmq ctx = z...
src/ralph/security/models.py
DoNnMyTh/ralph
1,668
12654018
<gh_stars>1000+ # -*- coding: utf-8 -*- from datetime import datetime from dj.choices import Choices from django.db import models from django.utils.translation import ugettext_lazy as _ from ralph.assets.models.base import BaseObject from ralph.lib.mixins.models import ( AdminAbsoluteUrlMixin, TaggableMixin, ...
leetcode.com/python/208_Implement_Trie_(Prefix_Tree).py
XSoyOscar/Algorithms
713
12654064
<gh_stars>100-1000 class TrieNode: def __init__(self): self.flag = False self.children = {} class Trie(object): def __init__(self): """ Initialize your data structure here. """ self.root = TrieNode() def insert(self, word): """ Inserts a ...
Exec/science/flame_wave/analysis/profile2.py
MargotF/Castro
178
12654075
<gh_stars>100-1000 import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 100, 1000) H = 50 delta = 2.5 T_base = 2 T_star = 1 T = T_star + 0.5*(T_base - T_star)*(1.0 + np.tanh((x - (H) - 1.5*delta)/(0.5*delta))) plt.plot(x, T) plt.plot([H, H], [1, T_base]) plt.plot([H+3*delta, H+3*delta], [1, T_base...
src/genie/libs/parser/ios/show_routing.py
balmasea/genieparser
204
12654082
'''show_route.py IOS parsers for the following show commands: * show ip route * show ip route vrf <vrf> * show ipv6 route * show ipv6 route vrf <vrf> * show ip route <Hostname or A.B.C.D> * show ip route vrf <vrf> <Hostname or A.B.C.D> * show ipv6 route <Hostname or 2001:DB8:64:79::C:D> ...
mpunet/augmentation/__init__.py
alexsosn/MultiPlanarUNet
156
12654089
from .augmenters import Elastic2D, Elastic3D
pyzoo/test/zoo/pipeline/inference/test_inference_model.py
limn2o4/analytics-zoo
2,970
12654169
<reponame>limn2o4/analytics-zoo # # Copyright 2018 Analytics Zoo 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 require...
qcodes/instrument_drivers/Minicircuits/USBHIDMixin.py
riju-pal/QCoDeS_riju
223
12654171
""" A mixin module for USB Human Interface Device instruments """ import os import time import struct from typing import Optional, List, Any try: import pywinusb.hid as hid except ImportError: # We will raise a proper error when we attempt to instantiate a driver. # Raising an exception here will cause CI ...
recipes/tcsbank-uconfig/all/conanfile.py
rockandsalt/conan-center-index
562
12654180
<gh_stars>100-1000 from conans import ConanFile, tools from conans.errors import ConanInvalidConfiguration import os required_conan_version = ">=1.33.0" class TCSBankUconfigConan(ConanFile): name = "tcsbank-uconfig" description = "Lightweight, header-only, C++17 configuration library" topics = ("conan",...
WEEKS/CD_Sata-Structures/_RESOURCES/python-prac/src/operators/test_membership.py
webdevhub42/Lambda
12,869
12654181
"""Membership operators @see: https://www.w3schools.com/python/python_operators.asp Membership operators are used to test if a sequence is presented in an object. """ def test_membership_operators(): """Membership operators""" # Let's use the following fruit list to illustrate membership concept. fruit...
opps/bin/opps-admin.py
jeanmask/opps
159
12654188
<reponame>jeanmask/opps #!/usr/bin/env python # -*- coding: utf-8 -*- import argparse from django.conf import settings from django.core import management settings.configure() if __name__ == "__main__": parser = argparse.ArgumentParser(description='Opps CMS bin file') parser.add_argument('operation', help='tas...
setup.py
undertuga/papa-nicolau
147
12654189
<gh_stars>100-1000 #!/usr/bin/env python from setuptools import setup, find_packages import scrape import os def read(*names): values = dict() extensions = [".txt", ".rst"] for name in names: value = "" for extension in extensions: filename = name + extension if os...
docs/nb_gen_tests/conftest.py
progwriter/pybatfish
160
12654199
<reponame>progwriter/pybatfish<gh_stars>100-1000 # coding: utf-8 from os.path import abspath, dirname, realpath from pathlib import Path import pytest import yaml from pybatfish.client.session import Session _THIS_DIR: Path = Path(abspath(dirname(realpath(__file__)))) _DOC_DIR: Path = _THIS_DIR.parent _QUESTIONS_YAM...
empire/server/modules/python/situational_awareness/host/osx/situational_awareness.py
chenxiangfang/Empire
2,541
12654205
<reponame>chenxiangfang/Empire from __future__ import print_function from builtins import object from builtins import str from typing import Dict from empire.server.common.module_models import PydanticModule class Module(object): @staticmethod def generate(main_menu, module: PydanticModule, params: Dict, ob...
boto3_type_annotations_with_docs/boto3_type_annotations/ec2/waiter.py
cowboygneox/boto3_type_annotations
119
12654222
from typing import Dict from typing import List from botocore.waiter import Waiter class BundleTaskComplete(Waiter): def wait(self, BundleIds: List = None, Filters: List = None, DryRun: bool = None, WaiterConfig: Dict = None): """ Polls :py:meth:`EC2.Client.describe_bundle_tasks` every 15 seconds ...
tests/schedules/test_adjustments.py
nicolasiltis/prefect
8,633
12654256
<reponame>nicolasiltis/prefect from datetime import timedelta import pendulum import pytest import prefect.schedules.adjustments as adjustments import prefect.schedules.filters @pytest.mark.parametrize( "interval", [ timedelta(days=1), timedelta(seconds=0), timedelta(days=-1), ...
samples/client/petstore/python/tests/test_configuration.py
MalcolmScoffable/openapi-generator
11,868
12654260
<reponame>MalcolmScoffable/openapi-generator # coding: utf-8 # flake8: noqa """ Run the tests. $ pip install nose (optional) $ cd petstore_api-python $ nosetests -v """ from __future__ import absolute_import import unittest import petstore_api class TestConfiguration(unittest.TestCase): """Animal unit test st...
krsh/config/__init__.py
riiid/krsh
133
12654280
<reponame>riiid/krsh # Copyright 2021 AIOps Squad, Riiid Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
tests/bento_service_examples/local_dependencies/local_module/__init__.py
co42/BentoML
3,451
12654293
<reponame>co42/BentoML def dependency_in_local_module_directory(foo): return foo
src/test-apps/happy/bin/weave-bdx.py
robszewczyk/openweave-core
249
12654304
<reponame>robszewczyk/openweave-core #!/usr/bin/env python3 # # Copyright (c) 2015-2017 Nest Labs, 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...
spytest/apis/common/redis.py
shubav/sonic-mgmt
132
12654316
import re import json from spytest import st APPL_DB = "APPL_DB" ASIC_DB = "ASIC_DB" COUNTERS_DB = "COUNTERS_DB" LOGLEVEL_DB = "LOGLEVEL_DB" CONFIG_DB = "CONFIG_DB" PFC_WD_DB = "PFC_WD_DB" FLEX_COUNTER_DB = "FLEX_COUNTER_DB" STATE_DB = "STATE_DB" SNMP_OVERLAY_DB = "SNMP_OVERLAY_DB" ERROR_DB = "ERROR_DB" ############...
note5/code/cnn.py
fluffyrita/LearnPaddle
367
12654323
# coding:utf-8 import paddle.v2 as paddle # 卷积神经网络LeNet-5,获取分类器 def convolutional_neural_network(datadim, type_size): image = paddle.layer.data(name="image", type=paddle.data_type.dense_vector(datadim)) # 第一个卷积--池化层 conv_pool_1 = paddle.networks.simple_img_conv_pool(input=ima...
sample models/Bank, 3 clerks (resources).py
akharitonov/salabim
151
12654334
# Bank, 3 clerks (resources).py import salabim as sim class CustomerGenerator(sim.Component): def process(self): while True: Customer() yield self.hold(sim.Uniform(5, 15).sample()) class Customer(sim.Component): def process(self): yield self.request(clerks) yi...
underworld/libUnderworld/configure.py
longgangfan/underworld2
116
12654363
#!/usr/bin/env python3 import sys, subprocess subp = subprocess.Popen( 'python3 `which scons` --config=force -f SConfigure ' + ' '.join(sys.argv[1:]), shell=True ) subp.wait() # return the return code sys.exit(subp.returncode)
django_su/forms.py
marknotfound/django-su
123
12654372
<reponame>marknotfound/django-su<gh_stars>100-1000 # -*- coding: utf-8 -*- from django import forms from django.conf import settings from django.contrib.auth import get_user_model from django.utils.translation import ugettext_lazy as _ User = get_user_model() class UserSuForm(forms.Form): username_field = User...
nel/util.py
psyML/nel
196
12654374
import six import Queue import socket import multiprocessing from time import time from itertools import chain from collections import defaultdict from bisect import bisect_left, bisect_right from contextlib import contextmanager from nel import logging log = logging.getLogger() def get_from_module(cid, mod_params, ...
tests/core/sinkhorn_test.py
MUCDK/ott
232
12654386
# coding=utf-8 # Copyright 2021 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 ...
scvelo/core/tests/test_arithmetic.py
WeilerP/scvelo
272
12654393
<gh_stars>100-1000 from typing import List from hypothesis import given from hypothesis import strategies as st from hypothesis.extra.numpy import arrays import numpy as np from numpy import ndarray from numpy.testing import assert_almost_equal, assert_array_equal from scvelo.core import clipped_log, invert, prod_su...
modules/imdb.py
nikolas/jenni
133
12654418
<filename>modules/imdb.py # -*- coding: utf8 -*- ''' imdb.py - jenni Movie Information Module Copyright 2014-2015, yano, yanovich.net Copyright 2012, <NAME>, <<EMAIL>> Licensed under the Eiffel Forum License 2. This module relies on omdbapi.com More info: * jenni: https://github.com/myano/jenni/ * Phenny: http://in...
django_apscheduler/migrations/0007_auto_20200717_1404.py
calledbert/django-apscheduler
331
12654442
<gh_stars>100-1000 # Generated by Django 2.2.14 on 2020-07-17 12:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("django_apscheduler", "0006_remove_djangojob_name"), ] operations = [ migrations.AlterField( model_name="djan...
deep_autoencoder.py
Abdel-Moussaoui/Auto-encoders
122
12654444
from keras.layers import Input, Dense from keras.models import Model from keras.datasets import mnist from keras import backend as K import numpy as np import matplotlib.pyplot as plt import pickle # Deep Autoencoder features_path = 'deep_autoe_features.pickle' labels_path = 'deep_autoe_labels.pickle' # this is the ...
pytext/utils/tests/label_test.py
dmitryvinn/pytext
6,199
12654451
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import unittest import numpy as np from pytext.utils import label class LabelUtilTest(unittest.TestCase): def test_get_label_weights(self): vocab = {"foo": 0, "bar": 1} weights = {"foo": 3.2, "foobar": ...
test/samples-python/simple.py
voltek62/vscode-ipe
227
12654456
print('hello') print('how are you') print(2+4*2)
Lib/test/test_compiler/testcorpus/53_list_comp_method.py
diogommartins/cinder
1,886
12654457
<gh_stars>1000+ [x for x in s].copy()
tooling/ddsketch-reference-generator/main.py
TimonPost/metrics
506
12654521
#!/usr/bin/env python3 import argparse from ddsketch.ddsketch import LogCollapsingLowestDenseDDSketch import numpy as np import os def main(): parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('input', type=argparse.FileType('r')) parser.add_argument('output', type...
jionlp/util/funcs.py
ji3g4m6zo6/JioNLP
1,063
12654554
# -*- coding=utf-8 -*- # library: jionlp # author: dongrixinyu # license: Apache License 2.0 # Email: <EMAIL> # github: https://github.com/dongrixinyu/JioNLP # description: Preprocessing tool for Chinese NLP def bracket(regular_expression): return ''.join([r'(', regular_expression, r')']) def bracket_absence(re...
awx/main/migrations/_scan_jobs.py
bhyunki/awx
11,396
12654567
<reponame>bhyunki/awx import logging logger = logging.getLogger('awx.main.migrations') def remove_scan_type_nodes(apps, schema_editor): WorkflowJobTemplateNode = apps.get_model('main', 'WorkflowJobTemplateNode') WorkflowJobNode = apps.get_model('main', 'WorkflowJobNode') for cls in (WorkflowJobNode, Wo...
api/ui_config.py
fanbyprinciple/gpt3-sandbox
2,514
12654618
"""Class to store customized UI parameters.""" class UIConfig(): """Stores customized UI parameters.""" def __init__(self, description='Description', button_text='Submit', placeholder='Default placeholder', show_example_form=False): self.description ...
plenum/test/pp_seq_no_restoration/test_node_erases_last_sent_pp_key_on_view_change.py
jandayanan/indy-plenum
148
12654641
<gh_stars>100-1000 import pytest from plenum.common.constants import LAST_SENT_PRE_PREPARE from plenum.test import waits from plenum.test.helper import sdk_send_batches_of_random, assertExp from plenum.test.test_node import ensureElectionsDone, getPrimaryReplica from plenum.test.view_change.helper import ensure_view_c...
utils/gapy/traces.py
00-01/gap_sdk
118
12654693
# # Copyright (C) 2019 GreenWaves Technologies # # 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 t...
pysbd/utils.py
gaganmanku96/pySBD
429
12654695
<reponame>gaganmanku96/pySBD #!/usr/bin/env python # -*- coding: utf-8 -*- import re import pysbd class Rule(object): def __init__(self, pattern, replacement): self.pattern = pattern self.replacement = replacement def __repr__(self): # pragma: no cover return '<{} pattern="{}" and re...
rasa_nlu_gao/classifiers/kashgari_intent_classifier.py
GaoQ1/rasa_nlu_gq
298
12654696
import logging from typing import List, Text, Any, Optional, Dict from rasa_nlu_gao.classifiers import INTENT_RANKING_LENGTH from rasa.nlu.components import Component from rasa.nlu.model import Metadata from rasa.nlu.training_data import Message import os import shutil import kashgari from kashgari.embeddings import ...
pool_automation/roles/perf_scripts/molecule/resources/tests/test_configured.py
Rob-S/indy-node
627
12654701
import pytest testinfra_hosts = ['clients'] def test_pool_txns_genesis_file_exists(host, pool_txns_path): txns_file = host.file(pool_txns_path) assert txns_file.exists def test_perf_processes_can_connect(host, venv_path, pool_txns_path): assert host.run( "{}/bin/perf_processes.py --test_conn -g...
non_semantic_speech_benchmark/export_model/model_conversion_beam_main_test.py
DionysisChristopoulos/google-research
23,901
12654711
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
osp/workers/server.py
davidmcclure/open-syllabus-project
220
12654772
<filename>osp/workers/server.py import os from osp.common import config from osp.common.utils import partitions from flask import Flask, request from rq_dashboard import RQDashboard from pydoc import locate # RQ dashboard: app = Flask(__name__) RQDashboard(app) @app.route('/ping') def ping(): return ('pong'...
setup.py
ronny-rentner/UltraDict
131
12654797
from pathlib import Path from setuptools import setup, Extension import Cython.Build # read the contents of your README file this_directory = Path(__file__).parent long_description = (this_directory / "README.md").read_text() version = '0.0.4' ext = Extension(name="UltraDict", sources=["UltraDict.py"]) setup( n...
book/lists/unordered_list_test.py
Web-Dev-Collaborative/algos
153
12654803
import unittest from unordered_list import UnorderedList class CorrectnessTest(unittest.TestCase): def test_adding(self): l = UnorderedList() self.assertEqual(l.size(), 0) self.assertTrue(l.is_empty()) l.add(1) self.assertEqual(l.size(), 1) self.assertEqual(l.head....
interpolation/smolyak/tests/test_derivatives.py
vishalbelsare/interpolation.py
110
12654816
def test_derivatives(): from ..interp import SmolyakInterp from ..grid import SmolyakGrid d = 5 N = 100 mu = 2 f = lambda x: (x).sum(axis=1) import numpy.random ub = numpy.random.random(d) + 6 lb = numpy.random.random(d) - 5 sg = SmolyakGrid(d, mu, lb=lb, ub=ub) values =...
tests/integration/test_ddp_summarization.py
Anita1017/nlp-recipes
4,407
12654872
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os import pytest import torch @pytest.mark.gpu @pytest.mark.integration def test_ddp_extractive_summarization_cnndm_transformers(scripts, tmp): ddp_env = os.environ.copy() ddp_env["OMP_NUM_THREADS"] = str(torc...
recipes/Python/572158_Pythhelper_open_SciTe_sessifiles_Windows/recipe-572158.py
tdiprima/code
2,023
12654879
# script to load SciTe .session files by double-clicking them in Windows Explorer # the .session file type must be present and its 'open" command associated with : # "/path/to/python.exe" "/path/to/scite.py" "%1" # NOTE: /path/to/scite.py MUST be the same as /path/to/scite.exe ! # Example : # "c:\python\python.exe"...
fastmri_recon/tests/data/datasets/fastmri_pyfunc_non_cartesian_test.py
samiulshuvo/fastmri-reproducible-benchmark
105
12654890
import numpy as np import pytest import tensorflow as tf from fastmri_recon.data.datasets.fastmri_pyfunc_non_cartesian import train_nc_kspace_dataset_from_indexable image_shape = [2, 640, 322, 1] af = 4 us = af / (2 / np.pi) image_size = [640, 474] kspace_shape = [image_shape[0], 1, 640 * (474//af), 1] file_contrast...
tests/unit/test_remove_script_semicolon.py
jtalmi/pre-commit-dbt
153
12654907
import io import pytest from pre_commit_dbt.check_script_semicolon import check_semicolon from pre_commit_dbt.remove_script_semicolon import main # Input, expected return value, expected output TESTS = ( (b"foo\n", 0, b"foo\n"), (b"", 0, b""), (b"\n\n", 0, b"\n\n"), (b"\n\n\n\n", 0, b"\n\n\n\n"), ...
src/python/platforms/linux/lkl/constants.py
mi-ac/clusterfuzz
5,023
12654913
<reponame>mi-ac/clusterfuzz # Copyright 2020 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 l...
Projects/Healthcare/breast-cancer/src/heatmaps/models.py
DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
3,266
12654945
<filename>Projects/Healthcare/breast-cancer/src/heatmaps/models.py # Copyright (C) 2019 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAM...
dev/Gems/StarterGame/Environment/Assets/renamer.py
brianherrera/lumberyard
1,738
12654947
<reponame>brianherrera/lumberyard import os import shutil from os import path def main(): for filename in os.listdir("."): print(filename) originalFilename = filename filename = filename.lower() filename = filename.replace("am_", "") os.rename(originalFilename, filename) ...
Chapter 01/1.12.py
ACsBlack/Tkinter-GUI-Application-Development-Blueprints-Second-Edition
120
12654950
""" Code illustration: 1.12 A demonstration of tkinter styling @Tkinter GUI Application Development Blueprints """ import tkinter as tk root = tk.Tk() root.configure(background='#4D4D4D') #top level styling # connecting to the external styling optionDB.txt root.option_readfile('optionDB.txt') #widget specific styl...
AutotestWebD/apps/user_center/views/user_uri_conf.py
yangjourney/sosotest
422
12654960
<gh_stars>100-1000 from apps.common.func.CommonFunc import * from django.db.models import Max from apps.common.func.LanguageFunc import * from django.shortcuts import render, HttpResponse from all_models.models import * from urllib import parse from apps.user_center.services.user_uriService import user_uriService from ...
tests/test_fiona.py
paultimothymooney/docker-python-2
2,030
12654974
import unittest import fiona import pandas as pd class TestFiona(unittest.TestCase): def test_read(self): with fiona.open("/input/tests/data/coutwildrnp.shp") as source: self.assertEqual(67, len(source))
webmagic-scripts/src/main/resources/python/oschina.py
AngelPASTORROJAS/L3S6-GL-webmagic-PASTOR_ROJAS-BENAOUD
11,052
12654988
title=xpath("div[@class=BlogTitle]") urls="http://my\\.oschina\\.net/flashsword/blog/\\d+" result={"title":title,"urls":urls}
Chapter 07/responsive.py
ACsBlack/Tkinter-GUI-Application-Development-Blueprints-Second-Edition
120
12655004
<filename>Chapter 07/responsive.py ''' Chapter 7 A demonstration of a responsive window using Grid.rowconfigure and Grid.columnconfigure ''' from tkinter import Tk, Button, Grid root = Tk() for x in range(10): btn = Button(root, text=x ) btn.grid(column=x, row=1, sticky='nsew') Grid.rowconfigure(root, ...
tracker/test_utils.py
rcaudill/SkyScan
223
12655037
"""Unit tests for utils.py""" import pytest from utils import bearing, calc_travel, coordinate_distance, deg2rad, elevation def test_deg2rad(): """Unit tests for deg2rad().""" # Note: python's math package includes a radians function that # converts degrees to radians. This function could be eliminated ...
src/genie/libs/parser/iosxe/tests/ShowL2fibBdPort/cli/equal/golden_output1_expected.py
balmasea/genieparser
204
12655051
<gh_stars>100-1000 expected_output = { 'Et0/2:12': { 'type': 'BD_PORT', 'is_path_list': False, 'port': 'Et0/2:12' }, '[IR]20012:2.2.2.2': { 'type':'VXLAN_REP', 'is_path_list': True, 'path_list': { 'id': 1191, 'path_count': 1, ...
apischema/deserialization/flattened.py
wyfo/apimodel
118
12655055
from typing import Iterator, Mapping, Sequence, Type from apischema.conversions.conversions import DefaultConversion from apischema.conversions.visitor import DeserializationVisitor from apischema.objects import ObjectField from apischema.objects.visitor import DeserializationObjectVisitor from apischema.types import ...
tests/test_api_bugs.py
lukasschwab/arxiv.py
553
12655073
<filename>tests/test_api_bugs.py """ Tests for work-arounds to known arXiv API bugs. """ import arxiv import unittest class TestClient(unittest.TestCase): def test_missing_title(self): """ Papers with the title "0" do not have a title element in the Atom feed. It's unclear whether other f...
examples/real_data/classification_test.py
mens-artis/Auto-PyTorch
1,657
12655086
<filename>examples/real_data/classification_test.py __author__ = "<NAME>, <NAME> and <NAME>" __version__ = "0.0.1" __license__ = "BSD" import os, sys sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..", ".."))) import logging from autoPyTorch import AutoNetClassification from autoPyTorch.data_manageme...
analysis/control/type_util.py
leozz37/makani
1,178
12655136
# Copyright 2020 Makani Technologies 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...
scripts/generate_mapped_file.py
abhim00/pileup.js
281
12655148
<gh_stars>100-1000 #!/usr/bin/env python ''' This script generates mapped files for use with test/MappedRemotedFile.js. Usage: $ cat <END http://path/to/file.txt [[0, 1234], [5678, 6789]] END ... Wrote file.mapped.txt Use with: new MappedRemoteFile('file.mapped.txt', [ [0, 1234], ...
seleniumwire/thirdparty/mitmproxy/net/http/http1/__init__.py
KozminMoci/selenium-wire
975
12655160
<filename>seleniumwire/thirdparty/mitmproxy/net/http/http1/__init__.py from .assemble import assemble_body, assemble_request, assemble_request_head, assemble_response, assemble_response_head from .read import (connection_close, expected_http_body_size, read_body, read_request, read_request_head, read...
scripts/__init__.py
owid/co2-data
245
12655179
import os CURRENT_DIR = os.path.dirname(__file__) INPUT_DIR = os.path.join(CURRENT_DIR, "input") OUTPUT_DIR = os.path.join(CURRENT_DIR, "..")
macarico/lts/behavioral_cloning.py
bgalbraith/macarico
121
12655207
from __future__ import division, generators, print_function import macarico class BehavioralCloning(macarico.Learner): def __init__(self, policy, reference): macarico.Learner.__init__(self) assert isinstance(policy, macarico.CostSensitivePolicy) self.policy = policy self.reference ...
DQM/HcalTasks/python/TestTask.py
ckamtsikis/cmssw
852
12655224
<reponame>ckamtsikis/cmssw import FWCore.ParameterSet.Config as cms testTask = cms.EDAnalyzer( "TestTask", # standard name = cms.untracked.string("TestTask"), debug = cms.untracked.int32(0), runkeyVal = cms.untracked.int32(0), runkeyName = cms.untracked.string("pp_run"), tagHF = cms.untracked.InputTag("qie10D...
training_dataset/yt_bb/visual.py
Anonymous502/siamfda-for-eccv
4,318
12655240
import glob import pandas as pd import numpy as np import cv2 visual = True col_names = ['youtube_id', 'timestamp_ms', 'class_id', 'class_name', 'object_id', 'object_presence', 'xmin', 'xmax', 'ymin', 'ymax'] df = pd.DataFrame.from_csv('yt_bb_detection_validation.csv', header=None, index_col=False) df.c...
packages/pyright-internal/src/tests/samples/dataclassTransform4.py
Microsoft/pyright
3,934
12655243
# This sample tests the case where a field descriptor has an implicit # "init" parameter type based on an overload. from typing import ( Any, Callable, Literal, Optional, Tuple, Type, TypeVar, Union, overload, ) T = TypeVar("T") class ModelField: def __init__( self, ...
optimus/engines/cudf/io/save.py
ironmussa/Optimus
1,045
12655247
<reponame>ironmussa/Optimus<filename>optimus/engines/cudf/io/save.py import warnings import pandavro as pdx from optimus.engines.base.io.save import BaseSave from optimus.helpers.logger import logger from optimus.helpers.types import * from optimus.engines.base.io.save import BaseSave class Save(BaseSave): def...
notebook/str_swap.py
vhn0912/python-snippets
174
12655251
s = 'one two one two one' print(s.replace('one', 'two').replace('two', 'one')) # one one one one one print(s.replace('one', 'X').replace('two', 'one').replace('X', 'two')) # two one two one two def swap_str(s_org, s1, s2, temp='*q@w-e~r^'): return s_org.replace(s1, temp).replace(s2, s1).replace(temp, s2) print(...
pycoin/coins/bitcoin/SolutionChecker.py
jaschadub/pycoin
1,210
12655252
<gh_stars>1000+ from .ScriptTools import BitcoinScriptTools from .VM import BitcoinVM from ...encoding.bytes32 import from_bytes_32 from pycoin.satoshi import errno from pycoin.satoshi.flags import ( SIGHASH_NONE, SIGHASH_SINGLE, SIGHASH_ANYONECANPAY, VERIFY_P2SH, VERIFY_SIGPUSHONLY, VERIFY_CLEANSTACK, VE...
app/model/base.py
snowdensb/braindump
631
12655270
<filename>app/model/base.py from datetime import datetime from app import db class Base(db.Model): __abstract__ = True id = db.Column(db.Integer, primary_key=True) created_date = db.Column(db.DateTime, index=True, default=datetime.utcnow) updated_date = db.Column(db.DateTime, index=True, default=datet...
hls4ml/backends/vivado/passes/garnet_templates.py
jaemyungkim/hls4ml
380
12655276
<filename>hls4ml/backends/vivado/passes/garnet_templates.py import numpy as np from hls4ml.model.types import FixedPrecisionType from hls4ml.backends.fpga.fpga_types import APTypeConverter from hls4ml.model.layers import GarNet, GarNetStack from hls4ml.backends.template import LayerConfigTemplate, FunctionCallTemplate...
xception_tf/test_tf_xception.py
rickyHong/Light-Head-RCNN-enhanced-Xdetector
116
12655293
<gh_stars>100-1000 import numpy as np import sys import os import tensorflow as tf import tf_xception_ input_placeholder, output = tf_xception_.KitModel('./xception.npy') for var in tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES): print(var.op.name) with tf.Session() as sess: init = tf.global_variables_...
datadog_nagios_plugin_wrapper/checks.d/nagios_plugin_wrapper.py
nadaj/Miscellany
155
12655297
import re from datadog_checks.base import AgentCheck from datadog_checks.base.errors import CheckException from datadog_checks.utils.subprocess_output import get_subprocess_output __version__ = "1.0.0" __author__ = "<NAME> <<EMAIL>>" class NagiosPluginWrapperCheck(AgentCheck): PERFDATA_RE = ( r"([^\s]+|'[...
backend/src/publisher/processing/pubsub.py
rutvikpadhiyar000/github-trends
157
12655331
<gh_stars>100-1000 from typing import Optional from src.utils.pubsub import publish_to_topic def publish_user(user_id: str, access_token: Optional[str] = None): publish_to_topic("user", {"user_id": user_id, "access_token": access_token})
mGui/examples/basicList.py
theodox/mGui
105
12655350
<filename>mGui/examples/basicList.py import maya.cmds as cmds import random from mGui import gui, forms, lists from mGui.bindings import bind from mGui.observable import ViewCollection def basic_list_binding(): ''' Illustrates the basics of binding to a list. The collection 'bound' contains some strings, an...
example/PUR/trainPUR-Reg.py
csiro-hydroinformatics/hydroDL
109
12655364
<reponame>csiro-hydroinformatics/hydroDL import sys sys.path.append('../') from hydroDL import master from hydroDL.master import default from hydroDL.data import camels from hydroDL.model import rnn, crit, train import json import os import numpy as np import torch import random # Options for different interface in...
worldengine/simulations/humidity.py
ctittel/worldengine
946
12655369
from worldengine.simulations.basic import find_threshold_f import numpy class HumiditySimulation(object): @staticmethod def is_applicable(world): return world.has_precipitations() and world.has_irrigation() and ( not world.has_humidity()) def execute(self, world, seed): assert...
Cython/Build/Tests/TestCyCache.py
smok-serwis/cython
6,663
12655383
<filename>Cython/Build/Tests/TestCyCache.py<gh_stars>1000+ import difflib import glob import gzip import os import tempfile import Cython.Build.Dependencies import Cython.Utils from Cython.TestUtils import CythonTest class TestCyCache(CythonTest): def setUp(self): CythonTest.setUp(self) self.tem...
models/ClassicNetwork/blocks/inception_blocks.py
Dou-Yu-xuan/deep-learning-visal
150
12655386
# -*- coding:UTF-8 -*- """ implementation of Inception blocks with pytorch @<NAME> 2020_09_011 """ import torch import torch.nn as nn import torch.nn.functional as F from models.blocks.conv_bn import BN_Conv2d class Stem_v4_Res2(nn.Module): """ stem block for Inception-v4 and Inception-RestNet-v2 """ ...
django_email_verification/views.py
eborchert/django-email-validation
208
12655401
from django.conf import settings from django.shortcuts import render from .confirm import verify_token, verify_view from .errors import NotAllFieldCompiled @verify_view def verify(request, token): try: template = settings.EMAIL_PAGE_TEMPLATE if not isinstance(template, str): raise Att...
aliyun-python-sdk-ecs/aliyunsdkecs/request/v20140526/CreateAutoProvisioningGroupRequest.py
yndu13/aliyun-openapi-python-sdk
1,001
12655410
<filename>aliyun-python-sdk-ecs/aliyunsdkecs/request/v20140526/CreateAutoProvisioningGroupRequest.py<gh_stars>1000+ # 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 ow...
examples/federated_learning/surface_defect_detection_v2/aggregate.py
hithxh/sedna
311
12655416
<gh_stars>100-1000 # Copyright 2021 The KubeEdge 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 ...
基础教程/A2-神经网络基本原理/第5步 - 非线性分类/src/ch10-NonLinearBinaryClassification/HelperClass2/ClassifierFunction_2_0.py
microsoft/ai-edu
11,094
12655435
<reponame>microsoft/ai-edu<gh_stars>1000+ # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for full license information. """ Version 2.0 """ import numpy as np class CClassifier(object): def forward(self, z): pass # equal to sigmoid b...
cookie.py
playplaying/NoXss
401
12655496
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- """Do some work about cookie""" import os import re import time from config import COOKIE_DIR from log import LOGGER __author__ = 'longwenzhang' def is_ip(domain): if re.search(r'\d{1,3}\.\d{1,3}\.\d{1,3}',domain): return True...
generator/tests/documenting_language_model_test.py
romulobusatto/google-api-php-client-services
709
12655534
#!/usr/bin/python2.7 # Copyright 2012 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/licenses/LICENSE-2.0 # # Unless requi...
config_utils.py
snakeztc/NeuralDialog-CVAE
329
12655543
# Copyright (C) 2017 <NAME>, Carnegie Mellon University class KgCVAEConfig(object): description= None use_hcf = True # use dialog act in training (if turn off kgCVAE -> CVAE) update_limit = 3000 # the number of mini-batch before evaluating the model # how to encode utterance. # bow: add word...
tools/c7n_openstack/c7n_openstack/resources/server.py
al3pht/cloud-custodian
2,415
12655544
from c7n_openstack.query import QueryResourceManager, TypeInfo from c7n_openstack.provider import resources from c7n.utils import local_session from c7n.utils import type_schema from c7n.filters import Filter from c7n.filters import AgeFilter @resources.register('server') class Server(QueryResourceManager): class...