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 |
|---|---|---|---|---|---|---|---|---|---|---|
scripts/check_spelling.py | gglin001/poptorch | 128 | 3210987 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import ast
import glob
import os
import re
import shlex
import shutil
import signal
import sys
import termios
import threading
import tty
from utils import _utils
CUSTOM_DIC_PATH = "docs/common/custom_dic"
HUNSPELL_CM... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/examples/container/gke/instantiate_driver.py | zimventures/libcloud | 1,435 | 3211096 | from libcloud.container.types import Provider
from libcloud.container.providers import get_driver
cls = get_driver(Provider.GKE)
conn = cls('<EMAIL>',
'libcloud.json', project='testproject')
conn.list_clusters()
| 0 | 0 | 0 | 0 | 0 | 0 |
dbaas/drivers/__init__.py | didindinn/database-as-a-service | 303 | 3211101 | from .base import * # NOQA
from .factory import * # NOQA
def factory_for(*args, **kwargs) -> object:
return DriverFactory.factory(*args, **kwargs)
| 0 | 1 | 0 | 0 | 1 | 0 |
setup.py | ecometrica/gdal2mbtiles | 117 | 3211102 | <reponame>ecometrica/gdal2mbtiles
#!/usr/bin/env python
from setuptools import setup
import gdal2mbtiles
# Hack to prevent stupid TypeError: 'NoneType' object is not callable error on
# exit of python setup.py test in multiprocessing/util.py _exit_function when
# running python setup.py test (see
# http://www.eby-... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_convergence.py | simonoso/EasyRL | 125 | 3211108 | <reponame>simonoso/EasyRL
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
import numpy as np
import tensorflow as tf
import gym
from easy_rl.agents import agents
from easy_rl.models import DQNModel
from easy_rl.utils.window_stat import Windo... | 0 | 0 | 0 | 0 | 0 | 0 |
pubnub/endpoints/message_count.py | panchiwalashivani/python | 146 | 3211112 | <reponame>panchiwalashivani/python
from pubnub import utils
from pubnub.endpoints.endpoint import Endpoint
from pubnub.enums import HttpMethod, PNOperationType
from pubnub.exceptions import PubNubException
from pubnub.models.consumer.message_count import PNMessageCountResult
class MessageCount(Endpoint):
MESSAGE_... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_parts.py | peterandluc/PyHDB | 332 | 3211115 | # Copyright 2014, 2015 SAP SE.
#
# 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,
#... | 1 | 2 | 1 | 0 | 4 | 0 |
cloudbaseinit/conf/ovf.py | andia10240/cloudbase-init | 160 | 3211143 | <filename>cloudbaseinit/conf/ovf.py
# Copyright 2019 VMware, 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... | 0 | 0 | 0 | 0 | 0 | 0 |
codeforces/1151/c.py | Ashindustry007/competitive-programming | 506 | 3211173 | #!/usr/bin/env python3
# https://codeforces.com/contest/1151/problem/C
a = [i*2+1 for i in range(1000)]
b = [i*2+2 for i in range(1000)]
x = [a, b]
y = [0, 0]
s = [0, 1]
t = [0, 1]
for i in range(2,70):
s.append(s[i-1]+s[i-2]*2)
t.append(2*t[i-1]+int(i%2==1))
s = s[2:]
l, r = map(int, input().split())
l -= 1
k ... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/lannouncer/__init__.py | domwillcode/home-assistant | 30,023 | 3211181 | <reponame>domwillcode/home-assistant
"""The lannouncer component."""
| 0 | 0 | 0 | 0 | 0 | 0 |
src/anyconfig/cli/parse_args.py | ssato/python-anyconfig | 213 | 3211188 | #
# Copyright (C) 2011 - 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: MIT
#
"""Argument parser.
"""
import argparse
import typing
from .. import api
from . import constants, utils
DEFAULTS = dict(
loglevel=0, list=False, output=None, itype=None, otype=None, atype=None,
merge=api.MS_DICTS, ignore_missing=... | 6 | 3 | 2 | 0 | 11 | 0 |
sponsors/migrations/0015_auto_20201117_1739.py | ewjoachim/pythondotorg | 911 | 3211192 | <filename>sponsors/migrations/0015_auto_20201117_1739.py
# Generated by Django 2.0.13 on 2020-11-17 17:39
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(set... | 0 | 0 | 0 | 0 | 0 | 0 |
testfixtures/sybil.py | abcdenis/testfixtures | 184 | 3211239 | <filename>testfixtures/sybil.py
from __future__ import absolute_import
import os
import re
import textwrap
from sybil import Region
from testfixtures import diff
FILEBLOCK_START = re.compile(r'^\.\.\s*topic::?\s*(.+)\b', re.MULTILINE)
FILEBLOCK_END = re.compile(r'(\n\Z|\n(?=\S))')
CLASS = re.compile(r'\s+:class:\s*(... | 0 | 0 | 0 | 0 | 0 | 0 |
checkov/terraform/checks/resource/azure/RemoteDebggingNotEnabled.py | jamesholland-uk/checkov | 4,013 | 3211272 | from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck
class RemoteDebuggingNotEnabled(BaseResourceValueCheck):
def __init__(self):
name = "Ensure that remote debugging is not enabled for app servi... | 0 | 2 | 0 | 0 | 2 | 0 |
pythran/tests/user_defined_import/method_in_imported_module_main.py | davidbrochart/pythran | 1,647 | 3211280 | from .method_in_imported_module import aa, hh
from .other_method_in_imported_module import CC, DD
def cc() -> object:
return aa(3)
#pythran export dd(int)
def dd(o) -> object:
return hh(o)
XX = cc() + [3]
YY = CC()
#pythran export bb()
def bb() -> tuple[object, object, object]:
return XX, YY, DD()
| 0 | 3 | 0 | 0 | 3 | 0 |
loompy/cell_calling.py | jlikhuva/loompy | 111 | 3211293 | # Original algorithm was published by <NAME> and colleagues as EmptyDrops (Lun, A. et al. Distinguishing cells from empty droplets in droplet-based single-cell RNA sequencing data.)
# This implementation is based on the code in cellranger v3.0 by 10x Genomics
# Copyright 2018 10X Genomics, Inc.
#
# Permission is here... | 7 | 11 | 0 | 0 | 18 | 0 |
unicorn/bindings/python/sample_armeb.py | clayne/unicorn_pe | 491 | 3211301 | <gh_stars>100-1000
#!/usr/bin/env python
# Sample code for ARM big endian of Unicorn. zhangwm <<EMAIL>>
from __future__ import print_function
from unicorn import *
from unicorn.arm_const import *
# code to be emulated
ARM_CODE = b"\xe3\xa0\x00\x37\xe0\x42\x10\x03" # mov r0, #0x37; sub r1, r2, r3
THUMB_CODE = b"\xb... | 0 | 0 | 0 | 0 | 0 | 0 |
observations/r/tobin.py | hajime9652/observations | 199 | 3211302 | <reponame>hajime9652/observations
# -*- 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 tobin(path):
"""Tobin's Tobit data
... | 0 | 0 | 0 | 0 | 0 | 0 |
sandbox/jorvis/nucmer_genome_coverage_summary.py | senjoro/biocode | 355 | 3211305 | <reponame>senjoro/biocode<filename>sandbox/jorvis/nucmer_genome_coverage_summary.py
#!/usr/bin/env python3.2
import argparse
import os
import re
def report_coverage_summary(refs, ofile_path):
ofh = open(ofile_path, 'w')
ofh.write("ref_id\tuncovered_bases\tref_length\n")
for ref in refs:
last... | 0 | 0 | 0 | 0 | 0 | 0 |
api/utils.py | oktoshi/OpenBazaar-Server | 723 | 3211318 | import bleach
from api import ALLOWED_TAGS, ALLOWED_ATTRIBUTES, ALLOWED_STYLES
# pylint: disable=W1402
def smart_unicode(s, encoding: str='utf8') -> object:
""" Convert str to unicode. If s is unicode, return itself.
>>> smart_unicode('')
u''
>>> smart_unicode('abc')
u'abc'
>>> smart_unicode('... | 2 | 3 | 0 | 0 | 5 | 0 |
gitlabform/processors/group/group_badges_processor.py | barryib/gitlabform | 299 | 3211327 | <filename>gitlabform/processors/group/group_badges_processor.py
from gitlabform.gitlab import GitLab
from gitlabform.processors.defining_keys import Key, And
from gitlabform.processors.multiple_entities_processor import MultipleEntitiesProcessor
class GroupBadgesProcessor(MultipleEntitiesProcessor):
def __init__(... | 0 | 0 | 0 | 0 | 0 | 0 |
ursina/prefabs/video_recorder.py | jtiai/ursina | 1,431 | 3211354 | from ursina import *
import os, shutil
# import imageio # gets imported in convert_to_gif
class VideoRecorder(Entity):
def __init__(self, duration: int=5, name: str='untitled_video', **kwargs):
super().__init__()
self.recording: bool = False
self.file_path = Path(application.asset_folde... | 2 | 4 | 0 | 5 | 11 | 0 |
docs/convert_notebooks_to_html_partial.py | samlaf/nbinteract | 214 | 3211383 | <filename>docs/convert_notebooks_to_html_partial.py<gh_stars>100-1000
"""Usage: convert_notebooks_to_html_partial.py [NOTEBOOKS ...]
This script takes the .ipynb files in the notebooks/ folder converts them to
HTML partials in the ch/ folder, recreating the folder structure in notebooks/.
It also adds the prev_page a... | 0 | 0 | 0 | 0 | 0 | 0 |
dev/python/histogram/hist.py | EFeru/ScottPlot | 1,447 | 3211407 | <filename>dev/python/histogram/hist.py
"""
This script analyzes standard datasets using using numpy's histogram tools
and displays statistics that can be used to test against when implementing
similar analysis tools in other languages.
"""
import pathlib
import matplotlib.pyplot as plt
import numpy as np
np.set_printo... | 0 | 0 | 0 | 0 | 0 | 0 |
litepcie/tlp/packetizer.py | antmicro/litepcie | 289 | 3211514 | #
# This file is part of LitePCIe.
#
# Copyright (c) 2015-2019 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
from migen import *
from migen.genlib.misc import chooser
from litepcie.tlp.common import *
# LitePCIeTLPHeaderInserter64b ---------------------------------------------------------------------
cla... | 0 | 0 | 0 | 0 | 0 | 0 |
vim_debug/new_debugger.py | timgates42/vim-debug | 128 | 3211528 | import subprocess
import textwrap
import socket
import vim
import sys
import os
import imp
from ui import DebugUI
from dbgp import DBGP
def vim_init():
'''put DBG specific keybindings here -- e.g F1, whatever'''
vim.command('ca dbg Dbg')
def vim_quit():
'''remove DBG specific keybindings'''
vim.comma... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/lib/fontbuild/mitreGlyph.py | BennZoll/roboto | 3,933 | 3211530 | # Copyright 2015 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... | 2 | 9 | 0 | 0 | 11 | 0 |
spot_bullet/src/old_eval_scripts/tg_eval.py | sofya-pugach/spot_mini_mini | 323 | 3211549 | <filename>spot_bullet/src/old_eval_scripts/tg_eval.py
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from ars_lib.ars import ARSAgent, Normalizer, Policy, ParallelWorker
from mini_bullet.minitaur_gym_env import MinitaurBulletEnv
from tg_lib.tg_policy import TGPolicy
import time
import torc... | 0 | 0 | 0 | 0 | 0 | 0 |
davarocr/davarocr/davar_spotting/models/seg_heads/instance_mask_att_head.py | icedream2/DAVAR-Lab-OCR | 387 | 3211551 | from __future__ import annotations
"""
####################################################################################################
# Copyright Info : Copyright (c) <NAME> @ Hikvision Research Institute. All rights reserved.
# Filename : instance_mask_att_head.py
# Abstract : Instance Mask ... | 5 | 5 | 0 | 2 | 12 | 0 |
examples/bots/class_based_handlers_bot.py | XIDY-Dex/vkwave | 222 | 3211586 | from vkwave.bots import SimpleLongPollBot
from vkwave.bots.addons.class_based_handlers import BaseHandler
bot = SimpleLongPollBot(tokens="MyToken", group_id=123456789)
@bot.message_handler(bot.text_filter("привет"))
class HelloHandler(BaseHandler):
async def handle(self, event: bot.SimpleBotEvent) -> str:
... | 1 | 1 | 0 | 0 | 2 | 0 |
test/utils/__init__.py | wconnell/torchdrug | 772 | 3211630 | <reponame>wconnell/torchdrug
from .test_comm import *
from .test_torch import * | 0 | 0 | 0 | 0 | 0 | 0 |
benchmark/scenarios/test/test_read_request_load.py | stackriot/flocker | 2,690 | 3211662 | <gh_stars>1000+
# Copyright 2016 ClusterHQ Inc. See LICENSE file for details.
from itertools import repeat
from uuid import uuid4
from ipaddr import IPAddress
from eliot.testing import capture_logging
from twisted.internet.defer import succeed, Deferred
from twisted.internet.task import Clock
from twisted.python.fai... | 0 | 0 | 0 | 0 | 0 | 0 |
cadence/tests/test_workflow_get_version.py | simkimsia/temporal-python-sdk | 141 | 3211691 | <reponame>simkimsia/temporal-python-sdk
import sys
from time import sleep
from cadence.clock_decision_context import DEFAULT_VERSION
from cadence.workerfactory import WorkerFactory
from cadence.workflow import workflow_method, Workflow, WorkflowClient
TASK_LIST = "TestWorkflowGetVersion"
DOMAIN = "sample"
v1_hits = ... | 0 | 0 | 0 | 0 | 0 | 0 |
tf_encrypted/protocol/pond/__init__.py | wqruan/tf-encrypted | 825 | 3211700 | """The Pond protocol."""
from __future__ import absolute_import
from .pond import AdditiveFIFOQueue
from .pond import Pond
from .pond import PondMaskedTensor
from .pond import PondPrivateTensor
from .pond import PondPrivateVariable
from .pond import PondPublicTensor
from .pond import PondTensor
from .pond import TFEIn... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_vollib_vs_ref_python_values/black_scholes/test_price.py | amirmalekicom/py_vollib | 145 | 3211712 | # -----------------------------------------------------------------------------
# IMPORTS
# Standard library imports
import unittest
# Related third party imports
# Local application/library specific imports
from py_vollib.black_scholes import black_scholes as c_black_scholes
from py_vollib.ref_python.black_scholes ... | 0 | 0 | 0 | 0 | 0 | 0 |
linkedlist/addTwoNumbersTwo.py | lidongdongbuaa/leetcode | 1,232 | 3211739 | <filename>linkedlist/addTwoNumbersTwo.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: <NAME>
# You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked lis... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/fixtures.py | timgates42/python-registry | 326 | 3211769 | import os.path
import pytest
from Registry import Registry
@pytest.fixture
def hive() -> object:
path = os.path.join(os.path.dirname(__file__), "reg_samples", "issue22.hive")
return Registry.Registry(path)
| 0 | 1 | 0 | 0 | 1 | 0 |
example/old/classify_with_svm.py | IcyW/stagesepx | 369 | 3211770 | <reponame>IcyW/stagesepx
from stagesepx.classifier import SVMClassifier
from stagesepx.reporter import Reporter
# 默认情况下使用 HoG 进行特征提取
# 你可以将其关闭从而直接对原始图片进行训练与测试:feature_type='raw'
cl = SVMClassifier(feature_type='hog')
# 基本与SSIM分类器的流程一致
# 但它对数据的要求可能有所差别,具体参见 cut.py 中的描述
data_home = './cut_result'
cl.load(data_home)
#... | 0 | 0 | 0 | 0 | 0 | 0 |
test-framework/test-suites/integration/tests/add/test_add_host_attr.py | kmcm0/stacki | 123 | 3211811 | import json
from textwrap import dedent
class TestAddHostAttr:
def test_no_args(self, host):
result = host.run('stack add host attr attr=test value=True')
assert result.rc == 255
assert result.stderr == dedent('''\
error - "host" argument is required
{host ...} {attr=string} {value=string} [shadow=boolea... | 0 | 0 | 0 | 0 | 0 | 0 |
api-inference-community/docker_images/speechbrain/app/pipelines/text_to_speech.py | abidlabs/huggingface_hub | 362 | 3211863 | from typing import Tuple
import numpy as np
from app.pipelines import Pipeline
class TextToSpeechPipeline(Pipeline):
def __init__(self, model_id: str):
# IMPLEMENT_THIS
# Preload all the elements you are going to need at inference.
# For instance your model, processors, tokenizer that mig... | 2 | 1 | 0 | 0 | 3 | 0 |
core/apps/search_head_api/models/sites.py | near-feign/pcapdb | 244 | 3211892 | from __future__ import annotations
from django.db import models
from django.contrib.auth.models import Group
from django.core.urlresolvers import reverse
import socket
class Site(models.Model):
"""Records for sites that group capture nodes into geographical or logical units."""
name = models.SlugField(max_le... | 0 | 3 | 0 | 0 | 3 | 0 |
Dictionary opperations (input,update a dict).py | sulphatet/Python | 28,321 | 3211911 | #Update the value of dictionary written by the user...
print("Dictinary opperations")
def Dictionary(Dict,key,value):
print("Original dictionary",Dict)
Dict[key]=value
print("Updated dictionary",Dict)
d=eval(input("Enter the dictionary"))
print("Dictionary",d,"\n")
k=input("Enter the key to be... | 0 | 0 | 0 | 0 | 0 | 0 |
txtorcon/controller_py3.py | glowatsk/txtorcon | 180 | 3211914 | <filename>txtorcon/controller_py3.py<gh_stars>100-1000
class _AsyncOnionAuthContext(object):
"""
Internal helper. An async context manager that holds client-style
onion authentication details and adds + removes them using
underlying :class:`txtorcon.Tor` methods.
"""
def __init__(self, tor, oni... | 0 | 0 | 0 | 0 | 0 | 0 |
data_preprocess.py | zzzkk2009/casia-surf-2019-codes | 123 | 3211933 | # -*- coding:utf-8 -*-
import os
import random
import cv2
import argparse
def mkdir_if_not_exist(path):
if not os.path.exists(os.path.join(*path)):
os.makedirs(os.path.join(*path))
class CasiaSurf(object):
def __init__(self):
self.color_list: list[object] = []
self.depth_list: list[o... | 0 | 1 | 0 | 3 | 4 | 0 |
tests/test_not_a_comment.py | gvanrossum/pyxl3 | 150 | 3211958 | # coding: pyxl
from pyxl import html
# This weird circumstance could cause extra spaces to get inserted...
def a():
return <div>
some stuff
$'{"#"}'
</div>
def b():
return (<div>
some stuff
$'{"#"}'
</div>)
def test():
as... | 0 | 0 | 0 | 0 | 0 | 0 |
code/python/tools/scene_generate_camera_trajectories_random_walk.py | americast/ml-hypersim | 1,246 | 3211973 | #
# For licensing see accompanying LICENSE.txt file.
# Copyright (C) 2020 Apple Inc. All Rights Reserved.
#
from pylab import *
import argparse
import h5py
import inspect
import os
import pandas as pd
import scipy.linalg
import sklearn.preprocessing
import sklearn.metrics
import path_utils
path_utils.add_path_to_sys... | 0 | 0 | 0 | 0 | 0 | 0 |
all/agents/independent.py | drozzy/autonomous-learning-library | 584 | 3212024 | <reponame>drozzy/autonomous-learning-library<filename>all/agents/independent.py
from ._multiagent import Multiagent
class IndependentMultiagent(Multiagent):
def __init__(self, agents):
self.agents = agents
def act(self, state):
return self.agents[state['agent']].act(state)
| 0 | 0 | 0 | 0 | 0 | 0 |
mojo/public/tools/mojom/mojom/generate/generator_unittest.py | zealoussnow/chromium | 14,668 | 3212031 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import imp
import os.path
import sys
import unittest
def _GetDirAbove(dirname) -> object:
"""Returns the directory "above" this file containing |dirname|... | 0 | 1 | 0 | 0 | 1 | 0 |
nndet/arch/decoder/__init__.py | joeranbosma/nnDetection | 242 | 3212071 | <reponame>joeranbosma/nnDetection<filename>nndet/arch/decoder/__init__.py<gh_stars>100-1000
from nndet.arch.decoder.base import BaseUFPN, UFPNModular, PAUFPN
| 0 | 0 | 0 | 0 | 0 | 0 |
sfaira/unit_tests/tests_by_submodule/versions/test_universe.py | johnmous/sfaira | 110 | 3212074 | import os
from sfaira.versions.metadata import CelltypeUniverse, OntologyCl, OntologyUberon
from sfaira.unit_tests import DIR_TEMP
"""
CelltypeUniverse
"""
def test_universe_io():
if not os.path.exists(DIR_TEMP):
os.mkdir(DIR_TEMP)
tmp_fn = os.path.join(DIR_TEMP, "universe_temp.csv")
targets = [... | 0 | 0 | 0 | 0 | 0 | 0 |
asreader/text_comprehension/visualisation.py | rkadlec/asreader | 113 | 3212124 | <filename>asreader/text_comprehension/visualisation.py
__author__ = 'schmidm'
import random
def make_html_file(examples, filename):
"""
Visualizes attention of a model in a HTML file.
:param examples:
:param filename:
:return:
"""
def attention_to_rgb(attention):
# red = int(att... | 0 | 0 | 0 | 0 | 0 | 0 |
python_source/beautifier.py | K0D4XP1/DigiSparkStealer | 129 | 3212133 | <reponame>K0D4XP1/DigiSparkStealer<gh_stars>100-1000
class Beautifier:
"""
Class that creates HTML file (_filename) with simple w3-css style from
input dict (_data). Example of input dict:
{ 'WI-FI keys':
[
{'ESSID': 'Burger-king', 'Pass': '<PASSWORD>'},
{'ESSID': 'Neig... | 0 | 0 | 0 | 0 | 0 | 0 |
python/716_Max_Stack.py | dvlpsh/leetcode-1 | 4,416 | 3212156 | <reponame>dvlpsh/leetcode-1
class MaxStack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.stack = []
self.max_stack = []
def push(self, x):
"""
:type x: int
:rtype: void
"""
self.stack.append(x)
... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/challenges/migrations/0050_remove_charfield_from_challenge_slug.py | kaustubh-s1/EvalAI | 1,470 | 3212159 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-01 06:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [("challenges", "0049_add_slug_field_in_challenge_phase")]
operations: list... | 0 | 0 | 2 | 0 | 2 | 0 |
notebook/name_main_example.py | vhn0912/python-snippets | 174 | 3212229 | import math
import numpy as np
print(math.__name__)
# math
print(np.__name__)
# numpy
import hello
print(hello.__name__)
# hello
hello.func()
# Hello!
# __name__ is hello
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/core/test_collections.py | NRauschmayr/sagemaker-debugger | 133 | 3212235 | <gh_stars>100-1000
# Standard Library
import os
# First Party
from smdebug.core.collection import Collection
from smdebug.core.collection_manager import CollectionManager
from smdebug.core.config_constants import DEFAULT_COLLECTIONS_FILE_NAME
from smdebug.core.modes import ModeKeys
from smdebug.core.reduction_config i... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/09/set_adt.py | 15921483570/python_data_structures_and_algorithms | 2,468 | 3212246 | # -*- coding: utf-8 -*-
# 从数组和列表章复制的代码
from __future__ import annotations
class Array(object):
def __init__(self, size: int=32, init: object | None=None):
self._size = size
self._items = [init] * size
def __getitem__(self, index) -> object:
return self._items[index]
def __setit... | 4 | 16 | 1 | 1 | 22 | 0 |
src/sparseml/onnx/benchmark/info.py | clementpoiret/sparseml | 922 | 3212268 | <filename>src/sparseml/onnx/benchmark/info.py
# Copyright (c) 2021 - present / Neuralmagic, 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.... | 0 | 0 | 0 | 0 | 0 | 0 |
capture/noworkflow/now/cmd/cmd_schema.py | raffaelfoidl/noworkflow | 108 | 3212277 | # Copyright (c) 2016 Universidade Federal Fluminense (UFF)
# Copyright (c) 2016 Polytechnic Institute of New York University.
# This file is part of noWorkflow.
# Please, consult the license terms in the LICENSE file.
"""'now schema'command"""
from __future__ import (absolute_import, print_function,
... | 0 | 6 | 0 | 0 | 6 | 0 |
docs/test_documentation.py | celikten/fluids | 380 | 3212280 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2021 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in th... | 0 | 0 | 0 | 0 | 0 | 0 |
Scripts/Miscellaneous/YouTube Audio Download/YouTubeAudio.py | ShivangiPatel102/Python_and_the_Web | 437 | 3212296 | # Importing pafy library
import pafy
# Taking url as input from the user
url = input("Enter URL: ")
# Creating a video instance
video = pafy.new(url)
# Using 'bestaudio()' to select the best audio file
bestaudio = video.getbestaudio()
# Using 'download()' to download the selected audio file
bestaudio.download()
| 0 | 0 | 0 | 0 | 0 | 0 |
test_aiodataloader.py | joshcurtis/aiodataloader | 209 | 3212399 | <filename>test_aiodataloader.py<gh_stars>100-1000
import pytest
from asyncio import gather
from functools import partial
from pytest import raises
from aiodataloader import DataLoader
pytestmark = pytest.mark.asyncio
async def do_test():
return True
def id_loader(**options):
load_calls = []
async def ... | 0 | 0 | 0 | 0 | 0 | 0 |
pytradfri/command.py | TimotheBarbe/pytradfri | 164 | 3212411 | <reponame>TimotheBarbe/pytradfri
"""Command implementation."""
from __future__ import annotations
from copy import deepcopy
from typing import Any, Callable, Optional
TypeProcessResultCb = Optional[Callable[[Any], Optional[str]]]
TypeErrCb = Optional[Callable[[str], str]]
class Command:
"""The object for coap c... | 0 | 0 | 0 | 0 | 0 | 0 |
arbitration/test.py | sigmoid3/Dapper | 974 | 3212459 | <gh_stars>100-1000
from ethereum import tester as t
from ethereum import utils
import sys
def test():
# Test the arbiter mechanism
t.gas_price = 0
t.gas_limit = 100000000
s = t.state()
c = s.abi_contract('arbitration.se')
o = []
s.block.log_listeners.append(lambda x: o.append(c._translator.... | 0 | 0 | 0 | 0 | 0 | 0 |
vapory/vapory.py | TonyZYT2000/vapory | 376 | 3212468 | <gh_stars>100-1000
import webbrowser # <= to open the POVRay help
from copy import deepcopy
import re
from .io import render_povstring
from .helpers import WIKIREF, vectorize, format_if_necessary
class Scene:
""" A scene contains Items and can be written to a file.
Examples
---------
>>> scene = Sce... | 0 | 0 | 0 | 0 | 0 | 0 |
UnityPy/enums/SerializedPropertyType.py | yvsdrop/UnityPy | 313 | 3212499 | <reponame>yvsdrop/UnityPy
from enum import IntEnum
class SerializedPropertyType(IntEnum):
kColor = 0
kVector = 1
kFloat = 2
kRange = 3
kTexture = 4
| 0 | 0 | 0 | 0 | 0 | 0 |
srn/extensions/__init__.py | zhangruihan1/SRN | 298 | 3212501 | from srn.extensions._nms.pth_nms import pth_nms as nms
| 0 | 0 | 0 | 0 | 0 | 0 |
caffe2/python/operator_test/mean_op_test.py | chocjy/caffe2 | 585 | 3212504 | <filename>caffe2/python/operator_test/mean_op_test.py
# Copyright (c) 2016-present, Facebook, 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/LICEN... | 0 | 0 | 0 | 0 | 0 | 0 |
Joy_QA_Platform/ApiManager/tasks.py | bzc128/Joy_QA_Platform | 123 | 3212505 | # #用例执行
# #@shared_task 装饰器能在没有具体的 Celery 实例时创建任务
from celery import shared_task
from httprunner import HttpRunner
import time,json,os,shutil
from djcelery import celery
from datetime import datetime, date
import django
os.environ['DJANGO_SETTINGS_MODULE'] = 'Joy_QA_Platform.settings'
django.setup()
from ApiManager.... | 3 | 3 | 0 | 0 | 6 | 0 |
st3/mdpopups/coloraide/spaces/oklab.py | evandroforks/mdpopups | 109 | 3212517 | """
Oklab class.
https://bottosson.github.io/posts/oklab/
"""
from ..spaces import Space, RE_DEFAULT_MATCH, GamutUnbound, OptionalPercent
from .xyz import XYZ
from .. import util
import re
m1 = [
[0.8189330101, 0.0329845436, 0.0482003018],
[0.3618667424, 0.9293118715, 0.2643662691],
[-0.1288597137, 0.0361... | 0 | 7 | 5 | 0 | 12 | 0 |
controle_estoque/Funcoes/extenso.py | jucimar1/controleEstoque | 134 | 3212524 | # -*- coding: utf-8 -*-
# Autor: <NAME> (xiru)
# Correcao em 20080407: <NAME> (100:"cento") => (1:"cento')
# Correcao em 20100311: <NAME> adicionado {0:""} ao ext[0], pois dava KeyError: 0 em números como 200, 1200, 300, etc.
# Modificação para tradução de moeda
from __future__ import annotations
import sys
ext = [... | 0 | 3 | 0 | 0 | 3 | 0 |
py_feature/109_have_you_bought.py | weiziyoung/instacart | 290 | 3212541 | <filename>py_feature/109_have_you_bought.py<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 21 00:54:02 2017
@author: konodera
pid freq
-------------
24852 57186
13176 47063
21137 39871
21903 38095
47209 30047
47626 28741
47766 28478
26209 26199
167... | 0 | 0 | 0 | 0 | 0 | 0 |
zeus/api/resources/install_stats.py | conrad-kronos/zeus | 221 | 3212589 | from datetime import timedelta
from sqlalchemy.sql import func
from flask import request
from zeus.api.utils import stats
from zeus.config import db
from zeus.models import Build, User
from zeus.utils import timezone
from .base import Resource
STAT_CHOICES = frozenset(
("builds.errored", "builds.total", "users.... | 0 | 1 | 0 | 0 | 1 | 0 |
modules/dbnd/src/targets/marshalling/marshaller.py | ipattarapong/dbnd | 224 | 3212635 | <gh_stars>100-1000
import abc
import typing
if typing.TYPE_CHECKING:
pass
class Marshaller(object):
type = None
file_format = None
# if true on folder read we use load funcition
support_directory_direct_read = False
support_multi_target_direct_read = False
support_directory_direct_write... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/docker/test_visit.py | visit-dav/vis | 226 | 3212644 | OpenDatabase("visit/data/curv2d.silo")
AddPlot("Pseudocolor", "d")
DrawPlots()
SaveWindow()
quit()
| 0 | 0 | 0 | 0 | 0 | 0 |
Code/line_helper_gui.py | hotmailbox/Structural-Engineering | 152 | 3212705 | '''
BSD 3-Clause License
Copyright (c) 2019, <NAME>
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 notice, this
list of condition... | 0 | 0 | 0 | 2 | 2 | 0 |
kim/role.py | mikeywaites/kim | 356 | 3212724 | # kim/roles.py
# Copyright (C) 2014-2015 the Kim authors and contributors
# <see AUTHORS file>
#
# This module is part of Kim and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from kim.exception import RoleError
class Role(set):
"""Roles are a fundamental feature of Kim.... | 0 | 4 | 0 | 1 | 5 | 0 |
tools/cloud_functions/gcs_event_based_ingest/tests/conftest.py | yrvine-g/bigquery-utils | 567 | 3212732 | # 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, ... | 4 | 33 | 32 | 0 | 69 | 0 |
ramp/tests/test_estimators.py | kvh/ramp | 214 | 3212735 | import sys
sys.path.append('../..')
import unittest
import numpy as np
import pandas as pd
from sklearn import linear_model
from ramp.estimators import (Probabilities,
BinaryProbabilities,
wrap_sklearn_like_estimator)
from ramp import shortcuts
from ramp.tests... | 0 | 1 | 0 | 1 | 2 | 0 |
utils/log.py | baronpan/SysmonHunter | 187 | 3212749 | <reponame>baronpan/SysmonHunter<gh_stars>100-1000
from termcolor import cprint
def log_error(s):
cprint(s, 'red')
def log_warn(s):
cprint(s, 'yellow')
def log_print(s):
cprint(s, 'white')
def log_debug(s):
cprint(s, 'grey')
def log_success(s):
cprint(s, 'green')
def log_error_u(s):
cprint(... | 0 | 0 | 0 | 0 | 0 | 0 |
blender/arm/logicnode/random/LN_random_color.py | onelsonic/armory | 2,583 | 3212767 | from arm.logicnode.arm_nodes import *
class RandomColorNode(ArmLogicTreeNode):
"""Generates a random color."""
bl_idname: str = 'LNRandomColorNode'
bl_label: str = 'Random Color'
arm_version: int = 1
def arm_init(self, context):
self.add_output('ArmColorSocket', 'Color')
| 0 | 0 | 3 | 0 | 3 | 0 |
pycon/sponsorship/migrations/0007_auto_20150721_1533.py | azkarmoulana/pycon | 154 | 3212771 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('sponsorship', '0006_migrate_web_description_and_logo'),
... | 0 | 0 | 0 | 0 | 0 | 0 |
spleeter/audio/convertor.py | ming-hai/spleeter | 19,827 | 3212804 | <reponame>ming-hai/spleeter<gh_stars>1000+
#!/usr/bin/env python
# coding: utf8
""" This module provides audio data convertion functions. """
# pyright: reportMissingImports=false
# pylint: disable=import-error
import numpy as np
import tensorflow as tf
from ..utils.tensor import from_float32_to_uint8, from_uint8_to... | 0 | 0 | 0 | 0 | 0 | 0 |
samsungctl/websocket_base.py | p3g4asus/samsungctl | 135 | 3212830 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import logging
import threading
import requests
from . import wake_on_lan
from .utils import LogIt, LogItWithReturn
logger = logging.getLogger('samsungctl')
class WebSocketBase(object):
"""Base class for TV's with websocket connectio... | 0 | 4 | 0 | 5 | 9 | 0 |
tests/newsqa_predictor_test_unsup.py | davidgolub/QuestionGeneration | 117 | 3212843 | <reponame>davidgolub/QuestionGeneration
import torch
from data_loaders.language_model_loader import LanguageModelLoader
from models.language_model import LanguageModel
from models.language_trainer import LanguageTrainer
from models.language_wrapper import LanguageWrapper
from helpers import constants
from helpers i... | 0 | 0 | 0 | 0 | 0 | 0 |
academicstoday_project/student/tests/test_quiz.py | LeeDoona/EasyGrading | 146 | 3212859 | <gh_stars>100-1000
# Django & Python
from django.core.urlresolvers import resolve
from django.http import HttpRequest
from django.http import QueryDict
from django.test import TestCase
from django.test import Client
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_mp2.py | berquist/pyquante2 | 107 | 3212906 | import unittest
from pyquante2 import rhf,basisset,h2,mp2
class test_mp2(unittest.TestCase):
def test_h2(self) -> None:
bfs = basisset(h2,'6-31g**')
solver=rhf(h2,bfs)
solver.converge()
nvirt = len(bfs)-h2.nocc()
emp2 = mp2(solver.i2,solver.orbs,solver.orbe,h2.nocc(),len(bfs... | 0 | 1 | 0 | 0 | 1 | 0 |
tools/issues2csv.py | mmccarty/legion | 555 | 3212950 | #!/usr/bin/env python3
import json
import argparse
import csv
import sys
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--state',
default = 'open', choices = ['open' ,'closed', 'all'],
help = 'state of issues to fetch')
parser.add_argument('-l', '--label',
... | 0 | 4 | 0 | 0 | 4 | 0 |
PyObjCTest/test_nsdateformatter.py | Khan/pyobjc-framework-Cocoa | 132 | 3212952 | from PyObjCTools.TestSupport import *
from Foundation import *
class TestNSDateFormatter (TestCase):
def testOutput(self):
formatter = NSDateFormatter.alloc().init()
formatter.setDateFormat_("yyyy/mm/dd")
self.assertResultIsBOOL(NSDateFormatter.getObjectValue_forString_range_error_)
... | 0 | 0 | 0 | 0 | 0 | 0 |
design/eclipses_lunar.py | facorazza/python-skyfield | 765 | 3212970 | <reponame>facorazza/python-skyfield
"""Check Skyfield lunar eclipses against the huge NASA table of eclipses."""
from collections import Counter
from skyfield import eclipselib
from skyfield.api import load, GREGORIAN_START
import datetime as dt
with load.open('https://eclipse.gsfc.nasa.gov/5MCLE/5MKLEcatalog.txt') a... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/core/profiler/util/test_string_hash.py | mircealungu/automatic-monitoring-for-flask | 630 | 3212972 | import pytest
def test_stringhash(string_hash):
assert string_hash.hash('abc') == 0
assert string_hash.hash('def') == 1
assert string_hash.hash('abc') == 0
def test_unhash(string_hash):
assert string_hash.unhash(string_hash.hash('abc')) == 'abc'
with pytest.raises(ValueError):
string_ha... | 0 | 0 | 0 | 0 | 0 | 0 |
generic/examples/simple_config.py | antmicro/nextpnr | 865 | 3212980 | <filename>generic/examples/simple_config.py
# Grid size including IOBs at edges
X = 12
Y = 12
# SLICEs per tile
N = 8
# LUT input count
K = 4
# Number of local wires
Wl = N*(K+1) + 8
# 1/Fc for bel input wire pips
Si = 4
# 1/Fc for Q to local wire pips
Sq = 4
# ~1/Fc local to neighbour local wire pips
Sl = 8 | 0 | 0 | 0 | 0 | 0 | 0 |
test/unit3/test_matmul.py | timmartin/skulpt | 2,671 | 3212982 | from __future__ import annotations
"""Unit testing for matrix multiplication operator, @"""
import unittest
class MatMulTests(unittest.TestCase):
def test_matmul(self) -> object:
class A:
def __init__(self,x):
self.x = x
def __matmul__(self,other) -> object:
... | 0 | 15 | 0 | 0 | 15 | 0 |
src/run_full.py | pathak22/videoseg | 166 | 3213024 | """
This file implements following paper:
Video Segmentation by Non-Local Consensus Voting
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# from __future__ import unicode_literals
import sys
import time
from PIL import Image
import numpy as np
from scip... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/notebook_runner.py | adityakuppa26/issue_163_documentation | 424 | 3213035 | import nbformat
import sys
from nbconvert.preprocessors import ExecutePreprocessor
with open(sys.argv[1]) as f:
nb = nbformat.read(f, as_version=4)
ep = ExecutePreprocessor(timeout=600)
ep.preprocess(nb, {'metadata': {'path': 'tests/'}}) | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter04/ear_detection.py | debojyoti007/OpenCV | 105 | 3213091 | import cv2
import numpy as np
left_ear_cascade = cv2.CascadeClassifier('./cascade_files/haarcascade_mcs_leftear.xml')
right_ear_cascade = cv2.CascadeClassifier('./cascade_files/haarcascade_mcs_rightear.xml')
if left_ear_cascade.empty():
raise IOError('Unable to load the left ear cascade classifier xml file')... | 0 | 0 | 0 | 0 | 0 | 0 |
pclib/cl/OutValRdyInelasticPipeAdapter.py | belang/pymtl | 206 | 3213131 | #=========================================================================
# OutValRdyInelasticPipeAdapter
#=========================================================================
# Models an inelastic pipeline at an output interface. Note that if
# nstages is set to zero, then this essentially models a single-entry
... | 1 | 2 | 0 | 0 | 3 | 0 |
transformations/speech_disfluency_perturbation/transformation.py | raft001/NL-Augmenter | 583 | 3213134 | import random
from typing import List, Optional
from interfaces.SentenceOperation import SentenceOperation
from tasks.TaskTypes import TaskType
class SpeechDisfluencyPerturbation(SentenceOperation):
tasks: List[TaskType] = [
TaskType.TEXT_CLASSIFICATION,
TaskType.TEXT_TO_TEXT_GENERATION,
]
... | 5 | 2 | 5 | 0 | 12 | 0 |
losses/bootstrapped_ce_loss.py | leo-hao/hyperseg | 154 | 3213184 | <filename>losses/bootstrapped_ce_loss.py<gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional
# Adapted from: https://github.com/PingoLH/FCHarDNet/blob/master/ptsemseg/loss/loss.py
class BootstrappedCrossEntropyLoss(nn.CrossEntropyLoss):
r"""This criteri... | 0 | 0 | 0 | 0 | 0 | 0 |
services/flow_bigquery.py | Muflhi01/flow-dashboard | 1,623 | 3213207 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# API calls to interact with Google Big Query
# TODO:
# - Build in push date overlap to handle late-reported data
from __future__ import annotations
from __future__ import absolute_import
from datetime import datetime, timedelta, time
from services.gservice import GoogleServ... | 6 | 7 | 0 | 3 | 16 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.