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 |
|---|---|---|---|---|---|---|---|---|---|---|
platypush/plugins/ping.py | RichardChiang/platypush | 228 | 163872 | import re
import subprocess
import sys
from typing import Optional, List
from platypush.message.response.ping import PingResponse
from platypush.plugins import Plugin, action
PING_MATCHER = re.compile(
r"(?P<min>\d+.\d+)/(?P<avg>\d+.\d+)/(?P<max>\d+.\d+)/(?P<mdev>\d+.\d+)"
)
PING_MATCHER_BUSYBOX = re.compile(
... | 9 | 2 | 0 | 0 | 11 | 0 |
tests/test_resource_tracker/test_api/test_resource_group_api_views/test_rg_text_attribute_definition_api_views/test_delete.py | LaudateCorpus1/squest | 112 | 163933 | from rest_framework import status
from rest_framework.reverse import reverse
from resource_tracker.models import ResourceGroupTextAttributeDefinition
from tests.test_resource_tracker.test_api.base_test_api import BaseTestAPI
class TestTextAttributeDefinitionDelete(BaseTestAPI):
def setUp(self):
super(Te... | 0 | 0 | 0 | 0 | 0 | 0 |
addons/figshare/views.py | gaybro8777/osf.io | 628 | 163940 | # -*- coding: utf-8 -*-
from addons.base import generic_views
from addons.figshare.serializer import FigshareSerializer
from website.project.decorators import (
must_have_addon, must_be_addon_authorizer,
)
SHORT_NAME = 'figshare'
FULL_NAME = SHORT_NAME
figshare_account_list = generic_views.account_list(
SH... | 0 | 1 | 0 | 0 | 1 | 0 |
spikeinterface/toolkit/qualitymetrics/quality_metric_list.py | khl02007/spikeinterface | 116 | 163954 | from .misc_metrics import (
compute_num_spikes,
compute_firing_rate,
compute_presence_ratio,
compute_snrs,
compute_isi_violations,
compute_amplitudes_cutoff,
)
from .pca_metrics import calculate_pc_metrics, _possible_pc_metric_names
# based on PCA
# "isolation_distance", "l_ratio", "d_prime", ... | 0 | 0 | 0 | 0 | 0 | 0 |
QUANTAXIS/QAPubSub/declaters.py | B34nK0/QUANTAXIS | 6,322 | 163976 | #app = faust.App('myapp', broker='kafka://localhost')
class QUANTAXIS_PUBSUBER():
def __init__(self, name, broker='rabbitmq://localhost'):
self.exchange = name
<EMAIL>(value_type=Order)
def agent(value_type=order):
pass | 0 | 0 | 0 | 0 | 0 | 0 |
src/sage/manifolds/subsets/pullback.py | UCD4IDS/sage | 1,742 | 164029 | r"""
Manifold Subsets Defined as Pullbacks of Subsets under Continuous Maps
"""
# ****************************************************************************
# Copyright (C) 2021 <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pu... | 0 | 0 | 0 | 0 | 0 | 1 |
obfuscators/obfuscator_indirections.py | breakpad/aamo | 115 | 164035 | import util as u
import re
import StringIO
def get_reg(invoke_param):
"""Return the parameter registry list"""
if invoke_param == '':
return
reg_list = re.finditer(r'(v|p)\d{1,3}', invoke_param)
for reg_value in reg_list:
yield reg_value.group()
def is_range(invoke_type):
"""Rang... | 0 | 0 | 0 | 0 | 0 | 0 |
dask/verify_dask_standalone.py | ntr/initialization-actions | 426 | 164062 | from dask.distributed import Client
import dask.array as da
import dask_ml
import dask_bigquery
import numpy as np
client = Client("localhost:8786")
x = da.sum(np.ones(5))
x.compute()
| 0 | 0 | 0 | 0 | 0 | 0 |
pegasus/ops/parsing_ops_test.py | akhilbobby/pegasus | 1,270 | 164079 | <reponame>akhilbobby/pegasus
# Copyright 2020 The PEGASUS Authors..
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | 0 | 0 | 0 | 0 | 0 | 0 |
torch-two-sample-master/torch_two_sample/__init__.py | isaacsultan/ift6135-gan | 199 | 164143 | from .statistics_diff import (
SmoothFRStatistic, SmoothKNNStatistic, MMDStatistic, EnergyStatistic)
from .statistics_nondiff import FRStatistic, KNNStatistic
__all__ = ['SmoothFRStatistic', 'SmoothKNNStatistic', 'MMDStatistic',
'EnergyStatistic', 'FRStatistic', 'KNNStatistic']
| 0 | 0 | 0 | 0 | 0 | 0 |
benchmark/path_selection_benchmark.py | pthevenet/lightnion | 120 | 164171 | <filename>benchmark/path_selection_benchmark.py
import lightnion as lnn
from lightnion import path_selection
import cProfile
lnn.cache.purge()
link = lnn.link.initiate(port=5000)
state = lnn.create.fast(link)
state, cons = lnn.consensus.download(state, flavor='unflavored')
cProfile.run("path_selection.select_path(con... | 0 | 0 | 0 | 0 | 0 | 0 |
fooltrader/api/event.py | beaquant/fooltrader | 1,103 | 164190 | # -*- coding: utf-8 -*-
from __future__ import annotations
import os
import pandas as pd
from fooltrader.api.technical import to_security_item
from fooltrader.contract.files_contract import get_event_path
from fooltrader.utils import pd_utils
from fooltrader.utils.pd_utils import df_for_date_range
def get_event(se... | 9 | 4 | 0 | 0 | 13 | 0 |
utils/compositions.py | chail/latent-composition | 152 | 164201 | <filename>utils/compositions.py
import torch
import torch.nn.functional as F
import numpy as np
import os
import os.path as osp
import sys
from collections import namedtuple
import cv2
from . import renormalize
from PIL import Image
Composite = namedtuple('Composite',
['parts_image', 'parts_mask... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/models/rl/integration/test_value_models.py | lavoiems/lightning-bolts | 822 | 164214 | import argparse
from unittest import TestCase
import pytest
from pytorch_lightning import Trainer
from pl_bolts.models.rl.double_dqn_model import DoubleDQN
from pl_bolts.models.rl.dqn_model import DQN
from pl_bolts.models.rl.dueling_dqn_model import DuelingDQN
from pl_bolts.models.rl.noisy_dqn_model import NoisyDQN
f... | 0 | 1 | 0 | 0 | 1 | 0 |
src/datapane/__init__.py | datapane/datapane | 481 | 164240 | <gh_stars>100-1000
# Copyright 2020 StackHut Limited (trading as Datapane)
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa F401
import os
import sys
from pathlib import Path
try:
from ._version import __rev__
except ImportError:
# NOTE - could use subprocess to get from git?
__rev__ = "local"
__versi... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/metrics.py | headupinclouds/LightNet | 737 | 164253 | import numpy as np
class RunningScore(object):
def __init__(self, n_classes):
self.n_classes = n_classes
self.confusion_matrix = np.zeros((n_classes, n_classes))
@staticmethod
def _fast_hist(label_true, label_pred, n_class) -> object:
mask = (label_true >= 0) & (label_true < n_cla... | 0 | 2 | 0 | 0 | 2 | 0 |
h2o-py/tests/testdir_misc/pyunit_frame_reload.py | vishalbelsare/h2o-3 | 6,098 | 164259 | import h2o
from h2o.exceptions import H2OResponseError
from tests import pyunit_utils
import tempfile
from collections import OrderedDict
from h2o.grid.grid_search import H2OGridSearch
from h2o.estimators.gbm import H2OGradientBoostingEstimator
def test_frame_reload():
work_dir = tempfile.mkdtemp()
iris = h2o... | 0 | 0 | 0 | 0 | 0 | 0 |
pykafka/rdkafka/simple_consumer.py | Instamojo/pykafka | 1,174 | 164291 | from __future__ import annotations
from contextlib import contextmanager
import logging
from pkg_resources import parse_version
import sys
import time
from pykafka.exceptions import RdKafkaStoppedException, ConsumerStoppedException
from pykafka.simpleconsumer import SimpleConsumer, OffsetType
from pykafka.utils.compat... | 18 | 6 | 0 | 2 | 26 | 0 |
MiscScipts/CarInfo.py | nevileone/CarHackingTools | 496 | 164306 | #!/usr/bin/env python
import sys
import time
import obd
import json
import os
if len(sys.argv) == 1:
connection = obd.OBD()
else:
connection = obd.OBD(sys.argv[1])
os.system('clear')
while True:
print 'Car Information: '
print 'Speed : ' + \
str(connection.query(obd.commands.SPEED).value.to("... | 0 | 0 | 0 | 0 | 0 | 0 |
ch03/3.2.1.7.py | AaronZhengkk/SpiderBook | 990 | 164348 | #coding:utf-8
'''
使用ProxyHandler在程序中动态设置代理
import urllib2
proxy = urllib2.ProxyHandler({'http': '127.0.0.1:8087'})
opener = urllib2.build_opener([proxy,])
urllib2.install_opener(opener)
response = urllib2.urlopen('http://www.zhihu.com/')
print response.read()
'''
'''
直接调用 opener 的 open方法代替全局的 urlopen方法
import urllib... | 0 | 0 | 0 | 0 | 0 | 0 |
chainer_/chainercv2/models/danet.py | naviocean/imgclsmob | 2,649 | 164385 | from __future__ import annotations
"""
DANet for image segmentation, implemented in Chainer.
Original paper: 'Dual Attention Network for Scene Segmentation,' https://arxiv.org/abs/1809.02983.
"""
__all__ = ['DANet', 'danet_resnetd50b_cityscapes', 'danet_resnetd101b_cityscapes']
import os
import chainer.funct... | 18 | 9 | 0 | 0 | 27 | 0 |
bin/awscli/customizations/configservice/getstatus.py | iilness2/bash-lambda-layer-custom | 399 | 164388 | <reponame>iilness2/bash-lambda-layer-custom
# Copyright 2014 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 |
river/datasets/synth/mv.py | fox-ds/river | 2,184 | 164420 | <filename>river/datasets/synth/mv.py
import random
from .. import base
class Mv(base.SyntheticDataset):
"""Mv artificial dataset.
Artificial dataset composed of both nominal and numeric features, whose features
present co-dependencies. Originally described in [^1].
The features are generated using ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_cli_latest.py | theowhy/cum | 163 | 164444 | <reponame>theowhy/cum<filename>tests/test_cli_latest.py
from unittest import mock
import cumtest
import datetime
import time
class TestCLILatest(cumtest.CumCLITest):
SERIES_KWARGS = {'url': ('https://manga.madokami.al/Manga/K/KA/KANG/'
'Kangoku%20Gakuen'),
'alias'... | 0 | 0 | 0 | 0 | 0 | 0 |
vumi/transports/opera/utils.py | seidu626/vumi | 199 | 164459 | from collections import namedtuple
import xml.etree.ElementTree as ET
OPERA_TIMESTAMP_FORMAT = "%Y%m%dT%H:%M:%S"
def parse_receipts_xml(receipt_xml_data) -> object:
tree = ET.fromstring(receipt_xml_data)
return map(receipt_to_namedtuple, tree.findall('receipt'))
def receipt_element_to_dict(element) -> dict... | 0 | 4 | 0 | 0 | 4 | 0 |
tools/bin/pythonSrc/ptyprocess-0.5.1/tests/test_wait.py | YangHao666666/hawq | 450 | 164462 | <reponame>YangHao666666/hawq
""" Test cases for PtyProcess.wait method. """
import time
import unittest
from ptyprocess import PtyProcess
class TestWaitAfterTermination(unittest.TestCase):
"""Various test cases for PtyProcess.wait()"""
def test_wait_true_shortproc(self):
"""Ensure correct (True) wait... | 0 | 0 | 0 | 0 | 0 | 0 |
glue/formats/html.py | glensc/glue | 514 | 164467 | <filename>glue/formats/html.py
import os
from .css import CssFormat
class HtmlFormat(CssFormat):
extension = 'html'
template = u"""
<html>
<head><title>Glue Sprite Test Html</title>
<link rel="stylesheet" type="text/css" href="{{ css_path }}"></head>
<body>
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/visions/declarative.py | bhumikapahariapuresoftware/visions | 142 | 164471 | from typing import Any, Callable, List, Optional, Sequence, Type, TypeVar, Union
from visions.relations import IdentityRelation, InferenceRelation
from visions.types.type import VisionsBaseType
T = TypeVar("T")
def process_relation(items: Union[dict, Type[VisionsBaseType]]) -> IdentityRelation:
if isinstance(it... | 5 | 4 | 0 | 0 | 9 | 0 |
data/transcoder_evaluation_gfg/python/MINIMUM_SWAPS_REQUIRED_BRING_ELEMENTS_LESS_EQUAL_K_TOGETHER.py | mxl1n/CodeGen | 241 | 164509 | # Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr , n , k ) -> object :
count = 0
for i in range ( 0 , n ) :
if ( arr [ i ] <= k ) :
... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/test_card.py | traviscook21/rich | 33,622 | 164533 | import io
import re
from rich.console import Console, RenderableType
from rich.__main__ import make_test_card
from ._card_render import expected
re_link_ids = re.compile(r"id=[\d\.\-]*?;.*?\x1b")
def replace_link_ids(render: str) -> str:
"""Link IDs have a random ID and system path which is a problem for
r... | 2 | 2 | 0 | 0 | 4 | 0 |
cauliflowervest/server/handlers/apple_firmware_test.py | isabella232/cauliflowervest | 292 | 164543 | <gh_stars>100-1000
# 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
ch3/dp/UVa11450_bu.py | lyskevin/cpbook-code | 1,441 | 164560 | <reponame>lyskevin/cpbook-code
# UVa 11450 - Wedding Shopping - Bottom Up (faster than Top Down)
def main():
TC = int(input())
for tc in range(TC):
MAX_gm = 30 # 20 garments at most and 20 models per garment at most
MAX_M = 210 ... | 0 | 0 | 0 | 0 | 0 | 0 |
notification/serializers.py | ThusharaX/mumbleapi | 187 | 164612 | from __future__ import annotations
from rest_framework import serializers
from .models import Notification
from users.serializers import UserProfileSerializer
from feed.serializers import MumbleSerializer
from article.serializers import ArticleSerializer
from discussion.serializers import DiscussionSerializer
class N... | 0 | 5 | 1 | 0 | 6 | 0 |
virl/cli/license/renew/authorization/commands.py | tombry/virlutils | 133 | 164641 | <reponame>tombry/virlutils
import click
from virl.api import VIRLServer
from virl.helpers import get_cml_client
@click.command()
def authorization():
"""
renew Smart License authorization
"""
server = VIRLServer()
client = get_cml_client(server)
licensing = client.licensing
try:
l... | 0 | 0 | 0 | 0 | 0 | 0 |
evennia/accounts/migrations/0001_initial.py | Jaykingamez/evennia | 1,544 | 164658 | # -*- coding: utf-8 -*-
from django.db import models, migrations
import django.utils.timezone
import django.core.validators
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [("auth", "0001_initial"), ("typeclasses", "0001_initial")]
operations: list[object] = [
migratio... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/test_plotter.py | orena1/statannotations | 110 | 164668 | <filename>tests/test_plotter.py<gh_stars>100-1000
import unittest
import pandas as pd
from statannotations._Plotter import _SeabornPlotter, IMPLEMENTED_PLOTTERS
import seaborn as sns
class TestPlotter(unittest.TestCase):
def setUp(self) -> None:
# noinspection DuplicatedCode
self.df = pd.DataFram... | 0 | 0 | 0 | 0 | 0 | 0 |
py_lecture/scripts/python_timer.py | yasutomo57jp/ros_lecture | 110 | 164683 | <reponame>yasutomo57jp/ros_lecture
#!/usr/bin/env python
import rospy
def timerCallback(event):
rospy.loginfo("timer callback")
def timer():
rospy.init_node('timer')
rospy.sleep(2.)
rospy.loginfo("sleep 2s")
rospy.Timer(rospy.Duration(2.0), timerCallback)
rospy.spin()
if __name__ == '__m... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/molecular_generation/JT_VAE/src/utils.py | agave233/PaddleHelix | 454 | 164721 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 0 | 3 | 0 | 0 | 3 | 0 |
Bitcoin-Price-GUI/bitcoin-price.py | elishahyousaf/Awesome-Python-Scripts | 1,026 | 164748 | <reponame>elishahyousaf/Awesome-Python-Scripts
import tkinter as tk
from tkinter import ttk
import urllib.request
import json
import time
def get_luno():
# to change ticker pair, look at here https://api.mybitx.com/api/1/tickers
req = urllib.request.urlopen("https://api.mybitx.com/api/1/ticker?pair=XBTMYR")
x = jso... | 0 | 0 | 0 | 0 | 0 | 0 |
python-standard-library/logging/logger_file.py | caesarcc/python-code-tutorials | 1,059 | 164759 | from __future__ import annotations
import logging
import math
logging.basicConfig(level=logging.DEBUG,
handlers=[logging.FileHandler('logs.log', 'a', 'utf-8')],
format="%(asctime)s %(levelname)-6s - %(funcName)-8s - %(filename)s - %(lineno)-3d - %(message)s",
... | 0 | 1 | 0 | 0 | 1 | 0 |
fatiando/seismic/tests/test_wavelets.py | XuesongDing/fatiando | 179 | 164764 | <gh_stars>100-1000
from __future__ import absolute_import
from pytest import raises
from .. import RickerWavelet
def test_ricker_copy():
"Make sure the copy method doesn't give the same object"
w = RickerWavelet(f=3, amp=4, delay=5)
wcopy = w.copy()
wcopy.f = 1
wcopy.amp = -2
wcopy.delay = -3
... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter10/create_personalised_coupons.py | carltyndall/Python-Automation-Cookbook-Second-Edition | 155 | 164783 | # IMPORTS
import hashlib
import re
import csv
from random import choice
CHARACTERS = 'ACEFGHJKLMNPRTUVWXY379'
# FUNCTIONS
def random_code(digits) -> object:
# All possibilities, except the letters and numbers that can
# be confusing ( 0 and O, etc )
digits = [choice(CHARACTERS) for _ in range(digits)]
... | 0 | 4 | 0 | 0 | 4 | 0 |
Supervised Learning with scikit-learn/Chapter 4 - Preprocessing and pipelines.py | nabeelsana/DataCamp-courses | 464 | 164816 | <reponame>nabeelsana/DataCamp-courses
#==============================================================================================================================#
#Chapter 4 Preprocessing and pipelines
#==============================================================================================================... | 0 | 0 | 0 | 0 | 0 | 0 |
sync.py | waketzheng/chinese_province_city_area_mapper | 1,230 | 164830 | # 从 https://github.com/Vonng/adcode/tree/master/data/adcode 同步需要的数据
import requests
import json
import base64
from io import StringIO
import csv
from progress.bar import Bar
adcode_dir_url = "https://api.github.com/repos/Vonng/adcode/git/trees/55df6cf713cdac2ac5220c972edf68553d2d4afa"
# 代表整个中国 adcode
china_base_adcod... | 0 | 1 | 0 | 0 | 1 | 0 |
numba/parfors/parfor_lowering_utils.py | auderson/numba | 6,620 | 164844 | <reponame>auderson/numba<filename>numba/parfors/parfor_lowering_utils.py
from collections import namedtuple
from numba.core import types, ir
from numba.core.ir_utils import mk_unique_var
from numba.core.typing import signature
_CallableNode = namedtuple("BoundFunc", ["func", "sig"])
class ParforLoweringBuilder:
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/autonlp/tasks.py | goncaloperes/autonlp | 667 | 164869 | TASKS = {
"binary_classification": 1,
"multi_class_classification": 2,
"entity_extraction": 4,
"extractive_question_answering": 5,
"summarization": 8,
"single_column_regression": 10,
"speech_recognition": 11,
}
DATASETS_TASKS = ["text-classification", "question-answering-extractive"]
| 0 | 0 | 0 | 0 | 0 | 0 |
dataviz/flagsfictional.py | Udzu/pudzu | 119 | 164913 | from pudzu.charts import *
from pudzu.sandbox.bamboo import *
df = pd.read_csv("datasets/flagsfictional.csv")
data = pd.DataFrame(list(generate_batches([dict(row) for _,row in df.iterrows()], 3)))
fg, bg="black", "#EEEEEE"
default_img = "https://s-media-cache-ak0.pinimg.com/736x/0d/36/e7/0d36e7a476b06333d9fe9960... | 0 | 1 | 0 | 0 | 1 | 0 |
examples/checkpointing/checkpoint.py | reguly/devito | 204 | 164927 | <reponame>reguly/devito
from devito import warning
warning("""The location of Devito's checkpointing has changed. This location will be
deprecated soon. Please change your imports to 'from devito import
DevitoCheckpoint, CheckpointOperato'""")
from devito.checkpointing import * # noqa | 0 | 0 | 0 | 0 | 0 | 0 |
f5/bigip/tm/security/test/unit/test_ip_intelligence.py | hixio-mh/f5-common-python | 272 | 164942 | <gh_stars>100-1000
# Copyright 2018 F5 Networks 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... | 0 | 0 | 0 | 0 | 0 | 0 |
release/scripts/presets/camera/GoPro_Hero3_Black.py | rbabari/blender | 365 | 164967 | <filename>release/scripts/presets/camera/GoPro_Hero3_Black.py
import bpy
bpy.context.camera.sensor_width = 6.16
bpy.context.camera.sensor_height = 4.62
bpy.context.camera.lens = 2.77
bpy.context.camera.sensor_fit = 'AUTO'
| 0 | 0 | 0 | 0 | 0 | 0 |
crits/targets/urls.py | dutrow/crits | 738 | 164988 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^list/$', views.targets_listing, name='crits-targets-views-targets_listing'),
url(r'^list/(?P<option>\S+)/$', views.targets_listing, name='crits-targets-views-targets_listing'),
url(r'^divisions/list/$', views.divisions_listing, na... | 0 | 0 | 0 | 0 | 0 | 0 |
python/grid_search.py | pl8787/textnet-release | 114 | 164993 | import sys
import os
import json
import copy
import multiprocessing
if len(sys.argv) < 5:
print "Usage: python grid_search.py [model_template_file] [parameters_config] [process_number] [run_dir]"
model_tpl_file = sys.argv[1]
param_conf_file = sys.argv[2]
proc_num = int(sys.argv[3])
run_dir = sys.argv[4]
if not o... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/lib/python3.8/site-packages/joblib/test/test_store_backends.py | avrumnoor/NewsSummarizer | 2,607 | 165053 | <gh_stars>1000+
try:
# Python 2.7: use the C pickle to speed up
# test_concurrency_safe_write which pickles big python objects
import cPickle as cpickle
except ImportError:
import pickle as cpickle
import functools
import time
from joblib.testing import parametrize, timeout
from joblib.test.common impo... | 0 | 0 | 0 | 0 | 0 | 0 |
bio_embeddings/utilities/cli.py | kvetab/bio_embeddings | 219 | 165054 | #!/usr/bin/env python3
import argparse
import logging
from bio_embeddings.utilities.pipeline import parse_config_file_and_execute_run
def main():
"""
Pipeline commandline entry point
"""
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
# Jax likes to print ... | 0 | 0 | 0 | 0 | 0 | 0 |
boto3_type_annotations_with_docs/boto3_type_annotations/opsworkscm/client.py | cowboygneox/boto3_type_annotations | 119 | 165068 | from typing import Optional
from botocore.client import BaseClient
from typing import Dict
from botocore.paginate import Paginator
from botocore.waiter import Waiter
from typing import Union
from typing import List
class Client(BaseClient):
def associate_node(self, ServerName: str, NodeName: str, EngineAttributes... | 63 | 18 | 0 | 0 | 81 | 0 |
Hackerrank/Practice/Python/4.sets/33.Set .union() Operation.py | kushagra1212/Competitive-Programming | 994 | 165075 | <reponame>kushagra1212/Competitive-Programming<filename>Hackerrank/Practice/Python/4.sets/33.Set .union() Operation.py<gh_stars>100-1000
# Enter your code here. Read input from STDIN. Print output to STDOUT
n=int(input())
roll_n=set(map(int,input().split()))
m=int(input())
roll_m=set(map(int,input().split()))
s=ro... | 0 | 0 | 0 | 0 | 0 | 0 |
dashboard/dashboard/pinpoint/handlers/commit_test.py | tingshao/catapult | 1,894 | 165086 | <reponame>tingshao/catapult
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import json
import ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/zero_code_change/test_tensorflow_error_handling_agent.py | jsspric/sagemaker-debugger | 133 | 165096 | <filename>tests/zero_code_change/test_tensorflow_error_handling_agent.py
# Standard Library
import logging
import os
# Third Party
import pytest
from tests.zero_code_change.test_tensorflow2_gradtape_integration import (
helper_keras_gradienttape_train,
)
from tests.zero_code_change.test_tensorflow_integration impo... | 0 | 0 | 0 | 0 | 0 | 0 |
src/schemathesis/service/auth.py | stannum-l/schemathesis | 563 | 165134 | from . import metadata
from .client import ServiceClient
from .constants import DEFAULT_HOSTNAME, DEFAULT_PROTOCOL
def login(token: str, hostname: str = DEFAULT_HOSTNAME, protocol: str = DEFAULT_PROTOCOL, verify: bool = True) -> str:
"""Make a login request to SaaS."""
client = ServiceClient(f"{protocol}://{h... | 4 | 1 | 0 | 0 | 5 | 0 |
src/utils/send_email.py | HaoJiangGuo/fp-server | 173 | 165135 | # -*- coding:utf-8 -*-
"""
发送邮件
"""
import email
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
class MailSender(object):
def __init__(self, host, username, password, to_emails, subject, content):
""" 初始化
@param host 邮件服务端host
... | 0 | 0 | 0 | 0 | 0 | 0 |
bw_plex/edl.py | Hellowlol/bw_plex | 371 | 165146 | from __future__ import annotations
import os
import shutil
import subprocess
import time
from bw_plex import LOG
TYPES = {'cut': 0,
'mute': 1,
'scene marker': 2,
'commercial break': 3}
TYPES.update(dict((v, k) for (k, v) in TYPES.items()))
def db_to_edl(item, type: int=3) -> object:
... | 4 | 3 | 0 | 0 | 7 | 0 |
1]. DSA/2]. Algorithms/01]. Searching Algorithms/Python/01) Binary Search.py | MLinesCode/The-Complete-FAANG-Preparation | 6,969 | 165151 | <reponame>MLinesCode/The-Complete-FAANG-Preparation
def binary_search(array, target):
first = 0
last = len(array) - 1
while first <= last:
midpoint = (first + last) // 2
if array[midpoint] == target:
return midpoint
elif array[midpoint] < target:
first = mid... | 0 | 0 | 0 | 0 | 0 | 0 |
fairness/algorithms/zafar/fair-classification-master/fair_classification/loss_funcs.py | yashwarlord/fairness-comparison | 146 | 165177 | <reponame>yashwarlord/fairness-comparison
import sys
import os
import numpy as np
import scipy.special
from collections import defaultdict
import traceback
from copy import deepcopy
def _hinge_loss(w, X, y):
yz = y * np.dot(X,w) # y * (x.w)
yz = np.maximum(np.zeros_like(yz), (1-yz)) # hinge function
... | 0 | 0 | 0 | 0 | 0 | 0 |
Pep_Talk_Generator/clue/code.py | quezadaminter/Adafruit_Learning_System_Guides | 665 | 165206 | # SPDX-FileCopyrightText: 2021 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import random
from adafruit_clue import clue
import displayio
from adafruit_display_text import label, wrap_text_to_pixels
from adafruit_bitmap_font import bitmap_font
import board
column_1 = [
"Champ, ",
"Fact: ",
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_client.py | jamesdarke/gwader | 309 | 165221 | """Tests for the `client` module."""
import json
import os
import signal
import threading
import time
from base64 import b64encode
from copy import deepcopy
import pytest
import requests
from responses import mock as responses
from aria2p import Client, ClientException
from aria2p.client import JSONRPC_CODES, JSONRP... | 0 | 2 | 0 | 0 | 2 | 0 |
plugins/print_rows.py | bennofs/execution-trace-viewer | 186 | 165236 | <filename>plugins/print_rows.py<gh_stars>100-1000
from yapsy.IPlugin import IPlugin
from core.api import Api
class PluginPrintRows(IPlugin):
def execute(self, api: Api):
trace_data = api.get_trace_data()
trace = api.get_selected_trace()
if not trace:
print("PluginPrintRows er... | 0 | 0 | 0 | 0 | 0 | 0 |
Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalNoise_cff.py | ckamtsikis/cmssw | 852 | 165244 | <filename>Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalNoise_cff.py
import FWCore.ParameterSet.Config as cms
import HLTrigger.HLTfilters.hltHighLevel_cfi
noiseHLT = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone(
HLTPaths = ['HLT_MET25'],
# eventSetupPathsKey='HcalCalNoise',
throw = Fa... | 0 | 0 | 0 | 0 | 0 | 0 |
websauna/utils/psql.py | highPriestLOL/websauna | 286 | 165264 | <reponame>highPriestLOL/websauna
"""PostgreSQL helpers."""
# Use pgcrypto, instead of uuid-ossp
# Also create a function uuid_generate_v4 for backward compatibility
UUID_SUPPORT_STMT = """CREATE EXTENSION IF NOT EXISTS "pgcrypto";
CREATE OR REPLACE FUNCTION uuid_generate_v4()
RETURNS uuid
AS '
BEGIN
RETURN gen_random_... | 0 | 0 | 0 | 0 | 0 | 0 |
platoon/channel/worker.py | mila-udem/platoon | 212 | 165284 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
:mod:`channel.worker` -- Multi-device sync API for a single computation device
==============================================================================
.. module:: worker
:platform: Unix
:synopsis: Provide methods for single device Theano code ... | 11 | 11 | 0 | 4 | 26 | 0 |
python_concurrency/simulationExample_multiprocessing.py | karthik/berkeley | 106 | 165292 | import numpy as np
import time
from multiprocessing import Pool, cpu_count
import sys
sys.path.append('..')
from numpyVectorization.motion_gauss import simulateParticles_loop
# How do we pass multiple arguments via pool? Use wrapper functions! Note:
# lambda functions will NOT work for this purpose
def wrapper_fun(ar... | 0 | 0 | 0 | 0 | 0 | 0 |
dash_docs/chapters/deployment/index.py | joelostblom/dash-docs | 379 | 165317 | import dash_core_components as dcc
import dash_html_components as html
from dash_docs import styles
from dash_docs import reusable_components as rc
layout = html.Div(children=[
rc.Markdown('''
# Deploying Dash Apps
By default, Dash apps run on `localhost` - you can only access them on your
own machine... | 0 | 0 | 0 | 0 | 0 | 0 |
infer_record.py | yeyupiaoling/MASR | 126 | 165346 | <filename>infer_record.py
import time
import torch
import functools
import argparse
import pyaudio
import wave
import torch.nn.functional as F
from utils import data
from ctcdecode import CTCBeamDecoder
from data.utility import add_arguments, print_arguments
parser = argparse.ArgumentParser(description=__doc__)
add_ar... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/PythonTests/test_vertex_centered_scalar_grid.py | ADMTec/CubbyFlow | 216 | 165354 | import numpy as np
import pyCubbyFlow
from pytest import approx
from pytest_utils import *
cnt = 0
def test_grid2():
global cnt
a = pyCubbyFlow.VertexCenteredScalarGrid2(resolution=(3, 4),
gridSpacing=(1, 2),
gridOr... | 0 | 4 | 0 | 0 | 4 | 0 |
symposion/proposals/migrations/0010_explicit_submit.py | azkarmoulana/pycon | 154 | 165364 | <reponame>azkarmoulana/pycon
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('proposals', '0009_auto_20170209_2326'),
]
operations = [
migrations.RenameField('proposalbase',... | 0 | 0 | 0 | 0 | 0 | 0 |
doc/ReleaseNotes/mk_example_table.py | scharlton2/modflow6 | 102 | 165385 |
from __future__ import annotations
import os
import sys
import pymake
pth = os.path.join('..', '..')
if pth not in sys.path:
sys.path.append(pth)
def get_distribution_name(versiontexname) -> object | None:
dist = None
fname = versiontexname
with open(fname) as f:
lines = f.readlines()
... | 0 | 1 | 0 | 0 | 1 | 0 |
src/FeatureVolumeCacheSequence.py | collector-m/overlap_localization | 188 | 165435 | <filename>src/FeatureVolumeCacheSequence.py
#!/usr/bin/env python3
# Developed by <NAME> and <NAME>
# This file is covered by the LICENSE file in the root of this project.
# A keras generator which generates batches out of cached feature volumes
import os
import numpy as np
from keras.utils import Sequence
class Fe... | 0 | 0 | 0 | 0 | 0 | 0 |
rdflib/tools/__init__.py | gromgull/rdflib | 1,424 | 165462 | <filename>rdflib/tools/__init__.py
"""
Various commandline tools for working with RDFLib
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
Katna/writer.py | viddik13/katna | 125 | 165473 | <reponame>viddik13/katna<filename>Katna/writer.py
import cv2
import os
import ntpath
class Writer:
"""The base class for writer to process data.
Extend the class to implement different writers based on requirement.
"""
def _generate_filename_from_filepath(self, filepath):
"""Retreives filena... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_tracy_widom.py | JohnnyDeuss/DPPy | 176 | 165527 | # coding: utf8
import unittest
import numpy as np
import sys
sys.path.append('..')
from dppy.beta_ensemble_polynomial_potential_core import TracyWidom
class TestTracyWidom(unittest.TestCase):
""" Based on the work of Bornemann 2010 `https://arxiv.org/pdf/0804.2543.pdf <https://arxiv.org/pdf/0804.2543.pdf>`_
... | 0 | 2 | 0 | 0 | 2 | 0 |
wouso/games/quiz/urls.py | AlexandruGhergut/wouso | 117 | 165528 | from django.conf.urls.defaults import *
urlpatterns = patterns('wouso.games.quiz.views',
url(r'^$', 'index', name='quiz_index_view'),
url(r'^cat/(?P<id>\d+)/$', 'category', name='quiz_category_view'),
url(r'^(?P<id>\d+)/$', 'quiz', name='quiz_view'),
)
| 0 | 0 | 0 | 0 | 0 | 0 |
tools/test_synthesis_sym.py | aditya2592/PoseCNN | 655 | 165535 | #!/usr/bin/env python
# --------------------------------------------------------
# FCN
# Copyright (c) 2016 RSE at UW
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
"""Test a FCN on an image database."""
import _init_paths
imp... | 0 | 0 | 0 | 0 | 0 | 0 |
valve/steam/client.py | Crowbar-Sledgehammer/python-valve | 136 | 165551 | # -*- coding: utf-8 -*-
# Copyright (C) 2013 <NAME>
"""
Provides an interface to the Steam client if present and running.
Windows only.
"""
import itertools
import _winreg as winreg
import os
AWAY = "away"
BUSY = "busy"
OFFLINE = "offline"
ONLINE = "online"
DOWNLOADS = "downloads"
GAMES = "games"
GAMES_DET... | 0 | 0 | 0 | 0 | 0 | 0 |
088-gosu-fuzzing/pwnbase.py | gynvael/stream | 152 | 165563 | #!/usr/bin/python
from __future__ import annotations
import random
import sys
import socket
import telnetlib
import os
import time
import threading
from struct import pack, unpack
from time import time
def recvuntil(sock, txt) -> tuple[str, object]:
d = ""
while d.find(txt) == -1:
try:
dn... | 0 | 13 | 0 | 0 | 13 | 0 |
custom_components/ble_monitor/ble_parser/ha_ble.py | avidit/home-assistant-config | 383 | 165579 | from __future__ import annotations
"""Parser for HA BLE (DIY sensors) advertisements"""
import logging
import struct
from Cryptodome.Cipher import AES
from .helpers import (
to_mac,
to_unformatted_mac,
)
_LOGGER = logging.getLogger(__name__)
def parse_uint(data_obj, factor: int=1) -> object:
"""convert ... | 4 | 7 | 0 | 0 | 11 | 0 |
src/chapter-1/test_class.py | luizyao/pytest-chinese-doc | 283 | 165587 | <filename>src/chapter-1/test_class.py
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
'''
Author: <NAME> (<EMAIL>)
Created Date: 2019-09-26 16:22:12
-----
Last Modified: 2019-09-26 16:33:29
Modified By: <NAME> (<EMAIL>)
-----
THIS PROGRAM IS FREE SOFTWARE, IS LICENSED UNDER MIT.
A short and simple permissive license wit... | 0 | 0 | 0 | 0 | 0 | 0 |
chapter10/test_with_mock/test_mailer.py | lixin940207/expert_python_programming | 189 | 165604 | # -*- coding: utf-8 -*-
import smtplib
from unittest.mock import MagicMock
from mailer import send
def test_send(monkeypatch):
smtp_mock = MagicMock()
smtp_mock.sendmail.return_value = {}
monkeypatch.setattr(smtplib, 'SMTP', MagicMock(return_value=smtp_mock))
res = send(
'<EMAIL>',
'... | 0 | 0 | 0 | 0 | 0 | 0 |
src/omlt/neuralnet/__init__.py | jalving/OMLT | 115 | 165613 | <gh_stars>100-1000
r"""
We use the following notation to describe layer and activation functions:
.. math::
\begin{align*}
N &:= \text{Set of nodes (i.e. neurons in the neural network)}\\
M_i &:= \text{Number of inputs to node $i$}\\
\hat z_i &:= \text{pre-activation value on node $i$}\\
z_i &:= \... | 0 | 0 | 0 | 0 | 0 | 0 |
abi.py | systemquant/DeFi_PanCakeSwapBot | 142 | 165628 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
Created on Sun Aug 29 10:11:13 2021
@author: Zain
"""
from bs4 import BeautifulSoup as bsp
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from webdriver_manager.firefox import GeckoDriverManager
def tokenAbi(addres... | 1 | 2 | 0 | 0 | 3 | 0 |
app/project_type/directory.py | rsennewald/ClusterRunner | 164 | 165629 | from __future__ import annotations
import os
from platform import node
from app.project_type.project_type import ProjectType
from app.util.conf.configuration import Configuration
from app.util.log import get_logger
class Directory(ProjectType):
"""
Example API call to invoke a directory-type build.
{
... | 4 | 3 | 0 | 0 | 7 | 0 |
test/terra/pulse/de/test_type_utils.py | jakelishman/qiskit-aer | 313 | 165637 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2020, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | 0 | 2 | 0 | 0 | 2 | 0 |
spirit/comment/poll/migrations/0002_auto_20190304_2115.py | Ke-xueting/Spirit | 974 | 165648 | <filename>spirit/comment/poll/migrations/0002_auto_20190304_2115.py
# Generated by Django 2.1.7 on 2019-03-04 21:15
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_comment_poll', '0001_initial'),
]
operations = [
migrations.AlterModelOpt... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/auditcare/utils/export.py | andyasne/commcare-hq | 471 | 165653 | <reponame>andyasne/commcare-hq
import csv
from datetime import datetime, timedelta
from itertools import chain
from django.conf import settings
from django.contrib.auth.models import User
from django.db.models import ForeignKey
import attr
from couchdbkit.ext.django.loading import get_db
from dimagi.utils.couch.data... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/example-server.py | FiyaFly/python-asana | 266 | 165709 | <reponame>FiyaFly/python-asana<gh_stars>100-1000
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from flask import Flask, request, session, redirect, render_template_string
import asana
import json
# OAuth Instructions:
#
# 1. create a new application in your Asana Account Settings ("App" p... | 0 | 0 | 0 | 0 | 0 | 0 |
process_mark.py | DrEdwardLee/BuildingChangeDetector | 191 | 165715 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
根据手工标注的标签生成npy文件,每个npy文件保存了一个二维数组(width, height, 8+1),
前8个通道是图像数据,最后一个通道是标签
"""
import os
import sys
import glob
import json
import tqdm
import skimage.io
import numpy as np
import matplotlib.pyplot as plt
def find_bnd(img) -> tuple[object, object... | 4 | 1 | 0 | 0 | 5 | 0 |
setup.py | georgekarapi/coinprice-indicator | 102 | 165736 | # -*- coding: utf-8 -*-
import yaml
from setuptools import setup, find_packages
config = yaml.load(open('config.yaml', 'r'))
readme = open('README.md', 'r')
license = open('LICENSE', 'r')
setup(
name=config['app']['name'].replace(" ","-"),
version=config['app']['version'],
description=config['app']['des... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/esp32/_pin.py | pauldeng/pycom-micropython-sigfox | 198 | 165757 | """
This test need a set of pins which can be set as inputs and have no external
pull up or pull down connected.
THIS TEST ONLY PASSES USING EXPANSION BOARD 2.1
ON EXPANSION BOARD 3.0 THE TEST FAILS ON LOPY4 AND WIPY DUE TO DIFFERENT REASONS
"""
from machine import Pin
from machine import UART
import os
mch = os.uname... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/plugins/hold_invoice.py | Bladez1753/lightning | 2,288 | 165764 | #!/usr/bin/env python3
"""Simple plugin to allow testing while closing of HTLC is delayed.
"""
from pyln.client import Plugin
import time
plugin = Plugin()
@plugin.hook('invoice_payment')
def on_payment(payment, plugin, **kwargs) -> dict[str,str]:
time.sleep(float(plugin.get_option('holdtime')))
return {'re... | 0 | 1 | 0 | 0 | 1 | 0 |
quantifiedcode/migrations/versions/a2e0f8f4b344_initial_models.py | marcinguy/quantifiedcode | 118 | 165798 | """Initial models.
Revision ID: a2e0f8f4b344
Revises:
Create Date: 2016-11-20 23:02:51.424015
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated b... | 0 | 0 | 0 | 0 | 0 | 0 |
spyder/plugins/profiler/api.py | Earthman100/spyder | 7,956 | 165806 | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Profiler Plugin.
"""
# Local imports
from spyder.plugins.profiler.plugin import ProfilerActions
from spyder.plugins.profiler.widgets.main_widget import (
Prof... | 0 | 0 | 0 | 0 | 0 | 0 |
crits/pcaps/pcap.py | dutrow/crits | 738 | 165810 | <reponame>dutrow/crits
try:
from django_mongoengine import Document
except ImportError:
from mongoengine import Document
from mongoengine import StringField, IntField
from mongoengine import EmbeddedDocument
from django.conf import settings
from crits.core.crits_mongoengine import CritsBaseAttributes, CritsSourceDo... | 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.