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 |
|---|---|---|---|---|---|---|---|---|---|---|
deps/pybind11/tests/test_smart_ptr.py | Mistobaan/coremltools | 11,356 | 129720 | <filename>deps/pybind11/tests/test_smart_ptr.py
import pytest
from pybind11_tests import ConstructorStats
def test_smart_ptr(capture):
# Object1
from pybind11_tests import (MyObject1, make_object_1, make_object_2,
print_object_1, print_object_2, print_object_3, print_object_4)
... | 0 | 0 | 0 | 0 | 0 | 0 |
django-rest-framework-fast/characters/migrations/0001_squashed_0003_auto_20190416_1625.py | mervatkheir/kite-python-blog-post-code | 238 | 129751 | # Generated by Django 2.2 on 2019-04-16 19:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial: bool = True
dependencies: list[object] = [
]
operations: list[object] = [
migrations.CreateModel(
name='Line',... | 0 | 0 | 3 | 0 | 3 | 0 |
funboost/utils/dependency_packages/mongomq/utils.py | DJMIN/funboost | 333 | 129767 | <filename>funboost/utils/dependency_packages/mongomq/utils.py
def enum(name, *sequential, **named):
values = dict(zip(sequential, range(len(sequential))), **named)
# NOTE: Yes, we *really* want to cast using str() here.
# On Python 2 type() requires a byte string (which is str() on Python 2).
# On Pyth... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/rest/test_rest.py | edmont/ot-br-posix | 174 | 129779 | <reponame>edmont/ot-br-posix
#!/usr/bin/env python3
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must re... | 0 | 0 | 0 | 0 | 0 | 0 |
gpytorch/functions/matern_covariance.py | llguo95/gpytorch | 2,673 | 129784 | <gh_stars>1000+
import math
import torch
class MaternCovariance(torch.autograd.Function):
@staticmethod
def forward(ctx, x1, x2, lengthscale, nu, dist_func):
if any(ctx.needs_input_grad[:2]):
raise RuntimeError("MaternCovariance cannot compute gradients with " "respect to x1 and x2")
... | 0 | 0 | 0 | 0 | 0 | 0 |
geopyspark/geotrellis/protobuf/extentMessages_pb2.py | geotrellis/geotrellis-python | 182 | 129792 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: extentMessages.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/variance_reduction.py | JannikWirtz/importance-sampling-diagnostics | 289 | 129802 | #!/usr/bin/env python
#
# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/
# Written by <NAME> <<EMAIL>>
#
import argparse
import os
from os import path
from keras import backend as K
from keras.losses import get as get_loss
from keras.utils.generic_utils import Progbar
import numpy as np
from impor... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/python/pulumi_aws/outposts/get_sites.py | alexbowers/pulumi-aws | 260 | 129803 | # 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! ***
from __future__ import annotations
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Seque... | 3 | 4 | 0 | 0 | 7 | 0 |
openmdao/utils/file_wrap.py | friedenhe/OpenMDAO | 451 | 129809 | <filename>openmdao/utils/file_wrap.py
"""
A collection of utilities for file wrapping.
Note: This is a work in progress.
"""
import re
from pyparsing import CaselessLiteral, Combine, OneOrMore, Optional, \
TokenConverter, Word, nums, oneOf, printables, ParserElement, alphanums
import numpy as np
def _getform... | 0 | 0 | 0 | 0 | 0 | 0 |
rplugin/python3/ultest/models/result.py | jpserra/vim-ultest | 313 | 129815 | <reponame>jpserra/vim-ultest<filename>rplugin/python3/ultest/models/result.py
import json
from dataclasses import asdict, dataclass
@dataclass
class Result:
id: str
file: str
code: int
output: str
def __str__(self):
props = self.dict()
return json.dumps(props)
def dict(self)... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/gis_tests/geogapp/models.py | ni-ning/django | 61,676 | 129819 | <gh_stars>1000+
from django.contrib.gis.db import models
class NamedModel(models.Model):
name = models.CharField(max_length=30)
class Meta:
abstract = True
def __str__(self):
return self.name
class City(NamedModel):
point = models.PointField(geography=True)
class Meta:
... | 0 | 0 | 0 | 0 | 0 | 0 |
networkx/algorithms/centrality/voterank_alg.py | jebogaert/networkx | 10,024 | 129832 | from __future__ import annotations
"""Algorithm to select influential nodes in a graph using VoteRank."""
__all__ = ["voterank"]
def voterank(G, number_of_nodes: object | None=None) -> object:
"""Select a list of influential nodes in a graph using VoteRank algorithm
VoteRank [1]_ computes a ranking of the n... | 1 | 1 | 0 | 0 | 2 | 0 |
nlpaug/augmenter/audio/mask.py | techthiyanes/nlpaug | 3,121 | 129848 | from __future__ import annotations
"""
Augmenter that apply mask operation to audio.
"""
from nlpaug.augmenter.audio import AudioAugmenter
import nlpaug.model.audio as nma
from nlpaug.util import Action, WarningMessage
class MaskAug(AudioAugmenter):
"""
:param int sampling_rate: Sampling rate of input au... | 8 | 1 | 0 | 0 | 9 | 0 |
pymorphy2__examples/определение_комментариев_женщин/main.py | gil9red/SimplePyScripts | 117 | 129878 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# pip install nltk
import nltk
# pip install pymorphy2
import pymorphy2
# TODO: объединить функции is_ADJS_sing_* и is_VERB_sing_*,
# а проверку пола вынести в отдельую функцию
def is_ADJS_sing_femn(parsed: pymorphy2.analyzer.Parse) ->... | 6 | 6 | 0 | 0 | 12 | 0 |
sdk/python/pulumi_gcp/projects/iam_policy.py | la3mmchen/pulumi-gcp | 121 | 129888 | <filename>sdk/python/pulumi_gcp/projects/iam_policy.py<gh_stars>100-1000
# 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 typin... | 0 | 0 | 0 | 0 | 0 | 0 |
python/GafferImageTest/ImageReaderTest.py | ddesmond/gaffer | 561 | 129899 | ##########################################################################
#
# Copyright (c) 2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | 0 | 2 | 0 | 0 | 2 | 0 |
tensorflow/security/fuzzing/dataFormatVecPermute_fuzz.py | EricRemmerswaal/tensorflow | 190,993 | 129941 | # Copyright 2021 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
#
# Unless required by applica... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/demos/multi_page_basics/pages/outlook.py | ruxi/dash-labs | 110 | 129949 | import dash
dash.register_page(
__name__,
title="Forward Outlook",
description="This is the forward outlook", # should accept callable too
path="/forward-outlook",
image="birds.jpeg",
)
def layout() -> str:
return "Forward outlook"
| 0 | 1 | 0 | 0 | 1 | 0 |
tests/general_spinless_fermion_opstr_test.py | anton-buyskikh/QuSpin | 195 | 129994 | from __future__ import print_function, division
import sys,os
qspin_path = os.path.join(os.getcwd(),"../")
sys.path.insert(0,qspin_path)
from quspin.basis import spinless_fermion_basis_1d
from quspin.basis import spinless_fermion_basis_general
import numpy as np
from itertools import product
def check_ME(b1,b2,opstr... | 1 | 0 | 0 | 0 | 1 | 0 |
update/venv/lib/python3.9/site-packages/fontTools/__init__.py | Imudassir77/material-design-icons | 38,667 | 129996 | <reponame>Imudassir77/material-design-icons
import logging
from fontTools.misc.loggingTools import configLogger
log = logging.getLogger(__name__)
version = __version__ = "4.22.1"
__all__ = ["version", "log", "configLogger"]
| 0 | 0 | 0 | 0 | 0 | 0 |
benchmarks/proximal_gradient_benchmark.py | GeoffNN/jaxopt | 434 | 130002 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 12 | 11 | 0 | 0 | 23 | 0 |
tests/test_json_loader.py | sephiartlist/dynaconf | 2,293 | 130016 | <filename>tests/test_json_loader.py
import json
import pytest
from dynaconf import LazySettings
from dynaconf.loaders.json_loader import DynaconfEncoder
from dynaconf.loaders.json_loader import load
from dynaconf.strategies.filtering import PrefixFilter
settings = LazySettings(environments=True, ENV_FOR_DYNACONF="P... | 0 | 0 | 0 | 0 | 0 | 0 |
stream/clients/python/bookkeeper/common/future/_helpers.py | pkumar-singh/bookkeeper | 1,545 | 130022 | <reponame>pkumar-singh/bookkeeper
# 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 writin... | 0 | 0 | 0 | 0 | 0 | 0 |
deps/v8/tools/testrunner/objects/testcase.py | zeusdeux/node | 239 | 130029 | # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | 3 | 6 | 0 | 5 | 14 | 0 |
utils/android/adb_test_runner/main.py | lwhsu/swift | 72,551 | 130034 | # main.py - Push executables and run them on an Android device -*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt... | 0 | 3 | 0 | 0 | 3 | 0 |
src/ostorlab/agent/message/proto/v2/scan_pb2.py | bbhunter/ostorlab | 113 | 130036 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: v2/scan.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/hosts/migrations/Add_blank_in_host_team_URL.py | kaustubh-s1/EvalAI | 1,470 | 130038 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-01-10 18:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [("hosts", "0003_challengehostteam_team_url")]
operations: list[object] = [... | 0 | 0 | 2 | 0 | 2 | 0 |
tasks/language_model/chinese_bert.py | chinaliwenbo/ChineseBert | 298 | 130049 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@file : chinese_bert.py
@author: zijun
@contact : <EMAIL>
@date : 2021/7/5 11:22
@version: 1.0
@desc :
"""
import argparse
from datasets.bert_dataset import BertDataset
from models.modeling_glycebert import GlyceBertModel
def sentence_hidden():
# init args
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/k8s/conftest.py | pawelkopka/kopf | 1,038 | 130088 | import pytest
@pytest.fixture(autouse=True)
def _autouse_resp_mocker(resp_mocker, version_api):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
uldlib/cmd.py | SpiReCZ/ulozto-streamer | 120 | 130097 | <filename>uldlib/cmd.py
import argparse
import sys
import signal
from os import path
from uldlib import downloader, captcha, __version__, __path__
def run():
parser = argparse.ArgumentParser(
description='Download file from Uloz.to using multiple parallel downloads.',
formatter_class=argparse.Arg... | 0 | 0 | 0 | 0 | 0 | 0 |
python-modules/twisted/twisted/mail/smtp.py | stormtheh4ck3r/python-for-android | 267 | 130106 | <gh_stars>100-1000
# -*- test-case-name: twisted.mail.test.test_smtp -*-
# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Simple Mail Transfer Protocol implementation.
"""
import time, re, base64, types, socket, os, random, rfc822
import binascii
from email.base64MIME import encod... | 0 | 0 | 0 | 0 | 0 | 0 |
lambdas/shared/tests/test_preview.py | BearerPipelineTest/quilt | 1,115 | 130123 | """
Preview helper functions
"""
import os
import pathlib
from unittest import TestCase
from unittest.mock import patch
import pyarrow.parquet as pq
from py_w3c.validators.html.validator import HTMLValidator
from t4_lambda_shared.preview import (
extract_excel,
extract_fcs,
extract_parquet,
get_bytes,... | 1 | 1 | 0 | 0 | 2 | 0 |
tools/state_updates.py | pnbruckner/homeassistant-conf | 165 | 130125 | #!/usr/bin/env python3
from collections import OrderedDict
import re
import sys
try:
filename = sys.argv[1]
if '.' not in sys.argv[2]:
raise ValueError
except:
print('Usage: python3 {} filename (entity_id [attribute...])...'.format(sys.argv[0]))
sys.exit(1)
attrs = {}
entity_id = None
for ar... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter 4/restful_python_chapter_04_05/gamesapi/games/admin.py | Mohamed2011-bit/Building-RESTful-Python-Web-Services | 116 | 130133 | <gh_stars>100-1000
"""
Book: Building RESTful Python Web Services
Chapter 4: Throttling, Filtering, Testing and Deploying an API with Django
Author: <NAME> - Twitter.com/gastonhillar
Publisher: Packt Publishing Ltd. - http://www.packtpub.com
"""
from django.contrib import admin
# Register your models here.
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/operations/test_sshops.py | myungseokang/aws-elastic-beanstalk-cli | 110 | 130179 | <filename>tests/unit/operations/test_sshops.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/... | 0 | 0 | 0 | 0 | 0 | 0 |
python_utils/pycaffe_utils.py | xzabg/fast-adversarial | 520 | 130182 | # ---------------------------------------------------------
# Copyright (c) 2015, <NAME>
#
# Licensed under The MIT License [see LICENSE for details]
# ---------------------------------------------------------
import caffe, yaml
def net_surgery(net, json_file_or_dict):
# Load the JSON file
if isinstance(js... | 0 | 0 | 0 | 0 | 0 | 0 |
ipfshttpclient/filescanner.py | Eternity-labs/py-ipfs-http-client | 186 | 130215 | <reponame>Eternity-labs/py-ipfs-http-client
import abc
import collections.abc
import enum
import fnmatch
import os
import re
import sys
import types
import typing as ty
from . import utils
from .exceptions import MatcherSpecInvalidError
# PyCharm rejects typing.AnyStr and will flag all usages of an error,
# effective... | 0 | 0 | 0 | 0 | 0 | 0 |
src/app/test/metrics_test.py | ExpressHermes/beer-garden | 230 | 130253 | # -*- coding: utf-8 -*-
from datetime import datetime
from time import sleep
import pytest
from mock import Mock
import beer_garden.metrics as metrics
@pytest.fixture
def prometheus_mocks(monkeypatch):
# TODO - Test http api latency
# monkeypatch.setattr(metrics, "http_api_latency_total", Mock())
monkey... | 0 | 0 | 0 | 0 | 0 | 0 |
topicnet/cooking_machine/config_parser.py | bt2901/TopicNet | 123 | 130263 | from __future__ import annotations
"""
Parsing text file into Experiment instance using strictyaml
(github.com/crdoconnor/strictyaml/)
The aim here is to make config:
* possible to use even for non-programmers
* hard to misuse
* easy debuggable
Hence, the process of parsing config is a bit more complicated than
it co... | 6 | 16 | 0 | 0 | 22 | 0 |
argoverse/utils/heuristic_ground_removal.py | gargrohin/argoverse-api | 560 | 130270 | <reponame>gargrohin/argoverse-api<filename>argoverse/utils/heuristic_ground_removal.py<gh_stars>100-1000
# <Copyright 2019, Argo AI, LLC. Released under the MIT license.>
import math
from typing import List
import numpy as np
LIDAR_RANGE = 250
GRID_DIST = 0.4
HEIGHT_VARIANCE_THRESHOLD = 0.001
HEIGHT_MEAN_THRESHOLD = ... | 0 | 0 | 0 | 0 | 0 | 0 |
semantic_segmentation/configs/convnext/upernet_convnext_tiny_512_160k_ade20k_ss.py | ParikhKadam/ConvNeXt | 3,453 | 130271 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
_base_ = [
'../_base_/models/upernet_convnext.py', '../_base_/datasets/ade20k.py',
'../_base_/default_runtime.py... | 0 | 0 | 0 | 0 | 0 | 0 |
skfem/element/element_tri/element_tri_hermite.py | reverendbedford/scikit-fem | 238 | 130305 | <filename>skfem/element/element_tri/element_tri_hermite.py
import numpy as np
from ..element_global import ElementGlobal
from ...refdom import RefTri
class ElementTriHermite(ElementGlobal):
"""The Hermite element with 3 DOFs per vertex and one interior DOF."""
nodal_dofs = 3
interior_dofs = 1
maxdeg... | 0 | 0 | 0 | 0 | 0 | 0 |
test/unit/transform/__init__.py | Wheelspawn/pudl | 285 | 130314 | <gh_stars>100-1000
"""Unit tests for the pudl.transform subpackage."""
| 0 | 0 | 0 | 0 | 0 | 0 |
gaphor/core/modeling/tests/test_diagram.py | vanillajonathan/gaphor | 867 | 130329 | import gaphas
import pytest
from gaphor.core.modeling import Diagram, Presentation, StyleSheet
class Example(gaphas.Element, Presentation):
def __init__(self, diagram, id):
super().__init__(connections=diagram.connections, diagram=diagram, id=id)
def unlink(self):
self.test_unlinked = True
... | 0 | 2 | 0 | 1 | 3 | 0 |
sequence_folders.py | flamehaze1115/DPSNet | 217 | 130349 | <filename>sequence_folders.py
import torch.utils.data as data
import numpy as np
from scipy.misc import imread
from path import Path
import random
def load_as_float(path):
return imread(path).astype(np.float32)
class SequenceFolder(data.Dataset):
"""A sequence data loader where the files are arranged in this... | 0 | 0 | 0 | 0 | 0 | 0 |
gunicorn/arbiter.py | Bloomstack/gunicorn | 6,851 | 130378 | <reponame>Bloomstack/gunicorn
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import errno
import os
import random
import select
import signal
import sys
import time
import traceback
from gunicorn.errors import HaltServer, AppImportError
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/conftest.py | hugovk/tldextract | 1,200 | 130405 | <filename>tests/conftest.py<gh_stars>1000+
"""py.test standard config file."""
import logging
import pytest
import tldextract.cache
@pytest.fixture(autouse=True)
def reset_log_level():
"""Automatically reset log level verbosity between tests. Generally want
test output the Unix way: silence is golden."""
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_timekline.py | rayshifu/easyquotation | 3,630 | 130407 | # coding:utf8
import unittest
from unittest import mock
import easyquotation
class TestTimeklineQuotation(unittest.TestCase):
MOCK_RESPONSE_DATA: list[tuple[str, str]] = [
(
"000001",
'min_data="\\n\\\ndate:180413\\n\\\n0930 11.64 29727\\n\\\n0931 11.65 52410\\n\\\n";',
)
... | 0 | 0 | 1 | 0 | 1 | 0 |
recipes/Python/576556_Generating_random_numbers_arbitrary/recipe-576556.py | tdiprima/code | 2,023 | 130418 | from __future__ import annotations
import pylab
import numpy
class GeneralRandom:
"""This class enables us to generate random numbers with an arbitrary
distribution."""
def __init__(self, x = pylab.arange(-1.0, 1.0, .01), p: object | None = None, Nrl: int = 1000):
"""Initialize the lookup table (with def... | 5 | 1 | 0 | 0 | 6 | 0 |
emukit/benchmarking/loop_benchmarking/benchmark_result.py | ndalchau/emukit | 272 | 130453 | from typing import List
import numpy as np
class BenchmarkResult:
def __init__(self, loop_names: List[str], n_repeats: int, metric_names: List[str]):
"""
:param loop_names: List of loop names
:param n_repeats: Number of random restarts in benchmarking
:param metric_names: List of... | 9 | 2 | 0 | 1 | 12 | 0 |
tensorflow/python/kernel_tests/batch_dataset_op_test.py | ryorda/tensorflow-viennacl | 522 | 130515 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 0 | 4 | 0 | 0 | 4 | 0 |
venv/Lib/site-packages/nipype/utils/nipype_cmd.py | richung99/digitizePlots | 585 | 130516 | # -*- coding: utf-8 -*-
from __future__ import annotations
import os
import argparse
import inspect
import sys
from ..interfaces.base import Interface, InputMultiPath, traits
from ..interfaces.base.support import get_trait_desc
from .misc import str2bool
def listClasses(module: object | None=None):
if module:
... | 4 | 1 | 0 | 0 | 5 | 0 |
tests/models/data/horovod/__init__.py | neptune-ml/pytorch-lightning | 15,666 | 130517 | <filename>tests/models/data/horovod/__init__.py
# this is needed only for mypy==0.800 as it undestands only packages
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_redundant.py | pooya/disco | 786 | 130531 | from disco.core import result_iterator
from disco.error import DataError
from disco.test import TestCase, TestJob, FailedReply
class RedundantJob(TestJob):
@staticmethod
def map(e, params):
yield int(e), ''
@staticmethod
def reduce(iter, params):
yield sum(k for k, v in iter), ''
clas... | 0 | 1 | 0 | 0 | 1 | 0 |
datasets/csqa_new/extract_submission.py | gogowhy/ENet_framework | 244 | 130535 | <reponame>gogowhy/ENet_framework
import json
with open("test_rand_split.jsonl", 'r') as fw:
for line in open("test_rand_split.jsonl", 'r').readlines():
data = json.loads(line.strip())
print(data["id"]+','+data["answerKey"]) | 0 | 0 | 0 | 0 | 0 | 0 |
superset/reports/logs/api.py | razzius/superset | 18,621 | 130550 | # 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... | 7 | 4 | 8 | 0 | 19 | 0 |
convlab2/policy/hdsa/multiwoz/predictor.py | Malavikka/ConvLab-2 | 339 | 130551 | <reponame>Malavikka/ConvLab-2<gh_stars>100-1000
import os
import zipfile
import torch
from pytorch_pretrained_bert.file_utils import PYTORCH_PRETRAINED_BERT_CACHE
from pytorch_pretrained_bert.modeling import BertForSequenceClassification
from pytorch_pretrained_bert.tokenization import BertTokenizer
from convlab2.pol... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/domain_generalization/re_identification/baseline.py | neka-nat/Transfer-Learning-Library | 1,474 | 130556 | <reponame>neka-nat/Transfer-Learning-Library
"""
@author: <NAME>
@contact: <EMAIL>
"""
import random
import time
import warnings
import sys
import argparse
import shutil
import os.path as osp
import numpy as np
import torch
import torch.nn as nn
from torch.nn import DataParallel
import torch.backends.cudnn as cudnn
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
model/resnet34.py | FAHAI-1/tensorflow-cifar100 | 109 | 130561 | <reponame>FAHAI-1/tensorflow-cifar100<filename>model/resnet34.py
import tensorflow as tf
def identity_block2d(input_tensor, kernel_size, filters, stage, block, is_training, reuse, kernel_initializer=tf.contrib.layers.variance_scaling_initializer()):
filters1, filters2, filters3 = filters
conv_name_2 = 'conv' + str... | 0 | 0 | 0 | 0 | 0 | 0 |
data_managers/data_manager_homer_preparsed/data_manager/homer_genome_preparse.py | supernord/tools-iuc | 142 | 130586 | <gh_stars>100-1000
#!/usr/bin/env python
# <NAME> for bowtie2
# Modified by <NAME> for homer
from __future__ import print_function
import json
import optparse
import os
import subprocess
import sys
DEFAULT_DATA_TABLE_NAME = "homer_preparse"
def get_id_name(params, dbkey, fasta_description=None):
# TODO: ensure ... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/BasicLinearTransforms.py | thisisgopalmandal/opencv | 56,632 | 130592 | <reponame>thisisgopalmandal/opencv
from __future__ import print_function
from builtins import input
import cv2 as cv
import numpy as np
import argparse
# Read image given by user
## [basic-linear-transform-load]
parser = argparse.ArgumentParser(description='Code for Changing the contrast and brightness of an image! tu... | 0 | 0 | 0 | 0 | 0 | 0 |
pyairctrl/http_client.py | isvogor-foi/py-air-control | 203 | 130600 | <filename>pyairctrl/http_client.py
"""HTTP Client."""
# pylint: disable=invalid-name, missing-class-docstring, missing-function-docstring
import base64
import binascii
import configparser
import json
import os
import random
import socket
import urllib.request
import xml.etree.ElementTree as ET
from collections impor... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/multiline_textbox.py | pzahemszky/guizero | 320 | 130603 | from guizero import App, TextBox, PushButton, Text
def show():
output.value = textbox.value
app = App()
textbox = TextBox(app, multiline=True, height=10, width=50, scrollbar=True)
textbox.value = "hello\ngoodbye\nno way\nthis is a very long stream of text, very long indeed, the best long line of text, its super b... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/torch/test_extensions_build.py | GreenWaves-Technologies/nncf | 136 | 130619 | <filename>tests/torch/test_extensions_build.py
import os
import subprocess
import pytest
import pathlib
import shutil
import torch
from tests.common.helpers import TEST_ROOT
from tests.torch.helpers import Command
EXTENSIONS_BUILD_FILENAME = 'extensions_build_checks.py'
@pytest.mark.parametrize("venv_type, package... | 0 | 0 | 0 | 0 | 0 | 0 |
models/yolo_nano.py | RealNewNoob/yolo_nano | 295 | 130623 | <reponame>RealNewNoob/yolo_nano<gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
from .basic_layers import conv1x1, conv3x3, EP, PEP, FCA, YOLOLayer
from utils.stats import build_targets, to_cpu, non_max_suppression
class YOLONano(nn.Module):
def __init__(self, num_classes, im... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_core.py | victorvasil93/flask-ask | 2,028 | 130634 | # -*- coding: utf-8 -*-
import unittest
from aniso8601.timezone import UTCOffset, build_utcoffset
from flask_ask.core import Ask
from datetime import datetime, timedelta
from mock import patch, MagicMock
import json
class FakeRequest(object):
""" Fake out a Flask request for testing purposes for now """
hea... | 0 | 0 | 1 | 0 | 1 | 0 |
exampleapp/dinosaurs/apps.py | jupiterFierce31/A-simple-example-of-a-Django-REST-app-Angular2 | 163 | 130647 | <reponame>jupiterFierce31/A-simple-example-of-a-Django-REST-app-Angular2<filename>exampleapp/dinosaurs/apps.py
from django.apps import AppConfig
class DinosaursConfig(AppConfig):
name = 'dinosaurs'
| 0 | 0 | 0 | 0 | 0 | 0 |
section-04-research-and-development/preprocessors.py | karanvijaygit/DMLM | 477 | 130658 | from __future__ import annotations
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
class TemporalVariableTransformer(BaseEstimator, TransformerMixin):
# Temporal elapsed time transformer
def __init__(self, variables, reference_variable):
if not ... | 2 | 4 | 0 | 0 | 6 | 0 |
tests/pyconverter-test/cases/array_index_type.py | jaydeetay/pxt | 977 | 130704 | <reponame>jaydeetay/pxt
foo = [7]
i = foo[0]
testNamespace.numberArgument(i) | 0 | 0 | 0 | 0 | 0 | 0 |
floss/logging_.py | mandiant/flare-floss | 145 | 130715 | # Copyright (C) 2022 Mandiant, Inc. All Rights Reserved.
import logging
from enum import Enum
TRACE = logging.DEBUG - 1
setattr(logging, "TRACE", TRACE)
logging.addLevelName(TRACE, "TRACE")
class DebugLevel(int, Enum):
NONE: int = 0
DEFAULT: int = 1
TRACE: int = 2
SUPERTRACE: int = 3
GREY = "\x1b[... | 0 | 3 | 4 | 0 | 7 | 0 |
pororo/tasks/semantic_role_labeling.py | jayten42/pororo | 1,137 | 130758 | from __future__ import annotations
"""Semantic Role Labeling related modeling class"""
from copy import deepcopy
from typing import List, Optional
from pororo.tasks.utils.base import PororoFactoryBase, PororoSimpleBase
class PororoSrlFactory(PororoFactoryBase):
"""
Conduct semantic role labeling
Korean... | 10 | 7 | 0 | 1 | 18 | 0 |
quantities/constants/electron.py | 502E532E/python-quantities | 105 | 130765 | """
"""
from ._utils import _cd
from ..unitquantity import UnitConstant
e = elementary_charge = UnitConstant(
'elementary_charge',
_cd('elementary charge'),
symbol='e'
)
elementary_charge_over_h = UnitConstant(
'elementary_charge_over_h',
_cd('elementary charge over h'),
symbol='e/h'
)
Farada... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/phoenixdb-1.1.0/phoenixdb/sqlalchemy_phoenix.py | rohankumardubey/hue | 5,079 | 130776 | <filename>desktop/core/ext-py/phoenixdb-1.1.0/phoenixdb/sqlalchemy_phoenix.py
# Copyright 2017 <NAME>
#
# 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 |
venv/Lib/site-packages/statsmodels/tsa/statespace/tests/test_simulation_smoothing.py | EkremBayar/bayar | 6,931 | 130785 | from __future__ import annotations
"""
Tests for simulation smoothing
Author: <NAME>
License: Simplified-BSD
"""
import os
import numpy as np
from numpy.testing import assert_allclose, assert_equal
import pandas as pd
from statsmodels import datasets
from statsmodels.tsa.statespace import mlemodel, sarimax, structur... | 4 | 0 | 1 | 0 | 5 | 0 |
models/tf_Cifar_OC_NN_Models.py | chihyunsong/oc-nn | 203 | 130790 | <filename>models/tf_Cifar_OC_NN_Models.py
# USAGE
# python test_network.py --model dog_not_dog.model --image images/examples/dog_01.png
# import the necessary packages
import numpy as np
import tensorflow as tf
from keras import backend as K
import time
## Declare the scoring functions
g = lambda x : 1/(1 + tf.ex... | 0 | 0 | 0 | 0 | 0 | 0 |
ext/bookstructures.py | kawaken/typescript-guide | 456 | 130796 | <filename>ext/bookstructures.py
from docutils import nodes
from docutils.parsers.rst import Directive
from sphinx.locale import _
def frontmatter(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
return [nodes.raw(
'',
r"""
\include{tobira... | 0 | 0 | 0 | 0 | 0 | 0 |
pommerman/forward_model.py | aarunsrinivas/pommerman | 725 | 130807 | from __future__ import annotations
'''Module to manage and advanced game state'''
from collections import defaultdict
import numpy as np
from . import constants
from . import characters
from . import utility
class ForwardModel(object):
"""Class for helping with the [forward] modeling of the game state."""
... | 4 | 14 | 0 | 0 | 18 | 0 |
tests/snippets.py | pierogis/imageio-ffmpeg | 127 | 130811 | <reponame>pierogis/imageio-ffmpeg<gh_stars>100-1000
"""
Snippets of code that are hard to bring under test, but that can be
used to manually test the behavior of imageip-ffmpeg in certain
use-cases. Some may depend on imageio.
"""
# %% Write a series of large frames
# In earlier versions of imageio-ffmpeg, the ffmpe... | 0 | 0 | 0 | 0 | 0 | 0 |
axelrod/tests/strategies/test_gambler.py | nandhinianandj/Axelrod | 596 | 130818 | <filename>axelrod/tests/strategies/test_gambler.py
"""Test for the Gambler strategy. Most tests come from the LookerUp test suite.
"""
import copy
import unittest
import axelrod as axl
from axelrod.load_data_ import load_pso_tables
from axelrod.strategies.lookerup import create_lookup_table_keys
from .test_evolvable_... | 0 | 0 | 0 | 0 | 0 | 0 |
noxfile.py | jads-nl/intro-to-python | 614 | 130863 | <reponame>jads-nl/intro-to-python<filename>noxfile.py<gh_stars>100-1000
"""Configure nox as the task runner.
Nox provides the following tasks:
- "init-project": install the pre-commit hooks
- "doctests": run the xdoctests in the source files
- "fix-branch-references": adjusts links with git branch references in
v... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/clingo/tmode/tmode.py | potassco/gringo | 423 | 130864 | from __future__ import annotations
from sys import stdout, exit
from textwrap import dedent
from copy import copy
from clingo.application import Application
from clingo import SymbolType, Number, Function, ast, clingo_main
class TermTransformer(ast.Transformer):
def __init__(self, parameter):
self.paramet... | 0 | 10 | 0 | 5 | 15 | 0 |
linebot/async_http_client.py | naotokuwa/line-bot-sdk-python | 1,563 | 130893 | # -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 13 | 0 | 1 | 0 | 14 | 0 |
ignite/distributed/launcher.py | iamhardikat11/ignite | 4,119 | 130909 | <reponame>iamhardikat11/ignite<gh_stars>1000+
from typing import Any, Callable, Dict, Optional
from ignite.distributed import utils as idist
from ignite.utils import setup_logger
__all__ = [
"Parallel",
]
class Parallel:
"""Distributed launcher context manager to simplify distributed configuration setup for... | 0 | 0 | 0 | 0 | 0 | 0 |
frappe/desk/form/test_form.py | Don-Leopardo/frappe | 3,755 | 130922 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import frappe, unittest
from frappe.desk.form.linked_with import get_linked_docs, get_linked_doctypes
class TestForm(unittest.TestCase):
def test_linked_with(self):
results = get_linked_docs("Role", "System Manager", ... | 0 | 0 | 0 | 0 | 0 | 0 |
VMEncryption/test/test_disk_util.py | shridpant/azure-linux-extensions | 266 | 130949 | <gh_stars>100-1000
import unittest
import mock
from main.Common import CryptItem
from main.EncryptionEnvironment import EncryptionEnvironment
from main.DiskUtil import DiskUtil
from console_logger import ConsoleLogger
from test_utils import MockDistroPatcher
class TestDiskUtil(unittest.TestCase):
""" unit tests ... | 0 | 0 | 0 | 0 | 0 | 0 |
SohuNewCrawler/TK_News.py | wangbl11/ECommerceCrawlers | 3,469 | 130964 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__author__ = 'AJay'
__mtime__ = '2019/4/15 0015'
"""
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import time
import threading
from datetime import datetime
import tkinter as tk
import os
from db import MongoArticle,MongoUrl,MongoConfig
from multiprocessing impor... | 0 | 1 | 0 | 0 | 1 | 0 |
buildroot/utils/checkpackagelib/lib_mk.py | efficiosoft/hassos | 617 | 130982 | <reponame>efficiosoft/hassos
# See utils/checkpackagelib/readme.txt before editing this file.
# There are already dependency checks during the build, so below check
# functions don't need to check for things already checked by exploring the
# menu options using "make menuconfig" and by running "make" with appropriate
#... | 0 | 0 | 0 | 0 | 0 | 0 |
calendarserver/accesslog.py | backwardn/ccs-calendarserver | 462 | 130994 | ##
# Copyright (c) 2006-2017 Apple 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 l... | 1 | 14 | 1 | 8 | 24 | 0 |
examples/unfinished/flp_nonlinear.py | gasse/PySCIPOpt | 311 | 130998 | <reponame>gasse/PySCIPOpt
# todo
"""
flp_nonlinear.py: piecewise linear model for the capacitated facility location problem
minimize the total (weighted) travel cost from n customers to a
given set of facilities, with fixed costs and limited capacities;
costs are nonlinear (square root of the total quantity serviced
... | 0 | 0 | 0 | 0 | 0 | 0 |
compiler/rule_translate.py | RAbraham/logica | 1,434 | 131020 | #!/usr/bin/python
#
# Copyright 2020 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 ag... | 13 | 23 | 0 | 13 | 49 | 0 |
models.py | OpnTec/open-event-scraper | 1,946 | 131021 | class Track(object):
id: int = 0
header_line: int = 1
filename: str = ""
key_color: str = "#FF4D55"
name: str = ""
description: str = ""
track_image_url: str = "http://lorempixel.com/400/200"
location: str = ""
gid: str = ""
order = -1
def __init__(self, id, name, header_lin... | 0 | 0 | 15 | 1 | 16 | 0 |
django/CVE-2021-35042/web/vuln/apps.py | nobgr/vulhub | 9,681 | 131028 | <reponame>nobgr/vulhub<gh_stars>1000+
from django.apps import AppConfig
class VulnConfig(AppConfig):
name = 'vuln'
default_auto_field = 'django.db.models.BigAutoField'
| 0 | 0 | 0 | 0 | 0 | 0 |
pytorch/main.py | bangab/GMVAE | 177 | 131032 | """
---------------------------------------------------------------------
-- Author: <NAME>
---------------------------------------------------------------------
Main file to execute the model on the MNIST dataset
"""
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import argparse
import rando... | 1 | 1 | 0 | 0 | 2 | 0 |
tests/test_client.py | ysinjab/erppeek | 134 | 131043 | <filename>tests/test_client.py
# -*- coding: utf-8 -*-
import mock
from mock import call, sentinel, ANY
import erppeek
from ._common import XmlRpcTestCase, OBJ
AUTH = sentinel.AUTH
ID1, ID2 = 4001, 4002
STABLE = ['uninstallable', 'uninstalled', 'installed']
def _skip_test(test_case):
pass
class IdentDict(obje... | 0 | 0 | 0 | 0 | 0 | 0 |
.venv/lib/python3.8/site-packages/pandas/tests/series/methods/test_at_time.py | acrucetta/Chicago_COVI_WebApp | 115 | 131044 | <gh_stars>100-1000
from datetime import time
import numpy as np
import pytest
from pandas._libs.tslibs import timezones
from pandas import DataFrame, Series, date_range
import pandas._testing as tm
class TestAtTime:
@pytest.mark.parametrize("tzstr", ["US/Eastern", "dateutil/US/Eastern"])
def test_localized... | 0 | 0 | 0 | 0 | 0 | 0 |
e3nn/math/_linalg.py | ninarina12/e3nn | 385 | 131050 | <reponame>ninarina12/e3nn<gh_stars>100-1000
from typing import Tuple
import torch
def direct_sum(*matrices):
r"""Direct sum of matrices, put them in the diagonal
"""
front_indices = matrices[0].shape[:-2]
m = sum(x.size(-2) for x in matrices)
n = sum(x.size(-1) for x in matrices)
total_shape ... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/seg/_base_/models/deeplabv3_central_mnb4.py | OpenGVLab/gv-benchmark | 106 | 131053 | # model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='EncoderDecoder',
# pretrained='checkpoints/metanet-b4/det_fmtb4_v1.pth.tar',
backbone=dict(
type='Central_Model',
backbone_name='MTB4',
task_names=('gv_patch', 'gv_global'),
main_task_name... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/adapters/adapter/transports.py | timfjord/sublime_debugger | 225 | 131069 | <reponame>timfjord/sublime_debugger<filename>modules/adapters/adapter/transports.py
from __future__ import annotations
from ...typecheck import *
from ...import core
from ...dap import Transport
import socket
import os
import subprocess
import threading
class Process:
@staticmethod
async def check_output(command: ... | 0 | 0 | 0 | 0 | 0 | 0 |
funannotate/library.py | davised/funannotate | 199 | 131081 | # -*- coding: utf-8 -*-
from __future__ import annotations
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from Bio import BiopythonWarning
import os
import uuid
import io
import subprocess
import logging
import sys
import csv
import time
import re
import shu... | 62 | 192 | 3 | 1 | 258 | 0 |
Ch16/MRF.py | jason-168/MLCode | 146 | 131092 |
# Code from Chapter 16 of Machine Learning: An Algorithmic Perspective (2nd Edition)
# by <NAME> (http://stephenmonika.net)
# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# This code comes with no warranty... | 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.