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 |
|---|---|---|---|---|---|---|---|---|---|---|
summarus/util/io.py | IlyaGusev/summarus | 139 | 1776301 | import json
def write_jsonl(records, path):
with open(path, "w") as w:
for r in records:
w.write(json.dumps(r, ensure_ascii=False) + "\n")
def read_jsonl(file_name) -> object:
records = []
with open(file_name, "r") as r:
for line in r:
record = json.loads(line)
... | 0 | 1 | 0 | 0 | 1 | 0 |
src/test/tests/hybrid/specmf.py | visit-dav/vis | 226 | 1776308 | # ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: val4mat.py
#
# Tests: mesh - 2d structured
# plots - pc
#
# Notes
#
# Programmer: <NAME>
# Date: Tuesday 12, 2008
#
# Modifiations:
#
# ------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
aiovk/__init__.py | Termonoid/aiovk | 113 | 1776309 | __version__ = '4.0.0'
from aiovk.sessions import ImplicitSession, TokenSession, AuthorizationCodeSession
from aiovk.api import API
from aiovk.longpoll import LongPoll
| 0 | 0 | 0 | 0 | 0 | 0 |
benchmark/benchmark.py | sugatoray/omegaconf | 1,091 | 1776337 | import copy
from typing import Any, Dict, List
from pytest import lazy_fixture # type: ignore
from pytest import fixture, mark, param
from omegaconf import OmegaConf
from omegaconf._utils import ValueKind, _is_missing_literal, get_value_kind
def build_dict(
d: Dict[str, Any], depth: int, width: int, leaf_value... | 31 | 20 | 1 | 0 | 52 | 0 |
bayesian/test/test_persistance.py | timgates42/bayesian-belief-networks | 734 | 1776348 | <filename>bayesian/test/test_persistance.py
import pytest
from bayesian.factor_graph import *
def f_prize_door(prize_door):
return 1.0 / 3
def f_guest_door(guest_door):
return 1.0 / 3
def f_monty_door(prize_door, guest_door, monty_door):
if prize_door == guest_door:
if prize_door == monty_door... | 0 | 0 | 0 | 0 | 0 | 0 |
info/__init__.py | semirook/flask-kit | 133 | 1776368 | # coding: utf-8
from flask import Blueprint
info = Blueprint(
'info', __name__,
template_folder='templates',
url_prefix='/info'
)
from .views import *
| 0 | 0 | 0 | 0 | 0 | 0 |
mqtt_io/tests/features/environment.py | DominicWindisch/mqtt-io | 231 | 1776377 | import asyncio
from typing import Any
# fixture of event handler that calls a mock, so we can see if an event has been called
def before_scenario(context: Any, scenario: Any) -> None:
"""
Initialise data.
"""
context.loop = asyncio.new_event_loop()
context.data = dict(
raw_config={},
... | 4 | 2 | 1 | 0 | 7 | 0 |
interop_2016/ex2_conditionals/test_condition2.py | fallenfuzz/pynet | 528 | 1776402 | file_name = "show_ver.out"
with open(file_name, "r") as f:
output = f.read()
if 'Cisco' in output:
print "Found Cisco string"
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/core/storage/storage_test.py | Leo-Ryu/termius-cli | 169 | 1776404 | <reponame>Leo-Ryu/termius-cli
# -*- coding: utf-8 -*-
import tempfile
from six import integer_types
from mock import patch, Mock
from unittest import TestCase
from termius.core.models.terminal import (
Host, SshConfig, Identity, SshKey, Group
)
from termius.core.exceptions import DoesNotExistException
from termius.... | 0 | 0 | 0 | 0 | 0 | 0 |
book/src/ch02/src/assignment_expressions.py | zangyuchen2008/Clean-Code-in-Python-Second-Edition | 133 | 1776457 | """Clean Code in Python - Second edition
Chapter 02: Assignment expressions
"""
import re
from typing import Iterable, Set
ARN_REGEX = re.compile(r"arn:aws:[a-z0-9\-]*:[a-z0-9\-]*:(?P<account_id>\d+):.*")
def collect_account_ids_from_arns(arns: Iterable[str]) -> Set[str]:
"""Given several ARNs in the form
... | 3 | 3 | 0 | 0 | 6 | 0 |
cross3d/softimage/__init__.py | vedantirb/cross3d | 129 | 1776509 | ##
# \namespace cross3d.softimage
#
# \remarks The cross3d.softimage package contains the necessary classes to control Softimage.
#
# \author douglas
# \author <NAME>
# \date 03/15/10
#
import external
def init():
# Making sure we can import the layer.
from PySoftimage import xsi
# Importi... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/03_gstools_covmodel.py | ehxan139/PyKrige | 280 | 1776559 | # -*- coding: utf-8 -*-
"""
GSTools Interface
=================
Example how to use the PyKrige routines with a GSTools CovModel.
"""
import numpy as np
from pykrige.ok import OrdinaryKriging
from matplotlib import pyplot as plt
import gstools as gs
# conditioning data
data = np.array(
[
[0.3, 1.2, 0.47],
... | 0 | 0 | 0 | 0 | 0 | 0 |
rlbench/tasks/setup_checkers.py | vonHartz/RLBench | 619 | 1776565 | from typing import List
import numpy as np
from pyrep.objects.proximity_sensor import ProximitySensor
from pyrep.objects.shape import Shape
from pyrep.objects.dummy import Dummy
from rlbench.backend.task import Task
from rlbench.backend.conditions import DetectedCondition, NothingGrasped
MAX_CHECKERS_TO_SETUP = 3
cl... | 1 | 5 | 0 | 0 | 6 | 0 |
02_usecases/sagemaker_recommendations/wip/train_basic.py | dpai/workshop | 2,327 | 1776582 | import time
import random
import pandas as pd
from glob import glob
import pprint
import argparse
import json
import subprocess
import sys
import os
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'scikit-learn==0.23.1'])
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'sagemaker-tensorfl... | 5 | 1 | 0 | 0 | 6 | 0 |
extraPackages/Pillow-6.0.0/Tests/test_image_getim.py | dolboBobo/python3_ios | 130 | 1776593 | <gh_stars>100-1000
from .helper import PillowTestCase, hopper
from PIL._util import py3
class TestImageGetIm(PillowTestCase):
def test_sanity(self):
im = hopper()
type_repr = repr(type(im.getim()))
if py3:
self.assertIn("PyCapsule", type_repr)
self.assertIsInstance(i... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/data_generation/dataloader_cms.py | pyvonpyton/PyHealth | 485 | 1776637 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""CMS dataset handling
"""
# Author: <NAME> <<EMAIL>>
# License: BSD 2 clause
import os
import pandas as pd
import numpy as np
from tqdm import tqdm
from pyhealth.data.base_cms import CMS_Data
from pyhealth.utils.utility import read_csv_to_df
from pyhealth.utils.utility i... | 0 | 0 | 0 | 0 | 0 | 0 |
django_file_form/fields.py | kosior/django-file-form | 133 | 1776658 | <reponame>kosior/django-file-form
from django.forms import FileField
from django.core import validators
from .widgets import UploadWidget, UploadMultipleWidget
from .models import TemporaryUploadedFile
from .util import get_list
class UploadedFileField(FileField):
widget = UploadWidget
def __init__(self, *,... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/minimum-non-zero-product-of-the-array-elements.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 1776665 | <reponame>Sourav692/FAANG-Interview-Preparation<filename>Algo and DSA/LeetCode-Solutions-master/Python/minimum-non-zero-product-of-the-array-elements.py<gh_stars>1000+
# Time: O(min(p, logM))
# Space: O(1)
class Solution(object):
def minNonZeroProduct(self, p):
"""
:type p: int
:rtype: int... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_gyt.py | mubashshirjamal/code | 1,582 | 1776676 | <reponame>mubashshirjamal/code
# -*- coding: utf-8 -*-
import os
import shutil
import tempfile
import datetime as dt
from os.path import join as opj
import nose
from tests.base import TestCase
from vilya.libs import gyt
TEST_REPO = '/tmp/test_gyt/repo/.git'
ENV_FOR_GIT = {
'GIT_AUTHOR_NAME': 'default_test',
... | 0 | 0 | 0 | 0 | 0 | 0 |
library/connecter/ansible/v2_3/adhoc.py | GNHJM/lykops | 141 | 1776695 | <filename>library/connecter/ansible/v2_3/adhoc.py
import os
from ansible import constants as C
from ansible.executor.task_queue_manager import TaskQueueManager
from ansible.parsing.splitter import parse_kv
from ansible.playbook.play import Play
from ansible.plugins import get_all_plugin_loaders
from library.connecter.... | 0 | 0 | 0 | 0 | 0 | 0 |
addons/s3/__init__.py | gaybro8777/osf.io | 628 | 1776715 | default_app_config = 'addons.s3.apps.S3AddonAppConfig'
| 0 | 0 | 0 | 0 | 0 | 0 |
snakewm/apps/games/maze3D/maze3d.py | AwesomeGitHubRepos/snakeware | 1,621 | 1776735 | <gh_stars>1000+
import pygame
import os
from math import cos, sin, tan, pi, floor, ceil, sqrt
from random import randint
import random
two_pi = pi * 2
half_pi = pi * 0.5
three_half_pi = pi * 1.5
NUMBER_OF_RAYS = 320
class DisjointSet:
class Element:
def __init__(self, key):
self.key = key
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/examples/help/two.py | demiurgestudios/shovel | 202 | 1776746 | <filename>test/examples/help/two.py
'''Dummy shovel tasks for testing'''
from shovel import task
@task
def widget():
'''long doc, long doc, long doc, long doc, long doc, long doc, long doc, '''
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
modules/flow.py | light1726/VAENAR-TTS | 125 | 1776790 | <reponame>light1726/VAENAR-TTS
import tensorflow as tf
import numpy as np
from typing import Tuple
from modules.transform import TransformerTransform
class BaseFlow(tf.keras.layers.Layer):
def __init__(self, inverse, name='BaseFlow', **kwargs):
super(BaseFlow, self).__init__(name=name, **kwargs)
... | 0 | 0 | 0 | 0 | 0 | 0 |
torchbearer/callbacks/sample_pairing.py | NunoEdgarGFlowHub/torchbearer | 358 | 1776814 | <filename>torchbearer/callbacks/sample_pairing.py
import torch
import torchbearer
from torchbearer import cite
from torchbearer.callbacks import Callback, only_if, once_per_epoch
bibtex = """
@article{inoue2018data,
title={Data augmentation by pairing samples for images classification},
author={<NAME>},
journa... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/changes/api/test_phabricator_notify_diff.py | vault-the/changes | 443 | 1776830 | from __future__ import annotations
from __future__ import absolute_import, division, unicode_literals
import random as insecure_random
import yaml
from cStringIO import StringIO
from datetime import datetime
from mock import ANY, Mock, patch
from changes.config import db
from changes.constants import SelectiveTestin... | 8 | 3 | 1 | 0 | 12 | 0 |
aliyun-python-sdk-smartag/aliyunsdksmartag/request/v20180313/ModifySagWifiRequest.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 1776871 | <reponame>yndu13/aliyun-openapi-python-sdk
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, V... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/tests/doctests.py | erikmd/alectryon | 151 | 1776946 | <gh_stars>100-1000
r"""
Run Alectryon's doctests.
$ python doctests.py | sed 's/\(tests\) in [0-9.]\+s$/\1/g' > doctests.out
# Run doctests; produces ‘doctests.out’
(but make sure that the ROOT of this repo is in PYTHONPATH)
"""
import doctest
import re
import sys
import unittest
from fnmatch import fnm... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/nltk_contrib/misc/huffman.py | h4ck3rm1k3/NLP-project | 123 | 1777022 | <gh_stars>100-1000
# Simple Huffman encoding/decoding, <NAME>
# http://en.wikipedia.org/wiki/Huffman_coding
import nltk
from operator import itemgetter
def huffman_tree(text):
coding = nltk.FreqDist(text).items()
coding.sort(key=itemgetter(1))
while len(coding) > 1:
a, b = coding[:2]
pair ... | 0 | 0 | 0 | 0 | 0 | 0 |
module-6/app/ProcessQuestionsStream/aws_xray_sdk/core/streaming/default_streaming.py | tuedtvt/awsworkshop | 294 | 1777059 | <reponame>tuedtvt/awsworkshop<gh_stars>100-1000
import threading
class DefaultStreaming(object):
"""
The default streaming strategy. It uses the total count of a
segment's children subsegments as a threshold. If the threshold is
breached, it uses subtree streaming to stream out.
"""
def __init... | 0 | 0 | 0 | 0 | 0 | 0 |
django_rest_passwordreset/signals.py | ndy40/django-rest-passwordreset | 258 | 1777069 | <reponame>ndy40/django-rest-passwordreset
from django.dispatch import Signal
__all__ = [
'reset_password_token_created',
'pre_password_reset',
'post_password_reset',
]
"""
Signal arguments: instance, reset_password_token
"""
reset_password_token_created = Signal()
"""
Signal arguments: user
"""
pre_passw... | 0 | 0 | 0 | 0 | 0 | 0 |
universal_computation/trainer.py | jasonjewik/universal-computation | 183 | 1777082 | from __future__ import annotations
import torch
from tqdm import tqdm
import time
class Trainer:
def __init__(
self,
model,
dataset,
loss_fn,
accuracy_fn: object | None=None,
steps_per_epoch: int=100,
test_steps_per_epoch: int=2... | 9 | 1 | 0 | 1 | 11 | 0 |
python/ql/test/query-tests/Variables/undefined/regression.py | vadi2/codeql | 4,036 | 1777097 | # Regression test for a false-positive in 'Uninitialized Local'
def func():
safe = 0
for i in []:
safe = 1
if True:
pass
print safe # wrongly flagged
from module1 import *
def func2():
os
def findPluginJars(dir):
return filter(lambda y: y,
(os.path.join(root, f) fo... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/streaming_example.py | krasnovmv/vkwave | 222 | 1777123 | <reponame>krasnovmv/vkwave
import asyncio
from vkwave.streaming import StreamingClient
from vkwave.bots import create_api_session_aiohttp
from vkwave.http import AIOHTTPWSClient
async def main():
api = create_api_session_aiohttp(token="<PASSWORD>")
client = StreamingClient(
api.api.get_context(),
... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/blink/tools/blinkpy/bindings/generate_idl_diff.py | sarang-apps/darshan_browser | 575 | 1777142 | <reponame>sarang-apps/darshan_browser
#!/usr/bin/env python
# Copyright 2015 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.
"""generate_idl_diff.py is a script that generates a diff of two given IDL files.
Usage: generate_... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_servicer.py | wutiantong/sea | 156 | 1777150 | import grpc
from sea.servicer import ServicerMeta
from sea.format import msg2dict, stream2dict
from sea import exceptions
from sea.pb2 import default_pb2
from tests.wd.protos import helloworld_pb2
def test_meta_servicer(app, logstream) -> str:
class HelloContext():
def __init__(self):
self.... | 0 | 2 | 0 | 2 | 4 | 0 |
pyQPanda/example/test_main.py | QianJianhua1/QPanda-2 | 631 | 1777159 | <gh_stars>100-1000
# coding=utf-8
import unittest
from unittest.runner import TextTestRunner
from unittest.suite import TestSuite
global TESTOPT
TESTOPT = "single"
if TESTOPT == "all":
def test():
# Run all test cases
case_dir = ".\\"
discover = unittest.defaultTestLoader.discover(case_... | 0 | 0 | 0 | 0 | 0 | 0 |
package_control/deps/oscrypto/_asymmetric.py | evandrocoan/package_control | 3,373 | 1777164 | # coding: utf-8
from __future__ import annotations
from __future__ import unicode_literals, division, absolute_import, print_function
import hashlib
import hmac
import re
import binascii
from ._asn1 import (
CertBag,
Certificate,
DSAPrivateKey,
ECPrivateKey,
EncryptedData,
EncryptedPrivateKeyI... | 2 | 24 | 5 | 0 | 31 | 0 |
audiofield/__init__.py | sapianco/django-audiofield | 140 | 1777211 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Django-audiofield is a Django application which allows audio file upload
and conversion to mp3, wav and ogg format.
It also makes it easy to play the audio files into your django application.
Project location : https://github.com/Star2Billing/django-audiofield
"""
__ver... | 0 | 0 | 0 | 0 | 0 | 0 |
superset/dashboards/filter_sets/dao.py | delorenzosoftware/superset | 18,621 | 1777265 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 2 | 1 | 0 | 0 | 3 | 0 |
tests/test_350_statics.py | manatlan/guy | 194 | 1777295 | # import sys; sys.path.insert(0,"..")
from guy import Guy
def test_useStatic(runner):
class UseStatic(Guy):
classvar=45
def __init__(self,v):
self.instancevar=v
Guy.__init__(self)
def verif(self,a,b):
self.exit(a+b)
t=UseStatic(42)
total=runne... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/hexrays/mdec-hexrays/mdechexrays/service.py | clayne/mdec | 317 | 1777311 | import os
import subprocess
import tempfile
from pathlib import Path
from mdecbase import Service
class HexraysService(Service):
"""
Hex-Rays decompiler as a service
"""
def decompile(self, path: str) -> str:
"""
Decompile all the functions in the binary located at `path`.
""... | 1 | 2 | 0 | 0 | 3 | 0 |
functions/upload_image/main.py | DaveCheez/serverless-store-demo | 171 | 1777362 | # Copyright 2018 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 0 | 1 | 0 | 0 | 1 | 0 |
procrastinate/protocols.py | mecampbellsoup/procrastinate | 129 | 1777384 | from typing import Any, Callable, List, Optional
from typing_extensions import Protocol
from procrastinate import jobs, retry
class TaskCreator(Protocol):
def task(
self,
_func: Optional[Callable] = None,
*,
name: Optional[str] = None,
aliases: Optional[List[str]] = None,... | 8 | 1 | 0 | 0 | 9 | 0 |
tests/dags/pydag/py_task.py | chriscardillo/gusty | 103 | 1777450 | # ---
# email: <EMAIL>
# dependencies:
# - direct_dep
# external_dependencies:
# - a_whole_dag: all
# python_callable: hello_world
# ---
def hello_world() -> object:
phrase = "hello python task"
print(phrase)
return phrase
| 0 | 1 | 0 | 0 | 1 | 0 |
src/ralph/domains/migrations/0004_auto_20160907_1100.py | DoNnMyTh/ralph | 1,668 | 1777473 | <gh_stars>1000+
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('domains', '0003_auto_20160823_0921'),
]
operations = [
migrations.AddField(
model_name='domain',... | 0 | 0 | 0 | 0 | 0 | 0 |
test_config_docker.py | BatuAksoy/kuyruk | 154 | 1777482 | <reponame>BatuAksoy/kuyruk<filename>test_config_docker.py
RABBIT_HOST = 'kuyruk_rabbitmq_1'
RABBIT_PORT = 5672
RABBIT_VIRTUAL_HOST = '/'
RABBIT_USER = 'kuyruk'
RABBIT_PASSWORD = '<PASSWORD>'
| 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/junos/tests/ShowBFDSession/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 1777485 | <reponame>balmasea/genieparser
expected_output = {
"bfd-session-information": {
"bfd-session": [
{
"session-adaptive-multiplier": "3",
"session-detection-time": "1.500",
"session-neighbor": "10.0.0.1",
"session-state": "Up",
... | 0 | 0 | 0 | 0 | 0 | 0 |
updater/reports/ReportOrgsTotal.py | eisenhowerj/hubble | 146 | 1777517 | <reponame>eisenhowerj/hubble<filename>updater/reports/ReportOrgsTotal.py<gh_stars>100-1000
from .ReportDaily import *
# Lists the total number of organizations
class ReportOrgsTotal(ReportDaily):
def name(self):
return "orgs-total"
def updateDailyData(self):
self.header, newData = self.parseData(self.executeQue... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_transport_jsonp.py | BlackSmith/sockjs | 122 | 1777529 | <filename>tests/test_transport_jsonp.py
from unittest import mock
from aiohttp import web
import pytest
from aiohttp.test_utils import make_mocked_coro
from sockjs.transports import jsonp
@pytest.fixture
def make_transport(make_request, make_manager, make_handler, make_fut):
def maker(method="GET", path="/", q... | 0 | 0 | 0 | 0 | 0 | 0 |
redlock/cli.py | fastfishio/redlock-py | 589 | 1777585 | from __future__ import annotations
from __future__ import print_function
import argparse
import sys
import textwrap
import redlock
def log(*args, **kwargs):
if not log.quiet:
print(*args, file=sys.stderr, **kwargs)
def lock(name, validity, redis, retry_count: int=3, retry_delay: int=200, **kwargs) -> ... | 2 | 2 | 0 | 0 | 4 | 0 |
spytest/apis/routing/ospf.py | shubav/sonic-mgmt | 132 | 1777597 | # OSPFv2 APIs
# Author: <NAME> (<EMAIL>)
from __future__ import annotations
from __future__ import division
from spytest import st
from spytest.utils import filter_and_select
from utilities.utils import get_interface_number_from_name
from utilities.common import integer_parse, is_basestring
from apis.system.rest im... | 330 | 91 | 0 | 0 | 421 | 0 |
dcos_installer/test_config.py | makkes/dcos | 2,577 | 1777607 | from dcos_installer import config
from gen.exceptions import ValidationError
def test_normalize_config_validation_exception():
errors = {
'key': {'message': 'test'},
}
validation_error = ValidationError(errors=errors, unset=set(['one', 'two']))
normalized = config.normalize_config_validation_e... | 0 | 0 | 0 | 0 | 0 | 0 |
social/backends/instagram.py | raccoongang/python-social-auth | 1,987 | 1777621 | from social_core.backends.instagram import InstagramOAuth2
| 0 | 0 | 0 | 0 | 0 | 0 |
flexget/tests/test_jinja_filters.py | herlon214/Flexget | 1,322 | 1777655 | import jinja2
import pytest
class TestJinjaFilters:
config: str = """
tasks:
stripyear:
mock:
- {"title":"The Matrix (1999)", "url":"mock://local1" }
- {"title":"The Matrix", "url":"mock://local2" }
- {"title":"The Matrix 1999", "url":"mock:/... | 0 | 0 | 2 | 0 | 2 | 0 |
test/tst_filepath.py | ruiying-ocean/netcdf4-python | 574 | 1777665 | import os, sys, shutil
import tempfile
import unittest
import netCDF4
class test_filepath(unittest.TestCase):
def setUp(self):
self.netcdf_file = os.path.join(os.getcwd(), "netcdf_dummy_file.nc")
self.nc = netCDF4.Dataset(self.netcdf_file)
def test_filepath(self):
assert self.nc.file... | 0 | 0 | 0 | 0 | 0 | 0 |
language/labs/drkit/hotpotqa/preprocessing/convert_hotpot_to_mrqa.py | naveenjafer/language | 1,199 | 1777681 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 0 | 1 | 0 | 0 | 1 | 0 |
util/data_loader.py | aiha-lab/lsq-lab | 129 | 1777708 | <gh_stars>100-1000
import os
import numpy as np
import torch as t
import torch.utils.data
import torchvision as tv
from sklearn.model_selection import train_test_split
def __balance_val_split(dataset, val_split=0.):
targets = np.array(dataset.targets)
train_indices, val_indices = train_test_split(
np... | 0 | 0 | 0 | 0 | 0 | 0 |
v2/benchmarks/latency.py | Dilepa/micropython-async | 443 | 1777710 | # latency.py Benchmark for uasyncio. Author <NAME> July 2018.
# This measures the scheduling latency of a notional device driver running in the
# presence of other coros. This can test asyncio_priority.py which incorporates
# the priority mechanism. (In the home directory of this repo).
# When running the test that u... | 1 | 0 | 0 | 0 | 1 | 0 |
lib/debugger/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_local.py | barni2000/ide-python | 229 | 1777716 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
import sys
import time
import pydevd
from _pydevd_bundle.pydevd_comm import get_global_debugger
from ptvsd.pydevd_hooks import install
from ptvsd... | 0 | 0 | 0 | 0 | 0 | 0 |
pyforms/basewidget.py | 0x4A-0x41-0x4B/pyforms | 661 | 1777717 | <reponame>0x4A-0x41-0x4B/pyforms
from confapp import conf
if conf.PYFORMS_MODE in ['GUI']:
from pyforms_gui.basewidget import BaseWidget
from pyforms_gui.organizers import vsplitter, hsplitter, segment, no_columns
elif conf.PYFORMS_MODE in ['TERMINAL']:
from pyforms_terminal.basewidget import BaseWidge... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/validation/test_unique_variable_names.py | KingDarBoja/graphql-core | 590 | 1777733 | <gh_stars>100-1000
from functools import partial
from graphql.validation import UniqueVariableNamesRule
from .harness import assert_validation_errors
assert_errors = partial(assert_validation_errors, UniqueVariableNamesRule)
assert_valid = partial(assert_errors, errors=[])
def describe_validate_unique_variable_na... | 0 | 0 | 0 | 0 | 0 | 0 |
{{ cookiecutter.project_name }}/{{ cookiecutter.project_name }}/settings.py | rajeshkumarkarra/sugardough | 193 | 1777745 | """
Django settings for {{ cookiecutter.project_name }} project.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
import sys
import dj_database_url
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
python/mxnet/optimizer/dcasgd.py | mchoi8739/incubator-mxnet | 211 | 1777755 | # coding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"... | 4 | 1 | 0 | 1 | 6 | 0 |
paddlespeech/server/engine/tts/online/onnx/pretrained_models.py | jerryuhoo/PaddleSpeech | 1,379 | 1777760 | # Copyright (c) 2022 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
#
# Unless required by appli... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | nizhib/pytorch-insightface | 114 | 1777776 | <filename>setup.py
import codecs
import os
import re
import subprocess
from setuptools import setup, find_packages
def get_absolute_path(*args):
"""Transform relative pathnames into absolute pathnames."""
return os.path.join(os.path.dirname(os.path.abspath(__file__)), *args)
def get_contents(*args):
"""... | 0 | 0 | 0 | 0 | 0 | 0 |
src/python/nimbusml/tests/ensemble/test_votingregressor.py | montehoover/NimbusML | 134 | 1777788 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
from __future__ import division
imp... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/transforms_tests/image_tests/test_rotate.py | beam2d/chainercv | 1,600 | 1777860 | import PIL
import random
import unittest
import numpy as np
import chainer
from chainer import testing
from chainercv.transforms import flip
from chainercv.transforms import rotate
try:
import cv2 # NOQA
_cv2_available = True
except ImportError:
_cv2_available = False
@testing.parameterize(*testing.pr... | 0 | 0 | 0 | 0 | 0 | 0 |
component/cacti/cactiweathermap.py | xin053/PocCollect | 340 | 1777867 | #!/usr/bin/env python
# encoding: utf-8
from t import T
import requests,urllib2,json,urlparse
class P(T):
def __init__(self):
T.__init__(self)
def verify(self,head='',context='',ip='',port='',productname={},keywords='',hackinfo=''):
target_url = "http://"+ip+":"+str(port)+"/plugins/weathermap/e... | 0 | 0 | 0 | 0 | 0 | 0 |
falcon_kit/util/io.py | peterjc/FALCON | 216 | 1777868 | from __future__ import annotations
"""I/O utilities
Not specific to FALCON.
"""
from __future__ import absolute_import
#from builtins import str
from builtins import object
import os
import resource
import shlex
import subprocess as sp
import sys
import traceback
from ..io import deserialize
def write_nothing(*args)... | 1 | 8 | 0 | 0 | 9 | 0 |
tests/test_logs.py | JoostvDoorn/pywren | 630 | 1777931 | <reponame>JoostvDoorn/pywren
#
# Copyright 2018 PyWren Team
#
# 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 applicabl... | 0 | 0 | 0 | 0 | 0 | 0 |
src/mcedit2/panels/worldinfo.py | elcarrion06/mcedit2 | 673 | 1777946 | """
worldinfo
"""
from __future__ import absolute_import
import logging
from contextlib import contextmanager
from PySide import QtGui
from PySide.QtCore import Qt
from mcedit2.command import SimpleRevisionCommand
from mcedit2.ui.panels.worldinfo import Ui_worldInfoWidget
from mcedit2.util.resources import resour... | 0 | 12 | 2 | 3 | 17 | 0 |
recipes/Python/66423_LazyDB/recipe-66423.py | tdiprima/code | 2,023 | 1777952 | <filename>recipes/Python/66423_LazyDB/recipe-66423.py
"""The LazyDB module transparently wraps any DB API compliant
interface (DCOracle, odbc, cx_oracle, etc.) and provides:
1. lazy evaluation and caching of database connections
2. one-step query facility with data access by column name
Example:
import LazyDB, cx_Ora... | 0 | 0 | 0 | 0 | 0 | 0 |
services/utils/tests/__init__.py | runsascoded/metaflow-service | 103 | 1777958 | from services.utils import DBConfiguration
import pytest
def get_test_dbconf() -> object:
"""
Returns a DBConfiguration suitable for the test environment, or exits pytest completely upon failure
"""
db_conf = DBConfiguration(timeout=1)
if db_conf.dsn != "dbname=test user=test host=db_test port=54... | 0 | 1 | 0 | 0 | 1 | 0 |
December-07/python_UjjwalPrahladka_Dec7.py | UjjwalPrahladka/A-December-of-Algorithms-2019 | 228 | 1777965 | <filename>December-07/python_UjjwalPrahladka_Dec7.py
queue = []
def enqueue(patient,pos):
queue.insert(pos, patient)
def dequeue(pos = 0):
return queue.pop(pos)
n = 0
while True:
try:
n = int(input('Enter no. of patients: '))
except:
print('Enter integer please')
else:
break
for token... | 0 | 0 | 0 | 0 | 0 | 0 |
CamJam Edukit 3 - GPIO Zero/Code/4-driving.py | vincecr0ft/EduKit3 | 132 | 1777973 | # CamJam EduKit 3 - Robotics
# Worksheet 4 - Driving and Turning
import time # Import the Time library
from gpiozero import CamJamKitRobot # Import the GPIO Zero Library CamJam library
robot = CamJamKitRobot()
robot.forward()
time.sleep(1) # Pause for 1 second
robot.backward()
time.sleep(1)
robot.left()
time.sl... | 0 | 0 | 0 | 0 | 0 | 0 |
sdf-net/lib/diffutils.py | ricklentz/nglod | 496 | 1777982 | # The MIT License (MIT)
#
# Copyright (c) 2021, NVIDIA 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 without limitation the rights to
# use, co... | 4 | 2 | 0 | 0 | 6 | 0 |
tensorflow_fold/blocks/layers.py | shkarupa-alex/fold | 2,020 | 1777997 | # 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... | 21 | 29 | 3 | 9 | 62 | 0 |
nengo/builder/neurons.py | Michaeljurado24/nengo | 762 | 1778104 | from __future__ import annotations
import numpy as np
from nengo.builder.builder import Builder
from nengo.builder.operator import Operator
from nengo.builder.signal import Signal
from nengo.exceptions import BuildError
from nengo.neurons import NeuronType, RatesToSpikesNeuronType
from nengo.utils.numpy import is_arra... | 4 | 5 | 0 | 6 | 15 | 0 |
web3/tools/__init__.py | bhardwajRahul/web3.py | 3,041 | 1778117 | from .pytest_ethereum import ( # noqa: F401
deployer,
linker,
)
| 0 | 0 | 0 | 0 | 0 | 0 |
services/data/__init__.py | anukaal/metaflow-service | 103 | 1778140 | from .models import FlowRow, RunRow, StepRow, TaskRow, ArtifactRow, MetadataRow
| 0 | 0 | 0 | 0 | 0 | 0 |
PWGJE/EMCALJetTasks/Tracks/analysis/base/struct/DataContainerFactory.py | maroozm/AliPhysics | 114 | 1778167 | <reponame>maroozm/AliPhysics
#**************************************************************************
#* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
#* *
#* Author: The ALICE Off-line Project. ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/wiring/__init__.py | whysage/python-dependency-injector | 1,997 | 1778171 | <reponame>whysage/python-dependency-injector<filename>tests/unit/wiring/__init__.py
"""Wiring tests."""
| 0 | 0 | 0 | 0 | 0 | 0 |
cfgov/v1/tests/jinja2tags/test_datetimes.py | Colin-Seifer/consumerfinance.gov | 156 | 1778228 | from datetime import date, datetime
from unittest import TestCase
from django.template import engines
from pytz import timezone
class DatetimesExtensionTests(TestCase):
def setUp(self):
self.engine = engines["wagtail-env"]
def test_date_filter(self):
tmpl = self.engine.from_string("{{ d | d... | 0 | 0 | 0 | 0 | 0 | 0 |
imylu/neural_network/linear_node.py | tushushu/Imilu | 407 | 1778267 | <filename>imylu/neural_network/linear_node.py
# -*- coding: utf-8 -*-
"""
@Author: tushushu
@Date: 2019-05-25 20:18:14
"""
import numpy as np
from .base_node import BaseNode
from .weight_node import WeightNode
class LinearNode(BaseNode):
"""Linear node class.
Attributes:
name {str} -- The name of Nod... | 0 | 0 | 0 | 0 | 0 | 0 |
thredo/thr.py | dabeaz/thredo | 340 | 1778296 | <reponame>dabeaz/thredo
# thr.py
#
# Functions that allow normal threads to promote into Curio async threads.
from concurrent.futures import Future
from curio.thread import is_async_thread, _locals, AWAIT, AsyncThread
from curio import spawn, UniversalQueue
_request_queue = None
def TAWAIT(coro, *args, **kwargs):
... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmark/torch/a2c/atari_model.py | lp2333/PARL | 3,172 | 1778306 | # Copyright (c) 2018 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
#
# Unless required by app... | 0 | 3 | 0 | 0 | 3 | 0 |
interpretdl/interpreter/occlusion.py | Christophe-Jia/InterpretDL | 107 | 1778316 | <reponame>Christophe-Jia/InterpretDL
from tqdm import tqdm
import numpy as np
import paddle
from .abc_interpreter import Interpreter, InputOutputInterpreter
from ..data_processor.readers import preprocess_inputs, preprocess_save_path
from ..data_processor.visualizer import explanation_to_vis, show_vis_explanation, sav... | 0 | 0 | 0 | 0 | 0 | 0 |
theseus/core/theseus_function.py | facebookresearch/theseus | 236 | 1778352 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import abc
from itertools import count
from typing import Generator, Iterable, List, Optional, Sequence
from theseus.geometry import Manifo... | 23 | 12 | 0 | 2 | 37 | 0 |
PaddleCV/video/models/tsn/__init__.py | suytingwan/models | 8,360 | 1778354 | <gh_stars>1000+
from .tsn import *
| 0 | 0 | 0 | 0 | 0 | 0 |
plat/fuel_helper.py | GSByeon/plat | 332 | 1778356 | <filename>plat/fuel_helper.py<gh_stars>100-1000
#!/usr/bin/env python
"""Routines for accessing fuel datasets."""
import numpy as np
import uuid
from fuel.datasets.hdf5 import H5PYDataset
from fuel.utils import find_in_data_path
from fuel.transformers.defaults import uint8_pixels_to_floatX
from fuel.schemes import Seq... | 0 | 0 | 0 | 0 | 0 | 0 |
deepmath/guidance/train.py | LaudateCorpus1/deepmath | 830 | 1778380 | # 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... | 5 | 6 | 0 | 0 | 11 | 0 |
scale/ingest/scan/scanners/scanner.py | kaydoh/scale | 121 | 1778384 | """Defines the base scanner class"""
from __future__ import unicode_literals
import logging
import os
from abc import ABCMeta, abstractmethod
from django.db import transaction
from ingest.models import Ingest, Scan
from ingest.scan.scanners.exceptions import ScannerInterruptRequested
from storage.models import Works... | 1 | 5 | 0 | 9 | 15 | 0 |
programs/program_table_4.py | aluo-x/shape2prog | 109 | 1778418 | from .utils import *
import math
import os
from .label_config import max_param, max_step
from misc import get_distance_to_center
###################################
# generate tables with "thick" supports
# tabletop can be: circle, square, rectangle
# supports can be: circle, square
# max steps: 2
####################... | 0 | 3 | 0 | 0 | 3 | 0 |
src/evaluation/eval_util.py | tfederico/human_dynamics | 558 | 1778422 | from __future__ import annotations
"""
Utils for evaluation.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
# Error metrics
def compute_accel(joints) -> object:
"""
Computes acceleration of 3D joints.
Args:
... | 5 | 10 | 0 | 0 | 15 | 0 |
src/backend/tasks/module.py | ddddhm1/LuWu | 658 | 1778437 | from abc import ABC
from tempfile import NamedTemporaryFile
from tempfile import TemporaryDirectory
from typing import Union
from fabric import Connection
from crud.crud_config import crud_ssh_config
from crud.crud_module import crud_redirector
from crud.crud_module import crud_team_server
from db.session import sess... | 0 | 0 | 0 | 0 | 0 | 0 |
interpreter.py | hgarrereyn/OCRaaP | 130 | 1778454 | <reponame>hgarrereyn/OCRaaP
import numpy as np
import cv2
import image_parser
import model
import os
import sys
import getopt
# Utility methods
def dist2(x,y,px,py):
return ((px - x) * (px - x)) + ((py - y) * (py - y))
def ang(x,y,px,py):
return bound_ang(np.angle(np.complex(x-px, y-py)))
def bound_ang(thet... | 0 | 0 | 0 | 0 | 0 | 0 |
server/device.py | ChuckMN/Apple-iOS-MDM-Server | 549 | 1778467 | from collections import deque
from plistlib import *
from operator import itemgetter
import time, datetime, copy
class device:
TIMEOUT = 20 # Number of seconds before command times out
WHITELIST = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 "
def __init__(self, newUDID, tuple):
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/basic_consumer_threaded.py | DavidWittman/pika | 2,479 | 1778520 | # -*- coding: utf-8 -*-
# pylint: disable=C0111,C0103,R0205
import functools
import logging
import threading
import time
import pika
from pika.exchange_type import ExchangeType
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
LOGGER = logging.get... | 0 | 0 | 0 | 0 | 0 | 0 |
zentral/contrib/monolith/migrations/0018_auto_20170331_0731.py | gwhitehawk/zentral | 634 | 1778528 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-31 07:31
from __future__ import unicode_literals
from django.db import migrations, models
import zentral.contrib.monolith.models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('monolith', '0017_manifest_vers... | 0 | 0 | 2 | 0 | 2 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.