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
tools/fidl/difl/comparator.py
wwjiang007/fuchsia-1
210
169420
# Copyright 2019 The Fuchsia 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 difl.ir import * import typing __all__ = ['Comparator'] class Comparator: def __init__(self): self.identifier_shapes_match: typing.Dict[s...
8
4
2
4
18
0
yabgp/tests/unit/message/attribute/test_aggregator.py
mengjunyi/yabgp
203
169443
# Copyright 2015 Cisco Systems, 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 requi...
0
0
0
0
0
0
AutotestWebD/all_urls/LittleToolUrl.py
yangjourney/sosotest
422
169544
<filename>AutotestWebD/all_urls/LittleToolUrl.py from django.conf.urls import url from apps.littletool.views import tool urlpatterns = [ #add page url(r'^littletool/jsoncn$', tool.jsoncn, name="LITTLETOOL_jsoncn"), ]
0
0
0
0
0
0
cloudmarker/events/azkvkeynoexpiryevent.py
TinLe/cloudmarker
208
169556
<reponame>TinLe/cloudmarker<gh_stars>100-1000 """Microsoft Azure Key Vault key expiry event. This module defines the :class:`AzKVKeyNoExpiryEvent` class that identifies Key Vault active (enabled) keys without expiry set. This plugin works on the Key Vault key properties found in the ``ext`` bucket of ``key_vault_key``...
0
0
0
0
0
0
tests/test_eval_metrics.py
IntheGrass/citeomatic_learning
162
169574
<filename>tests/test_eval_metrics.py import unittest from citeomatic.eval_metrics import precision_recall_f1_at_ks, average_results class TestEvalMetrics(unittest.TestCase): def test_precision_recall_f1_at_ks(self): gold_y = ['1', '2', '3'] pred_y = ['1', '4', '3'] scores_y = [1.0, 0.1, 0....
0
0
0
0
0
0
tests/test_port_utilities.py
ryan-lingle/node-launcher
249
169584
<reponame>ryan-lingle/node-launcher<filename>tests/test_port_utilities.py import pytest from node_launcher.port_utilities import is_port_in_use @pytest.fixture def used_port(): port = 8000 while port <= 65535: if is_port_in_use(port): return port port += 1 class TestBitcoinConfi...
0
0
0
0
0
0
leetcode.com/python/257_Binary_Tree_Paths.py
vansh-tiwari/coding-interview-gym
713
169587
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None from __future__ import annotations class Solution(object): def binaryTreePaths(self, root) -> object | str: """ :type root: TreeN...
0
1
0
0
1
0
lola/envs/matching_pennies.py
jleni/lola
125
169615
""" Matching pennies environment. """ import gym import numpy as np from gym.spaces import Discrete, Tuple from .common import OneHot class IteratedMatchingPennies(gym.Env): """ A two-agent vectorized environment for the Matching Pennies game. """ NAME: str = 'IMP' NUM_AGENTS: int = 2 NUM_AC...
0
2
4
1
7
0
oslo/torch/nn/modules/lazy.py
lipovsek/oslo
249
169629
<reponame>lipovsek/oslo import itertools from torch.nn.parameter import is_lazy from torch.nn.modules.lazy import _LazyProtocol class LazyModuleMixin: cls_to_become = None def __init__(self: _LazyProtocol, *args, **kwargs): # Mypy doesn't like this super call in a mixin super().__init__(*args...
0
0
0
0
0
0
terrascript/provider/cyrilgdn/vault.py
mjuenema/python-terrascript
507
169662
# terrascript/provider/cyrilgdn/vault.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:30:00 UTC) import terrascript class vault(terrascript.Provider): """Terraform Vault provider""" __description__: str = "Terraform Vault provider" __namespace__: str = "cyrilgdn" __name__: str = "v...
0
0
7
0
7
0
libs/enjarify/enjarify/typeinference/typeinference.py
gitter-badger/TTDeDroid
2,989
169669
<reponame>gitter-badger/TTDeDroid<gh_stars>1000+ # Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICEN...
0
0
0
0
0
0
problems/min_stack.py
vinta/fuck-coding-interviews
590
169672
# coding: utf-8 """ https://leetcode.com/problems/min-stack/ """ class MinStack: def __init__(self): self.array: list[object] = [] def push(self, x: int) -> None: self.array.append(x) def pop(self) -> None: self.array.pop() def top(self) -> int: return self.array[-1]...
3
12
0
4
19
0
desktop/core/ext-py/nose-1.3.7/unit_tests/test_doctest_error_handling.py
kokosing/hue
5,079
169675
import os import sys import unittest from nose.config import Config from nose.plugins import doctests from mock import Bucket class TestDoctestErrorHandling(unittest.TestCase): def setUp(self): self._path = sys.path[:] here = os.path.dirname(__file__) testdir = os.path.join(here, 'support'...
0
0
0
0
0
0
FAP_tools/sdcc_example/compile.py
dekuNukem/FAP_Z80
505
169683
import os os.system("clear") print("\nassembling crt0...\n") if(os.system("sdasz80 -o crt0_fap.s") != 0): exit() print("\ncompiling hellofap.c...\n") # code-loc is where main() is, data-loc is where RAM starts if os.system("sdcc -mz80 --code-loc 0x200 --data-loc 0xc000 --no-std-crt0 crt0_fap.rel hellofap.c") != 0:...
0
0
0
0
0
0
Contents/Libraries/Shared/guessit/options.py
jippo015/Sub-Zero.bundle
1,553
169689
<gh_stars>1000+ #!/usr/bin/env python # -*- coding: utf-8 -*- """ Options """ import json import os import pkgutil import shlex from argparse import ArgumentParser import six def build_argument_parser(): """ Builds the argument parser :return: the argument parser :rtype: ArgumentParser """ op...
0
0
0
0
0
0
forge/blade/entity/entity.py
wwxFromTju/neural-mmo
1,450
169700
import numpy as np from forge.blade.action import action from forge.blade.systems import skill, droptable class Entity(): def __init__(self, pos): self.pos = pos self.alive: bool = True self.skills = skill.Skills() self.entityIndex: int = 0 self.health = -1 self.lastAttacker: No...
0
2
0
3
5
0
module/model.py
Oldpan/CoupletAI
108
169737
import torch import torch.nn as nn import torch.nn.functional as F class Transformer(nn.Module): def __init__(self, vocab_size: int, max_seq_len: int, embed_dim: int, hidden_dim: int, n_layer: int, n_head: int, ff_dim: int, embed_drop: float, hidden_drop: float): super().__init__() self.tok_embedd...
40
9
0
0
49
0
setup.py
xrmx/splunk-sdk-python
495
169760
#!/usr/bin/env python # # Copyright 2011-2015 Splunk, 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...
0
4
8
0
12
0
tests/ut/datavisual/data_transform/loader_generators/test_data_loader_generator.py
fapbatista/mindinsight
216
169764
# Copyright 2020 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 agreed to...
1
1
0
0
2
0
modules/nltk_contrib/scripttranscriber/tokens.py
h4ck3rm1k3/NLP-project
123
169797
# -*- 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 ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by applicable law or agreed to in writing...
3
24
0
12
39
0
robot-server/tests/sessions/router/test_commands_router.py
y3rsh/opentrons
235
169807
"""Tests for the /sessions/.../commands routes.""" import pytest from datetime import datetime from decoy import Decoy from opentrons.protocol_engine import ( CommandStatus, EngineStatus, commands as pe_commands, errors as pe_errors, ) from robot_server.errors import ApiError from robot_server.servic...
6
4
0
0
10
0
pyscf/pbc/tdscf/test/test_krhf_slow_gamma.py
QuESt-Calculator/pyscf
501
169828
import os from pyscf.pbc.gto import Cell from pyscf.pbc.scf import KRHF from pyscf.pbc.tdscf import KTDHF from pyscf.pbc.tdscf import krhf_slow_gamma as ktd import unittest from numpy import testing import numpy from test_common import retrieve_m, retrieve_m_hf, assert_vectors_close, tdhf_frozen_mask class DiamondT...
0
0
4
0
4
0
sane_tikz/core.py
negrinho/sane_tikz
274
169830
# -*- coding: utf-8 -*- from __future__ import annotations import math from copy import deepcopy # from pprint import pprint #### overview # - all angles in degrees unless stated otherwise. # - all dimensions in cm (even for line width). # cs = [x, y], vec = [start_cs, end_cs] # nice constants: golden_ratio = 1.6180...
45
108
0
0
153
0
exercises/practice/armstrong-numbers/.meta/example.py
tamireinhorn/python
1,177
169864
def is_armstrong_number(number) -> object: return sum(pow(int(digit), len(str(number))) for digit in str(number)) == number
0
1
0
0
1
0
Chapter05/2avazu_ctr.py
karim7262/Python-Machine-Learning-By-Example
106
169872
<reponame>karim7262/Python-Machine-Learning-By-Example import csv def read_ad_click_data(n, offset=0): X_dict, y = [], [] with open('train.csv', 'r') as csvfile: reader = csv.DictReader(csvfile) for i in range(offset): next(reader) i = 0 for row in reader: ...
0
0
0
0
0
0
utils/wfuzzbasicauthbrute/wfuzz/plugins/iterations.py
ismailbozkurt/kubebot
171
169890
from externals.moduleman.plugin import moduleman_plugin import itertools class piterator_void: text="void" def count(self): return self.__count def __init__(self, *i): self._dic = i self.__count = max(map(lambda x:x.count(), i)) self.it = self._dic[0] def next(self): return (self.it.next(),) ...
0
0
0
0
0
0
Examples/4.1.6 HA-Queue Declaration.py
wangyonghong/RabbitMQ-in-Depth
111
169896
<reponame>wangyonghong/RabbitMQ-in-Depth<gh_stars>100-1000 import rabbitpy connection = rabbitpy.Connection() try: with connection.channel() as channel: queue = rabbitpy.Queue(channel, 'my-ha-queue', arguments={'x-ha-policy': 'all'}) if ...
0
0
0
0
0
0
prediction/src/preprocess/errors.py
yasiriqbal1/concept-to-clinic-1
346
169921
class EmptyDicomSeriesException(Exception): """ Exception that is raised when the given folder does not contain dcm-files. """ def __init__(self, *args): if not args: args = ('The specified path does not contain dcm-files. Please ensure that ' 'the path points to...
0
0
0
0
0
0
mayan/apps/appearance/settings.py
eshbeata/open-paperless
2,743
169980
from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from smart_settings import Namespace from .literals import DEFAULT_MAXIMUM_TITLE_LENGTH namespace = Namespace(name='appearance', label=_('Appearance')) setting_max_title_length = namespace.add_setting( global_name='A...
0
0
0
0
0
0
sdk/python/pulumi_azure/mssql/virtual_machine.py
ScriptBox99/pulumi-azure
109
169996
# 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, Union, overload from .. import...
0
0
0
0
0
0
host/target_oneplus3t.py
leosol/firehorse
230
170048
# # firehrose # By <NAME> & <NAME>, Aleph Research # import target target.add_target(name="oneplus3t", arch=64, programmer_path=r"target/oneplus3t/prog_ufs_firehose_8996_ddr.elf", peekpoke_style=1, rawprogram_xml="target/oneplus3t/rawp...
0
0
0
0
0
0
dataset/__init__.py
kekayan/TabFormer
158
170053
<reponame>kekayan/TabFormer from .datacollator import TransDataCollatorForLanguageModeling
0
0
0
0
0
0
security_monkey/tests/auditors/test_resource_policy_auditor.py
boladmin/security_monkey
4,258
170074
from __future__ import annotations from security_monkey.tests import SecurityMonkeyTestCase from security_monkey.auditor import Entity from security_monkey.auditors.resource_policy_auditor import ResourcePolicyAuditor from security_monkey import db from security_monkey.watcher import ChangeItem from security_monkey.dat...
5
0
0
0
5
0
plugin.video.mrknow/host/cdapl.py
mrknow/filmkodi
105
170120
# -*- coding: utf-8 -*- from __future__ import annotations import urllib, urllib2, re, os, sys, math import xbmcgui, xbmc, xbmcaddon, xbmcplugin from urlparse import urlparse, parse_qs import urlparse from BeautifulSoup import BeautifulSoup import time, datetime import HTMLParser #todo: BeautifulSoup scriptID = 'plug...
11
6
0
0
17
0
parc/asm_tests/scripts/objdump2vmh.py
kevinyuan/pydgin
159
170125
#!/usr/bin/env python #=============================================================================== # objdump2vmh.py #=============================================================================== # # -h --help Display this message # -v --verbose Verbose mode # -f --file Objdump file to parse # # Author...
1
1
0
0
2
0
third_party/chromite/lib/classifier.py
zipated/src
2,151
170134
<gh_stars>1000+ # -*- coding: utf-8 -*- # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Simple log-based classification of build failures.""" from __future__ import print_function import datetime i...
0
0
0
0
0
0
scale/ingest/strike/monitors/dir_monitor.py
kaydoh/scale
121
170147
"""Defines a monitor that watches a file system directory for incoming files""" from __future__ import unicode_literals import logging import math import os import time from datetime import datetime from django.utils.timezone import now from ingest.models import Ingest from ingest.strike.monitors.exceptions import I...
0
0
0
0
0
0
insights/parsers/tests/test_sap_host_profile.py
lhuett/insights-core
121
170173
from insights.parsers import sap_host_profile, SkipException from insights.parsers.sap_host_profile import SAPHostProfile from insights.tests import context_wrap import doctest import pytest HOST_PROFILE_DOC = """ SAPSYSTEMNAME = SAP SAPSYSTEM = 99 service/porttypes = SAPHostControl SAPOscol SAPCCMS DIR_LIBRARY = DIR_...
0
0
0
0
0
0
terrascript/resource/stobias123/orion.py
mjuenema/python-terrascript
507
170177
# terrascript/resource/stobias123/orion.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:24:05 UTC) import terrascript class orion_ip_address(terrascript.Resource): pass __all__ = [ "orion_ip_address", ]
0
0
0
0
0
0
observations/r/us_state_abbrev.py
hajime9652/observations
199
170189
<reponame>hajime9652/observations # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import csv import numpy as np import os import sys from observations.util import maybe_download_and_extract def us_state_abbrev(path): """Standard ...
0
0
0
0
0
0
sample/migrations/0004_howitworks_count.py
personalcomputer/drf-schema-adapter
140
170211
<reponame>personalcomputer/drf-schema-adapter # -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2018-04-27 11:39 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('sample', '0003_product_product_type'), ] ...
0
0
0
0
0
0
scripts/issue_watch.py
Jhsmit/awesome-panel
179
170236
<gh_stars>100-1000 import holoviews as hv import panel as pn import param from param import parameterized class testview(param.Parameterized): check_val = param.Integer(default=0) parameters = param.List(default=[]) def add_parameters(self, k): parameters = self.parameters for i in range(...
0
0
0
0
0
0
anomalib/utils/metrics/optimal_f1.py
openvinotoolkit/anomalib
689
170274
"""Implementation of Optimal F1 score based on TorchMetrics.""" import torch from torchmetrics import Metric, PrecisionRecallCurve class OptimalF1(Metric): """Optimal F1 Metric. Compute the optimal F1 score at the adaptive threshold, based on the F1 metric of the true labels and the predicted anomaly sco...
3
2
3
1
9
0
testcases/elichika_tests/syntax/With.py
vermashresth/chainer-compiler
116
170301
<gh_stars>100-1000 # coding: utf-8 import chainer from chainer_compiler.elichika.parser import flags class X(object): def __init__(self, a): self.a = a def __enter__(self): return self def __exit__(self, type, value, traceback): return False class Y(X): def __enter__(self): ...
0
0
0
0
0
0
certidude/api/utils/__init__.py
Korving-F/certidude
119
170320
class AuthorityHandler: def __init__(self, authority): self.authority = authority
0
0
0
0
0
0
eval_retrieve_store_imgs.py
KuangHaofei/video-contrastive-learning
123
170352
import numpy as np import os import csv import argparse import torchvision.transforms as transforms from PIL import Image def loading_ucf_lists() -> tuple[object, object]: dataset_root = "/home/ubuntu/data/ucf101" split = 'split_1' # data frame root dataset_frame_root = os.path.join(dataset_root, 'ra...
0
5
0
0
5
0
convert_weights/get_inception_weights.py
codestorm04/keras-inceptionV4
495
170360
import tensorflow as tf slim = tf.contrib.slim from helper_net.inception_v4 import * import pickle import numpy as np def get_weights(): checkpoint_file = '../checkpoints/inception_v4.ckpt' sess = tf.Session() arg_scope = inception_v4_arg_scope() input_tensor = tf.placeholder(tf.float32, (None, 299, 299, 3)) with...
0
0
0
0
0
0
tg/configurator/components/toscawidgets2.py
sergiobrr/tg2
812
170363
<reponame>sergiobrr/tg2<filename>tg/configurator/components/toscawidgets2.py # -*- coding: utf-8 -*- from tg.support.converters import asbool from ...configuration.utils import TGConfigError from ..base import (ConfigurationComponent, BeforeConfigConfigurationAction, AppReadyConfigurationAction) f...
0
0
0
0
0
0
applications/StructuralMechanicsApplication/python_scripts/postprocess_eigenvalues_process.py
lkusch/Kratos
778
170369
# Importing the Kratos Library import KratosMultiphysics import KratosMultiphysics.kratos_utilities as kratos_utils # Import applications import KratosMultiphysics.StructuralMechanicsApplication as KSM # Other imports import os def Factory(settings, Model) -> object: if(type(settings) != KratosMultiphysics.Param...
0
1
0
0
1
0
test/test_non_std_hash.py
neerajv18/SecureTea-Project
257
170375
<gh_stars>100-1000 # -*- coding: utf-8 -*- import unittest from securetea.lib.log_monitor.system_log.non_std_hash import NonStdHash from securetea.logger import SecureTeaLogger try: # if python 3.x.x from unittest.mock import patch except ImportError: # python 2.x.x from mock import patch class TestNonS...
0
0
0
0
0
0
dbaas/api/database_change_parameter.py
didindinn/database-as-a-service
303
170419
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from rest_framework import serializers from maintenance.models import DatabaseChangeParameter from api.maintenance_base import MaintennanceBaseApi class DatabaseChangeParameterSerializer(serializers.ModelSerializer): class Meta: ...
0
0
2
0
2
0
prob_mbrl/models/modules.py
mcgillmrl/prob_mbrl
108
170474
from __future__ import annotations import torch from torch import nn from torch.nn import Parameter jit_scripts = {} class StochasticModule(torch.nn.Module): def __init__(self, *args, **kwargs): super(StochasticModule, self).__init__(*args, **kwargs) class BDropout(StochasticModule): """ E...
26
12
0
1
39
0
jobsapp/migrations/0008_auto_20200810_1925.py
rishiparekh/Job-Portal
348
170489
<reponame>rishiparekh/Job-Portal # Generated by Django 3.0.7 on 2020-08-10 19:25 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('accounts', '0002_auto_20190326_1754'), ('jobsapp', '0007_job_salary'), ] operations = [ migrations.AlterUni...
0
0
0
0
0
0
scripts/update_metadata_util.py
Louquinze/auto-sklearn
6,390
170500
<gh_stars>1000+ import numpy as np import openml classification_tasks = [ 232, 236, 241, 245, 253, 254, 256, 258, 260, 262, 267, 271, 273, 275, 279, 288, 336, 340, 2119, 2120, 2121, 2122, 2123, 2125, 2356, 3044, 3047, 3048, 3049, 3053, 3054, 3055, 75089, 75092, 75093, 75098, 75100, 75108, 75109, 75112, 75...
0
0
0
0
0
0
src/libs/execute_on_terminal.py
PranjalPansuriya/JavaScriptEnhancements
690
170506
import sublime, sublime_plugin import shlex, os from ..libs import util from ..libs import Terminal from ..libs import javaScriptEnhancements from ..libs.global_vars import * class JavascriptEnhancementsExecuteOnTerminalCommand(): custom_name: str = "" cli: str = "" path_cli: str = "" settings_name: str = "...
0
1
12
0
13
0
kqueen/storages/exceptions.py
LaudateCorpus1/kqueen
140
170507
<filename>kqueen/storages/exceptions.py class BackendError(Exception): pass class FieldError(Exception): pass
0
0
0
0
0
0
api-reference-examples/python/pytx/pytx/batch.py
b-bold/ThreatExchange
997
170509
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from __future__ import annotations import json from .access_token import get_access_token from .request import Broker from .vocabulary import Batch as b from .vocabulary import ThreatExchange as t from .errors import ( pytxFetchError ) class...
1
3
0
0
4
0
apidaora/options.py
SubjeBilisim/apidaora
120
170513
from typing import Callable, List from .header import Header from .method import MethodType from .responses import Response, no_content class AllowHeader(Header, type=str, http_name='allow'): ... def make_options_controller( methods: List[MethodType], ) -> Callable[[], Response]: def controller() -> Re...
1
2
0
0
3
0
python2/examples/autocompile.py
openEuler-BaseService/pyinotify
1,509
170580
<filename>python2/examples/autocompile.py #!/usr/bin/env python # # Usage: # ./autocompile.py path ext1,ext2,extn cmd # # Blocks monitoring |path| and its subdirectories for modifications on # files ending with suffix |extk|. Run |cmd| each time a modification # is detected. |cmd| is optional and defaults to 'make'. ...
0
0
0
0
0
0
src/deutschland/travelwarning/__init__.py
andreasbossard/deutschland
445
170601
# flake8: noqa """ Auswärtiges Amt OpenData Schnittstelle Dies ist die Beschreibung für die Schnittstelle zum Zugriff auf die Daten des [Auswärtigen Amtes](https://www.auswaertiges-amt.de/de/) im Rahmen der [OpenData](https://www.auswaertiges-amt.de/de/open-data-schnittstelle/736118) Initiative. ## Deaktivier...
0
0
0
0
0
0
tests/test_nn.py
KaiyuYue/torchshard
265
170674
import unittest import copy from typing import Optional, List, Callable, Tuple import torch import torch.nn as nn import torch.distributed as dist import torch.multiprocessing as mp import torch.nn.parallel as parallel from torch import Tensor import torchshard as ts from testing import dist_worker, assertEqual, set...
5
5
0
0
10
0
tests/test_code/py/chained/chained.py
FreddyZeng/code2flow
2,248
170675
class Chain(): def __init__(self, val): self.val = val def add(self, b) -> object: self.val += b return self def sub(self, b) -> object: self.val -= b return self def mul(self, b) -> object: self.val *= b return self print(Chain(5).add(5).sub(...
0
3
0
0
3
0
examples/pbc/35-range_separated_density_fit.py
umamibeef/pyscf
501
170678
#!/usr/bin/env python ''' The basic usage of range-separated Gaussian density fitting (RSGDF or simply RSDF), including choosing an auxiliary basis, initializing 3c integrals, saving and reading 3c integrals, jk build, ao2mo, etc is the same as that of the GDF module. Please refer to the following examples for details...
0
0
0
0
0
0
libcst/codemod/commands/remove_pyre_directive.py
jschavesr/LibCST
880
170775
<reponame>jschavesr/LibCST<filename>libcst/codemod/commands/remove_pyre_directive.py # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import re from abc import ABC from typing import Patte...
0
0
0
0
0
0
Minimum Adjustment Cost.py
RijuDasgupta9116/LintCode
321
170850
<reponame>RijuDasgupta9116/LintCode """ Given an integer array, adjust each integers so that the difference of every adjcent integers are not greater than a given number target. If the array before adjustment is A, the array after adjustment is B, you should minimize the sum of |A[i]-B[i]| Note You can assume each nu...
0
0
0
0
0
0
gluoncvth/models/__init__.py
cclauss/gluoncv-torch
495
170894
from . import model_zoo from .resnet import * from .fcn import * from .pspnet import * from .deeplab import *
0
0
0
0
0
0
aliyun-python-sdk-hbase/aliyunsdkhbase/request/v20190101/ModifyBackupPlanConfigRequest.py
yndu13/aliyun-openapi-python-sdk
1,001
170921
# 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...
0
5
0
0
5
0
adapters/bitron/__init__.py
russdan/domoticz-zigbee2mqtt-plugin
146
170923
<gh_stars>100-1000 from adapters.bitron.AV201032 import AV201032 from adapters.bitron.siren import BitronSirenAdapterWithBattery bitron_adapters = { 'AV2010/32': AV201032, # Bitron Wireless wall thermostat with relay '902010/29': BitronSirenAdapterWithBattery # Bitron Outdoor siren }
0
0
0
0
0
0
dizoo/minigrid/envs/test_minigrid_env.py
LuciusMos/DI-engine
464
170929
<filename>dizoo/minigrid/envs/test_minigrid_env.py import pytest import os import numpy as np from dizoo.minigrid.envs import MiniGridEnv from easydict import EasyDict import copy # The following two cfg can be tested through TestMiniGridAKTDTnv config = dict( env_id='MiniGrid-AKTDT-13x13-v0', flat_obs=True, )...
0
0
0
0
0
0
bigflow_python/python/bigflow/transform_impls/max.py
advancedxy/bigflow_python
1,236
170942
<reponame>advancedxy/bigflow_python # # Copyright (c) 2015 Baidu, 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
fabtools/tests/functional_tests/test_disk.py
timgates42/fabtools
308
170979
<gh_stars>100-1000 from fabric.api import puts, sudo from fabtools.require.files import directory as require_directory def test_list_partitions(): """ List disk partitions """ from fabtools.disk import partitions partitions = partitions() for pname, ptype in partitions.items(): puts...
0
0
0
0
0
0
python/ql/test/library-tests/web/client/stdlib/test.py
vadi2/codeql
4,036
170999
import sys PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 if PY2: from httplib import HTTPConnection, HTTPSConnection if PY3: from http.client import HTTPConnection, HTTPSConnection def basic(): conn = HTTPConnection('example.com') conn.request('GET', '/path') def indirect_caller(): ...
0
0
0
0
0
0
notebook/matplotlib_mplot3d.py
vhn0912/python-snippets
174
171004
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d from matplotlib import cm fig = plt.figure() ax = fig.add_subplot(111, projection='3d') x = y = np.arange(-15, 15, 0.5) X, Y = np.meshgrid(x, y) sigma = 4 Z = np.exp(-(X**2 + Y**2)/(2*sigma**2)) / (2*np.pi*sigma**2) ax.plot_s...
0
0
0
0
0
0
tests/unit/test_httperror.py
jaimegildesagredo/finch
118
171017
# -*- coding: utf-8 -*- try: from http.client import responses except ImportError: from httplib import responses from hamcrest import * from finch import errors class TestHTTPError(object): def test_when_404_then_message_is_not_found(self): http_error = errors.HTTPError(404) assert_tha...
0
0
0
0
0
0
test/unit/pipelines/test_pipeline_tuning.py
rozlana-g/FEDOT
358
171037
import os from random import seed import numpy as np from hyperopt import hp, tpe, rand import pytest from sklearn.metrics import mean_squared_error as mse, roc_auc_score as roc from fedot.core.data.data import InputData from fedot.core.data.data_split import train_test_data_setup from fedot.core.pipelines.node impor...
0
7
0
0
7
0
tests/arrow/partitioned_test.py
sethvargo/vaex
337
171050
from pathlib import Path import shutil import glob import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pyarrow.dataset import vaex path = Path(__file__).parent.parent data_path = path / 'data' countries = ['US', 'US', 'NL', 'FR', 'NL', 'NL'] years = [2020, 2021, 2020, 2020, 2019, 2020] val...
0
0
0
0
0
0
275 H-Index II.py
ChiFire/legend_LeetCode
872
171060
<gh_stars>100-1000 """ Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? """ __author__ = 'Daniel' class Solution(object): def hIndex(self, A): """ Given sorted -> binary search From linear search into bin search :ty...
0
0
0
0
0
0
codigo/Live14/lock_1.py
cassiasamp/live-de-python
572
171081
from threading import Thread, Lock c = 0 lock = Lock() def count_300(): global c lock.acquire() try: while c < 30000: c += 1 print(c) finally: lock.release() def count_10000(): global c x = 340 while c < 100000: c += 1 print(c) t_0 = Thr...
0
0
0
0
0
0
crypto_tracker/crypto.py
sonalimahajan12/Automation-scripts
496
171099
<reponame>sonalimahajan12/Automation-scripts import requests import sys def get_prices(): # Checking there is a coin passed if len(sys.argv) > 1: coins = sys.argv[1:] else: # Default coins coins = ["BTC", "ETH", "XRP", "LTC", "BCH", "ADA", "DOT", "LINK", "BNB", "X...
0
0
0
0
0
0
pyprof/prof/utility.py
alejandromolinaml/PyProf
402
171102
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2020, NVIDIA CORPORATION. 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/li...
0
5
0
0
5
0
aioprocessing/managers.py
maratsarbasov/aioprocessing
517
171106
from __future__ import annotations import asyncio from multiprocessing.util import register_after_fork from queue import Queue from threading import ( Barrier, BoundedSemaphore, Condition, Event, Lock, RLock, Semaphore, ) from aioprocessing.locks import _ContextManager from .executor import...
2
9
7
1
19
0
modules/dbnd/src/dbnd/_core/utils/platform/osx_compatible/requests_in_forked_process.py
ipattarapong/dbnd
224
171163
<gh_stars>100-1000 import os from sys import platform as _platform is_osx = False if _platform == "darwin": is_osx = True def enable_osx_forked_request_calls(): if not is_osx: return from dbnd._core.configuration.dbnd_config import config if not config.getboolean("core", "fix_env_on_osx")...
0
0
0
0
0
0
exchangelib/services/send_notification.py
RossK1/exchangelib
1,006
171165
<gh_stars>1000+ from .common import EWSService from ..properties import Notification from ..util import MNS class SendNotification(EWSService): """MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/sendnotification This is not an actual EWS service you can call. We only us...
0
0
0
0
0
0
pywsl/utils/comcalc.py
t-sakai-kure/PNU-Classification
101
171169
<reponame>t-sakai-kure/PNU-Classification<gh_stars>100-1000 """ Common calculation. """ import numpy as np #import check def cv_index(n, n_fold): index = (np.arange(n, dtype=np.int)*n_fold)//n return index[np.random.permutation(n)] def squared_dist(x, c): # assert x.shape[1] == c.shape[1], "Dimension ...
0
0
0
0
0
0
mmdet2trt/models/detectors/__init__.py
tehkillerbee/mmdetection-to-tensorrt
496
171199
from .single_stage import SingleStageDetectorWraper from .two_stage import TwoStageDetectorWraper __all__ = ['SingleStageDetectorWraper', 'TwoStageDetectorWraper']
0
0
0
0
0
0
docs/conf.py
hidmic/timemory
284
171225
<gh_stars>100-1000 # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If ex...
0
0
0
0
0
0
tests/conftest.py
otherJL0/tmuxp
1,615
171226
import getpass import logging import os import pathlib import pytest from libtmux import exc from libtmux.server import Server from libtmux.test import TEST_SESSION_PREFIX, get_test_session_name, namer logger = logging.getLogger(__name__) @pytest.fixture(autouse=True, scope="session") def home_path(tmp_path_factor...
3
5
0
0
8
0
Python/Algorithm/SameConditional.py
piovezan/SOpt
148
171251
<reponame>piovezan/SOpt if m > 1: b = 'metros equivalem' else: b = 'metro equivale' #https://pt.stackoverflow.com/q/413280/101
0
0
0
0
0
0
GreedyInfoMax/audio/models/encoder.py
weiaicunzai/pytorch-faster-rcnn
288
171288
<gh_stars>100-1000 import torch.nn as nn class Encoder(nn.Module): def __init__(self, input_dim, hidden, kernel_sizes, strides, padding): super(Encoder, self).__init__() self.hidden = hidden assert ( len(kernel_sizes) == len(strides) == len(padding) ), "Inconsistent s...
0
0
0
0
0
0
tests/test_0000_test_suite.py
korantu/lona
230
171300
def test_test_suite(): assert True
0
0
0
0
0
0
oandapyV20-examples-master/src/concurrent_stream.py
cdibble2011/OANDA
127
171334
# -*- coding: utf-8 -*- """Concurrent streams and account polling using gevent. demonstrates usage of oandapyV20: - streaming prices - streaming events - account polling - restart of a greenlet in case of an exception For gevent details check: http://sdiehl.github.io/gevent-tutorial/ For REST-API V20 check: http://de...
4
0
0
0
4
0
pyzmq/run_test.py
nikicc/anaconda-recipes
130
171360
import zmq.backend.cython._device import zmq.backend.cython._poll import zmq.backend.cython._version import zmq.backend.cython.constants import zmq.backend.cython.context import zmq.backend.cython.error import zmq.backend.cython.message import zmq.backend.cython.socket import zmq.backend.cython.utils import zmq.devices...
0
0
0
0
0
0
python/44_shortest_path/dijkstra.py
shipan3452/algo
22,028
171398
#!/usr/bin/python # -*- coding: UTF-8 -*- from typing import List, Generator import heapq class Graph: def __init__(self, vertex_count: int) -> None: self.adj = [[] for _ in range(vertex_count)] def add_edge(self, s: int, t: int, w: int) -> None: edge = Edge(s, t, w) self.adj[s].appe...
16
15
0
1
32
0
claripy/frontends/__init__.py
embg/claripy
211
171406
from .light_frontend import LightFrontend from .full_frontend import FullFrontend from .hybrid_frontend import HybridFrontend from .composite_frontend import CompositeFrontend from .replacement_frontend import ReplacementFrontend
0
0
0
0
0
0
tools/seahub-admin.py
MJochim/seahub
420
171410
#!/usr/bin/env python # encoding: utf-8 # Copyright (c) 2012-2016 Seafile Ltd. import sqlite3 import os import sys import time import hashlib import getpass # Get .ccnet directory from argument or user input if len(sys.argv) >= 2: ccnet_dir = sys.argv[1] else: home_dir = os.path.join(os.path.expanduser('~...
0
0
0
0
0
0
python/lib/Lib/site-packages/django/contrib/admindocs/tests/fields.py
truthiswill/intellij-community
790
171429
from django.db import models class CustomField(models.Field): description: str = "A custom field type" class DescriptionLackingField(models.Field): pass
0
0
1
0
1
0
tests/contrib/test_nltk_with_sklearn.py
lsuarez98/autogoal
157
171432
from autogoal.contrib import find_classes from autogoal.kb import ( algorithm, Sentence, Seq, Word, Stem, build_pipeline_graph, Supervised, Label, ) from autogoal.grammar import generate_cfg, Symbol class Algorithm: def __init__( self, tokenizer: algorithm(Sentence,...
3
1
0
0
4
0
src/japronto/pipeline/__init__.py
kzh3ka/japronto
9,472
171446
class Pipeline: def __init__(self, ready): self._queue: list[object] = [] self._ready = ready @property def empty(self) -> object: return not self._queue def queue(self, task): print("queued") self._queue.append(task) task.add_done_callback(self._task_...
0
2
0
1
3
0
src/molecule/text.py
gardar/molecule
1,599
171561
<filename>src/molecule/text.py """Text utils.""" import re def camelize(string): """Format string as camel-case.""" # NOTE(retr0h): Taken from jpvanhal/inflection # https://github.com/jpvanhal/inflection return re.sub(r"(?:^|_)(.)", lambda m: m.group(1).upper(), string) def chomp(text: str) -> str: ...
0
0
0
0
0
0
mmrazor/models/builder.py
hunto/mmrazor
553
171571
<filename>mmrazor/models/builder.py # Copyright (c) OpenMMLab. All rights reserved. from mmcv.cnn import MODELS as MMCV_MODELS from mmcv.utils import Registry MODELS = Registry('models', parent=MMCV_MODELS) ALGORITHMS = MODELS MUTABLES = MODELS DISTILLERS = MODELS LOSSES = MODELS OPS = MODELS PRUNERS = MODELS QUANTIZ...
0
0
0
0
0
0