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 |
|---|---|---|---|---|---|---|---|---|---|---|
utils/measure_time_func.py | sundogrd/tensorflow_end2end_speech_recognition | 351 | 3261132 | #! /usr/bin/env python
# -*- coding: utf-8 -*
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import time
def measure_time(func) -> object:
@functools.wraps(func)
def _measure_time(*args, **kwargs):
start = time.time()
... | 0 | 1 | 0 | 0 | 1 | 0 |
recipes/Python/576594_Backupdownload_your_tweets_or_anyones_tweets_/recipe-576594.py | tdiprima/code | 2,023 | 3261182 | <gh_stars>1000+
#!/usr/bin/python
import time
from urllib2 import urlopen
from BeautifulSoup import BeautifulSoup
# Replace USERNAME with your twitter username
url = u'http://twitter.com/USERNAME?page=%s'
tweets_file = open('tweets', 'w')
for x in range(10*10000):
f = urlopen(url % x)
soup = BeautifulSoup(f.... | 0 | 0 | 0 | 0 | 0 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractDragomirCM.py | fake-name/ReadableWebProxy | 193 | 3261210 | from __future__ import annotations
def extractDragomirCM(item) -> bool | object | None:
"""
# DragomirCM
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if not postfix and ':' in item['title']:
postfix = item... | 0 | 1 | 0 | 0 | 1 | 0 |
lib/python/treadmill/tests/treadmill_cli_test.py | vrautela/treadmill | 133 | 3261231 | <reponame>vrautela/treadmill
"""Unit test Treadmill CLI.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import click
import click.testing
import mock
from treadmill import context
import treadmi... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/python_bindings_example_client.py | yashi/libcsp | 238 | 3261240 | #!/usr/bin/python3
# Build required code:
# $ ./examples/buildall.py
#
# Start zmqproxy (only one instance)
# $ ./build/zmqproxy
#
# Run client against server using ZMQ:
# $ LD_LIBRARY_PATH=build PYTHONPATH=build python3 examples/python_bindings_example_client.py -z localhost
#
import os
import time
import sys
import... | 0 | 1 | 0 | 0 | 1 | 0 |
etl/parsers/etw/Microsoft_Windows_WDAG_PolicyEvaluator_GP.py | IMULMUL/etl-parser | 104 | 3261246 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-WDAG-PolicyEvaluator-GP
GUID : e53df8ba-367a-4406-98d5-709ffb169681
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
src/TulsiGenerator/Scripts/user_build.py | comius/tulsi | 511 | 3261293 | #!/usr/bin/python
# Copyright 2018 The Tulsi 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 |
alex/utils/mfcc.py | oplatek/alex | 184 | 3261331 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from scipy.fftpack import dct
from collections import deque
class MFCCKaldi:
'''
TODO port Kaldi mfcc to Python. Use similar parameters as
in suggested in __init__ function
'''
def __init__(self, sourcerate: int=16000, framesize: ... | 36 | 4 | 0 | 1 | 41 | 0 |
library/oci_user_facts.py | slmjy/oci-ansible-modules | 106 | 3261337 | #!/usr/bin/python
# Copyright (c) 2017, 2018, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for ... | 1 | 5 | 0 | 0 | 6 | 0 |
photogrammetry_importer/utility/type_utility.py | clayne/Blender-Addon-Photogrammetry-Importer | 452 | 3261345 | <filename>photogrammetry_importer/utility/type_utility.py
def is_int(some_str):
""" Return True, if the given string represents an integer value. """
try:
int(some_str)
return True
except ValueError:
return False
def is_float(some_str):
""" Return True, if the given string repr... | 0 | 0 | 0 | 0 | 0 | 0 |
py/google/fhir/r4/primitive_handler_test.py | swrobel/fhir | 648 | 3261388 | <reponame>swrobel/fhir<gh_stars>100-1000
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 0 | 0 | 0 | 0 | 0 | 0 |
{{cookiecutter.module_name}}/{{cookiecutter.module_name}}/__main__.py | SethMichaelLarson/python_project_template | 174 | 3261394 | """ This is the entry point for if your module is
executed like this: ``python -m {{cookiecutter.module_name}}``. """
from .cli import main
if __name__ == '__main__':
main()
| 0 | 0 | 0 | 0 | 0 | 0 |
observations/r/puromycin.py | hajime9652/observations | 199 | 3261431 | # -*- 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 puromycin(path) -> tuple[object, object]:
"""Reaction Velocity of an ... | 0 | 1 | 0 | 0 | 1 | 0 |
omnizart/vocal_contour/__init__.py | nicolasanjoran/omnizart | 1,145 | 3261434 | """Vocal pitch contour transcription.
Transcribes monophonic pitch contour of vocal in given polyphonic audio.
Re-implementation of the repository `Vocal-Melody-Extraction <https://github.com/s603122001/Vocal-Melody-Extraction>`_.
Feature Storage Format
----------------------
Processed feature and label will be store... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/check_version.py | suned/pfun | 126 | 3261468 | import re
from typing import Union
from main_dec import main
from pfun import Effect, Try, curry, error, files, success
class MalformedTomlError(Exception):
pass
class NoVersionMatchError(Exception):
pass
def get_version(toml: str) -> Try[MalformedTomlError, str]:
match = re.search(r'version = \"([0... | 7 | 4 | 0 | 0 | 11 | 0 |
tests/__init__.py | eic/uproot4 | 133 | 3261475 | <filename>tests/__init__.py
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/main/LICENSE
| 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/provider/hashicorp/consul.py | mjuenema/python-terrascript | 507 | 3261480 | # terrascript/provider/hashicorp/consul.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:14:36 UTC)
import terrascript
class consul(terrascript.Provider):
"""terraform-provider-consul"""
__description__: str = "terraform-provider-consul"
__namespace__: str = "hashicorp"
__name__: st... | 0 | 0 | 7 | 0 | 7 | 0 |
rekognition-ocr/Python/whole_screenshot_example.py | mervatkheir/kite-python-blog-post-code | 238 | 3261514 | <gh_stars>100-1000
import io
import json
import boto3
import numpy as np
import pandas as pd
import requests
from PIL import Image, ImageFilter
from lib import mwo_image_slicer
client = boto3.client('rekognition') #instantiate AWS client
test_imgs_path = "E:/MWO/mwo_data/data/test_data/" #test images folder
def c... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorboard/acceptance/test_tensorboard_server.py | DeepLearnI/atlas | 296 | 3261515 | <filename>tensorboard/acceptance/test_tensorboard_server.py
import re
from foundations_spec import Spec, set_up, tear_down
from foundations_contrib.utils import run_command, cd
from .mixins.container_test_mixin import ContainerTestMixin
class TestTensorboardServer(Spec, ContainerTestMixin):
@set_up
def set_... | 0 | 0 | 0 | 0 | 0 | 0 |
mp_sort/virtenv/lib/python3.6/site-packages/transcrypt/demos/pysteroids_demo/pysteroids.py | ang-jason/fip_powerx_mini_projects-foxtrot | 2,200 | 3261553 | from __future__ import annotations
import logging
import math
import random
import audio
import org.threejs as three
from controls import Keyboard, ControlAxis
from units import Ship, Asteroid, Bullet
from utils import wrap, now, FPSCounter, coroutine, clamp, set_limits
DEBUG = True
logger = logging.getLo... | 3 | 11 | 0 | 11 | 25 | 0 |
homeassistant/components/modem_callerid/__init__.py | MrDelik/core | 30,023 | 3261572 | """The Modem Caller ID integration."""
from phone_modem import PhoneModem
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_DEVICE, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from .const import DATA_KEY_API, DO... | 4 | 2 | 0 | 0 | 6 | 0 |
torch2trt_dynamic/shape_converter.py | jinfagang/torch2trt_dynamic | 155 | 3261632 | <reponame>jinfagang/torch2trt_dynamic<filename>torch2trt_dynamic/shape_converter.py<gh_stars>100-1000
import torch
def get_tensor_shape(self):
return self.size()
old_get_attribute = torch.Tensor.__getattribute__
def new_getattribute__(self, name):
if name == 'shape':
return get_tensor_shape(self)
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/python/nimbusml/tests/pipeline/test_pipeline_subclassing.py | michaelgsharp/NimbusML | 134 | 3261638 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
import os
import unittest
import nu... | 0 | 2 | 0 | 0 | 2 | 0 |
udify/modules/text_field_embedder.py | annaproxy/udify-metalearning | 185 | 3261656 | """
A modification to AllenNLP's TextFieldEmbedder
"""
from typing import Dict, List, Optional
import warnings
import torch
from overrides import overrides
from torch.nn.modules.linear import Linear
from allennlp.common import Params
from allennlp.common.checks import ConfigurationError
from allennlp.data import Voc... | 10 | 5 | 0 | 1 | 16 | 0 |
demos/tests/performance_cases.py | kblaszczak-intel/open_model_zoo | 2,201 | 3261663 | # Copyright (c) 2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 0 | 2 | 0 | 0 | 2 | 0 |
glove-end-to-end/model.py | DeMasterboys/dialogue-understanding | 102 | 3261666 | <reponame>DeMasterboys/dialogue-understanding
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pad_sequence
from torch.autograd import Variable
if torch.cuda.is_available():
FloatTensor = torch.cuda.FloatTensor
LongTensor = torch.cuda.LongTens... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/deeplearning/sparse_training/pcl_mlp/test_mlp.py | breuera/libxsmm | 651 | 3261667 | <reponame>breuera/libxsmm
import torch
import random
import pcl_mlp
torch.manual_seed(77)
random.seed(77)
MB = 128 * 8
N = MB
K=256 #128
C=256 #64
"""
MB = 64
K= 64 #128
C= 64 #64
"""
fc = pcl_mlp.XsmmLinear(C, K)
#fc = pcl_mlp.XsmmLinear(C, K)
tl = torch.nn.Linear(C, K)
sparsity_rate = 0.8
#sparsity_rate = 0.2
... | 0 | 0 | 0 | 0 | 0 | 0 |
model_utils/network.py | gaoyiyeah/ZASR_tensorflow | 115 | 3261668 | #!/usr/bin/env python
# coding=utf-8
""" Deep Network wraper for BRNN CNN Lookahead CNN """
import tensorflow as tf
import numpy as np
scale = tf.Variable(tf.ones([1]))
offset = tf.Variable(tf.zeros([1]))
variance_epsilon = 0.001
def conv2d(batch_x, filter_shape, strides, pool_size, hyparam, use_dropout=False):
... | 0 | 0 | 0 | 0 | 0 | 0 |
doc/scripts/pickletrouble.py | stjordanis/PyTables | 869 | 3261676 | <reponame>stjordanis/PyTables<filename>doc/scripts/pickletrouble.py
import tables as tb
class MyClass:
foo = 'bar'
# An object of my custom class.
myObject = MyClass()
with tb.open_file('test.h5', 'w') as h5f:
h5f.root._v_attrs.obj = myObject # store the object
print(h5f.root._v_attrs.obj.foo) # retr... | 0 | 0 | 0 | 0 | 0 | 0 |
test/pre_train/model_stats.py | chao1412732094/tensorwatch | 3,453 | 3261711 | import tensorwatch as tw
import torchvision.models
model_names = ['alexnet', 'resnet18', 'resnet34', 'resnet101', 'densenet121']
for model_name in model_names:
model = getattr(torchvision.models, model_name)()
model_stats = tw.ModelStats(model, [1, 3, 224, 224], clone_model=False)
print(f'{model_name}: f... | 0 | 0 | 0 | 0 | 0 | 0 |
ffmpeg_streaming/_command_builder.py | ace-smart/py-streaming | 455 | 3261772 | <reponame>ace-smart/py-streaming<gh_stars>100-1000
"""
ffmpeg_streaming.build_args
~~~~~~~~~~~~
Build a command for the FFmpeg
:copyright: (c) 2020 by <NAME>.
:website: https://www.aminyazdanpanah.com
:email: <EMAIL>
:license: MIT, see LICENSE for more details.
"""
import sys
from ._utiles import cnv_options_to_arg... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/envs.py | destinyls/MonoFlex | 131 | 3261775 | from __future__ import annotations
import os
from datetime import datetime
import logging
import random
import numpy as np
import pdb
import torch
def seed_all_rng(seed: object | None=None):
"""
Set the random seed for the RNG in torch, numpy and python.
Args:
seed (int): if None, will use a stro... | 1 | 0 | 0 | 0 | 1 | 0 |
aiosmtpd/tests/conftest.py | kasimov-maxim/aiosmtpd | 257 | 3261803 | # Copyright 2014-2021 The aiosmtpd Developers
# SPDX-License-Identifier: Apache-2.0
import asyncio
import inspect
import socket
import ssl
from contextlib import suppress
from functools import wraps
from smtplib import SMTP as SMTPClient
from typing import Any, Callable, Generator, NamedTuple, Optional, Type, TypeVar
... | 0 | 0 | 0 | 0 | 0 | 1 |
lambda/lambda_function.py | gbenison/minecraft-ondemand | 1,268 | 3261825 | import os
import boto3
DEFAULT_REGION = 'us-west-2'
DEFAULT_CLUSTER = 'minecraft'
DEFAULT_SERVICE = 'minecraft-server'
REGION = os.environ.get('REGION', DEFAULT_REGION)
CLUSTER = os.environ.get('CLUSTER', DEFAULT_CLUSTER)
SERVICE = os.environ.get('SERVICE', DEFAULT_SERVICE)
if REGION is None or CLUSTER is None or SE... | 0 | 0 | 0 | 0 | 0 | 0 |
city_scrapers/mixins/chi_rogers_park_ssa.py | MAYANK25402/city-scrapers | 255 | 3261835 | <filename>city_scrapers/mixins/chi_rogers_park_ssa.py
import re
from collections import defaultdict
from datetime import datetime
from city_scrapers_core.constants import COMMISSION
from city_scrapers_core.items import Meeting
from dateutil.relativedelta import relativedelta
class ChiRogersParkSsaMixin:
timezone... | 0 | 0 | 0 | 0 | 0 | 0 |
gotools_suggestions.py | pmorie/GoTools | 121 | 3261845 | from __future__ import annotations
import sublime
import sublime_plugin
import json
import os
from .gotools_util import Buffers
from .gotools_util import GoBuffers
from .gotools_util import Logger
from .gotools_util import ToolRunner
from .gotools_settings import GoToolsSettings
class GotoolsSuggestions(sublime_plugi... | 0 | 2 | 1 | 0 | 3 | 0 |
leonardo/module/web/page/tables.py | timgates42/django-leonardo | 102 | 3261850 | <gh_stars>100-1000
import floppyforms as forms
from django.core import urlresolvers
from django.forms.models import modelformset_factory
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
from horizon.tables.formset import FormsetDataT... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/paired-eval.py | zhrlove/seq2seq_attention_1 | 383 | 3261909 | #!/usr/bin/env python3
import argparse
import sys
import numpy as np
from translate.evaluation import corpus_bleu, corpus_ter
parser = argparse.ArgumentParser()
parser.add_argument('source1')
parser.add_argument('source2')
parser.add_argument('target')
parser.add_argument('--bleu', action='store_true')
parser.add_ar... | 0 | 0 | 0 | 0 | 0 | 0 |
manager/app.py | Jamie-505/playground | 725 | 3261932 | <gh_stars>100-1000
import logging
import os
import celery_ as celery
import docker
from flask import Flask, jsonify, request
import requests
app = Flask(__name__)
import pommerman
# Game Manager and Servers
@a.app.before_request
def check_for_access():
incoming = request.get_json()
if request.path != '/pin... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/support.py | JumpingYang001/tornadis | 138 | 3261939 | <reponame>JumpingYang001/tornadis<filename>tests/support.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import unittest
try:
from unittest import mock # noqa
except ImportError:
try:
import mock # noqa
except ImportError:
pass
def test_redis_or_raise_... | 0 | 0 | 0 | 0 | 0 | 0 |
nmtpytorch/metrics/wer.py | toshohirasawa/mmt-with-monolingual-data | 420 | 3261941 | # -*- coding: utf-8 -*-
from __future__ import annotations
import editdistance
from .metric import Metric
class WERScorer:
def compute(self, refs, hyps, language: object | None=None, lowercase: bool=False) -> object:
if isinstance(hyps, str):
# hyps is a file
hyp_sents = open(hyps... | 2 | 1 | 0 | 0 | 3 | 0 |
thredo/mixin.py | RalphWalters/thredo | 340 | 3261947 | # mixin.py
__all__ = ['ThredoMixIn']
from . import io
from . import core
class ThredoMixIn:
'''
Mixin class that can be used to make standard socketserver objects to
use thredo
'''
_threads: None = None
def server_activate(self):
super().server_activate()
self.socket = io.Soc... | 0 | 0 | 1 | 0 | 1 | 0 |
reconLPT2Nbody_uNet.py | radgli/ML-Recon | 140 | 3261958 | <reponame>radgli/ML-Recon
#!/usr/bin/env python
import argparse
def get_parser():
parser = argparse.ArgumentParser(description="U-Net for ZA -> Nbody net")
parser.add_argument("cuda_visible_devices", type=str)
parser.add_argument("--cuda_cache_path", type=str,
default="/home/scratch/siyuh/nv_ComputeCache") # to... | 0 | 0 | 0 | 0 | 0 | 0 |
api/tacticalrmm/agents/migrations/0028_auto_20210206_1534.py | infinite8co/tacticalrmm | 903 | 3261964 | <filename>api/tacticalrmm/agents/migrations/0028_auto_20210206_1534.py
# Generated by Django 3.1.4 on 2021-02-06 15:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agents', '0027_agent_overdue_dashboard_alert'),
]
operations = [
migr... | 0 | 0 | 0 | 0 | 0 | 0 |
orator/dbal/platforms/mysql57_platform.py | wjzero/orator | 1,484 | 3262005 | <gh_stars>1000+
# -*- coding: utf-8 -*-
from .mysql_platform import MySQLPlatform
class MySQL57Platform(MySQLPlatform):
INTERNAL_TYPE_MAPPING = {
"tinyint": "boolean",
"smallint": "smallint",
"mediumint": "integer",
"int": "integer",
"integer": "integer",
"bigint"... | 0 | 0 | 0 | 0 | 0 | 0 |
bot_components/__init__.py | sghill/hubcommander | 1,286 | 3262007 |
SLACK_CLIENT = None
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/driver/core/arista_eos/test_arista_eos_base_driver.py | verbosemode/scrapli | 404 | 3262010 | import re
import pytest
from scrapli.driver.core.arista_eos.base_driver import PRIVS
from scrapli.exceptions import ScrapliPrivilegeError, ScrapliValueError
@pytest.mark.parametrize(
"priv_pattern",
[
("exec", "localhost>"),
("exec", "localhost(something)>"),
("exec", "localhost(some... | 0 | 1 | 0 | 0 | 1 | 0 |
src/python/bot/tokenizer/grammars/JavaScriptBaseLexer.py | mi-ac/clusterfuzz | 5,023 | 3262012 | <filename>src/python/bot/tokenizer/grammars/JavaScriptBaseLexer.py
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | 0 | 0 | 0 | 0 | 0 | 0 |
atlas/color_logger.py | alienzj/atlas | 204 | 3262030 | import os, sys
import logging, traceback
grey = "\x1b[38;21m"
green = "\x1b[32;21m"
yellow = "\x1b[33;21m"
red = "\x1b[31;21m"
bold_red = "\x1b[31;1m"
reset = "\x1b[0m"
prefix = "[Atlas] "
class ColorFormatter(logging.Formatter):
def __init__(
self,
format: str="%(asctime)s - %(name)s - %(level... | 1 | 2 | 0 | 1 | 4 | 0 |
dev_tools/modules_test_data/mod2/setup.py | LLcat1217/Cirq | 3,326 | 3262060 | from setuptools import setup
name = 'module2'
__version__ = ''
exec(open('pack2/_version.py').read())
setup(name=name, version=__version__, packages=['pack2'])
| 0 | 0 | 0 | 0 | 0 | 0 |
apps/dash-fashion-mnist-explorer/app.py | JeroenvdSande/dash-sample-apps | 2,332 | 3262116 | <reponame>JeroenvdSande/dash-sample-apps
import base64
from io import BytesIO
import numpy as np
from keras.models import load_model
from PIL import Image
import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output, State
import pickle
import plotly.ex... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/impl/parsers/ios/openconfig_vlan/switched_vlan.py | chadell/yangify | 109 | 3262117 | <filename>tests/impl/parsers/ios/openconfig_vlan/switched_vlan.py
from typing import List, Optional, cast
from tests.impl.helpers import json_helpers as jh
from yangify.parser import Parser
class SwitchedVlanConfig(Parser):
def interface_mode(self) -> Optional[str]:
v = jh.query('switchport.mode."#text"... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/inlineasm/asmrettype.py | learnforpractice/micropython-cpp | 692 | 3262121 | # test return type of inline asm
@micropython.asm_thumb
def ret_obj(r0) -> object:
pass
ret_obj(print)(1)
@micropython.asm_thumb
def ret_bool(r0) -> bool:
pass
print(ret_bool(0), ret_bool(1))
@micropython.asm_thumb
def ret_int(r0) -> int:
lsl(r0, r0, 29)
print(ret_int(0), hex(ret_int(1)), hex(ret_int(2))... | 0 | 4 | 0 | 0 | 4 | 0 |
_old/SubDump/subdump.py | tigefa4u/reddit | 444 | 3262130 | <reponame>tigefa4u/reddit
#/u/GoldenSights
import praw
import sqlite3
import time
import traceback
import urllib.parse
'''USER CONFIGURATION'''
APP_ID = ""
APP_SECRET = ""
APP_URI = ""
APP_REFRESH = ""
# https://www.reddit.com/comments/3cm1p8/how_to_make_your_bot_use_oauth2/
USERAGENT = ""
# This is a short descripti... | 0 | 0 | 0 | 0 | 0 | 0 |
imagetagger/imagetagger/images/migrations/0007_auto_20170830_1626.py | jbargu/imagetagger | 212 | 3262143 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-30 14:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('images', '0006_auto_20170825_1148'),
]
operations: list[obje... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/test_google_drive_to_sqlite.py | simonw/google-drive-to-sqlite | 128 | 3262153 | <gh_stars>100-1000
from click.testing import CliRunner
from google_drive_to_sqlite.cli import cli, DEFAULT_FIELDS
import httpx
import json
import pathlib
import pytest
import re
import stat
import sqlite_utils
TOKEN_REQUEST_CONTENT = (
b"grant_type=refresh_token&"
b"refresh_token=rtoken&"
b"client_id=14893... | 0 | 0 | 0 | 0 | 0 | 0 |
SocketProgrammingAssignment/作业2-UDPping程序/UDP_Heartbeat_client.py | moranzcw/Computer-Networking-A-Top-Down-Approach-NOTES | 4,518 | 3262176 | <reponame>moranzcw/Computer-Networking-A-Top-Down-Approach-NOTES
#可选练习一较简单,故略过
from socket import *
import time
servername='127.0.0.1'
serverPort=800
clientSocket=socket(AF_INET,SOCK_DGRAM)
for i in range(1,11):
stime=time.time()
message=str(i)+' '+str(time.time())
clientSocket.sendto(message.encod... | 0 | 0 | 0 | 0 | 0 | 0 |
climetlab/sources/multi_url.py | pmaciel/climetlab | 182 | 3262195 | # (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmenta... | 3 | 0 | 0 | 0 | 3 | 0 |
venv/lib/python3.6/site-packages/clint/textui/__init__.py | Guillaume-Fernandez/phishfinder | 1,230 | 3262251 | # -*- coding: utf-8 -*-
"""
clint.textui
~~~~~~~~~~~~
This module provides the text output helper system.
"""
import sys
if sys.platform.startswith('win'):
from ..packages import colorama
colorama.init()
from . import colored
from . import progress
from . import prompt
from .core import *
| 0 | 0 | 0 | 0 | 0 | 0 |
pyjobs/api/tests/test_job_applications_views.py | Mdslino/PyJobs | 132 | 3262290 | from json import loads
from unittest.mock import patch
from django.shortcuts import resolve_url
from django.test import TestCase
from model_bakery import baker as mommy
from model_mommy.recipe import Recipe
from pyjobs.api.views import JobResource
from pyjobs.core.models import *
from pyjobs.api.models import ApiKey
... | 0 | 0 | 0 | 0 | 0 | 0 |
pandas/tests/series/methods/test_pop.py | CJL89/pandas | 28,899 | 3262311 | <gh_stars>1000+
from pandas import Series
import pandas._testing as tm
def test_pop():
# GH#6600
ser = Series([0, 4, 0], index=["A", "B", "C"], name=4)
result = ser.pop("B")
assert result == 4
expected = Series([0, 0], index=["A", "C"], name=4)
tm.assert_series_equal(ser, expected)
| 0 | 0 | 0 | 0 | 0 | 0 |
droidlet/perception/semantic_parsing/utils/interaction_logger.py | ali-senguel/fairo | 669 | 3262316 | """
Copyright (c) Facebook, Inc. and its affiliates.
"""
import json
import os.path
class InteractionLogger:
def __init__(self):
"""Logger class for the NSP component.
args:
filepath (str): Where to log data.
headers (list): List of string headers to be used in data store.... | 0 | 0 | 0 | 0 | 0 | 0 |
pycaw/api/mmdeviceapi/__init__.py | Jan-Zeiseweis/pycaw | 234 | 3262343 | from ctypes import HRESULT, POINTER
from ctypes.wintypes import DWORD, LPCWSTR, LPWSTR, UINT
from comtypes import COMMETHOD, GUID, IUnknown
from .depend import IPropertyStore
class IMMDevice(IUnknown):
_iid_ = GUID('{D666063F-1587-4E43-81F1-B948E807363F}')
_methods_: tuple[object, object, object, object] = ... | 0 | 0 | 3 | 0 | 3 | 0 |
pygears/hdl/sv/modules/union.py | bogdanvuk/pygears | 120 | 3262344 | <reponame>bogdanvuk/pygears
from pygears import reg
from pygears.hdl.sv import SVGenPlugin
from pygears.hdl.sv.svmod import SVModuleInst
from pygears.lib.union import union_sync
from .syncguard import SVGenSyncGuard
class SVGenUnionSyncBase(SVModuleInst):
def __init__(self, node):
super().__init__(node)
... | 0 | 0 | 0 | 0 | 0 | 0 |
deploy/python/downloader/SAP_Scenarios.py | 1lomeno3/sap-hana | 194 | 3262354 | <filename>deploy/python/downloader/SAP_Scenarios.py
#!/usr/bin/env python3
#
# SMP Downloader
#
# License: GNU General Public License (GPL)
# (c) 2019 Microsoft Corp.
#
class Package(object):
selector_newest = 'max(range(len(results)), key=lambda index: results[index]["ReleaseDate"... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/reading_comprehension/utils/feature.py | MughilM/luke | 467 | 3262355 | import logging
import multiprocessing
import unicodedata
from argparse import Namespace
from contextlib import closing
from itertools import chain, repeat
from multiprocessing.pool import Pool
from tqdm import tqdm
from transformers.tokenization_roberta import RobertaTokenizer
logger = logging.getLogger(__name__)
c... | 1 | 10 | 0 | 0 | 11 | 0 |
Design/1396. Design Underground System.py | beckswu/Leetcode | 138 | 3262356 | <gh_stars>100-1000
class UndergroundSystem:
def __init__(self):
self.start = {}
self.end = {}
self.avg = {}
def checkIn(self, id: int, stationName: str, t: int) -> None:
self.start[id] = [stationName, t]
def checkOut(self, id: int, stationName: str, t: int) -> None:
... | 0 | 0 | 0 | 0 | 0 | 0 |
Z - Tool Box/LaZagne/Windows/lazagne/softwares/sysadmin/coreftp.py | dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1 | 1,290 | 3262363 | # -*- coding: utf-8 -*-
import binascii
try:
import _winreg as winreg
except ImportError:
import winreg
from lazagne.config.crypto.pyaes.aes import AESModeOfOperationECB
from lazagne.config.module_info import ModuleInfo
from lazagne.config.winstructure import OpenKey, HKEY_CURRENT_USER
class Co... | 0 | 2 | 0 | 1 | 3 | 0 |
python_code_tips/packages_example/dnac/__init__.py | zdh45222/2021MyDevNet | 156 | 3262372 | """Basic package for interacting with Cisco DNA Center"""
from .dnac_resources import dnac
from .dnac_functions import (
dnac_login,
host_list,
verify_single_host,
print_host_details,
network_device_list,
interface_details,
print_network_device_details,
print_interface_details,
)
| 0 | 0 | 0 | 0 | 0 | 0 |
api/curve/v1/services/__init__.py | QiliangFan/Baidu-Curve | 478 | 3262377 | <filename>api/curve/v1/services/__init__.py
# -*- coding: utf-8 -*-
"""
services
~~~~
:copyright: (c) 2017-2018 by Baidu, Inc.
:license: Apache, see LICENSE for more details.
"""
from .data import DataService
from .band import BandService
from .plugin import Plugin
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_input_poisson_neumann.py | clazaro/sfepy | 510 | 3262382 | from __future__ import absolute_import
input_name = '../examples/diffusion/poisson_neumann.py'
output_name = 'test_poisson_neumann.vtk'
from tests_basic import TestInput
class Test(TestInput):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
anchore/version.py | berez23/anchore | 401 | 3262394 | <reponame>berez23/anchore<filename>anchore/version.py
version = "1.1.9dev"
| 0 | 0 | 0 | 0 | 0 | 0 |
selenium_extensions/helpers.py | pythad/selenium_extensions | 153 | 3262395 | import time
from selenium.common.exceptions import StaleElementReferenceException
from selenium.common.exceptions import TimeoutException
def kill_virtual_display(self, display):
'''Kills virtual display created by ``pyvirtualdisplay.Display()``
Args:
display (pyvirtualdisplay.Display): display to k... | 2 | 3 | 0 | 0 | 5 | 0 |
ztag/transforms/http.py | justinbastress/ztag | 107 | 3262418 | <gh_stars>100-1000
from ztag.transform import ZGrabTransform, ZMapTransformOutput
from ztag import protocols, errors
from ztag.transform import Transformable
import re
# That's right, I'm parsing HTML with regex
title_regex = re.compile(r'<title>([\s\S]*?)<\/title>', re.IGNORECASE | re.UNICODE)
# Helper function to ... | 0 | 0 | 0 | 0 | 0 | 0 |
deep_dialog/dialog_system/__init__.py | ngduyanhece/KB-InfoBot | 184 | 3262429 | from .movie_dict import *
from .database import *
from .dialog_manager import *
from .dict_reader import *
| 0 | 0 | 0 | 0 | 0 | 0 |
sequana/vst.py | khourhin/sequana | 138 | 3262476 | # -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016-2020 - Sequana Development Team
#
# File author(s):
# <NAME> <<EMAIL>>
#
# Distributed under the terms of the 3-clause BSD license.
# The full license is in the LICENSE file, distributed with this software.
#
# website: ... | 1 | 3 | 0 | 0 | 4 | 0 |
venv/Lib/site-packages/pydeck/exceptions/__init__.py | ajayiagbebaku/NFL-Model | 7,702 | 3262486 | from .exceptions import BinaryTransportException, PydeckException # noqa,
| 0 | 0 | 0 | 0 | 0 | 0 |
unittest/scripts/auto/py_shell/scripts/mysqlsh_python_norecord.py | mueller/mysql-shell | 119 | 3262530 | #@ Python in interactive mode properly initializes sys.argv
testutil.call_mysqlsh(["--py", "-i" ,"-e", "import sys; print('sys.argv = {0}'.format(sys.argv))"]) | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_backtest.py | windblood/moonshot | 122 | 3262547 | # Copyright 2018 QuantRocket LLC - 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... | 0 | 32 | 0 | 0 | 32 | 0 |
homeassistant/components/tfiac/__init__.py | domwillcode/home-assistant | 30,023 | 3262571 | """The tfiac component."""
| 0 | 0 | 0 | 0 | 0 | 0 |
medspacy/common/medspacy_matcher.py | camelia-c/medspacy | 197 | 3262598 | from spacy.matcher import Matcher, PhraseMatcher
from .regex_matcher import RegexMatcher
from .base_rule import BaseRule
from spacy.tokens import Span
class MedspacyMatcher:
"""MedspacyMatcher is a class which combines spaCy's Matcher and PhraseMatcher classes
along with medspaCy's RegexMatcher and acts as o... | 4 | 6 | 1 | 4 | 15 | 0 |
setup.py | dirkesquire/pandas-highcharts | 273 | 3262601 | # -*- coding: utf-8 -*-
from distutils.core import setup
from setuptools import find_packages
setup(
name='pandas-highcharts',
version='0.5.2',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
description='pandas-highcharts is a Python package which allows you to easily build Highcharts... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ebonite/repository/__init__.py | zyfra/ebonite | 270 | 3262658 | from .artifact.base import ArtifactRepository
from .dataset.base import DatasetRepository
from .metadata.base import MetadataRepository
__all__ = ['ArtifactRepository', 'MetadataRepository', 'DatasetRepository']
| 0 | 0 | 0 | 0 | 0 | 0 |
Test/FunctionalTests/CommonTestScripts/FsmUtil.py | jethac/ATF | 821 | 3262666 | #Copyright (c) 2014 Sony Computer Entertainment America LLC. See License.txt.
import Test
def AddNewStateAndVerify(editingContext, xPos, yPos, label, size: int=64) -> object:
newState = editingContext.InsertState(xPos, yPos, label, size)
Test.Equal(label, newState.Name, "Verify label")
Test.Equal(xPos, newS... | 1 | 3 | 0 | 0 | 4 | 0 |
applications/ShapeOptimizationApplication/python_scripts/custom_ios/wrl_io.py | lkusch/Kratos | 778 | 3262720 | <reponame>lkusch/Kratos
# ==============================================================================
# KratosShapeOptimizationApplication
#
# License: BSD License
# license: ShapeOptimizationApplication/license.txt
#
# Main authors: <NAME>, https://github.com/armingeiser
#
# ========... | 0 | 0 | 0 | 0 | 0 | 0 |
theseus/embodied/measurements/tests/test_reprojection.py | facebookresearch/theseus | 236 | 3262823 | # 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 torch
import theseus as th
from theseus.utils.examples.bundle_adjustment.util import random_small_quaternion
def test_residual():
... | 0 | 0 | 0 | 0 | 0 | 0 |
tiktok_bot/models/follower.py | reliefs/tiktok_bot | 118 | 3262854 | <reponame>reliefs/tiktok_bot
from typing import List
from .request import (
ListRequestParams,
ListResponseData,
TimeOffsetRequestParams,
TimeOffsetResponseParams,
)
from .user import CommonUserDetails
class ListFollowersRequest(ListRequestParams, TimeOffsetRequestParams):
# The id of the user wh... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_fio_rm.py | sanjaymsh/Fiona | 778 | 3262855 | import os
import pytest
import fiona
from click.testing import CliRunner
from fiona.fio.main import main_group
def create_sample_data(filename, driver, **extra_meta):
meta = {
'driver': driver,
'schema': {
'geometry': 'Point',
'properties': {}
}
}
meta.update... | 0 | 0 | 0 | 0 | 0 | 0 |
infrastructure/blueprints/__init__.py | avosper-intellaegis/runway | 134 | 3262943 | <reponame>avosper-intellaegis/runway
"""Blueprints."""
from .admin_role import AdminRole
from .admin_user import AdminUser
from .cfngin_bucket import CfnginBucket
from .prevent_privilege_escalation import AdminPreventPrivilegeEscalation
from .test_runner_boundary import TestRunnerBoundary
from .test_runner_user import ... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/services/email_mgr.py | sleepingAnt/viewfinder | 645 | 3262944 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Viewfinder email send manager.
Example::
email_mgr = EmailManager()
email_mgr.SendEmail(from=u'朋友你好 <<EMAIL>>',
to='<EMAIL>',
subject='Hello friend',
... | 0 | 0 | 0 | 0 | 0 | 0 |
pythonx/ncm2_filter/substitute.py | roxma/cm2 | 1,448 | 3262989 | <filename>pythonx/ncm2_filter/substitute.py
import re
def Filter(**kargs):
key = kargs['key']
pattern = re.compile(kargs['pattern'])
replace = kargs['replace']
def filt(data, sr, sctx, sccol, matches):
for m in matches:
if key in m:
m[key] = pattern.sub(replace, m[ke... | 0 | 0 | 0 | 0 | 0 | 0 |
algs4/prim_mst.py | dumpmemory/algs4-py | 230 | 3263049 | <filename>algs4/prim_mst.py
"""
* Execution: python prim_mst.py filename.txt
* Data files: https://algs4.cs.princeton.edu/43mst/tinyEWG.txt
* https://algs4.cs.princeton.edu/43mst/mediumEWG.txt
* https://algs4.cs.princeton.edu/43mst/largeEWG.txt
*
* Compute a minimum spanning ... | 0 | 0 | 0 | 0 | 0 | 0 |
DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py | ckamtsikis/cmssw | 852 | 3263077 | import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
BTVHLTOfflineSource = DQMEDAnalyzer("BTVHLTOfflineSource",
dirname = cms.untracked.string("HLT/BTV"),
processname = cms.string("HLT"),
verbose = cms.untracked.bool... | 0 | 0 | 0 | 0 | 0 | 0 |
h2o-py/tests/testdir_algos/gbm/pyunit_7681_H2OGridSearch_get_hyperparams_dict_return_correct_params.py | vishalbelsare/h2o-3 | 6,098 | 3263079 | from __future__ import print_function
from builtins import range
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators import H2OGradientBoostingEstimator
from h2o.grid.grid_search import H2OGridSearch
import random
def get_hyperparams_dict_return_correct_params():
... | 0 | 0 | 0 | 0 | 0 | 0 |
lightning_transformers/core/nlp/seq2seq/__init__.py | maksym-taranukhin/lightning-transformers | 451 | 3263102 | from lightning_transformers.core.nlp.seq2seq.config import HFSeq2SeqConfig, Seq2SeqDataConfig # noqa: F401
from lightning_transformers.core.nlp.seq2seq.data import Seq2SeqDataModule # noqa: F401
from lightning_transformers.core.nlp.seq2seq.finetuning import FreezeEmbeddings # noqa: F401
from lightning_transformers.c... | 0 | 0 | 0 | 0 | 0 | 0 |
RecoVertex/AdaptiveVertexFinder/python/candidateVertexMerger_cfi.py | ckamtsikis/cmssw | 852 | 3263112 | import FWCore.ParameterSet.Config as cms
candidateVertexMerger = cms.EDProducer("CandidateVertexMerger",
secondaryVertices = cms.InputTag("inclusiveCandidateVertexFinder"),
maxFraction = cms.double(0.7),
minSignificance = cms.double(2)
)
| 0 | 0 | 0 | 0 | 0 | 0 |
mudpi/extensions/group/trigger.py | icyspace/mudpi-core | 163 | 3263115 | <reponame>icyspace/mudpi-core<gh_stars>100-1000
"""
Group Trigger Interface
Allows triggers to be grouped
together for complex conditions.
"""
from mudpi.exceptions import ConfigError
from mudpi.extensions import BaseInterface
from mudpi.extensions.trigger import Trigger
from mudpi.logger.Logger import Log... | 0 | 0 | 0 | 0 | 0 | 0 |
drivers/devices/kinect_azure/post_processing.py | takuya-ki/wrs | 522 | 3263154 | <reponame>takuya-ki/wrs
import cv2
import numpy as np
def smooth_depth_image(depth_image, max_hole_size=10):
"""Smoothes depth image by filling the holes using inpainting method
Parameters:
depth_image(Image): Original depth image
max_hole_size(int): Maximum size of hole to fill
Returns:
Image: Smoot... | 0 | 0 | 0 | 0 | 0 | 0 |
viper/core/archiver.py | acd62081/viper | 1,131 | 3263292 | <filename>viper/core/archiver.py
# -*- coding: utf-8 -*-
# This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
import os
import re
import sys
import inspect
from distutils.spawn import find_executable
import pkg_resources
import logging
# Compression
... | 0 | 0 | 0 | 0 | 0 | 0 |
protonfixes/gamefixes/379720.py | Citiroller/protonfixes | 213 | 3263330 | """ Game fix for Doom 2016
"""
#pylint: disable=C0103
from protonfixes import util, download
def main():
""" Install vcrun2015
"""
# https://github.com/ValveSoftware/Proton/issues/788#issuecomment-416651267
util.protontricks('vcrun2015')
# disable chroma implementation that is broken in wine
... | 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.