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 |
|---|---|---|---|---|---|---|---|---|---|---|
myia/operations/op_array_reduce_dim.py | strint/myia | 222 | 1615915 | <reponame>strint/myia
"""Implementation of the 'array_reduce_dim' operation."""
from ..lib import SHAPE, Graph, MetaGraph, MyiaTypeError, build_value
from ..operations import primitives as P
class ArrayReduceDim(MetaGraph):
"""MetaGraph to reduce array over specified dim(s)."""
def __init__(self, name="Arra... | 0 | 0 | 0 | 0 | 0 | 0 |
cumulusci/tests/pytest_plugins/pytest_sf_orgconnect.py | emregunel/CumulusCI | 163 | 1615927 | <gh_stars>100-1000
from contextlib import contextmanager
from pathlib import Path
import pytest
import cumulusci
from cumulusci.cli.org import org_remove, org_scratch, org_scratch_delete
from cumulusci.cli.runtime import CliRuntime
from cumulusci.core.config import TaskConfig
from cumulusci.core.exceptions import Org... | 0 | 0 | 0 | 0 | 0 | 0 |
gooey/tests/test_formatters.py | Jacke/Gooey | 13,430 | 1615940 | import argparse
import os
import shlex
import unittest
from gooey.gui import formatters
class TestFormatters(unittest.TestCase):
def test_counter_formatter(self):
"""
Should return the first option repeated N times
None if N is unspecified
Issue #316 - using lon... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/support/virt.py | tomdoherty/salt | 9,425 | 1615941 | <reponame>tomdoherty/salt
import time
import uuid
import attr
from saltfactories.daemons.container import SaltMinion
from saltfactories.utils import ports
from tests.support.runtests import RUNTIME_VARS
@attr.s(kw_only=True, slots=True)
class SaltVirtMinionContainerFactory(SaltMinion):
host_uuid = attr.ib(defau... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/granular/test_repeated_digits.py | neomatrix369/nlp_profiler | 221 | 1615943 | <gh_stars>100-1000
import numpy as np
import pytest
from nlp_profiler.constants import NaN
from nlp_profiler.granular_features.numbers \
import gather_repeated_digits, count_repeated_digits # noqa
text_with_repeated_digits1 = '283047 people live in this 999999 area'
text_with_repeated_digits2 = '283047 people li... | 0 | 0 | 0 | 0 | 0 | 0 |
eve_sqlalchemy/tests/sql.py | gllmbernard/eve-sqlalchemy | 126 | 1615959 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import random
import string
from datetime import datetime
from operator import and_, or_
from unittest import TestCase
import eve
from eve.utils import str_to_date
from sqlalchemy.sql.elements import BooleanClauseList
from eve_sqlalchemy impor... | 1 | 2 | 0 | 0 | 3 | 0 |
TWE-3/gensim/test/test_models.py | sysuhu/topical_word_embeddings | 330 | 1615962 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 <NAME> <<EMAIL>>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import os
import os.path
import tempfile... | 0 | 4 | 0 | 0 | 4 | 0 |
models/head/mlp.py | zhangzhengde0225/SwinTrack | 143 | 1615966 | from __future__ import annotations
import torch.nn as nn
from timm.models.layers import trunc_normal_
class Mlp(nn.Module):
""" Multilayer perceptron."""
def __init__(self, in_features, hidden_features: object | None=None, out_features: object | None=None,
num_layers: int=2,
... | 4 | 4 | 0 | 0 | 8 | 0 |
craftassist/agent/voxel_models/detection-transformer/models/common.py | kandluis/droidlet | 669 | 1615980 | """
Copyright (c) Facebook, Inc. and its affiliates.
"""
from torch import nn
import torch.nn.functional as F
class MLP(nn.Module):
"""Simple feed forward fully connected, with some options
Parameters
----------
input_dim : int
Number of input channels
hidden_dim : int
Number of c... | 1 | 1 | 0 | 0 | 2 | 0 |
workflow/pytz/tests/test_docs.py | czlhs/alfred-datetime-format-converter | 262 | 1615985 | <filename>workflow/pytz/tests/test_docs.py
# -*- coding: ascii -*-
from doctest import DocTestSuite
import unittest, os, os.path, sys
import warnings
# We test the documentation this way instead of using DocFileSuite so
# we can run the tests under Python 2.3
def test_README():
pass
this_dir = os.path.dirname(__... | 0 | 0 | 0 | 0 | 0 | 0 |
src/kudu/scripts/backup-perf.py | attilabukor/kudu | 1,538 | 1616005 | <reponame>attilabukor/kudu
#!/usr/bin/env python
#
# 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 Li... | 0 | 0 | 0 | 0 | 0 | 0 |
components/k8s-model-server/http-proxy/server_test.py | fyuan1316/kubeflow | 2,527 | 1616010 | # -*- coding: utf-8 -*-
#
# Copyright 2018 The Kubeflow 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
#
# Unl... | 0 | 5 | 0 | 0 | 5 | 0 |
mainapp/migrations/0026_merge_20180816_1442.py | sndp487/rescuekerala | 657 | 1616016 | <reponame>sndp487/rescuekerala
# Generated by Django 2.1 on 2018-08-16 09:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("mainapp", "0025_auto_20180816_1347"),
("mainapp", "0025_auto_20180816_1203"),
]
operations = []
| 0 | 0 | 0 | 0 | 0 | 0 |
python/ql/test/experimental/query-tests/Security/CWE-614/flask_bad.py | adityasharad/ql | 643 | 1616021 | <reponame>adityasharad/ql<gh_stars>100-1000
from flask import Flask, request, make_response, Response
app = Flask(__name__)
@app.route("/1")
def false():
resp = make_response()
resp.set_cookie("name", value="value", secure=False,
httponly=False, samesite='None')
return resp
@app.rou... | 0 | 0 | 0 | 0 | 0 | 0 |
fhirclient/models/goal.py | carolinarsm/client-py | 418 | 1616039 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Goal) on 2019-05-07.
# 2019, SMART Health IT.
from __future__ import annotations
from . import domainresource
class Goal(domainresource.DomainResource):
""" Describes the intended obj... | 4 | 2 | 2 | 27 | 35 | 0 |
tests/core/tests/test_admin_integration.py | marksweb/django-import-export | 2,020 | 1616044 | from __future__ import annotations
import os.path
from datetime import datetime
from unittest import mock
from unittest.mock import MagicMock
import chardet
import tablib
from core.admin import (
AuthorAdmin,
BookAdmin,
BookResource,
CustomBookAdmin,
ImportMixin,
)
from core.models import Author, B... | 1 | 13 | 0 | 0 | 14 | 0 |
mmf/datasets/iteration_strategies.py | dk25021999/mmf | 3,252 | 1616062 | # Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import annotations
import logging
import warnings
from dataclasses import dataclass
from typing import Dict
import numpy as np
from mmf.common.registry import registry
from mmf.utils.configuration import get_global_config
from mmf.utils.dataset import... | 13 | 10 | 9 | 2 | 34 | 0 |
release/stubs.min/Autodesk/Revit/DB/__init___parts/DocumentType.py | htlcnn/ironpython-stubs | 182 | 1616066 | class DocumentType(Enum,IComparable,IFormattable,IConvertible):
"""
Types of Revit documents.
enum DocumentType,values: BuildingComponent (4),Family (1),IFC (3),Other (100),Project (0),Template (2)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
... | 0 | 0 | 7 | 0 | 7 | 0 |
tests/test_cli.py | thorvalddox/html2image | 117 | 1616080 | <reponame>thorvalddox/html2image
# import html2image.cli as cli
# TODO : add tests when the CLI will be in a stable state
| 0 | 0 | 0 | 0 | 0 | 0 |
sketchgraphs_models/autoconstraint/dataset.py | applied-exploration/contraint-based-parametric-modelling | 204 | 1616089 | <gh_stars>100-1000
"""Dataset for auto-constraint model."""
from typing import Optional
import numpy as np
import torch
from sketchgraphs.data import sequence as datalib
from sketchgraphs.pipeline.graph_model.target import NODE_TYPES, EDGE_TYPES, EDGE_TYPES_PREDICTED, NODE_IDX_MAP, EDGE_IDX_MAP
from sketchgraphs.pip... | 0 | 0 | 0 | 0 | 0 | 0 |
videoanalyst/evaluation/got_benchmark/datasets/lasot.py | TragedyN/SiamFCpp | 737 | 1616108 | from __future__ import annotations
from __future__ import absolute_import, print_function
import glob
import json
import os
import pickle
from typing import Dict
import numpy as np
from loguru import logger
from tqdm import tqdm
_VALID_SUBSETS = ['train', 'test']
class LaSOT(object):
r"""`LaSOT <https://cis.te... | 7 | 7 | 0 | 1 | 15 | 0 |
src/smart_compose/utils/layer_utils.py | StarWang/detext | 1,229 | 1616119 | from __future__ import annotations
""" Layer common utilities """
import pickle
import numpy as np
import tensorflow as tf
from absl import logging
def init_word_embedding(vocab_size, num_units, we_trainable, we_file: object | None=None, name_prefix: str="w") -> object:
"""Initialize word embeddings from random ... | 5 | 12 | 0 | 0 | 17 | 0 |
napari/utils/_proxies.py | MaksHess/napari | 1,345 | 1616140 | import re
import sys
import warnings
from typing import Any, Callable, Generic, TypeVar, Union
import wrapt
from ..utils import misc
from ..utils.translations import trans
_T = TypeVar("_T")
class ReadOnlyWrapper(wrapt.ObjectProxy):
"""
Disable item and attribute setting with the exception of ``__wrapped_... | 2 | 6 | 1 | 0 | 9 | 0 |
bertkpe/dataloader/bert2tag_dataloader.py | kariswr/Multilingual-BERT-KPE | 274 | 1616149 | from __future__ import annotations
import os
import sys
import json
import torch
import logging
from tqdm import tqdm
from . import loader_utils
from ..constant import BOS_WORD, EOS_WORD, Tag2Idx
logger = logging.getLogger()
# ------------------------------------------------------------------------------------------... | 1 | 5 | 0 | 0 | 6 | 0 |
tests/test_codebase/test_mmpose/test_pose_detection.py | grimoire/mmdeploy | 746 | 1616176 | <filename>tests/test_codebase/test_mmpose/test_pose_detection.py<gh_stars>100-1000
# Copyright (c) OpenMMLab. All rights reserved.
import os
from tempfile import NamedTemporaryFile, TemporaryDirectory
import mmcv
import numpy as np
import pytest
import torch
import mmdeploy.backend.onnxruntime as ort_apis
from mmdepl... | 0 | 0 | 0 | 0 | 0 | 0 |
codesignal/set/areEquallyStrong.py | peterlamar/python-cp-cheatsheet | 140 | 1616194 | """
For yourLeft = 10, yourRight = 15, friendsLeft = 15, and friendsRight = 10, the output should be
areEquallyStrong(yourLeft, yourRight, friendsLeft, friendsRight) = true;
set(a,b) == {a,b}
"""
def areEquallyStrong(yourLeft, yourRight, friendsLeft, friendsRight) -> object:
return {yourLeft, yourRight} == {friend... | 0 | 1 | 0 | 0 | 1 | 0 |
dojo/github_issue_link/views.py | dant24/django-DefectDojo | 249 | 1616247 | <reponame>dant24/django-DefectDojo
# Standard library imports
import logging
# Third party imports
from django.contrib import messages
from django.contrib.admin.utils import NestedObjects
from django.urls import reverse
from django.db import DEFAULT_DB_ALIAS
from django.http import HttpResponseRedirect, HttpResponse
f... | 0 | 0 | 0 | 0 | 0 | 0 |
torchbenchmark/util/torch_nightly.py | xuzhao9/benchmark | 384 | 1616252 | from __future__ import annotations
"""
Return a list of recent PyTorch wheels published on download.pytorch.org.
Users can specify package name, python version, platform, and the number of days to return.
If one of the packages specified is missing on one day, the script will skip outputing the results on that day.
"""... | 15 | 6 | 0 | 0 | 21 | 0 |
src/sage/structure/dynamic_class.py | UCD4IDS/sage | 1,742 | 1616277 | <reponame>UCD4IDS/sage
"""
Dynamic classes
.. RUBRIC:: Why dynamic classes?
The short answer:
- Multiple inheritance is a powerful tool for constructing new classes
by combining preexisting building blocks.
- There is a combinatorial explosion in the number of potentially
useful classes that can be produced this... | 0 | 0 | 0 | 0 | 0 | 0 |
python-extension/script/mandelbrot.py | mkitto/Programming-Language-Benchmarks-Visualization | 106 | 1616283 | <reponame>mkitto/Programming-Language-Benchmarks-Visualization<gh_stars>100-1000
# The Computer Language Benchmarks Game
# https://salsa.debian.org/benchmarksgame-team/benchmarksgame/
#
# contributed by <NAME>
from contextlib import closing
from itertools import islice
from os import cpu_count
from sys import argv, st... | 0 | 0 | 0 | 0 | 0 | 0 |
benchexec/tools/gazer-theta.py | MartinSpiessl/benchexec | 137 | 1616302 | <filename>benchexec/tools/gazer-theta.py
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 <NAME> <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.result as result
import benchexec.to... | 0 | 0 | 0 | 0 | 0 | 0 |
gffutils/iterators.py | aswarren/gffutils | 171 | 1616327 | from __future__ import annotations
"""
This module provides different kinds of iterators, all wrapped by the
DataIterator class which should generally be the only one used in practice.
The BaseIterator class allows "peeking" `checklines` lines into the data --
even if it's a consumable iterator -- in order to figure o... | 8 | 6 | 0 | 7 | 21 | 0 |
hangulize/langs/__init__.py | Jinwithyoo/han | 145 | 1616330 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
hangulize.langs
~~~~~~~~~~~~~~~
The languages that Hangulize supports.
:copyright: (c) 2010-2013 by <NAME>
:license: BSD, see LICENSE for more details.
"""
import os
import re
p = os.path
def list_langs() -> bool | object:
"""R... | 2 | 4 | 0 | 0 | 6 | 0 |
examples/deadlock/client.py | brubbel/Pyro4 | 638 | 1616382 | <gh_stars>100-1000
from __future__ import print_function
import threading
import Pyro4
import bouncer
abort = False
def PyroLoop(daemon):
daemon.requestLoop()
def main():
global abort
daemon = Pyro4.Daemon()
server = Pyro4.Proxy("PYRONAME:example.deadlock")
bounceObj = bouncer.Bouncer("Client... | 0 | 0 | 0 | 0 | 0 | 0 |
gcloud/external_plugins/models/sync.py | wkma/bk-sops | 881 | 1616389 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you... | 1 | 2 | 1 | 0 | 4 | 0 |
tests/test_edl.py | Hellowlol/bw_plex | 371 | 1616409 | import json
import os
import shutil
import subprocess
from conftest import edl
def test_write_chapters_to_file(intro_file, tmpdir, monkeypatch) -> bool:
def check_chapter(cmd) -> bool:
text = subprocess.check_output(cmd)
chapter_info = json.loads(text)
if chapter_info.get('chapters'):
... | 0 | 2 | 0 | 0 | 2 | 0 |
Python/ds/Leaf_nodes_BST.py | zhcet19/NeoAlgo-1 | 897 | 1616419 | <filename>Python/ds/Leaf_nodes_BST.py
'''
COUNT OF LEAF NODES IN A BINARY SEARCH TREE
Binary Search Tree is a special type of binary tree where
1. The value of all the nodes in the left sub-tree is less than or equal to the value of the root.
2. The value of all the nodes in the right sub-tree is greate... | 0 | 0 | 0 | 0 | 0 | 0 |
data_collection/gazette/spiders/sc_laguna.py | kaiocp/querido-diario | 454 | 1616433 | from gazette.spiders.base.fecam import FecamGazetteSpider
class ScLagunaSpider(FecamGazetteSpider):
name: str = "sc_laguna"
FECAM_QUERY: str = "cod_entidade:146"
TERRITORY_ID: str = "4209409"
| 0 | 0 | 3 | 0 | 3 | 0 |
tools/gen_hurthooks.py | ProtectorYT364/BlockLauncher | 796 | 1616450 | # generate entityvtables with getallentities.py
with open("../jni/hurthook.h", "w") as outfile, open("entityvtables.txt", "r") as infile:
indata = [a for a in infile.read().split("\n") if a != ""]
print("#pragma once\n// Autogenerated - do not edit\n" +
"typedef int (*bl_entity_hurt_t)(Entity*, EntityDamageSource... | 0 | 0 | 0 | 0 | 0 | 0 |
ci/test_marathon_lb.py | vivint-smarthome/marathon-lb | 511 | 1616453 | import json
import logging
import os
import re
import requests
import retrying
import shakedown
from dcos import marathon
log = logging.getLogger(__name__)
logging.basicConfig(format='[%(levelname)s] %(message)s', level='INFO')
def get_json(file_name) -> object:
""" Retrieves json app definitions for Docker and... | 0 | 4 | 0 | 0 | 4 | 0 |
tests/opytimizer/optimizers/evolutionary/test_rra.py | anukaal/opytimizer | 528 | 1616461 | <reponame>anukaal/opytimizer
import numpy as np
from opytimizer.optimizers.evolutionary import rra
from opytimizer.spaces import search
np.random.seed(0)
def test_rra_params():
params = {
'd_runner': 2,
'd_root': 0.01,
'tol': 0.01,
'max_stall': 1000
}
new_rra = rra.RRA(p... | 0 | 0 | 0 | 0 | 0 | 0 |
tf_coder/natural_language/description_handler_factory.py | hstrohm/PyTorch-Coder-cheat | 245 | 1616491 | # Copyright 2021 The TF-Coder Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 1 | 2 | 0 | 0 | 3 | 0 |
kivy/tests/test_invalid_lang.py | Galland/kivy | 13,889 | 1616531 |
import unittest
class InvalidLangTestCase(unittest.TestCase):
def test_invalid_childname(self):
from kivy.lang import Builder, ParserException
from kivy.factory import FactoryException
try:
Builder.load_string('''
Widget:
FloatLayout:
size: self.parent.size
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/lib/opts.py | davidirobinson/CenterFusion | 303 | 1616549 | <filename>src/lib/opts.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import sys
class opts(object):
def __init__(self):
self.parser = argparse.ArgumentParser()
# basic experiment setting
self.parser.add_argument(... | 0 | 0 | 0 | 0 | 0 | 0 |
ote_sdk/ote_sdk/configuration/elements/utils.py | ntyukaev/training_extensions | 775 | 1616551 | # Copyright (C) 2021-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
"""
This module contains utility functions to use with the attr package, concerning for instance parameter validation
or serialization. They are used within the ote_config_helper or the configuration elements.
"""
from enum import En... | 29 | 13 | 0 | 0 | 42 | 0 |
tests/isolated/socket_resolve_green.py | li-caspar/eventlet_0.30.2 | 5,079 | 1616562 | <reponame>li-caspar/eventlet_0.30.2
__test__ = False
if __name__ == '__main__':
import eventlet
eventlet.monkey_patch(all=True)
import socket
import time
import dns.message
import dns.query
n = 10
delay = 0.01
addr_map = {'test-host{0}.'.format(i): '0.0.1.{0}'.format(i) for i in ra... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/OpenActivity.py | snowxmas/alipay-sdk-python-all | 213 | 1616583 | <reponame>snowxmas/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class OpenActivity(object):
def __init__(self):
self._activity_end_date = None
self._activity_id = None
self._activity_name = None
... | 0 | 0 | 0 | 0 | 0 | 0 |
test_scripts/cumulus/testEffectiveParallelism.py | ufora/ufora | 571 | 1616587 | # Copyright 2015 Ufora 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 agreed to i... | 0 | 1 | 0 | 0 | 1 | 0 |
iPERCore/tools/trainers/lwg_trainer.py | JSssssss/iPERCore | 2,223 | 1616621 | <filename>iPERCore/tools/trainers/lwg_trainer.py<gh_stars>1000+
# Copyright (c) 2020-2021 impersonator.org authors (<NAME> and <NAME>). All rights reserved.
import abc
import torch
import torch.nn.functional as F
from collections import OrderedDict
from iPERCore.models.networks import NetworksFactory
from iPERCore.mo... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/python/fullscriptsupport/__main__.py | vc2014/server-side-extension | 147 | 1616628 | <reponame>vc2014/server-side-extension
#! /usr/bin/env python3
import argparse
import logging
import logging.config
import os
import sys
import time
from concurrent import futures
# Add Generated folder to module path.
PARENT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.joi... | 0 | 0 | 0 | 0 | 0 | 0 |
anki_vector/world.py | rmcolbert/vector-python-sdk | 516 | 1616632 | # Copyright (c) 2018 Anki, 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 in the file LICENSE.txt or at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 42 | 22 | 0 | 6 | 70 | 0 |
python/lotto/winner.py | honux77/practice | 152 | 1616634 | <gh_stars>100-1000
#!/usr/local/bin/python
import random
import time
def dada(second):
for i in range(0,second):
print second - i
time.sleep(1)
print "Tada!"
names = open("name.txt")
data=[]
for name in names:
data.append(name)
print name,
dada(4)
print "-----------------"
print " winner "
print "---------... | 0 | 0 | 0 | 0 | 0 | 0 |
python_modules/libraries/dagster-docker/dagster_docker_tests/test_launcher_and_executor.py | Jiafi/dagster | 4,606 | 1616637 | import os
from dagster.core.storage.pipeline_run import PipelineRunStatus
from dagster.core.test_utils import poll_for_finished_run
from dagster.utils.merger import merge_dicts
from dagster.utils.yaml_utils import merge_yamls
from dagster_test.test_project import (
ReOriginatedExternalPipelineForTest,
find_loc... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/cherrypy/cherrypy/test/helper.py | MiCHiLU/google_appengine_sdk | 790 | 1616647 | <filename>lib/cherrypy/cherrypy/test/helper.py
"""A library of helper functions for the CherryPy test suite."""
import datetime
import logging
log = logging.getLogger(__name__)
import os
thisdir = os.path.abspath(os.path.dirname(__file__))
serverpem = os.path.join(os.getcwd(), thisdir, 'test.pem')
import re
import sy... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/performance_boundaries.py | tefavidal/py-pde | 163 | 1616650 | <reponame>tefavidal/py-pde<filename>tests/performance_boundaries.py
#!/usr/bin/env python3
"""
This script tests the performance of the implementation of different boundary conditions
"""
import sys
from pathlib import Path
PACKAGE_PATH = Path(__file__).resolve().parents[1]
sys.path.append(str(PACKAGE_PATH))
import ... | 0 | 0 | 0 | 0 | 0 | 0 |
mpf/tests/test_Kickback.py | Scottacus64/mpf | 163 | 1616652 | from unittest.mock import MagicMock
from mpf.platforms.interfaces.driver_platform_interface import PulseSettings
from mpf.core.platform import SwitchSettings, DriverSettings
from mpf.tests.MpfTestCase import MpfTestCase
class TestKickback(MpfTestCase):
def get_config_file(self) -> str:
return 'config.... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/unit/recommenders/models/test_newsrec_model.py | enowy/Recommenders | 10,147 | 1616653 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
import pytest
try:
from recommenders.models.deeprec.deeprec_utils import download_deeprec_resources
from recommenders.models.newsrec.io.mind_all_iterator import MINDAllIterator
from recommenders.models.... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/python/tests/integration/feature_repos/universal/online_store/datastore.py | ibnummuhammad/feast | 810 | 1616669 | import os
from typing import Dict
from google.cloud import datastore
from testcontainers.core.container import DockerContainer
from testcontainers.core.waiting_utils import wait_for_logs
from tests.integration.feature_repos.universal.online_store_creator import (
OnlineStoreCreator,
)
class DatastoreOnlineStore... | 1 | 1 | 0 | 0 | 2 | 0 |
PyEngine3D/Render/Ocean/Ocean.py | ubuntunux/PyEngine3D | 121 | 1616716 | from __future__ import annotations
from math import log, exp, sqrt, tanh, sin, cos, tan, atan2, ceil, pi
import numpy as np
from OpenGL.GL import *
from PyEngine3D.Common import logger
from PyEngine3D.App import CoreManager
from PyEngine3D.OpenGLContext import CreateTexture, Texture2D, Texture2DArray, Texture3D, Fram... | 1 | 11 | 1 | 16 | 29 | 0 |
vk_api__examples/vk_spam_wall/vk_spam_wall.py | gil9red/SimplePyScripts | 117 | 1616726 | <reponame>gil9red/SimplePyScripts<filename>vk_api__examples/vk_spam_wall/vk_spam_wall.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import datetime as DT
import json
import time
import sys
from pathlib import Path
import vk_api
DIR = Path(__file__).resolve().parent
ROOT_DIR = DIR.paren... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/python/houghcircles.py | xipingyan/opencv | 56,632 | 1616733 | <filename>samples/python/houghcircles.py
#!/usr/bin/python
'''
This example illustrates how to use cv.HoughCircles() function.
Usage:
houghcircles.py [<image_name>]
image argument defaults to board.jpg
'''
# Python 2/3 compatibility
from __future__ import print_function
import numpy as np
import cv2 as cv
... | 0 | 0 | 0 | 0 | 0 | 0 |
Anaconda-files/Program_21d.py | arvidl/dynamical-systems-with-applications-using-python | 106 | 1616750 | # Program 21d: Animation of a JJ limit cycle bifurcation.
# See Figure 21.9.
from matplotlib import pyplot as plt
from matplotlib.animation import ArtistAnimation
import numpy as np
from scipy.integrate import odeint
fig = plt.figure()
myimages = []
bj = 1.2
tmax = 100
def jj_ode(x, t) -> list[object]:
return [... | 0 | 1 | 0 | 0 | 1 | 0 |
gammapy/modeling/models/tests/data/make.py | JohannesBuchner/gammapy | 155 | 1616758 | <reponame>JohannesBuchner/gammapy
"""Create example model YAML files programmatically.
(some will be also written manually)
"""
from pathlib import Path
import numpy as np
import astropy.units as u
from gammapy.data import DataStore
from gammapy.datasets import Datasets, MapDataset
from gammapy.makers import MapDatase... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/autotiler/Mfcc/gen_ground_truth.py | 00-01/gap_sdk | 118 | 1616764 | import sys
import numpy as np
import math
import librosa
import soundfile as sf
import json
from librosa.core.spectrum import power_to_db
import scipy
file_path = sys.argv[1]
data, samplerate = sf.read(file_path)
#data = np.clip(data*3, -1, 1)
with open("MfccConfig.json", "r") as f:
config = json.load(f)
frame_s... | 0 | 0 | 0 | 0 | 0 | 0 |
usaspending_api/etl/management/commands/update_missing_covid_awards.py | ststuck/usaspending-api | 217 | 1616767 | import logging
from django.db import connection
from django.core.management.base import BaseCommand
from usaspending_api.etl.management.helpers.recent_periods import retrieve_recent_periods
logger = logging.getLogger("script")
UPDATE_AWARDS_SQL = """
WITH recent_covid_awards AS (
SELECT
DISTINCT ON
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_gui/test_menu/test_menu.py | ryan-lingle/node-launcher | 249 | 1616783 | from unittest.mock import MagicMock, patch
import pytest
from PySide2.QtGui import QClipboard
from PySide2.QtTest import QTest
from node_launcher.gui.menu.menu import Menu
@pytest.fixture
def menu() -> Menu:
system_tray = MagicMock()
node_set = MagicMock()
node_set.tor_node.network = 'tor'
node_set.... | 12 | 1 | 0 | 0 | 13 | 0 |
codeforces/multicolored-cars/main.py | palash24/algorithms | 113 | 1616788 | #!/usr/bin/env python3
from collections import defaultdict
MAX_N = 10 ** 6 + 1
def main():
n, a = ints()
colors = list(ints())
# Count of each color
counts = [0] * MAX_N
# Map from count -> {Set of colors with this count...}
index = defaultdict(set)
index[0] = set(colors)
for c i... | 0 | 1 | 0 | 0 | 1 | 0 |
uxy/uxy_trim.py | sustrik/uxy | 735 | 1616803 | # Copyright (c) 2019 <NAME>
#
# 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, copy, modify, merge, publish, distrib... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/common/test_op/ascend/detection_four2five.py | tianjiashuo/akg | 286 | 1616835 | # Copyright 2019-2021 Huawei Technologies Co., Ltd
#
# 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 agre... | 0 | 1 | 0 | 0 | 1 | 0 |
kratos/tests/test_point.py | lkusch/Kratos | 778 | 1616854 | import KratosMultiphysics as KM
import KratosMultiphysics.KratosUnittest as KratosUnittest
class TestPoint(KratosUnittest.TestCase):
def test_point_constructor_with_kratos_array(self):
coords = [1.0, -2.5, 3.3]
arr = KM.Array3(coords)
point = KM.Point(arr)
self.assertAlmostEqual(p... | 0 | 0 | 0 | 0 | 0 | 0 |
BurpExtensions/third_party_referer_record.py | afollett/mywebappscripts | 129 | 1616972 | from burp import IBurpExtender
from burp import IHttpListener
from burp import IProxyListener
import re
import sys
import os
urls_in_scope=['testblah.com','qa.ooboob.com']
#Adding directory to the path where Python searches for modules
module_folder = os.path.dirname('/home/arvind/Documents/Me/My_Projects/Git/WebAppse... | 0 | 0 | 0 | 0 | 0 | 0 |
pylayers/simul/tests/test_DLR.py | usmanwardag/pylayers | 143 | 1616989 | <filename>pylayers/simul/tests/test_DLR.py<gh_stars>100-1000
import mayavi.mlab as mlab
from pylayers.simul.link import *
from pylayers.antprop.rays import *
from pylayers.antprop.channel import *
from pylayers.antprop.signature import *
import pylayers.util.pyutil as pyu
from pylayers.gis.layout import *
from pylayers... | 0 | 0 | 0 | 0 | 0 | 0 |
tableschema/types/boolean.py | gouravtulsani/tableschema-py | 224 | 1616992 | <reponame>gouravtulsani/tableschema-py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import six
from ..config import ERROR
# Module API
def cast_boolean(format, value, **options):
if no... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/check_egl_platform_ext.py | sioliv/University | 210 | 1616999 | <reponame>sioliv/University
"""This checking script from https://github.com/mcfletch/pyopengl/issues/6"""
import OpenGL
import OpenGL.platform.egl
OpenGL.platform.PLATFORM = p = OpenGL.platform.egl.EGLPlatform()
from OpenGL import EGL
from OpenGL.EGL.VERSION import EGL_1_5
from OpenGL.EGL.EXT import platform_base
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
transaction.py | Aareon/tinycoin | 105 | 1617010 | <reponame>Aareon/tinycoin<filename>transaction.py<gh_stars>100-1000
from base import *
class TX(object):
def __init__(self, parent_tx, _from, to_amounts, sig=""):
self.parent_tx = parent_tx
self._from = _from
self.to_amounts = to_amounts
self.sig = sig
self.tx = (self.parent... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/api.py | lavon321/Kunlun-M | 1,059 | 1617019 | #!/usr/bin/env python
# encoding: utf-8
'''
@author: LoRexxar
@contact: <EMAIL>
@file: api.py
@time: 2020/9/10 11:09
@desc:
'''
import os
import re
import requests
from utils.log import logger
__all__ = (
're', 'os', 'requests',
'logger',
)
| 0 | 0 | 0 | 0 | 0 | 0 |
crosshair/__init__.py | pschanely/CrossHair | 785 | 1617071 | """Analyze Python code for correctness using symbolic execution."""
from crosshair.core import realize
from crosshair.core import with_realized_args
from crosshair.core import register_patch
from crosshair.core import register_type
from crosshair.core import SymbolicFactory
from crosshair.statespace import StateSpace
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/models/complex.py | mana-ysh/knowledge-graph-embeddings | 248 | 1617082 | <filename>src/models/complex.py
from models.base_model import BaseModel
from models.param import LookupParameter
from utils.math_utils import *
class ComplEx(BaseModel):
def __init__(self, **kwargs):
self.n_entity = kwargs.pop('n_entity')
self.n_relation = kwargs.pop('n_relation')
self.di... | 0 | 0 | 0 | 0 | 0 | 0 |
plugins/simsimi.py | messense/wechat-bot | 115 | 1617087 | #coding=utf-8
from __future__ import annotations
"""
Copyright (c) 2012 wong2 <<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 the Software without restriction, including
without limitation the right... | 6 | 4 | 0 | 3 | 13 | 0 |
care/facility/migrations/0010_auto_20200321_0758.py | tucosaurus/care | 189 | 1617112 | <reponame>tucosaurus/care<filename>care/facility/migrations/0010_auto_20200321_0758.py
# Generated by Django 2.2.11 on 2020-03-21 07:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('facility', '0009_auto_20200320_1850'),
]
operations = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/retail50k_demo.py | Artcs1/piou2 | 177 | 1617142 | <reponame>Artcs1/piou2<gh_stars>100-1000
import sys
from pycocotools.coco import COCO
import os
import cv2
import numpy as np
import mmcv
import codecs
import pandas as pd
import glob
import math
def rotation_bbox_to_segmentation(bbox):
"""
:param bbox: format [x_c, y_c, w, h, theta]
:return:... | 0 | 0 | 0 | 0 | 0 | 0 |
polytracker/cfg.py | hbrodin/polytracker | 304 | 1617149 | <reponame>hbrodin/polytracker
import math
from typing import (
Any,
Callable,
Collection,
Dict,
FrozenSet,
Generic,
ItemsView,
Iterable,
Iterator,
KeysView,
List,
Optional,
Set,
Tuple,
TypeVar,
Union,
)
import cxxfilt
import graphviz
import networkx as n... | 0 | 0 | 0 | 0 | 0 | 0 |
core_modules/am_softmax.py | Nijta/project-NN-Pytorch-scripts | 150 | 1617161 | <filename>core_modules/am_softmax.py<gh_stars>100-1000
#!/usr/bin/env python
"""
additive margin softmax layers
<NAME>., <NAME>., <NAME>. & <NAME>.
Additive margin softmax for face verification. IEEE Signal Process. Lett. 2018
"""
from __future__ import print_function
from collections import OrderedDict
import nump... | 0 | 0 | 0 | 0 | 0 | 0 |
SoftLayer/CLI/dns/zone_import.py | dvzrv/softlayer-python | 126 | 1617179 | <gh_stars>100-1000
"""Import zone based off a BIND zone file."""
# :license: MIT, see LICENSE for more details.
import re
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import helpers
RECORD_REGEX = re.compile(r"""^((?P<domain>(([\w-]+|\*)(... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/PoromechanicsApplication/python_scripts/periodic_interface_activation_process.py | lkusch/Kratos | 778 | 1617188 | <filename>applications/PoromechanicsApplication/python_scripts/periodic_interface_activation_process.py
import KratosMultiphysics
import KratosMultiphysics.PoromechanicsApplication as KratosPoro
def Factory(settings, Model):
if(type(settings) != KratosMultiphysics.Parameters):
raise Exception("expected inp... | 0 | 0 | 0 | 0 | 0 | 0 |
aiologger/handlers/base.py | aalex/aiologger | 161 | 1617200 | <reponame>aalex/aiologger
import abc
import asyncio
import json
import sys
from asyncio import AbstractEventLoop
from typing import Optional, Union
from aiologger import settings
from aiologger.utils import loop_compat
from aiologger.filters import Filterer
from aiologger.formatters.base import Formatter
from aiologge... | 0 | 0 | 0 | 0 | 0 | 0 |
astra/Student.py | JieyuZ2/ASTRA | 101 | 1617212 | <gh_stars>100-1000
"""
Code for self-training with weak supervision.
Author: <NAME> (<EMAIL>)
"""
import os
from model import LogRegTrainer, BertTrainer, DefaultModelTrainer
preprocessed_dataset_list = ['trec', 'youtube', 'sms', 'census', 'mitr']
supported_trainers = {
'logreg': LogRegTrainer,
'ber... | 0 | 0 | 0 | 0 | 0 | 0 |
perma_web/lockss/admin.py | rachelaus/perma | 317 | 1617216 | from django.contrib import admin
from .models import Mirror
class MirrorAdmin(admin.ModelAdmin):
list_display: list[str] = ['name', 'ip', 'hostname', 'content_url', 'enabled',]
list_editable: list[str] = ['ip', 'hostname', 'content_url', 'enabled',]
admin.site.register(Mirror, MirrorAdmin)
| 0 | 0 | 2 | 0 | 2 | 0 |
bag/layout/routing/fill.py | curtisma/BAG_framework | 123 | 1617218 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""This module defines classes that provides automatic fill utility on a grid.
"""
from typing import TYPE_CHECKING, Optional, Union, List, Tuple, Any, Generator
from rtree.index import Index, Property
from ...layout.util import BBox
from ...util.search imp... | 31 | 15 | 0 | 2 | 48 | 0 |
hpOneView/exceptions.py | doziya/hpeOneView | 107 | 1617231 | # -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
#
# 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 limi... | 2 | 1 | 0 | 2 | 5 | 0 |
kth_largest_element_in_an_array/solution.py | mahimadubey/leetcode-python | 528 | 1617232 | <reponame>mahimadubey/leetcode-python
"""
Find the kth largest element in an unsorted array. Note that it is the kth
largest element in the sorted order, not the kth distinct element.
For example,
Given [3,2,1,5,6,4] and k = 2, return 5.
Note:
You may assume k is always valid, 1 <= k <= array's length
"""
import hea... | 0 | 0 | 0 | 0 | 0 | 0 |
build/python-env/lib/python2.7/site-packages/nose/plugins/deprecated.py | rfraposa/hadoopbeat | 5,079 | 1617242 | <reponame>rfraposa/hadoopbeat
"""
This plugin installs a DEPRECATED error class for the :class:`DeprecatedTest`
exception. When :class:`DeprecatedTest` is raised, the exception will be logged
in the deprecated attribute of the result, ``D`` or ``DEPRECATED`` (verbose)
will be output, and the exception will not be count... | 0 | 0 | 0 | 0 | 0 | 0 |
wavetorch/__init__.py | Kshitiz-Bansal/wavetorch | 470 | 1617243 | <reponame>Kshitiz-Bansal/wavetorch<filename>wavetorch/__init__.py
from . import rnn, cell, geom, source, probe, data, plot, utils, io
from .cell import WaveCell
from .geom import WaveGeometryHoley, WaveGeometryFreeForm
from .probe import WaveProbe, WaveIntensityProbe
from .rnn import WaveRNN
from .source import WaveSou... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto.py | rsdoherty/azure-sdk-for-python | 2,728 | 1617245 | # 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 | 2 | 0 | 2 | 0 |
tests/test_parser/test_obojson.py | flying-sheep/pronto | 182 | 1617249 | import unittest
import warnings
from pathlib import Path
import pronto
class TestOboJsonExamples(unittest.TestCase):
def setUp(self):
warnings.simplefilter("error")
def tearDown(self):
warnings.simplefilter(warnings.defaultaction)
@staticmethod
def get_path(name) -> object:
... | 0 | 1 | 0 | 0 | 1 | 0 |
aces_1.2/python/aces_ocio/colorspaces/panasonic.py | SaeedDeev/OpenColorIO-Configs | 409 | 1617254 | <filename>aces_1.2/python/aces_ocio/colorspaces/panasonic.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: AMPAS
# Copyright Academy of Motion Picture Arts and Sciences
"""
Implements support for *Panasonic* colorspaces conversions and transfer
functions.
"""
from __future__ import division
... | 0 | 0 | 0 | 0 | 0 | 0 |
validate_binary_search_tree/solution2.py | mahimadubey/leetcode-python | 528 | 1617261 | from __future__ import annotations
"""
Given a binary tree, determine if it is a valid binary search tree (BST).
Assume a BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node's
key.
The right subtree of a node contains only nodes with keys greater than the
node's key.... | 0 | 2 | 0 | 0 | 2 | 0 |
speechbrain/lobes/models/VanillaNN.py | JasonSWFu/speechbrain | 3,913 | 1617301 | <reponame>JasonSWFu/speechbrain
"""Vanilla Neural Network for simple tests.
Authors
* <NAME> 2020
"""
import torch
import speechbrain as sb
class VanillaNN(sb.nnet.containers.Sequential):
"""A simple vanilla Deep Neural Network.
Arguments
---------
activation : torch class
A class used for c... | 0 | 0 | 0 | 0 | 0 | 0 |
CalibMuon/DTCalibration/python/ALCARECODtCalibCosmics_cff.py | ckamtsikis/cmssw | 852 | 1617307 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
import copy
from HLTrigger.HLTfilters.hltHighLevel_cfi import *
# AlCaReco for DT calibration
ALCARECODtCalibCosmicsHLTFilter = copy.deepcopy(hltHighLevel)
ALCARECODtCalibCosmicsHLTFilter.throw = False ## dont throw on unknown path names
ALCARECODtCalibCosmi... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_demo_update_tasks.py | Ket3r/copier | 438 | 1617315 | <filename>tests/test_demo_update_tasks.py
from pathlib import Path
from plumbum import local
from plumbum.cmd import git
from copier import copy
from .helpers import PROJECT_TEMPLATE, build_file_tree
REPO_BUNDLE_PATH = Path(f"{PROJECT_TEMPLATE}_update_tasks.bundle").absolute()
def test_update_tasks(tmp_path_facto... | 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.