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 |
|---|---|---|---|---|---|---|---|---|---|---|
alipay/aop/api/response/AlipayEbppPdeductSignConfirmResponse.py | antopen/alipay-sdk-python-all | 213 | 1799899 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayEbppPdeductSignConfirmResponse(AlipayResponse):
def __init__(self):
super(AlipayEbppPdeductSignConfirmResponse, self).__init__()
self._agreem... | 0 | 0 | 0 | 0 | 0 | 0 |
Packs/ExpanseV2/Scripts/ExpanseEnrichAttribution/ExpanseEnrichAttribution_test.py | diCagri/content | 799 | 1799932 | import demistomock as demisto # noqa
import ExpanseEnrichAttribution
CURRENT_IP = [
{"ip": "1.1.1.1", "attr1": "value1"},
{"ip": "8.8.8.8", "attr1": "value2"},
]
ENRICH_IP = [
{"ipaddress": "1.1.1.1", "provider": "Cloudflare", "ignored": "ignored-right"},
{"ipaddress": "8.8.8.4", "provider": "Googl... | 0 | 0 | 0 | 0 | 0 | 0 |
src/python/txtai/embeddings/documents.py | malywonsz/txtai | 1,893 | 1799971 | """
Documents module
"""
import os
import pickle
import tempfile
class Documents:
"""
Streams documents to temporary storage. Allows queuing large volumes of content for later indexing.
"""
def __init__(self):
"""
Creates a new documents stream.
"""
self.documents: N... | 0 | 2 | 0 | 3 | 5 | 0 |
octopus/platforms/EOS/cfg.py | SillyTin/octopus | 212 | 1799982 | from octopus.arch.wasm.cfg import WasmCFG
# Eos smart contract == wasm module
class EosCFG(WasmCFG):
def __init__(self, module_bytecode):
WasmCFG.__init__(self,
module_bytecode=module_bytecode)
def visualize_instrs_per_funcs(self, show: bool=True, save: bool=True,
... | 4 | 0 | 0 | 0 | 4 | 0 |
cli/tests/pcluster/aws/test_dynamo.py | maclema/aws-parallelcluster | 279 | 3200016 | # Copyright 2020 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/apache2.0/
#
# or in the "LICENSE.txt" file accom... | 0 | 1 | 0 | 0 | 1 | 0 |
get_pairs_name.py | nvxxu2i/coinnect | 167 | 3200025 | # This python3 script displays all pairs that can be used
# on Kraken, Poloniex and Bitstamp platform. The pairs can then be copied/pasted
# into Coinnect. This script does the conversion for Poloniex (see Pair doc).
import json
import ssl
import urllib.request
# ugly fix the ssl certificate bug
ssl._create_default_h... | 0 | 0 | 0 | 0 | 0 | 0 |
raw_packet/Tests/Unit_tests/Utils/test_base.py | Vladimir-Ivanov-Git/raw_packet | 146 | 3200040 | <gh_stars>100-1000
# region Description
"""
test_base.py: Unit tests for Raw-packet Base class
Author: <NAME>
License: MIT
Copyright 2020, Raw-packet Project
"""
# endregion
# region Import
from socket import AF_INET
from unittest import TestCase
from raw_packet.Utils.base import Base
from raw_packet.Tests.Unit_tests.... | 0 | 0 | 0 | 0 | 0 | 0 |
src/Utils/FilterUtil/__init__.py | QWERTSKIHACK/peniot | 143 | 3200062 | """
Filtering Utilities
It contains necessary functionalities used for filtering packets in several attacks
1) PyShark Filterer (used with Generic Sniffer)
""" | 0 | 0 | 0 | 0 | 0 | 0 |
entity/cards/LETL_027H/__init__.py | x014/lushi_script | 102 | 3200146 | <reponame>x014/lushi_script<gh_stars>100-1000
# -*- coding: utf-8 -*-
import entity.cards.LETL_027H.LETL_027P6
import entity.cards.LETL_027H.LETL_027P2
import entity.cards.LETL_027H.LETL_029P12
import entity.cards.LETL_027H.LETL_606
import entity.cards.LETL_027H.LETL_605
import entity.cards.LETL_027H.LETL_609
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/simple_binlog_stream_reader_wrapper_test.py | ywlianghang/mysql_streamer | 419 | 3200156 | # -*- coding: utf-8 -*-
# Copyright 2016 Yelp Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 0 | 1 | 0 | 0 | 1 | 0 |
NLP/NAACL2021-RocketQA/data_process/construct_marco_train_ce.py | zhangyimi/Research | 1,319 | 3200159 | <reponame>zhangyimi/Research<filename>NLP/NAACL2021-RocketQA/data_process/construct_marco_train_ce.py
import sys
import random
sys.path.append('data_process/')
import utils
recall_cands_file = sys.argv[1]
outfile = sys.argv[2]
random_seed = 111
rng = random.Random(random_seed)
neg_cnt = 4
q_text, p_text, p_title = ... | 0 | 0 | 0 | 0 | 0 | 0 |
astprocessor.py | somebody1234/Charcoal | 184 | 3200178 | from charcoaltoken import CharcoalToken as CT
from unicodegrammars import UnicodeGrammars
def PassThrough(r) -> object:
return r
def GetFreeVariable(s, n: int=1) -> object:
r = ""
for _ in range(n):
r += next(filter(lambda c: c not in s + r, "ικλμνξπρςστυφχψωαβγδεζηθ"))
return r
def Verbosif... | 1 | 4 | 0 | 0 | 5 | 0 |
toytree/TreeParser.py | smau8/toytree | 127 | 3200194 | <filename>toytree/TreeParser.py
#!/usr/bin/env python
"""
A newick/nexus file/string parser based on the ete3.parser.newick. Takes as
input a string or file that contains one or multiple lines that contain
newick strings. Lines that do not contain newick strings are ignored, unless
the #NEXUS is in the header in whi... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_divide.py | josemolinagarcia/maya-math-nodes | 148 | 3200213 | <filename>tests/test_divide.py
# Copyright (c) 2018 <NAME> et al. All rights reserved.
# Use of this source code is governed by an MIT license that can be found in the LICENSE file.
from node_test_case import NodeTestCase
class TestDivide(NodeTestCase):
def test_divide(self):
self.create_node('Divide', {'... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/specs/parsing/test_027_parsing_DataLoaderDescription.py | bfclarke/kipoi | 213 | 3200240 | """Test the parsing utilities for ArraySchema
"""
import os
import pytest
import six
from pytest import raises
from kipoi.specs import DataLoaderDescription, example_kwargs, RemoteFile
from related import from_yaml
# Class to test
CLS = DataLoaderDescription
# common header
inp_targ = """
"""
GOOD_EXAMPLES = ["""
ty... | 0 | 0 | 0 | 0 | 0 | 0 |
yefan/015/015.py | saurabh896/python-1 | 3,976 | 3200257 | # coding = utf-8
__author__ = 'Forec'
import xlwt
import re
book = xlwt.Workbook(encoding = 'utf-8',style_compression=0)
sheet = book.add_sheet('number',cell_overwrite_ok = True)
line = 0
info = re.compile(r'\[(\d+),\s+(\d+),\s+(\d+)\]')
with open(r'c:\python27\oneday_one\numbers.txt',"r") as f:
data = f... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter4/ch4_pairs_correlation_real_symbol.py | buiksat/Learn-Algorithmic-Trading | 449 | 3200288 | <reponame>buiksat/Learn-Algorithmic-Trading<gh_stars>100-1000
import numpy as np
import pandas as pd
from statsmodels.tsa.stattools import coint
import matplotlib.pyplot as plt
# Set a seed value to make the experience reproducible
np.random.seed(123)
import pandas as pd
pd.set_option('display.max_rows', 500)
pd.set_... | 0 | 0 | 0 | 0 | 0 | 0 |
financial_insights.py | hugochan/K-Competitive-Autoencoder-for-Text-Analytics | 133 | 3200303 | '''
Created on Apr, 2017
@author: hugo
'''
import numpy as np
def calc_ranks(x) -> object:
"""Given a list of items, return a list(in ndarray type) of ranks.
"""
n = len(x)
index = list(zip(*sorted(list(enumerate(x)), key=lambda d:d[1], reverse=True))[0])
rank = np.zeros(n)
rank[index] = ran... | 0 | 2 | 0 | 0 | 2 | 0 |
app/lib/notifications/instances/notification_subscription.py | grepleria/SnitchDNS | 152 | 3200323 | <gh_stars>100-1000
from app.lib.base.instance.base_instance import BaseInstance
import json
from json.decoder import JSONDecodeError
class NotificationSubscription(BaseInstance):
@property
def zone_id(self):
return self.item.zone_id
@zone_id.setter
def zone_id(self, value):
self.item.... | 0 | 0 | 0 | 0 | 0 | 0 |
tutorials/stock-wallet/microservices/wallet/tests/test_queries/test_services.py | bhardwajRahul/minos-python | 247 | 3200327 | import sys
import unittest
from src import (
WalletQueryService,
)
from tests.utils import (
build_dependency_injector,
)
class TestWalletQueryService(unittest.IsolatedAsyncioTestCase):
def setUp(self) -> None:
self.injector = build_dependency_injector()
async def asyncSetUp(self) -> None:
... | 0 | 3 | 0 | 0 | 3 | 0 |
test/regression/features/lambda/lambda_nested.py | ppelleti/berp | 137 | 3200358 | l = lambda x: lambda y: x + y
print(l(1)(2))
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/customer/test_forms.py | QueoLda/django-oscar | 4,639 | 3200376 | <reponame>QueoLda/django-oscar
from datetime import date, datetime
from unittest import mock
import pytz
from django.conf import settings
from django.core import mail
from django.core.exceptions import ValidationError
from django.test import TestCase, override_settings
from oscar.apps.customer.forms import (
Emai... | 0 | 0 | 0 | 0 | 0 | 0 |
lambda_toolkit/modules/conf.py | lucioveloso/lambda-toolkit | 136 | 3200394 | #!/usr/bin/env python
import lambda_toolkit.modules.logger as logger
from lambda_toolkit.modules.utils import Utils
import os
import json
import pkgutil
import boto3
from shutil import copytree
class Conf:
def __init__(self):
self.config_file = os.path.join(os.path.expanduser('~'), ".lambda-toolkit.json... | 0 | 3 | 0 | 0 | 3 | 0 |
src/api/test/test_collaborator_serializer.py | RogerTangos/datahub-stub | 192 | 3200400 | from mock import patch
from django.test import TestCase
from ..serializer import CollaboratorSerializer
class CollaboratorSerializerTests(TestCase):
"""Test RepoSerializer methods"""
def setUp(self):
self.username = "delete_me_username"
self.repo_base = "delete_me_repo_base"
self.pa... | 0 | 1 | 0 | 0 | 1 | 0 |
html_parsing/get_game_genres/parsers/spong_com.py | DazEB2/SimplePyScripts | 117 | 3200411 | <reponame>DazEB2/SimplePyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from typing import List
from base_parser import BaseParser
class SpongCom_Parser(BaseParser):
def _parse(self) -> List[str]:
url = f'https://spong.com/search/index.jsp?q={self.game_name}'
ro... | 0 | 0 | 0 | 0 | 0 | 0 |
index/src/main/scripts/DBpediaResource/types_freebase.py | david-oggier/dbpedia-spotlight | 158 | 3200420 | """
Reads in source files from DBpedia and Freebase and writes
type files (TSV) for DBpedia Spotlight.
$ python types_freebase.py page_ids_en.nt.bz2 wikipedia_links_en.nt.bz2 freebase-simple-topic-dump.tsv.bz2
"""
from collections import defaultdict
import sys, csv, bz2, re
import rdflib
import getopt
#Read comman... | 0 | 0 | 0 | 0 | 0 | 0 |
vivisect/impemu/platarch/msp430.py | rnui2k/vivisect | 716 | 3200436 | import envi.archs.msp430.emu as e_msp430e
import vivisect.impemu.emulator as v_i_emulator
class Msp430WorkspaceEmulator(v_i_emulator.WorkspaceEmulator, e_msp430e.Msp430Emulator):
taintregs = [ x for x in range(2, 16) ]
def __init__(self, vw, **kwargs):
'''
Please see the base emulator class i... | 0 | 0 | 0 | 0 | 0 | 0 |
ndb/memcache_client.py | ukrukarg/datastore-ndb-python | 119 | 3200447 | <gh_stars>100-1000
#
# Copyright 2017 The ndb 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 requi... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit_tests/strategies.py | OttoWinter/esphomeyaml | 249 | 3200480 | from typing import Text
import hypothesis.strategies._internal.core as st
from hypothesis.strategies._internal.strategies import SearchStrategy
@st.defines_strategy(force_reusable_values=True)
def mac_addr_strings() -> object:
# type: () -> SearchStrategy[Text]
"""A strategy for MAC address strings.
Thi... | 0 | 1 | 0 | 0 | 1 | 0 |
salesman/basket/utils.py | icvntechstudio/django-salesman | 222 | 3200481 | <reponame>icvntechstudio/django-salesman
from django.core.exceptions import ValidationError # noqa
def validate_basket_item(attrs: dict, context: dict = {}) -> dict:
"""
Default basket item validator function. Can be overrider by providing
a path to a function in ``SALESMAN_BASKET_ITEM_VALIDATOR`` settin... | 0 | 0 | 0 | 0 | 0 | 0 |
se/vendor/kindleunpack/mobi_cover.py | vr8hub/tools | 985 | 3200483 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
from __future__ import unicode_literals, division, absolute_import, print_function
from .compatibility_utils import unicode_str
from .unipath import pathof
import os
import imghdr
import struct
# note: ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/Player.py | Purukitto/muCLIar | 140 | 3200502 | <filename>src/Player.py
from ChromeDriver import create_driver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
from pyvirtualdisplay import Display
import os
import pickle
# TODO:
class Play... | 0 | 0 | 0 | 0 | 0 | 0 |
gce/survival-training/wrapper/train_test.py | Meghanath-Data/ml-on-gcp | 465 | 3200521 | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 0 | 0 | 0 | 0 | 0 | 0 |
libs/configs/MLT/gwd/cfgs_res50_mlt_v3.py | Artcs1/RotationDetection | 850 | 3200544 | <filename>libs/configs/MLT/gwd/cfgs_res50_mlt_v3.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import numpy as np
from libs.configs._base_.models.retinanet_r50_fpn import *
from libs.configs._base_.datasets.dota_detection import *
from libs.configs._base... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxr/tests/ShowMfibRouteSummary/cli/equal/golden_output3_expected.py | balmasea/genieparser | 204 | 3200550 | expected_output = {
'vrf':
{'vpn1':
{'no_g_routes': 5,
'no_sg_routes': 44
}
}
}
| 0 | 0 | 0 | 0 | 0 | 0 |
gcld3/tests/gcld3_test.py | amykhuang/cld3 | 529 | 3200571 | """Tests for gcld3."""
import gcld3
import unittest
class NnetLanguageIdentifierTest(unittest.TestCase):
def testLangIdentification(self):
detector = gcld3.NNetLanguageIdentifier(min_num_bytes=0, max_num_bytes=1000)
sample = "This text is written in English."
result = detector.FindLanguage(text=sample... | 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/provider/local.py | mjuenema/python-terrascript | 507 | 3200613 | # terrascript/provider/local.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:21:17 UTC)
#
# For imports without namespace, e.g.
#
# >>> import terrascript.provider.local
#
# instead of
#
# >>> import terrascript.provider.hashicorp.local
#
# This is only available for 'official' and 'partner' provi... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/app_manager/tests/test_id_strings.py | akashkj/commcare-hq | 471 | 3200633 | import doctest
from nose.tools import assert_equal
from corehq.apps.app_manager import id_strings
def test_doctests():
results = doctest.testmod(id_strings)
assert_equal(results.failed, 0)
| 0 | 0 | 0 | 0 | 0 | 0 |
utils/io_utils.py | mckinziebrandon/seq2seq_projects | 341 | 3200659 | <filename>utils/io_utils.py
"""Utilities for downloading data from various datasets, tokenizing, vocabularies."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import re
import sys
import yaml
import copy
import pandas as pd
import logging
impor... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/SwimmingDEMApplication/tests/tests_python_scripts/candelier_scripts/plot_error_vs_memory.py | lkusch/Kratos | 778 | 3200666 | import matplotlib.pyplot as plt
import math
import candelier.candelier_parameters as ch_pp
import candelier as ch
import DEM_explicit_solver_var as DEM_parameters
def Radius(a) -> object:
a_2 = [x ** 2 for x in a]
return math.sqrt(sum(a_2))
sim = ch.AnalyticSimulator(ch_pp)
coors = [None] * 3
sim.CalculatePo... | 0 | 1 | 0 | 0 | 1 | 0 |
teacherInfo/teacherInfo/pipelines.py | CareyRay/Python-Spider | 713 | 3200683 | <reponame>CareyRay/Python-Spider
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import json
import codecs
class TeacherinfoPipeline(object):
def __init__(self):
s... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_mss_clamp.py | yasics/vpp | 751 | 3200704 | #!/usr/bin/env python3
import unittest
from framework import VppTestCase, VppTestRunner
from scapy.layers.inet import IP, TCP
from scapy.layers.inet6 import IPv6
from scapy.layers.l2 import Ether
from scapy.packet import Raw
class TestMSSClamp(VppTestCase):
""" TCP MSS Clamping Test Case """
def setUp(sel... | 0 | 0 | 0 | 0 | 0 | 0 |
kuryr_kubernetes/cmd/sanity_checks.py | digitalsimboja/kuryr-kubernetes | 155 | 3200746 | # Copyright (c) 2021 OpenStack Foundation.
# 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... | 0 | 5 | 0 | 0 | 5 | 0 |
vaas-app/src/vaas/manager/admin.py | allegro/vaas | 251 | 3200768 | <filename>vaas-app/src/vaas/manager/admin.py<gh_stars>100-1000
import csv
from django.contrib import admin
from vaas.manager.models import Director, Backend, Probe, TimeProfile
from vaas.manager.forms import DirectorModelForm
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
environment.py | nakamoo/a3c_PredNet | 443 | 3200801 | <gh_stars>100-1000
class Environment(object):
"""RL learning environment
"""
@property
def state(self):
pass
@property
def reward(self):
pass
def receive_action(self, action):
pass
class EpisodicEnvironment(Environment):
def initialize(self):
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
dymos/transcriptions/explicit_shooting/test/explicit_benchmark.py | yonghoonlee/dymos | 104 | 3200810 | <filename>dymos/transcriptions/explicit_shooting/test/explicit_benchmark.py
import openmdao.api as om
import dymos as dm
from dymos.examples.brachistochrone.brachistochrone_ode import BrachistochroneODE
prob = om.Problem()
prob.driver = om.pyOptSparseDriver(optimizer='SLSQP')
tx = dm.transcriptions.ExplicitShootin... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/testing_config/custom_components/switch/test_legacy.py | domwillcode/home-assistant | 30,023 | 3200846 | """Test switch platform for test_embedded component."""
| 0 | 0 | 0 | 0 | 0 | 0 |
bin/aprint.py | secdec/ADAPT | 183 | 3200849 | <gh_stars>100-1000
#
# Automated Dynamic Application Penetration Testing (ADAPT)
#
# Copyright (C) 2018 Applied Visions - http://securedecisions.com
#
# Written by <NAME> - http://www.siegetechnologies.com/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/python/alerts_stateless/alerts.py | pvmsikrsna/wallaroo | 1,459 | 3200865 | <filename>examples/python/alerts_stateless/alerts.py
# Copyright 2017 The Wallaroo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/sqlIntro.py | PushpneetSingh/Hello-world | 1,428 | 3200897 | <filename>Python/sqlIntro.py
import sqlite3
import urllib.request
import ssl
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
conn = sqlite3.connect('emaildb.sqlite')
cur = conn.cursor()
# delete any table named Counts beforehand from the database
conn.execute('''DROP TAB... | 0 | 0 | 0 | 0 | 0 | 0 |
h2o-docs/src/booklets/v2_2015/source/DeepLearning_Vignette_code_examples/deeplearning_predict.py | ahmedengu/h2o-3 | 6,098 | 3200898 | <filename>h2o-docs/src/booklets/v2_2015/source/DeepLearning_Vignette_code_examples/deeplearning_predict.py
# Classify the test set (predict class labels)
# This also returns the probability for each class
pred = model.predict(test)
# Take a look at the predictions
pred.head()
| 0 | 0 | 0 | 0 | 0 | 0 |
eeauditor/auditors/aws/Amazon_APIGW_Auditor.py | kbhagi/ElectricEye | 442 | 3200906 | <gh_stars>100-1000
#This file is part of ElectricEye.
#SPDX-License-Identifier: Apache-2.0
#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 t... | 0 | 0 | 0 | 0 | 0 | 0 |
datasets/transforms.py | Pandinosaurus/pnn.pytorch | 222 | 3200912 | <reponame>Pandinosaurus/pnn.pytorch
# transforms.py
from __future__ import division
import math
import types
import torch
import utils
import random
import numbers
import numpy as np
import scipy as sp
from scipy import misc
from PIL import Image, ImageOps, ImageDraw
class Compose(object):
"""Composes several tra... | 0 | 0 | 0 | 0 | 0 | 0 |
perf_dashboard/regressions/views.py | silenceshell/tools | 264 | 3200940 | <filename>perf_dashboard/regressions/views.py
# Copyright Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/min_auto.py | cwwang15/neural_network_cracking | 196 | 3201021 | import sys
import argparse
import csv
import os
import collections
def guess_numbers(ifname) -> dict[object,object]:
with open(ifname, 'r') as ifile:
try:
return dict([(row[2], int(row[5])) for row in csv.reader(
ifile, delimiter='\t', quotechar=None)])
except ValueError... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/compatibilities/test_pandas.py | FrostByte266/neupy | 801 | 3201036 | import pandas as pd
from sklearn import datasets, preprocessing
from sklearn.model_selection import train_test_split
from neupy import algorithms, layers
from neupy.utils import asfloat
from neupy.algorithms.gd import objectives
from base import BaseTestCase
class PandasCompatibilityTestCase(BaseTestCase):
def ... | 0 | 0 | 0 | 0 | 0 | 0 |
hnswlib-pyspark/tests/test_knn_evaluator.py | chenjia123/hnswlib | 158 | 3201044 | <gh_stars>100-1000
# coding=utf-8
from pyspark_hnsw.evaluation import KnnSimilarityEvaluator
from pyspark.ml.linalg import Vectors
from pyspark.sql import SQLContext
from pyspark.sql.types import *
def test_evaluator(spark_context):
sql_context = SQLContext(spark_context)
neighbors_list_schema = ArrayType(... | 0 | 0 | 0 | 0 | 0 | 0 |
app/grandchallenge/blogs/migrations/0005_post_companies.py | nlessmann/grand-challenge.org | 101 | 3201084 | <reponame>nlessmann/grand-challenge.org
# Generated by Django 3.1.13 on 2021-08-24 11:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("products", "0007_projectairfiles"),
("blogs", "0004_auto_20210614_0734"),
]
operations = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
external-import/crowdstrike/src/crowdstrike/__init__.py | tiiibs/connectors | 132 | 3201149 | # -*- coding: utf-8 -*-
"""OpenCTI CrowdStrike connector module."""
from crowdstrike.core import CrowdStrike
__all__ = ["CrowdStrike"]
| 0 | 0 | 0 | 0 | 0 | 0 |
scripts/bleu_format_valid.py | isi-nlp/Zoph_RNN | 199 | 3201157 | <filename>scripts/bleu_format_valid.py
#pass the output of the kbest from the RNN toolkit into this to strip it of the extra padding
# The difference between this and bleu_format.py is that:
# 1. this script will take the refence file as input and generate an temp reference file which have the same lines with the for... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/strict/mod.py | Euromance/pycopy | 663 | 3201180 | print(__name__)
val = 1
def foo():
print("foo")
# This module is supposed to be imported, not run directly. But run-tests
# script will run it, so add dummy __main__() and corresponding .exp file.
def __main__():
print("Shouldn't run")
| 0 | 0 | 0 | 0 | 0 | 0 |
Medium/find-kth-largest-value-in-bst.py | SaumyaRai2010/algoexpert-data-structures-algorithms | 152 | 3201207 |
# FIND KTH LARGEST VALUE IN BST
# This is an input class. Do not edit.
class BST:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
# O(H + K) time and O(H) space
def findKthLargestValueInBst(tree, k):
# Write your code here.
... | 0 | 0 | 0 | 0 | 0 | 0 |
boxsdk/util/text_enum.py | takeontom/box-python-sdk | 367 | 3201208 | # coding: utf-8
from __future__ import absolute_import, unicode_literals
from enum import Enum
from six import text_type
class TextEnum(text_type, Enum):
def __repr__(self) -> object:
return self._value_ # pylint:disable=no-member
def __str__(self) -> object:
return str(self.value) # pylin... | 0 | 2 | 0 | 0 | 2 | 0 |
src/python/remoteTestServer.py | neoremind/luceneutil | 164 | 3201274 | import copy
import os
import codecs
import random
import time
import socket
import threading
import subprocess
import cPickle
import traceback
import sys
import signal
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
"""
One instance of this runs, per machine that will launch tests. This
instance spawns multiple sub-pr... | 0 | 0 | 0 | 0 | 0 | 0 |
pytorch/utils.py | VisualMine/PlaneNet | 372 | 3201290 | from __future__ import annotations
import numpy as np
import cv2
#MEAN_STD = [[0.29010095242892997, 0.32808144844279574, 0.28696394422942517], [0.1829540508368939, 0.18656561047509476, 0.18447508988480435]]
MEAN_STD = np.array([[0.5, 0.5, 0.5], [1, 1, 1]], dtype=np.float32)
MAX_DEPTH = 10
## Global color mapping
clas... | 1 | 11 | 0 | 0 | 12 | 0 |
stock_prediction_readme_generator.py | ngeorgieff/stock-prediction-deep-neural-learning | 145 | 3201294 | <filename>stock_prediction_readme_generator.py<gh_stars>100-1000
# Copyright 2020 <NAME>. 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 | 0 | 0 | 0 | 0 | 0 |
marrow/mailer/transport/ses.py | DanielOverdevest/mailer | 166 | 3201321 | <reponame>DanielOverdevest/mailer<gh_stars>100-1000
# encoding: utf-8
try:
import boto3
from botocore.exceptions import ClientError
except ImportError:
raise ImportError("You must install the boto3 package to deliver mail via Amazon SES.")
__all__ = ['AmazonTransport']
log = __import__('logging').getLo... | 0 | 0 | 0 | 0 | 0 | 0 |
release/scripts/freestyle/styles/apriori_and_causal_density.py | MarkC-b3d/blender-mc3d | 365 | 3201332 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | 0 | 0 | 0 | 0 | 0 | 0 |
src/lib/attacks/ddos/ddos.py | nahuelhm17/vault_scanner | 230 | 3201367 | #! /usr/bin/python
import random
from scapy.all import *
import threading
import socket
import sys
from urllib.parse import urlparse
import colors
import time
class DDoS(object):
def __init__(self, url, ip, start_port, end_port, dport, threads,
interval):
if url is not None and ip is n... | 0 | 3 | 0 | 4 | 7 | 0 |
citeomatic/models/options.py | IntheGrass/citeomatic_learning | 162 | 3201388 | import json
from citeomatic import file_util
from citeomatic.common import PAPER_EMBEDDING_MODEL, CITATION_RANKER_MODEL
from traitlets import Bool, HasTraits, Int, Unicode, Enum, Float
class ModelOptions(HasTraits):
# The type of candidate selector to use. Okapi BM25 (https://en.wikipedia.org/wiki/Okapi_BM25)
... | 0 | 3 | 4 | 0 | 7 | 0 |
tests/test_vtask.py | facebook/sparts | 220 | 3201427 | <filename>tests/test_vtask.py
# Copyright (c) 2014, Facebook, Inc. All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/appstore/__init__.py | dimagilg/commcare-hq | 471 | 3201453 | __author__ = 'spencertank'
| 0 | 0 | 0 | 0 | 0 | 0 |
addons/pythonscript_repl/python_repl.py | blueflamegames/godot-python | 1,323 | 3201460 | <gh_stars>1000+
import sys
import ctypes
from code import InteractiveConsole
from collections import deque
from threading import Thread, Lock, Event
from queue import SimpleQueue
from _godot import StdoutStderrCaptureToGodot, StdinCapture
from godot import exposed, export, ResourceLoader, VBoxContainer
from .plugin i... | 0 | 0 | 0 | 0 | 0 | 0 |
capcha_server.py | Loop6102/IchHoffeEsKlappt | 126 | 3201482 | <reponame>Loop6102/IchHoffeEsKlappt
import logging
import time
from flask import Flask
from amazoncaptcha import AmazonCaptcha
'''
------------------------------------------------------------------------
LOGGING - Initite logging for the Bot
------------------------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
ivy/test/typedot.py | b1f6c1c4/cfg-enum | 113 | 3201483 |
from ivy import ivy_module as im
from ivy.ivy_compiler import ivy_from_string
from ivy.tk_ui import new_ui
from ivy import ivy_utils as iu
prog = """#lang ivy1.5
object obj = {
type t
}
relation r(X:obj.t)
action a(x:obj.t) = {
local y:obj.t {
if some z:s. z = z {
y := y
}
}
}
type s
axiom forall X:s. ... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/db/test/notification_test.py | xuantan/viewfinder | 645 | 3201493 | # Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Tests for Notification & push notifications.
"""
__authors__ = ['<EMAIL> (<NAME>)',
'<EMAIL> (<NAME>)']
import time
from viewfinder.backend.base import util
from viewfinder.backend.base.testing import async_test
from viewfinder.backend.db.notif... | 0 | 0 | 0 | 0 | 0 | 0 |
Alignment/MillePedeAlignmentAlgorithm/python/mpsvalidate/geometrydata.py | ckamtsikis/cmssw | 852 | 3201542 | ##########################################################################
# Geometry data
##
class GeometryData:
""" Class which holds the geometry data of a ObjId
"""
def __init__(self, subdetid = 0, discriminator = ()):
self.subdetid = subdetid
self.discriminator = discriminator
# ObjI... | 0 | 0 | 0 | 0 | 0 | 1 |
homeassistant/components/garages_amsterdam/const.py | MrDelik/core | 30,023 | 3201561 | <gh_stars>1000+
"""Constants for the Garages Amsterdam integration."""
DOMAIN = "garages_amsterdam"
ATTRIBUTION = f'{"Data provided by municipality of Amsterdam"}'
| 0 | 0 | 0 | 0 | 0 | 0 |
galaxy/main/migrations/0134_update_contenttype.py | bmclaughlin/galaxy | 904 | 3201614 | <reponame>bmclaughlin/galaxy
# Generated by Django 2.1.7 on 2019-03-26 23:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0133_collection_tasks'),
]
operations = [
migrations.AlterField(
model_name='contenttype',
... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/tests/Rsd/Processor/Tools/TestDriver/TestCodeProcessor.py | little-blue/Surelog | 670 | 3201622 | # -*- coding: utf-8 -*-
import sys, re
class TestCodeProcessor:
LINE_TYPE_PSEUDO_OP: str = "P"
LINE_TYPE_OP: str = "O"
LINE_TYPE_LABEL: str = "L"
LINE_TYPE_COMMENT: str = "C"
class Op( object ):
CONDITION_STR_LIST: list[str] = [
"eq", "ne", "cs", "cc",
"mi", "... | 0 | 9 | 10 | 8 | 27 | 0 |
objectModel/Python/cdm/objectmodel/relationship_info.py | rt112000/CDM | 884 | 3201647 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from cdm.resolvedmodel import ResolvedTraitSet
class RelationshipInfo:
def __init_... | 0 | 0 | 0 | 0 | 0 | 0 |
api/util/drf_writable_nested/serializers.py | SolidStateGroup/Bullet-Train-API | 126 | 3201674 | from drf_writable_nested import NestedCreateMixin, NestedUpdateMixin
from rest_framework import serializers
class NestedUpdateMixinDeleteBeforeUpdate(NestedUpdateMixin):
"""
ref: https://github.com/beda-software/drf-writable-nested/issues/158
"""
def update(self, instance, validated_data) -> object:
... | 0 | 1 | 0 | 0 | 1 | 0 |
spectral/algorithms/algorithms.py | wwlswj/spectral | 398 | 3201681 | from __future__ import annotations
'''
Basic algorithms and data handling code.
'''
from __future__ import absolute_import, division, print_function, unicode_literals
import math
from numbers import Integral
import numpy as np
import pickle
import spectral as spy
from ..io.spyfile import SpyFile, TransformedImage
fr... | 29 | 49 | 0 | 5 | 83 | 0 |
python/cross_service/apigateway_websocket_chat/test/test_websocket_chat.py | iconara/aws-doc-sdk-examples | 5,166 | 3201686 | <reponame>iconara/aws-doc-sdk-examples
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Unit tests for websocket_chat.py.
"""
import boto3
from botocore.exceptions import ClientError
import pytest
from websocket_chat import ApiGatewayWebsocket
@pytest.m... | 0 | 0 | 0 | 0 | 0 | 0 |
rmgpy/rmg/test_data/restartTest/seed_no_filters/seed/reactions.py | tza0035/RMG-Py | 250 | 3201727 | <filename>rmgpy/rmg/test_data/restartTest/seed_no_filters/seed/reactions.py
#!/usr/bin/env python
# encoding: utf-8
name = "seed"
shortDesc = ""
longDesc = """
"""
autoGenerated=True
entry(
index = 0,
label = "H + H <=> H2",
degeneracy = 0.5,
duplicate = True,
kinetics = Arrhenius(A=(5.45e+10,'cm^... | 0 | 0 | 0 | 0 | 0 | 0 |
qa/rpc-tests/test_framework/bip64.py | coindroid42/chain2 | 515 | 3201745 | from __future__ import annotations
import struct
import copy
from test_framework.mininode import ser_vector, deser_vector, COutPoint, deser_uint256, deser_compact_size, CTxOut
class msg_getutxos(object):
command: bytes = b"getutxos"
def __init__(self, checkmempool: bool = False, outpoints: list[object] = []):... | 7 | 8 | 2 | 3 | 20 | 0 |
packages/pyright-internal/src/tests/samples/loops5.py | Jasha10/pyright | 3,934 | 3201750 | <reponame>Jasha10/pyright<filename>packages/pyright-internal/src/tests/samples/loops5.py<gh_stars>1000+
# This sample tests a case where a potential type alias
# ("a") is involved in a recursive type dependency
# ("a" depends on "test" which depends on "a").
# pyright: strict
test = {"key": "value"}
while True:
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/simple/grid_potential.py | rknop/amuse | 131 | 3201847 | <reponame>rknop/amuse<filename>examples/simple/grid_potential.py
# -*- coding: ascii -*-
from __future__ import print_function
from amuse.units import units, nbody_system
from amuse.datamodel import Particle
from amuse.community.athena.interface import Athena
from amuse.community.hermite.interface import Hermite
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
toolset/utils/popen.py | xsoheilalizadeh/FrameworkBenchmarks | 5,300 | 3201919 | from logging import error
from subprocess import Popen
from threading import Event
from threading import Thread
class PopenTimeout(Popen):
'''
Popen class with timeout for Python 2.7
see https://stackoverflow.com/questions/1191374/using-module-subprocess-with-timeout
'''
def __init__(self, *args, *... | 0 | 2 | 0 | 1 | 3 | 0 |
deep_dialog/agents/agent_lu_rl.py | ngduyanhece/KB-InfoBot | 184 | 3201920 | '''
'''
import lasagne
import theano
import lasagne.layers as L
import theano.tensor as T
import numpy as np
import sys
import time
from deep_dialog import dialog_config
from collections import Counter, defaultdict, deque
import random
import cPickle as pkl
EPS = 1e-10
def categorical_sample(probs, mode='sample')... | 0 | 0 | 0 | 0 | 0 | 0 |
golem/report/report.py | Sunil-Rathore/golem | 171 | 3201925 | <gh_stars>100-1000
import os
import shutil
from datetime import datetime, timedelta
from golem.core import test_directory
from golem.core.project import Project
from golem.report.execution_report import execution_report_path
from golem.core import utils
def get_last_execution_timestamps(projects=None, execution=None... | 0 | 0 | 0 | 0 | 0 | 0 |
2016/multiple-dispatch/python/multi_with_base_class_defaults.py | mikiec84/code-for-blog | 1,199 | 3201929 | # Variation of multi.py supporting base-class defaults.
#
# Tested with Python 3.4
#
# <NAME> [http://eli.thegreenplace.net]
# This code is in the public domain.
#
# This part is the multimethod "library".
#
import itertools
def all_subclasses(cls) -> object:
"""Returns a list of *all* subclasses of cls, recursi... | 0 | 5 | 0 | 1 | 6 | 0 |
resotoworker/resotoworker/__main__.py | someengineering/resoto | 126 | 3201942 | from functools import partial
import time
import os
import sys
import threading
import resotolib.proc
from typing import List, Dict
from .config import add_config
from resotolib.config import Config
from resotolib.logger import log, setup_logger, add_args as logging_add_args
from resotolib.jwt import add_args as jwt_ad... | 6 | 5 | 1 | 0 | 12 | 0 |
nscl/configs/common.py | K-A-R-T/DCL-Release | 343 | 3202002 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : common.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 09/29/2018
#
# This file is part of NSCL-PyTorch.
# Distributed under terms of the MIT license.
"""
Common configuration.
"""
from jacinle.utils.container import G
__all__ = ['make_base_configs']
cl... | 0 | 1 | 0 | 0 | 1 | 0 |
test_ngtf.py | avijit-chakroborty/ngraph-bridge | 142 | 3202012 | #!/usr/bin/env python3
# ==============================================================================
# Copyright 2018-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 Licens... | 0 | 0 | 0 | 0 | 0 | 0 |
old_stuff/harold/tests/test_time_domain_plots.py | weightan/quaternion_polynomials | 154 | 3202031 | <reponame>weightan/quaternion_polynomials
from harold import State, Transfer, step_response_plot, impulse_response_plot
from numpy import eye
from numpy.random import rand, seed
def test_step_response_plot_shape():
seed(1234)
f = step_response_plot(Transfer(5, dt=0.5))
assert f.shape == (1, 1)
a, b, ... | 0 | 0 | 0 | 0 | 0 | 0 |
auth/migrations/0004_auto_20210613_1316.py | NakolenkeDevelopment/rustockholm.club | 496 | 3202037 | <gh_stars>100-1000
# Generated by Django 3.2 on 2021-06-13 13:16
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auth', '0003_auto_20201024_1527'),
]
operations = [
migrations.AlterField(
... | 0 | 0 | 0 | 0 | 0 | 0 |
Codes/gracekoo/69_sqrtx.py | liuxiaohui1221/algorithm | 256 | 3202055 | <filename>Codes/gracekoo/69_sqrtx.py
# -*- coding: utf-8 -*-
# @Time: 2020/3/11 11:57
# @Author: GraceKoo
# @File: 69_sqrtx.py
# @Desc:https://leetcode-cn.com/problems/sqrtx/
class Solution:
def mySqrt(self, x: int) -> int:
if x < 2:
return x
left = 2
right = x // 2
whi... | 0 | 0 | 0 | 0 | 0 | 0 |
qbittorrent/__init__.py | NanoCode012/python-qBittorrent | 212 | 3202079 | <gh_stars>100-1000
from qbittorrent.client import Client
| 0 | 0 | 0 | 0 | 0 | 0 |
esky/slaveproc.py | omnivore/esky | 190 | 3202097 | <reponame>omnivore/esky
# Copyright (c) 2009-2010, Cloud Matrix Pty. Ltd.
# All rights reserved; available under the terms of the BSD License.
"""
esky.slaveproc: utilities for running a slave process.
A "slave process" is one that automatically dies when its master process dies.
To implement this, the slave pro... | 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.