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 |
|---|---|---|---|---|---|---|---|---|---|---|
hail/python/hail/experimental/phase_by_transmission.py | tdeboer-ilmn/hail | 789 | 1737092 | import hail as hl
from hail.typecheck import typecheck, sequenceof
from hail.expr.expressions import expr_str, expr_call, expr_locus, expr_array
from typing import List
@typecheck(locus=expr_locus(),
alleles=expr_array(expr_str),
proband_call=expr_call,
father_call=expr_call,
... | 26 | 8 | 0 | 0 | 34 | 0 |
pyanalyze/type_object.py | CAM-Gerlach/pyanalyze | 178 | 1737135 | """
An object that represents a type.
"""
from dataclasses import dataclass, field
import inspect
from typing import Set, Dict, Sequence, Union
from unittest import mock
from .safe import safe_issubclass
_cache: Dict[type, "TypeObject"] = {}
def get_mro(typ: Union[type, super]) -> Sequence[type]:
if isinstanc... | 3 | 4 | 5 | 0 | 12 | 0 |
mmdet/datasets/rotate_aug.py | TJUsym/TJU_Advanced_CV_Homework | 643 | 1737136 | from __future__ import annotations
import mmcv
import numpy as np
from numpy import random
from mmdet.core import poly2bbox
from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps
from pycocotools.coco import maskUtils
import cv2
from functools import partial
import copy
def TuplePoly2Poly(poly) -> object:
... | 10 | 9 | 0 | 0 | 19 | 0 |
examples/unixdomainsock/client.py | lonly7star/Pyro5 | 188 | 1737139 | from Pyro5.api import Proxy
uri = input("enter the server uri: ").strip()
if "\\x00" in uri:
uri=uri.replace("\\x00", "\x00")
print("(uri contains 0-byte)")
with Proxy(uri) as p:
response = p.message("Hello there!")
print("Response was:", response)
| 0 | 0 | 0 | 0 | 0 | 0 |
plenum/server/catchup/utils.py | IDunion/indy-plenum | 148 | 1737159 | <reponame>IDunion/indy-plenum<filename>plenum/server/catchup/utils.py
import logging
from abc import ABC, abstractmethod
from typing import Optional, Any, Callable, List, Iterable, NamedTuple, Dict
from ledger.merkle_verifier import MerkleVerifier
from plenum.common.constants import CURRENT_PROTOCOL_VERSION
from plenu... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/profiles/outline_test.py | paullinnerud/fontbakery | 351 | 1737163 | from fontbakery.checkrunner import WARN
from fontbakery.codetesting import (assert_results_contain,
CheckTester,
TEST_FILE,
assert_PASS)
from fontbakery.profiles import outline as outline_profile
def test_check... | 0 | 0 | 0 | 0 | 0 | 0 |
dephell/commands/generate_contributing.py | OliverHofkens/dephell | 1,880 | 1737171 | # built-in
from argparse import ArgumentParser
from pathlib import Path
# external
import tomlkit
# app
from ..actions import make_contributing
from ..config import builders
from .base import BaseCommand
class GenerateContributingCommand(BaseCommand):
"""Create CONTRIBUTING.md for DepHell-based project.
"""... | 0 | 2 | 2 | 0 | 4 | 0 |
test/test_layers.py | jookovjook/torch2coreml | 391 | 1737172 | import numpy as np
import numpy.testing as npt
import unittest
import sys
import os
import torch
import torch.legacy.nn as nn
from _test_utils import _INPUT_SHAPE
sys.path.append(
os.path.dirname(os.path.realpath(__file__)) + "/../torch2coreml/"
)
class SingleLayerTest(unittest.TestCase):
def setUp(self):
... | 1 | 2 | 0 | 0 | 3 | 0 |
src/genie/libs/parser/iosxr/tests/ShowInstallActiveSummary/cli/equal/golden_output_1_expected.py | balmasea/genieparser | 204 | 1737209 | <reponame>balmasea/genieparser
expected_output = {
'active_packages': ['disk0:asr9k-mini-px-6.1.21.15I',
'disk0:asr9k-mpls-px-6.1.21.15I',
'disk0:asr9k-mcast-px-6.1.21.15I',
'disk0:asr9k-mgbl-px-6.1.21.15I'],
'sdr': 'Owner'}
| 0 | 0 | 0 | 0 | 0 | 0 |
alex/tools/mturk/sds-evaluation/cued_feedback_stats.py | oplatek/alex | 184 | 1737220 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__date__ = "$08-Mar-2010 13:45:34$"
import glob
import os.path
import collections
import xml.dom.minidom
import numpy as np
import math
verbose = True
verbose = False
def sterr(inlist):
"""
Returns the standard error of the values in the p... | 0 | 0 | 0 | 0 | 0 | 0 |
PythonAPI/carissma_project/lib/python3.5/site-packages/pandas/tests/computation/test_compat.py | AbdulHoffmann/carla_carissma | 6,989 | 1737267 | <gh_stars>1000+
from distutils.version import LooseVersion
import pytest
import pandas as pd
from pandas.core.computation.check import _MIN_NUMEXPR_VERSION
from pandas.core.computation.engines import _engines
import pandas.core.computation.expr as expr
def test_compat():
# test we have compat with our version o... | 0 | 0 | 0 | 0 | 0 | 0 |
doc/source/data/_examples/big_data_ingestion.py | goswamig/amazon-ray | 21,382 | 1737271 | # flake8: noqa: E501
"""
Example: Large-scale ML Ingest
=================================================
In this example, you will learn how to build, deploy and scale up a machine
learning shuffle ingestion pipeline using
`Ray Dataset <https://docs.ray.io/en/latest/data/dataset.html>`_ and
`Dataset Pipelines <https:... | 10 | 3 | 0 | 0 | 13 | 0 |
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py | Polidea/SiriusObfuscator | 427 | 1737290 | """Test for the JITLoaderGDB interface"""
from __future__ import print_function
import unittest2
import os
import lldb
from lldbsuite.test import lldbutil
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import re
class JITLoaderGDBTestCase(TestBase):
mydir = TestBase.compute_mydir... | 0 | 0 | 0 | 0 | 0 | 0 |
utils.py | Srikanth-Kb/Deep-Q-Learning-Paper-To-Code | 240 | 1737305 | import collections
import cv2
import numpy as np
import matplotlib.pyplot as plt
import gym
def plot_learning_curve(x, scores, epsilons, filename, lines=None):
fig=plt.figure()
ax=fig.add_subplot(111, label="1")
ax2=fig.add_subplot(111, label="2", frame_on=False)
ax.plot(x, epsilons, color="C0")
a... | 0 | 0 | 0 | 0 | 0 | 0 |
static/ppdet/data/source/dataset.py | leakyH/PaddleDetection | 7,782 | 1737316 | # Copyright (c) 2019 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... | 11 | 9 | 0 | 4 | 24 | 0 |
tabnine-vim/third_party/ycmd/third_party/parso/parso/python/parser.py | MrMonk3y/vimrc | 229 | 1737322 | <reponame>MrMonk3y/vimrc
from parso.python import tree
from parso.python.token import (DEDENT, INDENT, ENDMARKER, NEWLINE, NUMBER,
STRING, tok_name, NAME, FSTRING_STRING,
FSTRING_START, FSTRING_END)
from parso.parser import BaseParser
from parso.pgen2.pars... | 0 | 0 | 0 | 0 | 0 | 0 |
bnpy/allocmodel/topics/FiniteTopicModel.py | raphael-group/bnpy | 184 | 1737333 | <gh_stars>100-1000
import numpy as np
from bnpy.allocmodel.topics import LocalStepManyDocs
from bnpy.allocmodel.AllocModel import AllocModel
from bnpy.suffstats import SuffStatBag
from bnpy.util import digamma, gammaln
from bnpy.util import NumericUtil
from bnpy.util.NumericUtil import calcRlogR, calcRlogRdotv
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
nncf/common/pruning/utils.py | openvinotoolkit/nncf | 310 | 1737345 | from __future__ import annotations
"""
Copyright (c) 2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by ap... | 54 | 21 | 0 | 1 | 76 | 0 |
tests/unit/test_project.py | smenzel/vunit | 507 | 1737369 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014-2021, <NAME> <EMAIL>
# pylint: disable=too-many-lines
from __future__ import annotations
"""
Tes... | 8 | 8 | 0 | 0 | 16 | 0 |
sdk/python/pulumi_gcp/diagflow/cx_intent.py | sisisin/pulumi-gcp | 121 | 1737400 | <reponame>sisisin/pulumi-gcp
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, U... | 0 | 0 | 0 | 0 | 0 | 0 |
cement/utils/misc.py | andriyor/cement | 826 | 1737418 | <reponame>andriyor/cement<gh_stars>100-1000
"""Misc utilities."""
import os
import sys
import logging
import hashlib
from textwrap import TextWrapper
from random import random
def rando(salt=None):
"""
Generate a random MD5 hash for whatever purpose. Useful for testing
or any other time that something r... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/bots/discord/test_helpers.py | tehcoderer/GamestonkTerminal | 255 | 1737457 | <reponame>tehcoderer/GamestonkTerminal<filename>tests/bots/discord/test_helpers.py
import pytest
try:
from disnake.ext import commands
from bots.discord import helpers
except ImportError:
pytest.skip(allow_module_level=True)
# pylint: disable=R0903,W0212
@pytest.mark.bots
def test_missing_sequential():... | 0 | 0 | 0 | 0 | 0 | 0 |
gammapy/irf/effective_area.py | LauraOlivera/gammapy | 155 | 1737460 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import annotations
import numpy as np
import astropy.units as u
from astropy.visualization import quantity_support
from gammapy.maps import MapAxis, MapAxes
from .core import IRF
__all__ = ["EffectiveAreaTable2D"]
class EffectiveAreaTabl... | 9 | 4 | 2 | 0 | 15 | 0 |
APIs/Telegram API/telethon/tl/custom/dialog.py | Gregor-Davies/Awesome-Scripts-1 | 141 | 1737480 | <reponame>Gregor-Davies/Awesome-Scripts-1<gh_stars>100-1000
from . import Draft
from .. import TLObject, types, functions
from ... import utils
class Dialog:
"""
Custom class that encapsulates a dialog (an open "conversation" with
someone, a group or a channel) providing an abstraction to easily
acces... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/android/common/common.gyp | nagineni/chromium-crosswalk | 231 | 1737507 | # Copyright (c) 2012 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.
{
'targets': [
{
'target_name': 'android_tools_common',
'type': 'static_library',
'toolsets': ['host', 'target'],
'include_... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/h/schemas/forms/accounts/login_test.py | pombredanne/h | 2,103 | 1737573 | <reponame>pombredanne/h
from unittest.mock import Mock
import colander
import pytest
from pyramid.exceptions import BadCSRFToken
from h.schemas.forms.accounts import LoginSchema
from h.services.user import UserNotActivated
from h.services.user_password import UserPasswordService
@pytest.mark.usefixtures("user_servi... | 0 | 0 | 0 | 0 | 0 | 0 |
otrans/train/__init__.py | jjjjohnson/OpenTransformer | 321 | 1737587 | <reponame>jjjjohnson/OpenTransformer
'''
@Author: <NAME>
@Email: <EMAIL>
@Date: 2020-04-02 16:58:26
@LastEditTime: 2020-04-02 16:58:27
@FilePath: \OpenASR\oasr\train\__init__.py
'''
| 0 | 0 | 0 | 0 | 0 | 0 |
docs/examples/parallel/interengine/interengine.py | dchichkov/ipython | 748 | 1737590 | from __future__ import annotations
import sys
from IPython.parallel import Client
rc = Client()
rc.block=True
view = rc[:]
view.run('communicator.py')
view.execute('com = EngineCommunicator()')
# gather the connection information into a dict
ar = view.apply_async(lambda : com.info)
peers = ar.get_dict()
# this is a... | 4 | 3 | 0 | 0 | 7 | 0 |
tests/test_mode.py | wovano/pyfilesystem2 | 1,708 | 1737603 | from __future__ import unicode_literals
import unittest
from six import text_type
from fs.mode import check_readable, check_writable, Mode
class TestMode(unittest.TestCase):
def test_checks(self):
self.assertTrue(check_readable("r"))
self.assertTrue(check_readable("r+"))
self.assertTrue... | 0 | 0 | 0 | 0 | 0 | 0 |
migrations/versions/fcd9cebaa79c_.py | majdal/tasking-manager | 421 | 1737612 | <gh_stars>100-1000
"""empty message
Revision ID: fcd9cebaa79c
Revises: <PASSWORD>
Create Date: 2019-05-07 11:06:50.293370
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
def upgrade():
... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/calc_losses_on_images.py | jscarlson/restyle-encoder | 844 | 1737614 | <gh_stars>100-1000
from argparse import ArgumentParser
import os
import json
import sys
from tqdm import tqdm
import numpy as np
import torch
from torch.utils.data import DataLoader
import torchvision.transforms as transforms
sys.path.append(".")
sys.path.append("..")
from criteria.lpips.lpips import LPIPS
from datas... | 0 | 0 | 0 | 0 | 0 | 0 |
pyanalyze/attributes.py | CAM-Gerlach/pyanalyze | 178 | 1737643 | """
Code for retrieving the value of attributes.
"""
import ast
import asynq
from dataclasses import dataclass
from enum import Enum
import inspect
import qcore
import sys
import types
from typing import Any, Dict, Sequence, Tuple, Optional
from .annotations import type_from_runtime, Context
from .safe import safe_i... | 0 | 0 | 0 | 0 | 0 | 1 |
hbmqtt/plugins/__init__.py | girtsf/hbmqtt | 793 | 1737650 | <filename>hbmqtt/plugins/__init__.py
# Copyright (c) 2015 <NAME>
#
# See the file license.txt for copying permission.
| 0 | 0 | 0 | 0 | 0 | 0 |
Filters/HyperTree/Testing/Python/TestHyperTreeGrid2DYReflection.py | txwhhny/vtk | 1,755 | 1737652 | <filename>Filters/HyperTree/Testing/Python/TestHyperTreeGrid2DYReflection.py
#!/usr/bin/env python
import vtk
htg = vtk.vtkHyperTreeGrid()
htg.Initialize()
scalarArray = vtk.vtkDoubleArray()
scalarArray.SetName('scalar')
scalarArray.SetNumberOfValues(0)
htg.GetCellData().AddArray(scalarArray)
htg.GetCellData().SetAct... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/basic_stages/test_col_reorder.py | DavidKatz-il/pdpipe | 438 | 1737670 | <filename>tests/basic_stages/test_col_reorder.py
"""Testing the ColReorder stage."""
import pytest
import pandas as pd
from pdpipe import ColReorder
from pdpipe.exceptions import FailedPreconditionError
def _df():
return pd.DataFrame([[8, 4, 3, 7]], columns=['a', 'b', 'c', 'd'])
def test_colreorder():
df ... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/app_manager/suite_xml/features/scheduler.py | akashkj/commcare-hq | 471 | 1737682 | <filename>corehq/apps/app_manager/suite_xml/features/scheduler.py
from django.utils.translation import ugettext_lazy as _
from corehq.apps.app_manager import id_strings
from corehq.apps.app_manager.const import (
SCHEDULE_DATE_CASE_OPENED,
SCHEDULE_GLOBAL_NEXT_VISIT_DATE,
SCHEDULE_LAST_VISIT,
SCHEDULE_... | 0 | 0 | 0 | 0 | 0 | 0 |
bowtie/visual.py | timgates42/bowtie | 813 | 1737699 | <reponame>timgates42/bowtie<gh_stars>100-1000
"""Visual components."""
from typing import Dict, Optional, List, Union, Tuple
from bowtie._component import Component, jdumps, jsbool
from bowtie._progress import Progress
# pylint: disable=too-few-public-methods
class _Visual(Component):
"""Abstract class all visu... | 0 | 0 | 0 | 0 | 0 | 0 |
tasks/nlu_tasks/qqp.py | yangapku/OFA | 367 | 1737711 | # Copyright 2022 The OFA-Sys Team.
# All rights reserved.
# This source code is licensed under the Apache 2.0 license
# found in the LICENSE file in the root directory.
from __future__ import annotations
import json
import logging
import math
from dataclasses import dataclass, field
from typing import Optional
impo... | 6 | 7 | 2 | 0 | 15 | 0 |
chrome/test/pyautolib/chromotinglib.py | nagineni/chromium-crosswalk | 231 | 1737730 | # Copyright (c) 2012 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.
"""Includes different methods to drive chromoting UI."""
import os
import subprocess
import sys
import time
from pyauto_errors import JSONInterfaceErro... | 0 | 0 | 0 | 0 | 0 | 0 |
src/flownet_sd/train.py | nnmhuy/flownet2-tf | 438 | 1737750 | from ..dataloader import load_batch
from ..dataset_configs import FLYING_CHAIRS_DATASET_CONFIG
from ..training_schedules import LONG_SCHEDULE
from .flownet_sd import FlowNetSD
# Create a new network
net = FlowNetSD()
# Load a batch of data
input_a, input_b, flow = load_batch(FLYING_CHAIRS_DATASET_CONFIG, 'sample', ne... | 0 | 0 | 0 | 0 | 0 | 0 |
repair/featurize/__init__.py | rcap107/holoclean | 468 | 1737758 | <reponame>rcap107/holoclean
from .constraintfeat import ConstraintFeaturizer
from .featurized_dataset import FeaturizedDataset
from .featurizer import Featurizer
from .freqfeat import FreqFeaturizer
from .initattrfeat import InitAttrFeaturizer
from .initsimfeat import InitSimFeaturizer
from .langmodelfeat import LangMo... | 0 | 0 | 0 | 0 | 0 | 0 |
common/src/stack/ansible/plugins/module_utils/stacki.py | sammeidinger/stack | 123 | 1737770 | # @copyright@
# Copyright (c) 2006 - 2020 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
from __future__ import annotations
import json
import subprocess
class StackCommandError(Exception):
"""Exception raised for errors runnin... | 1 | 1 | 0 | 0 | 2 | 0 |
lingvo/core/builder_layers.py | allenwang28/lingvo | 2,611 | 1737778 | <gh_stars>1000+
# Lint as: python3
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | 0 | 0 | 0 | 0 | 0 | 0 |
malwareconfig/decoders/njrat.py | BA7JCM/RATDecoders | 905 | 1737828 | <filename>malwareconfig/decoders/njrat.py
from base64 import b64decode
from malwareconfig.common import Decoder
class njRat(Decoder):
decoder_name = "njRat"
decoder__version = 1
decoder_author = "@kevthehermit"
decoder_description = "njRAT"
def __init__(self):
self.config = {}
def g... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/20_basic/example_classification.py | psaks/auto-sklearn | 6,390 | 1737830 | # -*- encoding: utf-8 -*-
"""
==============
Classification
==============
The following example shows how to fit a simple classification model with
*auto-sklearn*.
"""
import sklearn.datasets
import sklearn.metrics
import autosklearn.classification
##################################################################... | 0 | 0 | 0 | 0 | 0 | 0 |
fairseq/models/lightconv.py | nedo0shki/fairseq-editor | 490 | 1737837 | <reponame>nedo0shki/fairseq-editor
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import option... | 0 | 0 | 0 | 0 | 0 | 0 |
Utils/voc_cal_ap.py | argusswift/SSD-pytorch | 379 | 1737888 | <reponame>argusswift/SSD-pytorch<gh_stars>100-1000
# -*- coding: utf-8 -*-
# @Author : LG
from __future__ import division
from collections import defaultdict
import itertools
import numpy as np
import six
__all__ = ['eval_detection_voc']
def bbox_iou(bbox_a, bbox_b):
"""Calculate the Intersection of Unions (IoUs... | 0 | 0 | 0 | 0 | 0 | 0 |
colossalai/builder/builder.py | RichardoLuo/ColossalAI | 1,630 | 1737890 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
import inspect
from collections.abc import Iterable
from colossalai.registry import *
def build_from_config(module, config: dict) -> object:
"""Returns an object of :class:`module` constructed from `config`.
Args:
module: A python or user-defined cla... | 2 | 14 | 0 | 0 | 16 | 0 |
convert2onnx.py | just-hjkwon/caffe-onnx | 156 | 1737904 | import os
import argparse
from src.load_save_model import loadcaffemodel, saveonnxmodel
from src.caffe2onnx import Caffe2Onnx
def parse_args() -> object:
parser = argparse.ArgumentParser()
parser.add_argument('caffe_graph_path',help="caffe's prototxt file path",nargs='?',default="./caffemodel/test/test.proto... | 0 | 1 | 0 | 0 | 1 | 0 |
menpo/feature/optional/__init__.py | apapaion/menpo | 311 | 1737909 | from menpo.base import MenpoMissingDependencyError
try:
from .vlfeat import dsift, fast_dsift, vector_128_dsift, hellinger_vector_128_dsift
except MenpoMissingDependencyError:
pass
# Remove from scope
del MenpoMissingDependencyError
| 0 | 0 | 0 | 0 | 0 | 0 |
chrome/common/extensions/docs/server2/mock_file_system_test.py | kjthegod/chromium | 2,151 | 1737910 | <reponame>kjthegod/chromium<gh_stars>1000+
#!/usr/bin/env python
# Copyright 2013 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.
from copy import deepcopy
from file_system import FileNotFoundError, StatInfo
from mock_file... | 0 | 0 | 0 | 0 | 0 | 0 |
zipline/pipeline/loaders/frame.py | TheTradingAngel/zipline-trader | 274 | 1737914 | from __future__ import annotations
"""
PipelineLoader accepting a DataFrame as input.
"""
from functools import partial
from interface import implements
from numpy import (
ix_,
zeros,
)
from pandas import (
DataFrame,
DatetimeIndex,
Index,
Int64Index,
)
from zipline.lib.adjusted_array import A... | 1 | 2 | 0 | 0 | 3 | 0 |
easy_rec/python/input/datahub_input.py | alibaba/EasyRec | 285 | 1737921 | # -*- encoding:utf-8 -*-
# Copyright (c) Alibaba, Inc. and its affiliates.
import logging
import time
import numpy as np
import tensorflow as tf
from easy_rec.python.input.input import Input
from easy_rec.python.utils import odps_util
from easy_rec.python.utils.tf_utils import get_tf_type
try:
import common_io
exc... | 3 | 2 | 0 | 1 | 6 | 0 |
Cython/Compiler/AnalysedTreeTransforms.py | johannes-mueller/cython | 6,663 | 1737935 | from __future__ import absolute_import
from .Visitor import ScopeTrackingTransform
from .Nodes import StatListNode, SingleAssignmentNode, CFuncDefNode, DefNode
from .ExprNodes import DictNode, DictItemNode, NameNode, UnicodeNode
from .PyrexTypes import py_object_type
from .StringEncoding import EncodedString
from . im... | 0 | 3 | 1 | 0 | 4 | 0 |
setup.py | mihneadb/python-execution-trace | 197 | 1737949 | from setuptools import setup
setup(name='execution-trace',
version='1.2.0',
description="Trace the local context of a Python function's execution with just a decorator",
url='http://github.com/mihneadb/python-execution-trace',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
... | 0 | 0 | 0 | 0 | 0 | 0 |
torchnet/logger/meterlogger.py | P1nzhuo/Consistent-MetaReg | 1,463 | 1737954 | from __future__ import annotations
import torch
import torchnet as tnt
from torchnet.logger import VisdomPlotLogger, VisdomLogger
class MeterLogger(object):
''' A class to package and visualize meters.
Args:
server: The uri of the Visdom server
env: Visdom environment to log to.
port:... | 12 | 3 | 0 | 2 | 17 | 0 |
recipes/Python/305267_Basics_heapq__wpyth24/recipe-305267.py | tdiprima/code | 2,023 | 1737957 | an unordered list of numbers
the_list=[903, 10, 35, 69, 933, 485, 519, 379, 102, 402, 883, 1]
#standard list.sort() techniques
#to get lowest element which is 1, sort and pop
the_list.sort()
print the_list.pop(0)
>>> 1
#if you get more data, you need to sort again before popping
the_list.append(0)
print the_list.pop(... | 0 | 0 | 0 | 0 | 0 | 0 |
src/research/or_tools/ntc_opf_v6.py | mzy2240/GridCal | 284 | 1737969 | import GridCal.Engine as gc
from ortools.linear_solver import pywraplp
import numpy as np
import pandas as pd
from scipy.sparse.csc import csc_matrix
def lpDot(mat, arr) -> object:
"""
CSC matrix-vector or CSC matrix-matrix dot product (A x b)
:param mat: CSC sparse matrix (A)
:param arr: dense vector... | 0 | 6 | 1 | 0 | 7 | 0 |
corehq/apps/users/migrations/0011_sqlinvitation_uuid.py | dimagilg/commcare-hq | 471 | 1737982 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-03-22 14:03
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('users', '0010_populate_usersinvitation'),
]
operations: list[object... | 0 | 0 | 2 | 0 | 2 | 0 |
backend/db/query_parser.py | xuantan/viewfinder | 645 | 1737987 | <reponame>xuantan/viewfinder
# Copyright 2011 Viewfinder Inc. All Rights Reserved.
"""Parses query expressions into hierarchical query trees.
Given a data schema (defined via schema.py), you can create Query objects
and execute them against a database client. For example, with table 'User'
and columns 'given_name' an... | 0 | 0 | 0 | 0 | 0 | 0 |
seldom/cli.py | defnngj/pyse | 250 | 1738004 | from __future__ import annotations
import os
import sys
import ssl
import argparse
from seldom.logging import log
from seldom.har2case.core import HarParser
from webdriver_manager.firefox import GeckoDriverManager
from webdriver_manager.microsoft import IEDriverManager
from webdriver_manager.microsoft import EdgeChromi... | 2 | 2 | 0 | 0 | 4 | 0 |
tools/projects_sort.py | Intellinium/DAPLink | 1,354 | 1738015 | <gh_stars>1000+
#!/usr/bin/env python
#
# DAPLink Interface Firmware
# Copyright (c) 2009-2021, Arm Limited, All Rights Reserved
# Copyright (c) 2021 <NAME>
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | 0 | 0 | 0 | 0 | 0 | 0 |
pipeline/python/ion/plugin/__init__.py | konradotto/TS | 125 | 1738016 | # Copyright (C) 2012 Ion Torrent Systems, Inc. All Rights Reserved
__version__ = "3.0"
""" These values are imported directly into plugin implementation classes via
>>> from ion.plugin import *
"""
from ion.plugin.base import IonPlugin
from ion.plugin.constants import *
from ion.plugin.commands import *
from ion... | 0 | 0 | 0 | 0 | 0 | 0 |
goturn_single/tracker/tracker_trainer.py | NicoleWang/tracker_goturn | 228 | 1738032 | # Date: Sunday 23 July 2017
# Email: <EMAIL>
# Name: Nrupatunga
# Description: tracker trainer
from ..helper import config
class tracker_trainer:
"""tracker trainer class"""
def __init__(self, example_generator, regressor_train, logger):
"""TODO: to be defined. """
self.example_generator_ =... | 0 | 0 | 0 | 9 | 9 | 0 |
xautodl/trade_models/quant_transformer.py | Joey61Liuyi/AutoDL-Projects | 817 | 1738047 | <filename>xautodl/trade_models/quant_transformer.py
##################################################
# Copyright (c) <NAME> [GitHub D-X-Y], 2021 #
##################################################
from __future__ import division
from __future__ import print_function
import os, math, random
from collections import O... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/libs/rlottie/lv_example_rlottie_1.py | MakerAsia/lvgl | 3,531 | 1738057 | <reponame>MakerAsia/lvgl<filename>examples/libs/rlottie/lv_example_rlottie_1.py<gh_stars>1000+
#!/opt/bin/lv_micropython -i
import lvgl as lv
import display_driver
#
# Load a lottie animation from flash
#
from lv_example_rlottie_approve import lv_example_rlottie_approve
lottie = lv.rlottie_create_from_raw(lv.scr_act()... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/python/keras/distribute/multi_worker_training_state.py | MathMachado/tensorflow | 848 | 1738082 | <reponame>MathMachado/tensorflow
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | 0 | 0 | 0 | 0 | 0 | 0 |
paddlex/cv/nets/hrnet.py | yaoshanliang/PaddleX | 3,655 | 1738085 | # Copyright (c) 2020 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... | 32 | 15 | 0 | 4 | 51 | 0 |
importer/migrations/0010_auto_20180920_2013.py | juliecentofanti172/juliecentofanti.github.io | 134 | 1738108 | # Generated by Django 2.0.8 on 2018-09-20 20:13
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [("importer", "0009_convert_project_text_to_keys")]
operations: list[object] = [
migrations.AlterFie... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/particle/test_particle.py | scikit-hep/particle | 106 | 1738137 | <gh_stars>100-1000
# Copyright (c) 2018-2021, <NAME> and <NAME>.
#
# Distributed under the 3-clause BSD license, see accompanying file LICENSE
# or https://github.com/scikit-hep/particle for details.
import pytest
from hepunits import meter, second
from pytest import approx
from particle import data
from particle.pa... | 0 | 0 | 0 | 0 | 0 | 0 |
django_js_reverse/tests/unit_tests.py | thread/django-js-reverse | 492 | 1738146 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import io
import json
import os
import re
import subprocess
import sys
import unittest
import tempfile
import contextlib
import shutil
import six
import django
from django.conf import settings
from django.core.exceptions import Impr... | 0 | 6 | 0 | 0 | 6 | 0 |
src/lib_ext/webrtc/webrtc/api/api.gyp | saurabhshri/CCAligner | 139 | 1738171 | # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project au... | 0 | 0 | 0 | 0 | 0 | 0 |
tony-examples/linearregression-mxnet/tony_mxnet_submit.py | ashahab/TonY | 645 | 1738209 | #!/bin/python2
import os
import datetime
import shutil
import tempfile
import re
import time
import logging
logging.basicConfig(format='%(process)d-%(levelname)s-%(message)s', level=logging.INFO)
full_path=os.path.realpath(__file__)
base_dir = os.path.dirname( os.path.abspath(__file__) )
cwd=os.getcwd()
now=dateti... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/aio/base_execution_context.py | xolve/azure-sdk-for-python | 2,728 | 1738236 | <reponame>xolve/azure-sdk-for-python<filename>sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/aio/base_execution_context.py
# The MIT License (MIT)
# Copyright (c) 2021 Microsoft Corporation
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documen... | 0 | 0 | 0 | 0 | 0 | 0 |
imperative/python/test/unit/core/test_util.py | Olalaye/MegEngine | 5,168 | 1738262 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS,... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/__init__.py | moovy2/azure-sdk-for-python | 2,728 | 1738263 | <reponame>moovy2/azure-sdk-for-python
# 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) A... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/MoveTests/BehaviourTests/run_behaviour_tests.py | noellee/flint | 138 | 1738265 | #!/usr/bin/env python3
from __future__ import annotations
import re
from pathlib import Path
from typing import NamedTuple, Optional, List, Iterable
import subprocess, os, sys, shutil
from contextlib import contextmanager
import json
class CompilationError(Exception): ...
class FlintCompilationError(CompilationError)... | 8 | 10 | 10 | 0 | 28 | 0 |
tests/contrib/test_mobile.py | jeanmask/opps | 159 | 1738276 | from django.test import TestCase
from django.test.client import RequestFactory
from opps.contrib.mobile import template
from opps.contrib.mobile.middleware import (
MobileDetectionMiddleware, MobileRedirectMiddleware
)
class TestMobileTemplatesDir(TestCase):
def setUp(self):
self.detection_middlewar... | 0 | 0 | 0 | 0 | 0 | 0 |
pymc/blocking.py | MarcoGorelli/pymc | 5,476 | 1738292 | <reponame>MarcoGorelli/pymc<filename>pymc/blocking.py
# Copyright 2020 The PyMC Developers
#
# 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/LIC... | 0 | 0 | 0 | 0 | 0 | 0 |
09_multiprocessing/prime_validation/primes.py | siddheshmhatre/high_performance_python | 698 | 1738298 | <gh_stars>100-1000
import math
import timeit
def check_prime(n):
if n % 2 == 0:
return False
from_i = 3
to_i = math.sqrt(n) + 1
for i in xrange(from_i, int(to_i), 2):
if n % i == 0:
return False
return True
if __name__ == "__main__":
for label, nbr in [("trivial n... | 0 | 0 | 0 | 0 | 0 | 0 |
pypi_server/db/__init__.py | jayvdb/pypi-server | 119 | 1738323 | <filename>pypi_server/db/__init__.py
# encoding: utf-8
import logging
import os
from playhouse.signals import Model as SignalsModel
from slimurl import URL
from peewee import Proxy, SqliteDatabase, MySQLDatabase, PostgresqlDatabase
from playhouse.migrate import SqliteMigrator, MySQLMigrator, PostgresqlMigrator
DB = Pr... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/email/mime/message.py | shawwn/cpython | 52,316 | 1738324 | # Copyright (C) 2001-2006 Python Software Foundation
# Author: <NAME>
# Contact: <EMAIL>
from __future__ import annotations
"""Class representing message/* MIME documents."""
__all__ = ['MIMEMessage']
from email import message
from email.mime.nonmultipart import MIMENonMultipart
class MIMEMessage(MIMENonMultipar... | 2 | 0 | 0 | 0 | 2 | 0 |
tests/components/iotawatt/__init__.py | MrDelik/core | 30,023 | 1738332 | <gh_stars>1000+
"""Tests for the IoTaWatt integration."""
from iotawattpy.sensor import Sensor
INPUT_SENSOR = Sensor(
channel="1",
base_name="My Sensor",
suffix=None,
io_type="Input",
unit="Watts",
value=23,
begin="",
mac_addr="mock-mac",
)
OUTPUT_SENSOR = Sensor(
channel="N/A",
... | 0 | 0 | 0 | 0 | 0 | 0 |
lldb/test/API/lang/cpp/static_members/TestCPPStaticMembers.py | mkinsner/llvm | 2,338 | 1738336 | <reponame>mkinsner/llvm
"""
Tests that C++ member and static variables have correct layout and scope.
"""
import unittest2
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestCase(TestBase):
mydir = TestBase.compute_mydir(__fi... | 0 | 0 | 0 | 0 | 0 | 0 |
awxkit/awxkit/api/pages/roles.py | DamoR25/awxnew | 11,396 | 1738341 | from __future__ import annotations
import logging
from awxkit.api.resources import resources
from . import base
from . import page
log = logging.getLogger(__name__)
class Role(base.Base):
NATURAL_KEY: tuple[str] = ('name',)
def get_natural_key(self, cache: object | None=None) -> object | None:
i... | 1 | 1 | 1 | 0 | 3 | 0 |
audioBook/downloader.py | takhello/spider_collection | 106 | 1738345 | import time
import requests
import parsel
import re
import os
from ThreadPool import ThreadPool
class Downloader(object):
base_url: str = "https://www.ishuyin.com/"
def __init__(self, id):
self.search_url="https://www.ishuyin.com/show-{id}.html".format(id=id)
self.mp3_url_list: list[object... | 0 | 1 | 1 | 6 | 8 | 0 |
django_informixdb/__init__.py | AcckiyGerman/django_informixdb | 1,236 | 1738351 | <reponame>AcckiyGerman/django_informixdb
__version__ = '1.3.3'
| 0 | 0 | 0 | 0 | 0 | 0 |
aiogram/utils/emoji.py | andrew-ld/aiogram | 2,744 | 1738357 | <reponame>andrew-ld/aiogram
try:
import emoji
except ImportError:
raise ImportError('Need install "emoji" module.')
def emojize(text):
return emoji.emojize(text, use_aliases=True)
def demojize(text):
return emoji.demojize(text)
| 0 | 0 | 0 | 0 | 0 | 0 |
Python/Numpy/Mean, Var, and Std/Solution.py | PawarAditi/HackerRank | 219 | 1738363 | <gh_stars>100-1000
import numpy as np
np.set_printoptions(legacy='1.13')
n, m = map(int, input().split())
array = np.array([input().split() for _ in range(n)], int)
print(np.mean(array, axis=1), np.var(array, axis=0), np.std(array), sep = '\n') | 0 | 0 | 0 | 0 | 0 | 0 |
fitparse/base.py | mt5555/python-fitparse | 548 | 1738373 | <filename>fitparse/base.py
#!/usr/bin/env python
import io
import os
import struct
import warnings
# Python 2 compat
try:
num_types = (int, float, long)
except NameError:
num_types = (int, float)
from fitparse.processors import FitFileDataProcessor
from fitparse.profile import FIELD_TYPE_TIMESTAMP, MESSAGE_T... | 0 | 0 | 0 | 0 | 0 | 0 |
annif/util.py | issa-project/Annif | 121 | 1738380 | from __future__ import annotations
"""Utility functions for Annif"""
import glob
import os
import os.path
import tempfile
import numpy as np
from annif import logger
from annif.suggestion import VectorSuggestionResult
def atomic_save(obj, dirname, filename, method: object | None=None):
"""Save the given object (... | 1 | 6 | 0 | 0 | 7 | 0 |
app/grandchallenge/core/templatetags/bleach.py | njmhendrix/grand-challenge.org | 101 | 1738385 | from typing import Union
import bleach
from django import template
from django.conf import settings
from django.utils.safestring import mark_safe
from markdown import markdown as render_markdown
from grandchallenge.core.utils.markdown import LinkBlankTargetExtension
register = template.Library()
@register.filter
d... | 3 | 2 | 0 | 0 | 5 | 0 |
trove/guestagent/strategies/replication/mysql_gtid.py | hlesesne/trove | 244 | 1738387 | <reponame>hlesesne/trove
# Copyright 2014 Tesora, 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
#... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/mmrotate/rotated-detection_sdk_dynamic.py | grimoire/mmdeploy | 746 | 1738388 | <reponame>grimoire/mmdeploy
_base_ = ['./rotated-detection_static.py', '../_base_/backends/sdk.py']
codebase_config = dict(model_type='sdk')
backend_config = dict(pipeline=[
dict(type='LoadImageFromFile'),
dict(type='Collect', keys=['img'], meta_keys=['filename', 'ori_shape'])
])
| 0 | 0 | 0 | 0 | 0 | 0 |
osh/builtin_process.py | pdebelak/oil | 2,209 | 1738392 | #!/usr/bin/env python2
from __future__ import annotations
"""
builtin_process.py - Builtins that deal with processes or modify process state.
This is sort of the opposite of builtin_pure.py.
"""
from __future__ import print_function
import signal # for calculating numbers
from _devbuild.gen import arg_types
from _d... | 0 | 12 | 0 | 0 | 12 | 0 |
notebooks/utils/models/model.py | wenjiew/openvino_notebooks | 1,031 | 1738399 | from __future__ import annotations
"""
Copyright (C) 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | 1 | 2 | 0 | 0 | 3 | 0 |
src/verifai/simulators/webots/client_webots.py | BehaviorPredictionTestingPlatform/VerifAI | 109 | 1738401 | from verifai.client import Client
class ClientWebots(Client):
def __init__(self, simulation_data):
port = simulation_data.port
bufsize = simulation_data.bufsize
super().__init__(port, bufsize)
self.task = simulation_data.task
def simulate(self, sample) -> object:
retur... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/st/ops/gpu/test_local_response_norm_op.py | PowerOlive/mindspore | 3,200 | 1738416 | <reponame>PowerOlive/mindspore<filename>tests/st/ops/gpu/test_local_response_norm_op.py
# Copyright 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:... | 0 | 0 | 0 | 0 | 0 | 0 |
windows/winproxy/apis/iphlpapi.py | IMULMUL/PythonForWindows | 479 | 1738422 | from __future__ import annotations
import ctypes
import windows.generated_def as gdef
from ..apiproxy import ApiProxy, NeededParameter
from ..error import succeed_on_zero
class IphlpapiProxy(ApiProxy):
APIDLL: str = "iphlpapi"
default_error_check = staticmethod(succeed_on_zero)
@IphlpapiProxy()
def SetTcpEn... | 6 | 6 | 1 | 0 | 13 | 0 |
userbot/utils/chrome.py | SonicXsap/Man-Userbot | 144 | 1738440 | # Copyright (C) 2020 <NAME>
#
# SPDX-License-Identifier: GPL-3.0-or-later
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... | 1 | 2 | 0 | 0 | 3 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.