max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
sample/tensorflow/unit_test/add_bias_transpose_unit_test.py | dujiangsu/FasterTransformer | 777 | 1666307 | <reponame>dujiangsu/FasterTransformer<filename>sample/tensorflow/unit_test/add_bias_transpose_unit_test.py<gh_stars>100-1000
from __future__ import print_function
import tensorflow as tf
import numpy as np
import unittest
import sys
import os
import math
sys.path.append("./tensorflow/")
from utils.encoder import build_... | 0 | 0 | 0 | 0 | 0 | 0 |
launch_hits.py | dorazhao99/simple-amt | 306 | 1666376 | <reponame>dorazhao99/simple-amt<filename>launch_hits.py
import argparse, json
import os
import simpleamt
import sys
if __name__ == '__main__':
parser = argparse.ArgumentParser(parents=[simpleamt.get_parent_parser()])
parser.add_argument('--hit_properties_file', type=argparse.FileType('r'))
parser.add_argument('... | 0 | 0 | 0 | 0 | 0 | 0 |
classifier/options.py | ujos89/DualRL | 293 | 1666384 | <reponame>ujos89/DualRL<filename>classifier/options.py
from common_options import *
def add_cls_arguments(parser):
parser.add_argument("--mode", default="train", help="Mode: train or eval.")
parser.add_argument("--n_epoch", default=10, help="Max n epoch during textcnn training.")
parser.add_argument("--ba... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/test/test_compiler/test_static/fstring.py | mananpal1997/cinder | 1,886 | 1666399 | from .common import StaticTestBase
class FStringTests(StaticTestBase):
def test_format_spec(self):
codestr = """
def f(x: float) -> str:
return f"{x:.2f}"
"""
with self.in_module(codestr) as mod:
f = mod.f
self.assertEqual(f(2.134), "2.13... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_ple.py | MatheusZickuhr/PyGame-Learning-Environment | 959 | 1666401 | <filename>tests/test_ple.py
#!/usr/bin/python
"""
This tests that all the PLE games launch, except for doom; we
explicitly check that it isn't defined.
"""
import nose
import numpy as np
import unittest
NUM_STEPS=150
class NaiveAgent():
def __init__(self, actions):
self.actions = actions
def pi... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmarks/django-workload/uwsgi/files/django-workload/django_workload/wsgi.py | jonasbn/cloudsuite | 103 | 1666462 | <gh_stars>100-1000
# Copyright 2017-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.
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dja... | 0 | 0 | 0 | 0 | 0 | 0 |
anima/env/houdini/render.py | MehmetErer/anima | 101 | 1666481 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import hou
class RenderSlicer(object):
"""A tool to help slice single frame renders in to many little parts which
will help it to be rendered in small parts in a render farm.
"""
def __init__(self, camera=None):
self._camera = None
self.came... | 0 | 0 | 0 | 0 | 0 | 0 |
asana/resources/gen/user_task_lists.py | FiyaFly/python-asana | 266 | 1666528 | <reponame>FiyaFly/python-asana
# coding=utf-8
class _UserTaskLists:
def __init__(self, client=None):
self.client = client
def get_user_task_list(self, user_task_list_gid, params=None, **options):
"""Get a user task list
:param str user_task_list_gid: (required) Globally unique identifi... | 0 | 0 | 0 | 0 | 0 | 0 |
reddit2telegram/channels/~inactive/usa_memes/app.py | mainyordle/reddit2telegram | 187 | 1666533 | <filename>reddit2telegram/channels/~inactive/usa_memes/app.py
#encoding:utf-8
subreddit = 'Funny+Gifs'
t_channel = '@USA_MEMES'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/CompileTests/Python_tests/test2011_004.py | maurizioabba/rose | 488 | 1666536 | <gh_stars>100-1000
def foo():
123
| 0 | 0 | 0 | 0 | 0 | 0 |
tools/aquery_differ/resolvers/dep_set_resolver.py | jobechoi/bazel | 16,989 | 1666542 | # Copyright 2018 The Bazel 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 applicable la... | 0 | 1 | 0 | 1 | 2 | 0 |
fexm/configfinder/config_finder_for_pacman_package.py | fgsect/fexm | 105 | 1666596 | <reponame>fgsect/fexm
#!/usr/bin/env python3
"""
Find input vector for a pacman package.
"""
import argparse
import os
import sh
parentdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
os.sys.path.insert(0, parentdir)
from builders import builder
from cli_config import CliConfig
from helpers.exceptio... | 0 | 0 | 0 | 0 | 0 | 0 |
operators/browser.py | Darkblader24/material-combiner-addon | 192 | 1666661 | <reponame>Darkblader24/material-combiner-addon<gh_stars>100-1000
import webbrowser
import bpy
from bpy.props import *
class OpenBrowser(bpy.types.Operator):
bl_idname = 'smc.browser'
bl_label = 'Open Browser'
bl_description = 'Click to open in browser'
link = StringProperty(default='')
def exec... | 0 | 0 | 0 | 0 | 0 | 0 |
buildroot-2021.05.3/support/testing/tests/package/test_s6_rc.py | thvlt/tinyemu | 349 | 1666712 | import os
import infra.basetest
class TestS6Rc(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_PACKAGE_S6_RC=y
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
img = os.path.join(self.buildd... | 0 | 0 | 0 | 0 | 0 | 0 |
fooltrader/rest/controller/security.py | beaquant/fooltrader | 1,103 | 1666731 | # -*- coding: utf-8 -*-
from flask import request
from fooltrader.consts import CRYPTOCURRENCY_PAIR, SECURITY_TYPE_MAP_EXCHANGES
from fooltrader.domain.data.es_quote import CryptocurrencyMeta, StockMeta
from fooltrader.rest import app
from fooltrader.rest.common import success
@app.route('/security', methods=['GET']... | 0 | 1 | 0 | 0 | 1 | 0 |
bin/evaluation.py | ishine/FastVocoder | 116 | 1666775 | import torch
import os
import argparse
import numpy as np
import hparams as hp
from data.utils import parse_path_file
from model.generator.melgan import MelGANGenerator
from .synthesize import Synthesizer
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
def load_data(audio_index_path, mel_index... | 0 | 1 | 0 | 0 | 1 | 0 |
commands/execute.py | Commodoreprime/Command-Block-Assembly | 223 | 1666781 | from .core import Command, Resolvable, EntityRef, SimpleResolve, WorldPos
from .nbt import NBTStorable
from .scoreboard import ScoreRef
from .selector import ScoreRange
class Execute(Command):
def __init__(self, chain):
self.chain = SimpleResolve(*chain._components)
def resolve(self, scope) -> object... | 1 | 28 | 0 | 2 | 31 | 0 |
scripts/evaluate_pos_translation_rate.py | anoidgit/zero | 111 | 1666786 | <reponame>anoidgit/zero
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
from collections import Counter
def parseargs():
msg = "Evlauate P/R/F score for particular POS Tagged Tokens"
usage = "{} [<args>]... | 0 | 0 | 0 | 0 | 0 | 0 |
hwt/serializer/hwt/context.py | ufo2011/hwt | 134 | 1666798 | <filename>hwt/serializer/hwt/context.py
class ValueWidthRequirementScope():
"""
Context manager which temporarily swaps the _valueWidthRequired on specified context
.. code-block:: python
with ValueWidthRequirementScope(ctx, True):
#...
"""
def __init__(self, ctx, val):
... | 0 | 0 | 0 | 0 | 0 | 0 |
pyNastran/dev/bdf_vectorized/cards/aero/aero.py | ACea15/pyNastran | 293 | 1666848 | <filename>pyNastran/dev/bdf_vectorized/cards/aero/aero.py
from numpy import zeros
from pyNastran.dev.bdf_vectorized.cards.vectorized_card import VectorizedCard
from pyNastran.dev.bdf_vectorized.bdf_interface.assign_type import integer_or_blank, double_or_blank, double
from pyNastran.bdf.field_writer_8 import print_card... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_fold/loom/calculator_example/model_test.py | shkarupa-alex/fold | 2,020 | 1666856 | # Copyright 2017 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 required by applicable law or a... | 0 | 0 | 0 | 0 | 0 | 0 |
test/support/python/lightgbm_classification.py | frankstratton/eps | 600 | 1666889 | <filename>test/support/python/lightgbm_classification.py
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from lightgbm import LGBMClassifier
from sklearn2pmml import sklearn2pmml
from sklearn2pmml.decoration import ContinuousDomain, CategoricalDomain
from sklearn2pmml.pipeline import PMM... | 0 | 0 | 0 | 0 | 0 | 0 |
RecoVertex/AdaptiveVertexFinder/python/doubleVertexFilter_cfi.py | ckamtsikis/cmssw | 852 | 1666893 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
doubleVertexFilter = cms.EDProducer("DoubleVertexFilter",
primaryVertices = cms.InputTag("offlinePrimaryVertices"),
secondaryVertices = cms.InputTag("vertexFinder"),
maxFraction = cms.double(0.7)
)
| 0 | 0 | 0 | 0 | 0 | 0 |
tools/perf-scale-workload/model.py | jmgray24/amazon-timestream-tools | 143 | 1666910 | <reponame>jmgray24/amazon-timestream-tools
from collections import defaultdict, namedtuple
import random, string
import os
import numpy as np
######################################################################################
## Data model for an example DevOps application tracking resource utilization stats ##
## ... | 0 | 0 | 0 | 0 | 0 | 0 |
test/integration/test_api.py | snarfed/flynt | 487 | 1666946 | import os
import shutil
import pytest
from flynt import api
from flynt import state
from flynt.api import _fstringify_file
# These "files" are byte-string constants instead of actual files to prevent e.g. Git or text editors from accidentally changing the encoding
invalid_unicode = b"# This is not valid unicode: " +... | 0 | 4 | 0 | 0 | 4 | 0 |
care/utils/inverse_choices.py | gigincg/care | 189 | 1666964 | <gh_stars>100-1000
def inverse_choices(choices):
output = {}
for choice in choices:
output[choice[1]] = choice[0]
return output
| 0 | 0 | 0 | 0 | 0 | 0 |
clearml/version.py | allegroai/clearml | 1,118 | 1666974 | __version__ = '1.1.3rc0'
| 0 | 0 | 0 | 0 | 0 | 0 |
calvin/runtime/north/plugins/port/queue/fanout_mapped_fifo.py | gabrielcercel/calvin-base | 334 | 1667001 | <filename>calvin/runtime/north/plugins/port/queue/fanout_mapped_fifo.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright (c) 2016 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 Licens... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/rerr.py | vlad-ivanov-name/josh | 682 | 1667004 | <filename>scripts/rerr.py
#!/usr/bin/env python3
import sys
import json
for line in map(str.rstrip, sys.stdin):
m = json.loads(line)
try:
for s in m["message"]["spans"]:
print("{}:{}: {}".format(s["file_name"], s["line_start"], m["message"]["message"]))
except:
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
easy_rec/python/loss/pairwise_loss.py | swaitw/EasyRec | 285 | 1667050 | # coding=utf-8
# Copyright (c) Alibaba, Inc. and its affiliates.
import logging
import tensorflow as tf
if tf.__version__ >= '2.0':
tf = tf.compat.v1
def pairwise_loss(labels, logits) -> object:
pairwise_logits = tf.expand_dims(logits, -1) - tf.expand_dims(logits, 0)
logging.info('[pairwise_loss] pairwise log... | 0 | 1 | 0 | 0 | 1 | 0 |
test/integration_test/tools/lib/ofp/ofp_group_stats.py | ryoon/lagopus | 281 | 1667059 | <filename>test/integration_test/tools/lib/ofp/ofp_group_stats.py
import os
import sys
import copy
import logging
from checker import *
from .ofp import register_ofp_creators
from .ofp import OfpBase
from .ofp_bucket_counter import SCE_BUCKET_STATS
from .ofp_bucket_counter import OfpBucketCounterCreator
# YAML:
# grou... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/repoze.who-2.3/repoze/who/plugins/auth_tkt.py | kokosing/hue | 5,079 | 1667072 | import datetime
from codecs import utf_8_decode
from codecs import utf_8_encode
import hashlib
import os
import time
from wsgiref.handlers import _monthname # Locale-independent, RFC-2616
from wsgiref.handlers import _weekdayname # Locale-independent, RFC-2616
try:
from urllib.parse import urlencode, parse_qs... | 0 | 0 | 0 | 0 | 0 | 1 |
milano/backends/azkaban_utils.py | NVIDIA/Milano | 145 | 1667099 | <gh_stars>100-1000
# Copyright (c) 2018 NVIDIA Corporation
import requests
import io
import zipfile
from typing import Iterable, Tuple, Sequence
class AzkabanConnectionError(Exception):
"""An exception that is going to be raised if something fails
with Azkaban access.
"""
def __init__(self, message):
sel... | 0 | 0 | 0 | 0 | 0 | 0 |
web.py | shomikverma/chemprop | 689 | 1667103 | """Runs the web version of chemprop locally."""
from chemprop.web import chemprop_web
if __name__ == '__main__':
chemprop_web()
| 0 | 0 | 0 | 0 | 0 | 0 |
python/seldon/cli/cmd_api.py | smsahu/seldon-server | 1,645 | 1667139 | <reponame>smsahu/seldon-server<filename>python/seldon/cli/cmd_api.py<gh_stars>1000+
import pprint
import argparse
import os
import sys
import re
import json
import MySQLdb
import requests
import db_utils
gdata = {
'all_clients_node_path': "/all_clients",
}
def pp(o):
p = pprint.PrettyPrinter(indent=4)
p.... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/283531_Using_Import_Reading/recipe-283531.py | tdiprima/code | 2,023 | 1667276 | <filename>recipes/Python/283531_Using_Import_Reading/recipe-283531.py
# To run this code, create a python file, say config.py, with a sample parameter
# called sample_param.
import os
import sys
def main():
if len(sys.argv) == 1:
print "usage: %s config_file" % os.path.basename(sys.argv[0])
sys... | 0 | 0 | 0 | 0 | 0 | 0 |
dfvfs/compression/decompressor.py | dfjxs/dfvfs | 176 | 1667284 | # -*- coding: utf-8 -*-
"""The decompressor interface."""
import abc
class Decompressor(object):
"""Decompressor interface."""
# pylint: disable=redundant-returns-doc
@abc.abstractmethod
def Decompress(self, compressed_data):
"""Decompresses the compressed data.
Args:
compressed_data (bytes)... | 0 | 0 | 0 | 0 | 0 | 0 |
getting_started/utils.py | jsnlp/snorkel-tutorials | 315 | 1667294 | <reponame>jsnlp/snorkel-tutorials<filename>getting_started/utils.py
import glob
import os
import subprocess
import pandas as pd
def load_unlabeled_spam_dataset():
"""Load spam training dataset without any labels."""
if os.path.basename(os.getcwd()) == "snorkel-tutorials":
os.chdir("getting_started")
... | 0 | 0 | 0 | 0 | 0 | 0 |
2020/05/10/Creating a Custom Save Method in Django Models/django_override_model_save/custom_save_example/example/models.py | kenjitagawa/youtube_video_code | 492 | 1667343 | from django.db import models
import requests
class Location(models.Model):
zip_code = models.IntegerField()
latitude = models.DecimalField(blank=True, max_digits=9, decimal_places=6)
longitude = models.DecimalField(blank=True, max_digits=9, decimal_places=6)
def save(self, *args, **kwargs):
r... | 0 | 1 | 0 | 0 | 1 | 0 |
ch02-安装OpenCV/最简单-使用pip安装opencv-python和opencv-contrib-python/test_opencv_contrib_python.py | makelove/OpenCV-Python-Tutorial | 2,875 | 1667361 | <filename>ch02-安装OpenCV/最简单-使用pip安装opencv-python和opencv-contrib-python/test_opencv_contrib_python.py
# -*- coding: utf-8 -*-
# @Time : 2017/8/2 10:23
# @Author : play4fun
# @File : test_opencv_contrib_python.py
# @Software: PyCharm
"""
test_opencv_contrib_python.py:
"""
import numpy as np
import cv2
from matp... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/monitoring/cron-send-os-skydns-checks.py | fahlmant/openshift-tools | 164 | 1667369 | <reponame>fahlmant/openshift-tools
#!/usr/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
'''
Send Openshift Master SkyDNS metric checks to Zagg
Openshift uses SkyDNS to locate services inside of the cluster.
Openshift implements SkyDNS a bit different. Normally SkyDNS uses etcd as a backend
for the D... | 0 | 0 | 0 | 0 | 0 | 0 |
rotkehlchen/tests/exchanges/test_gemini.py | rotkehlchenio/rotkehlchen | 137 | 1667377 | import warnings as test_warnings
from unittest.mock import patch
import pytest
import requests
from rotkehlchen.assets.asset import WORLD_TO_GEMINI
from rotkehlchen.assets.converters import UNSUPPORTED_GEMINI_ASSETS
from rotkehlchen.constants.assets import A_BCH, A_BTC, A_ETH, A_LINK, A_LTC, A_USD
from rotkehlchen.co... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/integration_tests/spark/sdk/clean_up_cluster.py | Geims83/aztk | 161 | 1667405 | import azure.batch.models as batch_models
from azure.batch.models import BatchErrorException
from aztk.error import AztkError
def clean_up_cluster(spark_client, id):
try:
cluster = spark_client.cluster.get(id)
nodes = [node for node in cluster.nodes]
if not any([
node.stat... | 0 | 0 | 0 | 0 | 0 | 0 |
aleph/tests/test_profiles_api.py | Rosencrantz/aleph | 1,213 | 1667412 | <reponame>Rosencrantz/aleph
import logging
# from pprint import pformat
from followthemoney import model
from aleph.core import db
from aleph.authz import Authz
from aleph.model import EntitySet, EntitySetItem, Judgement
from aleph.logic.entitysets import save_entityset_item
from aleph.index.entities import index_ent... | 0 | 0 | 0 | 0 | 0 | 0 |
credentialstore_keygen.py | prohfesor/tapiriik | 1,445 | 1667459 | from Crypto.PublicKey import RSA
key = RSA.generate(2048)
print("CREDENTIAL_STORAGE_PRIVATE_KEY = " + key.exportKey("DER").__repr__())
print("CREDENTIAL_STORAGE_PUBLIC_KEY = " + key.publickey().exportKey("DER").__repr__())
| 0 | 0 | 0 | 0 | 0 | 0 |
ppt2pdf/ppt2pdf_linux.py | TheFenrisLycaon/Automation-scripts | 496 | 1667483 | # import libraries
import glob
import tqdm
import os
PATH = "INPUT FOLDER"
# extension
et = "pptx" # or ppt
files = [f for f in glob.glob(PATH + "/**/*.{}".format(et), recursive=True)]
for f in tqdm.tqdm(files):
command = "unoconv -f pdf \"{}\"".format(f)
os.system(command)
| 0 | 0 | 0 | 0 | 0 | 0 |
otter/manual/execute.py | radsec/ottr | 207 | 1667490 | import time
import json
import boto3
REGION = ''
AWS_ACCOUNT = ''
DYNAMODB_TABLE = ''
STEP_FUNCTION_ARN = f'arn:aws:states:{REGION}:{AWS_ACCOUNT}:stateMachine:otter-state'
# Example Payload
payload = {
"assets": [
{
"hostname": "panos01.example.com",
"common_name": "panos01.examp... | 0 | 0 | 0 | 0 | 0 | 0 |
changedetectionio/dev-docker/sleep.py | MadameMinty/changedetection.io | 3,933 | 1667496 | <reponame>MadameMinty/changedetection.io
import time
print ("Sleep loop, you should run your script from the console")
while True:
# Wait for 5 seconds
time.sleep(2)
| 0 | 0 | 0 | 0 | 0 | 0 |
observations/r/cubits.py | hajime9652/observations | 199 | 1667526 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def cubits(path) -> tuple[object, object]:
"""Galton's example of the rel... | 0 | 1 | 0 | 0 | 1 | 0 |
auctioning_platform/auctions/auctions/domain/entities/auction.py | nhdinh/smp-modulith | 299 | 1667531 | <filename>auctioning_platform/auctions/auctions/domain/entities/auction.py
from datetime import datetime
from typing import List, Optional
from foundation.events import EventMixin
from foundation.value_objects import Money
from auctions.domain.entities.bid import Bid
from auctions.domain.events import AuctionBegan, A... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_app.py | minodes/nbpymd | 180 | 1667558 | <reponame>minodes/nbpymd<filename>tests/test_app.py
import os
import subprocess
def local(args):
cmd = ' '.join(args) if type(args) == list else args
return subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
def cells_default_params(a=100, b=200):
a, b = int(a), int(b)
int(a + b)
d... | 0 | 0 | 0 | 0 | 0 | 0 |
cloudmarker/test/test_azwebappclientcertevent.py | TinLe/cloudmarker | 208 | 1667627 | <filename>cloudmarker/test/test_azwebappclientcertevent.py
"""Tests for AzWebAppClientCertEvent plugin."""
import copy
import unittest
from cloudmarker.events import azwebappclientcertevent
base_record = {
'ext': {
'record_type': 'web_app_config',
'cloud_type': 'azure',
'client_cert_en... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/timeBreak.py | saurabhcommand/Hello-world | 1,428 | 1667660 | <gh_stars>1000+
import time
import webbrowser
from random import randint
videos=["https://www.youtube.com/watch?v=qwIH7p9oJVM&list=RDqwIH7p9oJVM&start_radio=1","https://www.youtube.com/watch?v=nZhLM-FeV9A&list=RDqwIH7p9oJVM&index=2","https://www.youtube.com/watch?v=BJWTzYPWINw&index=6&list=RDqwIH7p9oJVM","https://www.... | 0 | 0 | 0 | 0 | 0 | 0 |
nodes/2.x/python/TimeSpan.LapTime.py | andydandy74/ClockworkForDynamo | 147 | 1667729 | import time
times = IN[0]
times.append(IN[2])
OUT = times | 0 | 0 | 0 | 0 | 0 | 0 |
testing/helpers.py | dry-python/dependencies | 175 | 1667753 | <reponame>dry-python/dependencies
import functools
import inspect
import random
import re
import string
import pytest
class CodeCollector:
"""Dedicated decorator to use functions as Py.Test function parameters."""
seen = set()
def __init__(self, *names):
self.names = names or ("code",)
... | 0 | 0 | 0 | 0 | 0 | 0 |
yaldevtools/source_file.py | libyal/libyal | 176 | 1667755 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""The source file classes."""
import collections
import io
import os
from yaldevtools import source_code
class DefinitionsIncludeHeaderFile(object):
"""Definitions include header file.
Attributes:
enum_declarations (list[EnumDeclaration]): enumera... | 0 | 9 | 1 | 27 | 37 | 0 |
tests/app/models.py | simiotics/djangorestframework-queryfields | 195 | 1667775 | from django.db import models
class Quote(object):
def __init__(self, character, line, sketch):
self.character = character
self.line = line
self.sketch = sketch
class Snippet(models.Model):
title = models.CharField(max_length=80)
code = models.TextField()
linenos = models.Bo... | 0 | 0 | 1 | 0 | 1 | 0 |
pytext/torchscript/seq2seq/beam_decode.py | baronrustamov/pytext | 6,199 | 1667789 | <reponame>baronrustamov/pytext
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List, Tuple
import torch
from torch import Tensor
class BeamDecode(torch.nn.Module):
"""
Decodes the output of Beam Search to get the top hypotheses
"""
def... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tests/test_report.py | girishc13/docker-locust | 194 | 1667791 | <gh_stars>100-1000
"""Unit test for Report generator."""
import json
import os
from unittest import TestCase
import requests_mock
from src.report import HTML_TEMPLATE, STAT_URL
from src.report import generate_report
WORK_DIR = os.path.dirname(__file__)
MOCKED_DISTRIBUTION = os.path.join(WORK_DIR, 'mocked_distributio... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/design_interpolation_filter.py | W3AXL/tsl-sdr | 112 | 1667803 | <reponame>W3AXL/tsl-sdr
#!/usr/bin/env python
from gnuradio import filter
import json
import sys
def design_filter(interpolation, decimation, fractional_bw):
"""
Given the interpolation rate, decimation rate and a fractional bandwidth,
design a set of taps.
Args:
interpolation: interpolation f... | 0 | 0 | 0 | 0 | 0 | 0 |
server/ai/src/plot_locations.py | DaminK/find3 | 4,349 | 1667845 | import os
import operator
import hashlib
import sys
import random
import requests
import randomcolor
import numpy
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot
from scipy.stats import gaussian_kde
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
def getcol... | 0 | 1 | 0 | 0 | 1 | 0 |
ee/api/chalicelib/core/roles.py | nogamenofun98/openreplay | 3,614 | 1667875 | from __future__ import annotations
from chalicelib.core import users
from chalicelib.utils import pg_client, helper
from chalicelib.utils.TimeUTC import TimeUTC
def update(tenant_id, user_id, role_id, changes) -> dict[str,list[str]] | object | None:
admin = users.get(user_id=user_id, tenant_id=tenant_id)
if ... | 0 | 5 | 0 | 0 | 5 | 0 |
languages/python/text_manipulation_argparse1.py | Andilyn/learntosolveit | 136 | 1667876 | import argparse
import filecmp
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Directory comparison")
parser.add_argument("--recurse", "-r", action="store_true", default=False)
parser.add_argument('dirs', nargs=2)
options = parser.parse_args()
dd = filecmp.dircmp(options.d... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_utils/test_se_layer.py | wzpscott/SegformerDistillation | 903 | 1667889 | <gh_stars>100-1000
import mmcv
import pytest
import torch
from mmseg.models.utils.se_layer import SELayer
def test_se_layer():
with pytest.raises(AssertionError):
# test act_cfg assertion.
SELayer(32, act_cfg=(dict(type='ReLU'), ))
# test config with channels = 16.
se_layer = SELayer(16)... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/nxos/tests/ShowIpStaticRouteMulticast/cli/equal/golden_output_2_expected.py | balmasea/genieparser | 204 | 1667935 |
expected_output = {
'vrf': {
'default': {
},
'management': {
},
},
}
| 0 | 0 | 0 | 0 | 0 | 0 |
test/memory_consumption.py | pavanbadugu/cachelot | 323 | 1667968 | #!/usr/bin/env python
#
# Cachelot vs Memcached server memory consumption test
#
import sys
import string
import random
import os
import subprocess
import shlex
import time
import logging
import atexit
import memcached
log = logging.getLogger()
toMb = lambda b: b*1.0/1024/1024
SELF, _ = os.path.splitext(os.path.bas... | 0 | 7 | 0 | 0 | 7 | 0 |
chainer_chemistry/links/update/cgcnn_update.py | pfnet/chainerchem | 184 | 1667997 | <gh_stars>100-1000
import chainer
from chainer import links, functions # NOQA
class CGCNNUpdate(chainer.Chain):
"""Update submodule for CGCNN
Args:
n_site_features (int): hidden dimension of atom feature vector.
This value must be the same as n_site_feat.
"""
def __init__(self, ... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/cognitiveservices/azure-cognitiveservices-personalizer/azure/cognitiveservices/personalizer/models/personalizer_client_enums.py | rsdoherty/azure-sdk-for-python | 2,728 | 1668001 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 0 | 0 | 3 | 0 | 3 | 0 |
examples/nas/legacy/cream/lib/utils/op_by_layer_dict.py | dutxubo/nni | 9,680 | 1668056 | <reponame>dutxubo/nni
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# Written by <NAME> and <NAME>
# email: <EMAIL> and <EMAIL>
# This dictionary is generated from calculating each operation of each layer to quickly search for layers.
# flops_op_dict[which_stage][which_operation] =
# (flops_... | 0 | 0 | 0 | 0 | 0 | 0 |
f5/bigip/tm/util/__init__.py | nghia-tran/f5-common-python | 272 | 1668065 | # coding=utf-8
#
# Copyright 2016 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/KoubeiMallCircleRecommenditemQueryModel.py | antopen/alipay-sdk-python-all | 213 | 1668073 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from alipay.aop.api.constant.ParamConstants import *
class KoubeiMallCircleRecommenditemQueryModel(object):
def __init__(self):
self._city_code: None = None
self._data_set_id: None = None
self._d... | 0 | 12 | 0 | 10 | 22 | 0 |
tensorflow/contrib/boosted_trees/estimator_batch/trainer_hooks_test.py | tianyapiaozi/tensorflow | 848 | 1668075 | <reponame>tianyapiaozi/tensorflow
# 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-... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/utils/stl/test/file_parsing.py | isra-fel/STL | 8,232 | 1668117 | # Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
from collections import namedtuple
from dataclasses import dataclass, field
from pathlib import Path
from typing import Dict, List, Optional, Set, Tuple, Union
import itertools
import os
import re
import lit.Te... | 10 | 7 | 5 | 0 | 22 | 0 |
AppPkg/Applications/Python/Python-2.7.2/Lib/test/testall.py | CEOALT1/RefindPlusUDK | 2,757 | 1668123 | <filename>AppPkg/Applications/Python/Python-2.7.2/Lib/test/testall.py
# Backward compatibility -- you should use regrtest instead of this module.
from warnings import warnpy3k
warnpy3k("the test.testall module has been removed in Python 3.0",
stacklevel=2)
del warnpy3k
import sys, regrtest
sys.arg... | 0 | 0 | 0 | 0 | 0 | 0 |
paper_experiments/utils/combine_and_process_detections.py | noskill/JRMOT_ROS | 112 | 1668143 | <reponame>noskill/JRMOT_ROS<gh_stars>100-1000
import os
from os import listdir
from os.path import isfile, join
#root = "/cvgl2/u/mihirp/depth_tracking/data/JRDB/sequences/"
#root = "/cvgl2/u/mihirp/depth_tracking/data/JRDB/test_sequences/"
#root = "/cvgl2/u/mihirp/depth_tracking/data/KITTI/sequences/"
root = "/cvgl2/... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/nlu_basic_api.py | hyydrra/dialog-nlu | 104 | 1668151 | # -*- coding: utf-8 -*-
"""
@author: mwahdan
"""
from dialognlu import AutoNLU
from flask import Flask, jsonify, request
import argparse
# Create app
app = Flask(__name__)
def initialize(load_folder_path):
global nlu_model
nlu_model = AutoNLU.load(load_folder_path)
@app.route('/', meth... | 0 | 2 | 0 | 0 | 2 | 0 |
src/ocstyle/error.py | blueronin/ocstyle | 110 | 1668171 | <filename>src/ocstyle/error.py<gh_stars>100-1000
# Copyright 2012 The ocstyle 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
#
# U... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/benchmark/calldatacopy_test.py | sambarnes/warp | 414 | 1668177 | <filename>tests/benchmark/calldatacopy_test.py
import os
import tempfile
import pytest
from starkware.starknet.compiler.compile import compile_starknet_files
from starkware.starknet.testing.state import StarknetState
from tests.logging.generateMarkdown import steps_in_function
from tests.utils import CAIRO_PATH
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/find-transaction.py | Moliholy/tron-api-python | 111 | 1668180 | <reponame>Moliholy/tron-api-python
from tronapi import Tron
from tronapi import HttpProvider
full_node = HttpProvider('https://api.trongrid.io')
solidity_node = HttpProvider('https://api.trongrid.io')
event_server = HttpProvider('https://api.trongrid.io')
tron = Tron(full_node=full_node,
solidity_node=soli... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/context.py | monosidev/monosi | 156 | 1668215 | <reponame>monosidev/monosi<filename>tests/context.py<gh_stars>100-1000
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../src')))
import ingestion
import pipeline
import scheduler
import server
| 0 | 0 | 0 | 0 | 0 | 0 |
share/ci/get_qt_ssl.py | 314pies/ScreenTranslator | 442 | 1668216 | import common as c
from config import ssl_dir, os_name
import sys
import xml.etree.ElementTree as ET
c.print('>> Downloading ssl for Qt for {}'.format(os_name))
if os_name == 'linux':
os_url = 'linux_x64'
tool_name = 'tools_openssl_x64'
root_path = 'Tools/OpenSSL/binary'
elif os_name == 'win32':
os_ur... | 0 | 0 | 0 | 0 | 0 | 0 |
config.py | xymor/flask-restless-security | 176 | 1668241 | from datetime import timedelta
class Config(object):
DEBUG: bool = False
TESTING: bool = False
SQLALCHEMY_DATABASE_URI: str = ''
APP_NAME: str = 'ApplicationName'
SECRET_KEY: str = 'add_secret'
JWT_EXPIRATION_DELTA = timedelta(days=30)
JWT_AUTH_URL_RULE: str = '/api/v1/auth'
SECURITY_... | 0 | 0 | 17 | 0 | 17 | 0 |
nel/__init__.py | psyML/nel | 196 | 1668248 | <filename>nel/__init__.py
# register components via descriptors
from features import probability, context, meta, dummy, coherence, recognition # pylint: disable=I0011,W0611
from corpora import generic, conll, tac#pylint: disable=I0011,W0611
| 0 | 0 | 0 | 0 | 0 | 0 |
stream/clients/python/examples/admin.py | pkumar-singh/bookkeeper | 1,545 | 1668251 | # -*- coding: utf-8 -*-
#
# 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, soft... | 0 | 0 | 0 | 0 | 0 | 0 |
crypto/storagespace/solve.py | cclauss/fbctf-2019-challenges | 213 | 1668305 | <gh_stars>100-1000
#!/usr/bin/env sage
from typing import Any, Dict, Optional, Tuple
from sage.all import (
bsgs,
CRT_list,
EllipticCurve,
factor,
GF,
)
import warnings
import logging
import hashlib
import random
import base64
import json
import sys
# ignore bsgs deprecation
warnings.filterwarning... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/protocol15.py | sasano8/pyright | 241 | 1668339 | # This sample tests the handling of protocols with properties that
# make use of generics.
from typing import Protocol, TypeVar
T = TypeVar("T")
class Proto(Protocol):
@property
def f(self: T) -> T:
...
class Concrete:
@property
def f(self) -> "Concrete":
return self
x: Proto = C... | 1 | 2 | 1 | 0 | 4 | 0 |
RecoEgamma/EgammaIsolationAlgos/python/egmPhotonIsolationAOD_cff.py | Purva-Chaudhari/cmssw | 852 | 1668382 | import FWCore.ParameterSet.Config as cms
from CommonTools.ParticleFlow.pfNoPileUpIso_cff import pfPileUpIso, pfNoPileUpIso, pfNoPileUpIsoTask
from RecoEgamma.EgammaIsolationAlgos.egmIsoConeDefinitions_cfi import IsoConeDefinitions as _IsoConeDefinitions
from RecoEgamma.EgammaIsolationAlgos.egmIsolationDefinitions_cff ... | 0 | 0 | 0 | 0 | 0 | 0 |
gym_starcraft/gym_starcraft/envs/starcraft_base_env.py | miniTsl/IC3Net | 158 | 1668416 | <filename>gym_starcraft/gym_starcraft/envs/starcraft_base_env.py
import gym
import torchcraft.Constants as tcc
import random
import yaml
import subprocess
import sys
import time
import socket, errno
import os
import signal
import atexit
import uuid
import gym_starcraft.utils as utils
import tempfile
DISTANCE_FACTOR ... | 0 | 0 | 0 | 0 | 0 | 0 |
gabbi/tests/test_syntax_warning.py | scottwallacesh/gabbi | 145 | 1668438 | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... | 0 | 0 | 0 | 0 | 0 | 0 |
solutions/problem_204.py | ksvr444/daily-coding-problem | 1,921 | 1668454 | from __future__ import annotations
class Node:
def __init__(self):
self.left: None = None
self.right: None = None
def count_nodes(root, lspine: int=0, rspine: int=0) -> int | object:
if not root:
return 0
if not lspine:
node = root
while node:
node = no... | 2 | 1 | 0 | 2 | 5 | 0 |
tf_encrypted/protocol/aby3/__init__.py | wqruan/tf-encrypted | 825 | 1668480 | """Implementation of the ABY3 framework."""
from .aby3 import ABY3
from .aby3 import ARITHMETIC
from .aby3 import BOOLEAN
from .aby3 import ABY3PrivateTensor
from .aby3 import ABY3PublicTensor
from .aby3 import ABY3Tensor
__all__ = [
"ABY3",
"ABY3Tensor",
"ABY3PublicTensor",
"ABY3PrivateTensor",
"... | 0 | 0 | 0 | 0 | 0 | 0 |
igibson/object_states/texture_change_state_mixin.py | mamadbiabon/iGibson | 360 | 1668511 | <filename>igibson/object_states/texture_change_state_mixin.py
class TextureChangeStateMixin(object):
def __init__(self):
super(TextureChangeStateMixin, self).__init__()
self.material = None
def update_texture(self):
# Assume only state evaluated True will need non-default texture
... | 0 | 0 | 0 | 0 | 0 | 0 |
tracardi/process_engine/action/v1/internal/inject_event/model/configuration.py | bytepl/tracardi | 153 | 1668535 | <filename>tracardi/process_engine/action/v1/internal/inject_event/model/configuration.py
from pydantic import BaseModel, validator
class Configuration(BaseModel):
event_id: str
@validator("event_id")
def event_id_can_not_be_empty(cls, value):
if len(value) == 0:
raise ValueError("Even... | 0 | 0 | 0 | 0 | 0 | 0 |
testing/MLDBFB-404-case_into_beh_test.py | kstepanmpmg/mldb | 665 | 1668540 | <reponame>kstepanmpmg/mldb
#
# MLDBFB-404-case_into_beh_test.py
# Mich, 2016-03-14
# This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved.
#
from mldb import mldb, MldbUnitTest
class TestCaseIntoBeh(MldbUnitTest): # noqa
query = ('SELECT conv : CASE (behA AND behC) WHEN 1 THEN 1 ELSE 0 END ... | 0 | 0 | 0 | 0 | 0 | 0 |
sequana/multiqc/bamtools_stats.py | khourhin/sequana | 138 | 1668564 | <reponame>khourhin/sequana<filename>sequana/multiqc/bamtools_stats.py<gh_stars>100-1000
#!/usr/bin/env python
""" MultiQC module to parse output from sequana"""
import os
import re
from collections import OrderedDict
# prevent boring warning (version 1.0)
import logging
logging.captureWarnings(True)
from multiqc impor... | 0 | 0 | 0 | 0 | 0 | 0 |
smacc_client_library/battery_monitor_client/server/battery_monitor_node.py | koyalbhartia/SMACC | 203 | 1668565 | #!/usr/bin/env python
from __future__ import print_function
import roslib
import rospy
import std_msgs
import numpy
from sensor_msgs.msg import BatteryState
if __name__ == "__main__":
rospy.init_node('battery_node')
pub = rospy.Publisher("battery", BatteryState, queue_size=1)
tinit = rospy.Time.now().to... | 0 | 0 | 0 | 0 | 0 | 0 |
odo/backends/tests/test_s3_redshift.py | farukht/odo | 844 | 1668598 | <filename>odo/backends/tests/test_s3_redshift.py
import os
import sys
import pytest
pytestmark = pytest.mark.skipif(sys.platform == 'win32',
reason='Requires Mac or Linux')
sa = pytest.importorskip('sqlalchemy')
boto = pytest.importorskip('boto')
pytest.importorskip('psycopg2')
pytest.... | 0 | 0 | 0 | 0 | 0 | 0 |
src/main/python/counts_tools/utils/__init__.py | cday97/beam | 123 | 1668635 | __author__ = 'daddy30000'
| 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/nose-1.3.7/functional_tests/support/coverage2/blah.py | kokosing/hue | 5,079 | 1668667 | def dostuff():
print 'hi'
def notcov():
print 'not covered'
| 0 | 0 | 0 | 0 | 0 | 0 |
yaql/tests/test_branching.py | nzlosh/yaql | 112 | 1668673 | <gh_stars>100-1000
# Copyright (c) 2015 Mirantis, 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 require... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.