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
python/GafferUI/Button.py
ddesmond/gaffer
561
11002361
########################################################################## # # Copyright (c) 2011, <NAME>. All rights reserved. # Copyright (c) 2011-2012, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
example/pyctp/ctp_mock.py
mmmaaaggg/pyctp_lovelylain
358
11002364
<reponame>mmmaaaggg/pyctp_lovelylain # -*- coding: utf-8 -*- ''' 对CTP进行mock,目的有二: 1. 为agent提供桩机,便于agent功能的开发和测试 2. 结合实时行情,测试策略的实时信号 3. 结合历史ticks行情,对策略进行确认测试 TODO: 为真实起见,在mock中采用Command模式 桩机控制: (数据播放循环) 数据播放 触发Agent数据准备 触发Agent策略执行 触发API桩机-->Command 控制器触发SPI ... ...
dogpile/cache/__init__.py
SandySalvatore/dogpile_cache_release
152
11002368
__version__ = '0.5.4' from .region import CacheRegion, register_backend, make_region
test/test_agentmanager.py
AndersBlomdell/python-networkmanager
128
11002410
<filename>test/test_agentmanager.py from test import * class AgentManagerTest(TestCase): def test_registration(self): NetworkManager.AgentManager.Register('python-network-manager-test') NetworkManager.AgentManager.Unregister() if __name__ == '__main__': unittest.main()
util_scripts/histogram_radii.py
ShuaiW/kaggle-heart
182
11002442
<reponame>ShuaiW/kaggle-heart import cPickle as pickle import matplotlib.pyplot as plt d = pickle.load(open("pkl_train_slice2roi.pkl")) d.update(pickle.load(open("pkl_validate_slice2roi.pkl"))) c = pickle.load(open("pkl_train_metadata.pkl")) c.update(pickle.load(open("pkl_validate_metadata.pkl"))) slice_radius = [...
aces_1.1/python/aces_ocio/colorspaces/sony.py
Someguy300/OpenColorIO-Configs
409
11002443
<reponame>Someguy300/OpenColorIO-Configs #!/usr/bin/env python # -*- coding: utf-8 -*- # SPDX-License-Identifier: AMPAS # Copyright Academy of Motion Picture Arts and Sciences """ Implements support for *Sony* colorspaces conversions and transfer functions. """ from __future__ import division import array import os ...
services/ui_backend_service/api/utils.py
Netflix/metaflow-service
103
11002452
import json import os import re import time from collections import deque from typing import Callable, Dict, List, Tuple from urllib.parse import parse_qsl, urlsplit from aiohttp import web from multidict import MultiDict from services.data.db_utils import DBPagination, DBResponse from services.utils import format_bas...
Lib/site-packages/django/contrib/admin/templatetags/admin_static.py
Lucas11200/LocaPy
304
11002461
<filename>Lib/site-packages/django/contrib/admin/templatetags/admin_static.py import warnings from django.template import Library from django.templatetags.static import static as _static from django.utils.deprecation import RemovedInDjango30Warning register = Library() @register.simple_tag def static(path): war...
paddlenlp/transformers/ernie_ctm/modeling.py
zzz2010/PaddleNLP
7,091
11002472
<reponame>zzz2010/PaddleNLP # Copyright (c) 2021 PaddlePaddle 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 ...
corehq/ex-submodules/couchforms/migrations/0006_unfinishedarchivestub_attempts.py
dimagilg/commcare-hq
471
11002486
# -*- coding: utf-8 -*- # Generated by Django 1.11.26 on 2019-12-10 00:08 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('couchforms', '0005_index_cleanup'), ] operations = [ migrations.AddField( ...
posts/migrations/0017_linkedpost.py
lobotomoe/vas3k.club
496
11002500
# Generated by Django 3.1 on 2021-01-15 23:50 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('users', '0020_auto_20200822_0818'), ('posts', '0016_auto_20201115_0912'), ] operations = [ migrations...
plugins/wappalyzer.py
hack654a/w12scan-client
159
11002528
<reponame>hack654a/w12scan-client<filename>plugins/wappalyzer.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Time : 2019/1/29 7:09 PM # @Author : w8ay # @File : wappalyzer.py import json import os import re import warnings from lib.data import PATHS, collector class Wappalyzer(object): """ Python...
darkctf2020/rrop/patch.py
nhtri2003gmail/ctf-write-ups
101
11002530
<filename>darkctf2020/rrop/patch.py #!/usr/bin/env python3 from pwn import * binary = ELF('rrop') binary.asm(binary.symbols['alarm'], 'ret') binary.save('rrop_noalarm') os.chmod('rrop_noalarm',0o755)
nova/tests/functional/regressions/test_bug_1937375.py
zjzh/nova
1,874
11002532
<gh_stars>1000+ # Copyright 2020, Red Hat, 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 required by...
.modules/.theHarvester/discovery/baidusearch.py
termux-one/EasY_HaCk
1,103
11002535
<gh_stars>1000+ import httplib import myparser import time import sys class search_baidu: def __init__(self, word, limit): self.word = word self.total_results = "" self.server = "www.baidu.com" self.hostname = "www.baidu.com" self.userAgent = "(Mozilla/5.0 (Windows; U; Win...
AutotestFramework/core/keywords/ALL_KEYWORD_REGISTERD.py
yangjourney/sosotest
422
11002561
#新增关键字步骤: #1/ 新家关键字类和方法. #2/ __init__.py中引入新增的关键字类 #3/ 在关键字对应产生作用的区域加入注册. #kw的名字的列表,与执行列表要一一对应。 import os from core.tools.CommonFunc import * from core.processor.SelfKeywordProcesser import SelfKeywordProcesser mypath = os.path.dirname(os.path.abspath(__file__)).replace("\\","/") kwKeyList = [] for root, dirs, files i...
test/structure/test_cells.py
MSimoncelli/phonopy
127
11002562
"""Tests of routines in cells.py.""" import os import numpy as np import pytest from phonopy import Phonopy from phonopy.interface.phonopy_yaml import read_cell_yaml from phonopy.structure.atoms import PhonopyAtoms from phonopy.structure.cells import ( ShortestPairs, TrimmedCell, compute_all_sg_permutatio...
chaospy/distributions/collection/fisk.py
utsekaj42/chaospy
333
11002594
<filename>chaospy/distributions/collection/fisk.py """Fisk or Log-logistic distribution.""" from ..baseclass import SimpleDistribution, ShiftScaleDistribution class fisk(SimpleDistribution): """Fisk or Log-logistic distribution.""" def __init__(self, c=1): super(fisk, self).__init__(dict(c=c)) d...
pptx/exc.py
kckaiwei/python-pptx
1,429
11002599
# encoding: utf-8 """ Exceptions used with python-pptx. The base exception class is PythonPptxError. """ class PythonPptxError(Exception): """Generic error class.""" class PackageNotFoundError(PythonPptxError): """ Raised when a package cannot be found at the specified path. """ class InvalidXml...
website/static/code/day_one_min.py
profread/python
389
11002614
""" A small Python program that uses the GitHub search API to list the top projects by language, based on stars. """ import requests GITHUB_API_URL = "https://api.github.com/search/repositories" def create_query(languages, min_stars=50000): query = f"stars:>{min_stars} " for language in languages: ...
utils/GYBUnicodeDataUtils.py
lwhsu/swift
72,551
11002617
<filename>utils/GYBUnicodeDataUtils.py # ===--- GYBUnicodeDataUtils.py ----------------------*- coding: utf-8 -*-===// # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Except...
practice-ocr/train_code/train_crnn/split_train_test.py
edgardeng/machine-learning-pytorch
387
11002621
<reponame>edgardeng/machine-learning-pytorch<gh_stars>100-1000 import numpy as np h1 = open('infofiles/infofile_selfcollect.txt',encoding='utf-8') h2 = open('infofiles/infofile_selfcollect_train.txt','w',encoding='utf-8') h3 = open('infofiles/infofile_selfcollect_test.txt','w',encoding='utf-8') content = h1.readlines()...
python_bindings/tutorial/lesson_02_input_image.py
shubhamp-ca/Halide
107
11002623
# Halide tutorial lesson 2. # This lesson demonstrates how to pass in input images. # This lesson can be built by invoking the command: # make tutorial_lesson_02_input_image # in a shell with the current directory at the top of the halide source tree. # Otherwise, see the platform-specific compiler invocations bel...
mercury/ep-discover-snmp.py
lixmk/Concierge
108
11002632
<filename>mercury/ep-discover-snmp.py #!/usr/bin/env python # By <NAME> # exfil.co # @lixmk # # This script is part of the Concierge Toolkit # https://github.com/lixmk/Concierge # # Uses SNMP to discover Mercury Security door controllers # Mercury controllers (hardware and/or firmware) are rebranded by several other ve...
cli/tests/test_genesis.py
RomarQ/sawtooth-core
1,530
11002642
<reponame>RomarQ/sawtooth-core # Copyright 2017 Intel Corporation # # 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 app...
tools/mo/openvino/tools/mo/front/kaldi/replace_eltwise_nin1.py
ryanloney/openvino-1
1,127
11002646
# Copyright (C) 2018-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.tools.mo.ops.elementwise import Add, Mul from openvino.tools.mo.ops.split import Split from openvino.tools.mo.front.common.partial_infer.utils import int64_array from openvino.tools.mo.front.common.replacement import FrontR...
python/test-interop.py
togawamanabu/RoboND-DeepRL-Project
852
11002659
#!/usr/bin/python print('hello from test-interop.py script') import argparse parser = argparse.ArgumentParser(description='test-interop') parser.add_argument('--foo', action='store_true',help='foo flag') parser.add_argument('--bar', action='store_true',help='bar flag') args = parser.parse_args() print('foo: ' + str(...
utils/crop_and_resize.py
kylemcdonald/SmileCNN
151
11002668
import numpy as np from skimage.measure import block_reduce def crop_and_resize(img, target_size=32, zoom=1): small_side = int(np.min(img.shape) * zoom) reduce_factor = small_side / target_size crop_size = target_size * reduce_factor mid = np.array(img.shape) / 2 half_crop = crop_size / 2 cente...
tests/integration/test_container_health.py
mifrost/vmware_exporter
315
11002679
<reponame>mifrost/vmware_exporter<gh_stars>100-1000 from pytest_docker_tools import container, build import requests vmware_exporter_image = build(path='.') vmware_exporter = container( image='{vmware_exporter_image.id}', ports={ '9272/tcp': None, }, ) def test_container_starts(vmware_exporter)...
zerver/migrations/0044_reaction.py
TylerPham2000/zulip
17,004
11002681
<gh_stars>1000+ import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("zerver", "0043_realm_filter_validators"), ] operations = [ migrations.CreateModel( name="Reacti...
resotocore/tests/resotocore/web/certificate_handler_test.py
someengineering/resoto
126
11002684
from pathlib import Path from tempfile import TemporaryDirectory from typing import Iterator from arango.database import StandardDatabase from pytest import fixture from resotolib.x509 import bootstrap_ca, load_cert_from_bytes, cert_fingerprint, csr_to_bytes, gen_csr, gen_rsa_key from resotocore.dependencies import e...
Chapter14/telegram_bot.py
haohaoxiao/Deep-Reinforcement-Learning-Hands-On-Second-Edition
621
11002687
<filename>Chapter14/telegram_bot.py #!/usr/bin/env python3 # This module requires python-telegram-bot import os import sys import logging import configparser import argparse try: import telegram.ext except ImportError: print("You need python-telegram-bot package installed " "to start the bot") sy...
tests/test_get_behaviors.py
clamdad/atom
222
11002693
<filename>tests/test_get_behaviors.py<gh_stars>100-1000 # -------------------------------------------------------------------------------------- # Copyright (c) 2013-2021, Nucleic Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with...
owmeta/website.py
marcodafonseca/PyOpenWorm
118
11002697
from rdflib.term import URIRef from owmeta_core.dataobject import DatatypeProperty from . import SCI_CTX from .document import BaseDocument class Website(BaseDocument): """ A representation of a website """ class_context = SCI_CTX url = DatatypeProperty() ''' A URL for the website ''' title =...
step/eval_sem_seg.py
xiaaoo/irn
430
11002735
import numpy as np import os from chainercv.datasets import VOCSemanticSegmentationDataset from chainercv.evaluations import calc_semantic_segmentation_confusion import imageio def run(args): dataset = VOCSemanticSegmentationDataset(split=args.chainer_eval_set, data_dir=args.voc12_root) labels = [dataset.get_...
tests/test_fields.py
lmbringas/drf-extra-fields
537
11002749
<reponame>lmbringas/drf-extra-fields<gh_stars>100-1000 import base64 import copy import datetime import django import imghdr import os from decimal import Decimal import pytest import pytz from django.core.exceptions import ValidationError from django.test import TestCase, override_settings from mock import patch from...
python/389_Find_the_Difference.py
dvlpsh/leetcode-1
4,416
11002750
<gh_stars>1000+ class Solution(object): def findTheDifference(self, s, t): """ :type s: str :type t: str :rtype: str """ res = ord(t[-1]) for i in range(len(s)): res += ord(t[i]) res -= ord(s[i]) return chr(res) # def findT...
self_attention_cv/UnetTr/__init__.py
Siyuan89/self-attention-cv
759
11002760
<reponame>Siyuan89/self-attention-cv from .UnetTr import UNETR
mmtbx/refinement/real_space/fit_small_molecule.py
dperl-sol/cctbx_project
155
11002768
<filename>mmtbx/refinement/real_space/fit_small_molecule.py<gh_stars>100-1000 from __future__ import absolute_import, division, print_function from scitbx.array_family import flex from mmtbx.refinement.real_space import individual_sites from libtbx.test_utils import approx_equal from cctbx import maptbx from libtbx imp...
NeoTrellis_M4_MIDI_Synth/code.py
gamblor21/Adafruit_Learning_System_Guides
665
11002771
<filename>NeoTrellis_M4_MIDI_Synth/code.py """ NeoTrellis M4 Express MIDI synth Adafruit invests time and resources providing this open source code. Please support Adafruit and open source hardware by purchasing products from Adafruit! Written by <NAME> for Adafruit Industries Copyright (c) 2018 Adafruit Industries L...
omnizart/drum/prediction.py
nicolasanjoran/omnizart
1,145
11002819
<filename>omnizart/drum/prediction.py # pylint: disable=E1101 import numpy as np from omnizart.utils import get_logger logger = get_logger("Drum Prediction") def create_batches(feature, mini_beat_per_seg, b_size=6): """Create a 4D input for model prediction. Parameters ---------- feature: 3D numpy...
src/cifar.py
DLPerf/class-balanced-loss
541
11002832
"""CIFAR-10 data set. See http://www.cs.toronto.edu/~kriz/cifar.html. """ import os import tensorflow as tf from data_utils import get_img_num_per_cls HEIGHT = 32 WIDTH = 32 DEPTH = 3 class CifarDataSet(object): """Cifar data set.""" def __init__(self, data_dir, data_vers...
scripts/tests/test_checkin_tests.py
gabehollombe-aws/aws-doc-sdk-examples
5,166
11002841
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """ This script contains tests that verify the checkin_tests script works as expected. """ import pytest import checkin_tests @pytest.mark.parametrize("file_contents,expected_error_count", [ ("Test file con...
src/nanoemoji/color_glyph.py
yisibl/nanoemoji
113
11002855
# 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 law or agreed to in writing, ...
salt/modules/drac.py
ifraixedes/saltstack-salt
9,425
11002865
<filename>salt/modules/drac.py """ Manage Dell DRAC """ import logging import salt.utils.path log = logging.getLogger(__name__) def __virtual__(): if salt.utils.path.which("racadm"): return True return ( False, "The drac execution module cannot be loaded: racadm binary not in path...
tests/file_io/ntfs_file_io.py
dfjxs/dfvfs
176
11002885
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for the file-like object implementation using pyfsntfs.""" import unittest from dfvfs.file_io import ntfs_file_io from dfvfs.lib import definitions from dfvfs.lib import errors from dfvfs.path import factory as path_spec_factory from tests.fil...
infer/base.py
shikhar-srivastava/hover_net
222
11002906
import argparse import glob import json import math import multiprocessing import os import re import sys from importlib import import_module from multiprocessing import Lock, Pool import matplotlib.pyplot as plt import numpy as np import torch import torch.utils.data as data import tqdm from run_utils.utils import c...
examples/agents/random_agent.py
23pointsNorth/gym
112
11002908
<reponame>23pointsNorth/gym import argparse import sys import gym from gym import wrappers, logger class RandomAgent(object): """The world's simplest agent!""" def __init__(self, action_space): self.action_space = action_space def act(self, observation, reward, done): return self.action_s...
setup.py
gokhanagma/nengo
762
11002911
<filename>setup.py #!/usr/bin/env python # Automatically generated by nengo-bones, do not edit this file directly import io import pathlib import runpy try: from setuptools import find_packages, setup except ImportError: raise ImportError( "'setuptools' is required but not installed. To install it, "...
wagtail/contrib/postgres_search/migrations/0001_initial.py
brownaa/wagtail
8,851
11002912
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2017-03-22 14:53 import django.db.models.deletion from django.db import migrations, models import django.contrib.postgres.fields.jsonb import django.contrib.postgres.search from ..models import IndexEntry table = IndexEntry._meta.db_table class Migration(mig...
atomate/qchem/workflows/tests/test_parse_pass_write.py
rkingsbury/atomate
167
11002919
import os import unittest import shutil from atomate.qchem.firetasks.geo_transformations import RotateTorsion from atomate.qchem.firetasks.write_inputs import WriteInputFromIOSet from atomate.qchem.firetasks.parse_outputs import QChemToDb from fireworks import Firework, Workflow, FWorker from fireworks.core.rocket_lau...
cvnets/layers/normalization/group_norm.py
apple/ml-cvnets
209
11002942
<gh_stars>100-1000 # # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from torch import nn, Tensor from typing import Optional, Tuple from . import register_norm_fn @register_norm_fn(name="group_norm") class GroupNorm(nn.GroupNorm): """ Applies a `Group N...
ssds/pipeline/pipeline_anchor_apex.py
ShuangXieIrene/ssds.pytorch
661
11002964
import sys import torch import time from datetime import timedelta from apex import amp import ssds.core.tools as tools import ssds.core.visualize_funcs as vsf from ssds.modeling.layers.box import extract_targets CURSOR_UP_ONE = "\x1b[1A" ERASE_LINE = "\x1b[2K" class ModelWithLossBasic(torch.nn.Module): r""" C...
reviewboard/webapi/resources/base_file_attachment.py
amalik2/reviewboard
921
11002974
<gh_stars>100-1000 from __future__ import unicode_literals from djblets.webapi.fields import IntFieldType, StringFieldType from reviewboard.attachments.models import FileAttachment from reviewboard.webapi.base import WebAPIResource class BaseFileAttachmentResource(WebAPIResource): """A base resource representin...
Tensorflow-tutorials/freeze_model_and_deploy/webapp.py
AathmanT/cv-tricks.com
326
11002984
<reponame>AathmanT/cv-tricks.com import sys import os import flask from flask import render_template, send_from_directory, request, redirect,url_for from werkzeug import secure_filename from flask import jsonify import base64 import StringIO import tensorflow as tf import numpy as np import cv2 # Obtain the flask app ...
examples/pytorch/hilander/utils/misc.py
ketyi/dgl
9,516
11003000
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file re-uses implementation from https://github.com/yl-1993/learn-to-cluster """ import os import time import json import pickle import random import numpy as np class TextColors: HEADER = '\033[35m' OKBLUE = '\033[34m' OKGREEN = '\033[32m' WARNIN...
google/cloud/dialogflow_v2beta1/types/conversation.py
rkdfc93/python-dialogflow
171
11003012
<filename>google/cloud/dialogflow_v2beta1/types/conversation.py # -*- coding: utf-8 -*- # Copyright 2022 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.o...
src/pipx/commands/run_pip.py
mindywallen699/pipx
3,573
11003043
from pathlib import Path from typing import List from pipx.constants import ExitCode from pipx.util import PipxError from pipx.venv import Venv def run_pip( package: str, venv_dir: Path, pip_args: List[str], verbose: bool ) -> ExitCode: """Returns pipx exit code.""" venv = Venv(venv_dir, verbose=verbose)...
intern/cycles/blender/addon/osl.py
noorbeast/blender
365
11003055
<filename>intern/cycles/blender/addon/osl.py # # Copyright 2011-2013 Blender Foundation # # 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 # # Unle...
tests/query/stateless/test_findpath.py
tom-chensf/nebula-graph
816
11003084
# --coding:utf-8-- # # Copyright (c) 2020 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License, # attached with Common Clause Condition 1.0, found in the LICENSES directory. from tests.common.nebula_test_suite import NebulaTestSuite class TestFindPathQuery(NebulaTestSuite): ...
lib/pysot/visualization/draw_eao.py
Existever/PyCFTrackers
231
11003106
import matplotlib.pyplot as plt import numpy as np import pickle from matplotlib import rc from .draw_utils import COLOR, MARKER_STYLE #rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) rc('text', usetex=True) def draw_eao(result): fig = plt.figure() ax = fig.add_subplot(111, projection='polar'...
env/lib/python3.8/site-packages/pandas/tests/series/methods/test_truncate.py
acrucetta/Chicago_COVI_WebApp
1,738
11003107
<filename>env/lib/python3.8/site-packages/pandas/tests/series/methods/test_truncate.py import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.tseries.offsets import BDay class TestTruncate: def test_truncate(self, datetime_series): offset = BDay() ts = dat...
unit4/spiders/spider_3_login.py
nulearn3296/scrapy-training
182
11003113
import scrapy class QuotesLoginSpider(scrapy.Spider): name = 'quotes-loginspider-v2' start_urls = ['https://quotes.toscrape.com/login'] def parse(self, response): yield scrapy.FormRequest.from_response( response, formdata={'username': 'any', 'password': '<PASSWORD>'}, ...
sas_kernel/kernel.py
gvelasq/sas_kernel
207
11003123
# # Copyright SAS Institute # # 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...
.cloud-build/utils/UpdateNotebookVariables.py
gogasca/vertex-ai-samples
418
11003138
<reponame>gogasca/vertex-ai-samples<gh_stars>100-1000 #!/usr/bin/env python # 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...
pyez/user_defined_table.py
rsmekala/junosautomation
117
11003156
from jnpr.junos import Device from jnpr.junos.factory.factory_loader import FactoryLoader import yaml yaml_data=""" --- ArpTable: rpc: get-arp-table-information item: arp-table-entry key: mac-address view: ArpView ArpView: fields: mac_address: mac-address ip_address: ip-address interface_name: i...
generate.py
alex-calderwood/fairseq-image-captioning
282
11003165
import argparse import os import torch import pandas as pd from fairseq import options, tasks, checkpoint_utils from fairseq.data import encoders from tqdm import tqdm import data def main(script_args, model_args): split = script_args.split os.path.join(model_args.features_dir, ) predictions = predict(i...
2021/quals/rev-polymorph/targets/patchbytes.py
BearerPipelineTest/google-ctf
2,757
11003185
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
src/python/emane/events/fadingselectionevent.py
weston-nrl/emane
114
11003197
# # Copyright (c) 2017 - Adjacent Link LLC, Bridgewater, New Jersey # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notic...
tardis/io/parsers/blondin_toymodel.py
ahmedo42/tardis
176
11003204
<reponame>ahmedo42/tardis import re import yaml import numpy as np import pandas as pd from astropy import units as u from tardis.util.base import parse_quantity PATTERN_REMOVE_BRACKET = re.compile(r"\[.+\]") T0_PATTERN = re.compile("tend = (.+)\n") def read_blondin_toymodel(fname): """ Reading the Blond...
frameworks/AutoGluon/__init__.py
Ennosigaeon/automlbenchmark
282
11003212
from amlb.benchmark import TaskConfig from amlb.data import Dataset from amlb.utils import call_script_in_same_dir def setup(*args, **kwargs): call_script_in_same_dir(__file__, "setup.sh", *args, **kwargs) def run(dataset: Dataset, config: TaskConfig): from frameworks.shared.caller import run_in_venv d...
indra/assemblers/sif/__init__.py
zebulon2/indra
136
11003214
<reponame>zebulon2/indra<gh_stars>100-1000 from .assembler import SifAssembler
tencentcloud/mgobe/v20201014/mgobe_client.py
PlasticMem/tencentcloud-sdk-python
465
11003220
# -*- coding: utf8 -*- # Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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...
modin/data_management/functions/foldfunction.py
atomicai/modin
7,258
11003234
<filename>modin/data_management/functions/foldfunction.py # Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the # ...
tools/generate-unit-test-expect/tripeptide-md.py
andrewdchen/torchani
305
11003261
import ase import ase.io import ase.optimize import ase.md.velocitydistribution import ase.md.verlet import os from neurochem_calculator import NeuroChem, path import torchani import pickle neurochem = NeuroChem() molecule = ase.io.read(os.path.join(path, 'tripeptide/tripeptide-000.ipt_optimization.xyz')) temp = 30...
sdriving/tsim/utils.py
avik-pal/social-driving
127
11003271
<filename>sdriving/tsim/utils.py import math import numpy as np import torch import horovod.torch as hvd TWO_PI = 2 * math.pi @torch.jit.script def angle_normalize(angle: torch.Tensor) -> torch.Tensor: """ Normalize the `angle` to have a value in [-pi, pi] Args: angle: Tensor of angles of shap...
python-packages/order_utils/test/test_asset_data_utils.py
bryan-liu-nova/ZRXFork
1,075
11003272
<reponame>bryan-liu-nova/ZRXFork """Tests of 0x.order_utils.asset_data_utils.""" import pytest from zero_ex.order_utils.asset_data_utils import ( decode_erc20_asset_data, decode_erc721_asset_data, encode_erc20_asset_data, encode_erc721_asset_data, ERC20_ASSET_DATA_BYTE_LENGTH, ERC721_ASSET_DAT...
2019/10/11/Intro to Flask-Security/flask_security_example/app.py
kenjitagawa/youtube_video_code
492
11003274
from flask import Flask, render_template, request, redirect, url_for from flask_sqlalchemy import SQLAlchemy from flask_security import Security, SQLAlchemyUserDatastore, login_required, \ UserMixin, RoleMixin from flask_security.utils import hash_password app = Flask(__name__) app.config['SECRET_KEY'] = 't...
vyper/semantics/types/user/struct.py
ethereum/vyper
1,471
11003295
<reponame>ethereum/vyper from collections import OrderedDict from vyper import ast as vy_ast from vyper.abi_types import ABI_Tuple, ABIType from vyper.ast.validation import validate_call_args from vyper.exceptions import ( InvalidAttribute, NamespaceCollision, StructureException, UnknownAttribute, ...
evalml/pipelines/components/transformers/samplers/base_sampler.py
Mahesh1822/evalml
454
11003299
"""Base Sampler component. Used as the base class of all sampler components.""" import copy from abc import abstractmethod from evalml.pipelines.components.transformers import Transformer from evalml.utils.woodwork_utils import infer_feature_types class BaseSampler(Transformer): """Base Sampler component. Used a...
scripts/help2comp.py
sagarkar10/zpwr
135
11003302
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Parse getopt-style help texts for options # and generate zsh(1) completion function. # http://github.com/RobSis/zsh-completion-generator # Usage: program --help | ./help2comp.py program_name import sys import re from string import Template URL = 'http://github.com/Rob...
tests/apps/django_app/base/urls.py
reinhard-mueller/webargs
579
11003303
<gh_stars>100-1000 from django.conf.urls import url from tests.apps.django_app.echo import views urlpatterns = [ url(r"^echo$", views.echo), url(r"^echo_form$", views.echo_form), url(r"^echo_json$", views.echo_json), url(r"^echo_json_or_form$", views.echo_json_or_form), url(r"^echo_use_args$", vi...
plugins/auth_users/views.py
ajenti/ajen
3,777
11003318
<reponame>ajenti/ajen<filename>plugins/auth_users/views.py<gh_stars>1000+ """ User authentication provider based on the ajenti config file and permissions management. """ import os import json from jadi import component import aj from aj.auth import authorize from aj.api.http import url, HttpPlugin from aj.api.endpo...
tests/test_cipher.py
telegrambotdev/pytube
2,471
11003349
import pytest from pytube import cipher from pytube.exceptions import RegexMatchError def test_map_functions(): with pytest.raises(RegexMatchError): cipher.map_functions("asdf") def test_get_initial_function_name_with_no_match_should_error(): with pytest.raises(RegexMatchError): cipher.get_...
bin/convert-to-json.py
Deekshith1994/Recipes
591
11003371
#!/usr/bin/env python from __future__ import print_function import sys import json from ingredient_phrase_tagger.training import utils if len(sys.argv) < 2: sys.stderr.write('Usage: make-data.py FILENAME') sys.exit(1) print(json.dumps(utils.import_data(open(sys.argv[1])), indent=4))
rest/taskrouter/twiml/example1/example/example.6.x.py
Tshisuaka/api-snippets
234
11003411
<filename>rest/taskrouter/twiml/example1/example/example.6.x.py # Download the Python helper library from twilio.com/docs/python/install from flask import Flask from twilio.twiml.voice_response import VoiceResponse app = Flask(__name__) @app.route("/enqueue_call", methods=['GET', 'POST']) def enqueue_call(): res...
desktop/core/ext-py/docutils-0.14/test/test_parsers/test_rst/test_directives/test_test_directives.py
kokosing/hue
5,079
11003416
#! /usr/bin/env python # $Id: test_test_directives.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: <NAME> <<EMAIL>> # Copyright: This module has been placed in the public domain. """ Tests for misc.py test directives. """ from __init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestS...
small_text/data/sampling.py
chschroeder/small-text
218
11003426
import numpy as np def stratified_sampling(y, n_samples=10): """ Performs a stratified random sampling. Parameters ---------- y : list of int or numpy.ndarray List of labels. Returns ------- indices : numpy.ndarray Indices of the stratified subset. Notes ----...
angr/angrdb/serializers/comments.py
Kyle-Kyle/angr
6,132
11003432
# pylint:disable=unused-import from ..models import DbKnowledgeBase, DbComment from ...knowledge_plugins.comments import Comments from ...knowledge_base import KnowledgeBase class CommentsSerializer: """ Serialize/unserialize comments to/from a database session. """ @staticmethod def dump(session...
pytest-virtualenv/tests/integration/test_tmpvirtualenv.py
manahl/pytest-plugins
282
11003463
<gh_stars>100-1000 import os import pathlib import subprocess import sys import textwrap import pytest_virtualenv as venv def check_member(name, ips): return name in ips def test_installed_packages(): with venv.VirtualEnv() as v: ips = v.installed_packages() assert len(ips) > 0 asse...
train/test_isp.py
RunqiuBao/Event_ESTRNN
180
11003465
import rawpy import cv2 import os import numpy as np from PIL import Image from os.path import join from metrics import psnr_calculate, ssim_calculate from utils import AverageMeter, img2video def raw2rgb(img_raw): import os Image.fromarray(img_raw, mode="I;16").save('saved.tiff') raw_buf = rawpy.imread('...
src/nlpia/book/examples/ch06_nessvectors.py
byukan/nlpia
532
11003489
<gh_stars>100-1000 """ From chapter 6 about the "ness" of word vectors: Compose a word vector for each "ness" like placeness, humanness, femaleness, etc Provide a nessvector for any given word >>> nessvector('Seattle') placeness 0.257971 peopleness -0.059435 animalness -0.014691 conceptness 0.175459 fem...
frappe-bench/env/lib/python2.7/site-packages/faker/providers/person/sl_SI/__init__.py
ibrahmm22/library-management
412
11003490
<filename>frappe-bench/env/lib/python2.7/site-packages/faker/providers/person/sl_SI/__init__.py # coding=utf-8 from __future__ import unicode_literals from .. import Provider as PersonProvider class Provider(PersonProvider): formats = ['{{first_name}} {{last_name}}'] first_names_male = [ "Franc", "J...
rollbar/examples/django/app.py
arthurio/pyrollbar
177
11003494
import os import sys import django from django.conf import settings # use settings compatible with the installed Django version # v1.10+ requires MIDDLEWARE keyname # older versions require MIDDLEWARE_CLASSES keyname ROLLBAR_CONFIG = { 'access_token': 'POST_SERVER_ITEM_ACCESS_TOKEN', 'environment': 'develop...
exercises/practice/scale-generator/.meta/example.py
samr1ddh1/python-1
1,177
11003505
class Scale: ASCENDING_INTERVALS = ['m', 'M', 'A'] CHROMATIC_SCALE = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'] FLAT_CHROMATIC_SCALE = ['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B'] FLAT_KEYS = ['F', 'Bb', 'Eb',...
atest/testdata/standard_libraries/process/files/countdown.py
phil-davis/robotframework
7,073
11003508
<gh_stars>1000+ import subprocess import sys import time def countdown(path): for i in range(10, 0, -1): with open(path, 'w') as f: f.write('%d\n' % i) time.sleep(0.2) with open(path, 'w') as f: f.write('BLASTOFF') if __name__ == '__main__': path = sys.argv[1] chi...
cellpose/__init__.py
YinuoJin/cellpose
504
11003523
<filename>cellpose/__init__.py from .io import logger_setup logger, log_file = logger_setup()
scripts/rnnlm/get_best_model.py
LanceaKing/kaldi
116
11003535
#!/usr/bin/env python3 # Copyright 2017 Johns Hopkins University (author: <NAME>) # License: Apache 2.0. import argparse import glob import re import sys parser = argparse.ArgumentParser(description="Works out the best iteration of RNNLM training " "based on dev-set per...
sdk/cosmos/azure-cosmos/azure/cosmos/partition_key.py
rsdoherty/azure-sdk-for-python
2,728
11003540
<reponame>rsdoherty/azure-sdk-for-python # The MIT License (MIT) # Copyright (c) 2014 Microsoft Corporation # 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 wit...
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/cpp/this/TestCPPThis.py
Polidea/SiriusObfuscator
427
11003546
""" Tests that C++ member and static variables are available where they should be. """ import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class CPPThisTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) # rdar://problem/9962...