max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
lmgtfy/views.py | opendata/LMGTDFY | 120 | 11155251 | import csv
from django.contrib import messages
from django.shortcuts import HttpResponseRedirect, resolve_url, HttpResponse
from django.views.generic import FormView, ListView
from lmgtfy.forms import MainForm
from lmgtfy.helpers import search_bing, check_valid_tld
from lmgtfy.models import Domain, DomainSearch, Doma... |
modules/aws_iam_role/aws_iam_role.py | riddopic/opta | 595 | 11155263 | from typing import TYPE_CHECKING
from modules.base import AWSIamAssembler, ModuleProcessor, get_eks_module_refs
from opta.exceptions import UserErrors
if TYPE_CHECKING:
from opta.layer import Layer
from opta.module import Module
class AwsIamRoleProcessor(ModuleProcessor, AWSIamAssembler):
def __init__(s... |
h2o-py/tests/testdir_algos/gam/pyunit_PUBDEV_7367_gridsearch_subspaces_invalid.py | vishalbelsare/h2o-3 | 6,098 | 11155265 | <reponame>vishalbelsare/h2o-3
from __future__ import division
from __future__ import print_function
from past.utils import old_div
import sys
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.gam import H2OGeneralizedAdditiveEstimator
from h2o.grid.grid_search import H2OGrid... |
standalone_tests/offline_sync_train.py | borisgrafx/client | 3,968 | 11155342 | import wandb
wandb.init(mode="offline", config=dict(init1=11, init2=22))
wandb.config.extra3=33
wandb.log(dict(this="that"))
wandb.log(dict(yes=2))
|
Sobolev/make_gif.py | inamori/DeepLearningImplementations | 2,010 | 11155346 | <reponame>inamori/DeepLearningImplementations<filename>Sobolev/make_gif.py
import glob
import shlex
import subprocess
from natsort import natsorted
list_files = glob.glob("figures/*")
list_files_20pts = natsorted([f for f in list_files if "20_npts" in f])
list_files_100pts = natsorted([f for f in list_files if "100_n... |
python/cogs/extra/chase.py | dev-null-undefined/felix | 135 | 11155374 | """This is a cog for a discord.py bot.
it prints out either a random or specified chase pic,
the guide to those chase pics and some additional resources.
Commands:
chase
├ num print a specific chase pic
└ random prints a random chase pic
"""
import re
from random import choice
from disc... |
src/users/migrations/0005_UserUUID.py | denkasyanov/education-backend | 151 | 11155410 | # Generated by Django 3.1.8 on 2021-05-01 23:33
import uuid
from django.db import migrations, models
def set_random_uuid_for_all_users(apps, schema_editor):
for user in apps.get_model('users.User').objects.filter(uuid__isnull=True).iterator():
user.uuid = uuid.uuid4()
user.save(update_fields=['uu... |
utils/report.py | WuDiDaBinGe/TAKG | 130 | 11155425 | import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import numpy as np
def export_train_and_valid_reward(train_reward, valid_reward, plot_every, path):
# Export the results to a csv file
labels = ['Training reward:,', 'Validation reward:,']
float_lists = [train_reward, valid_rewar... |
models/SelectionGAN/person_transfer/models/model_variants.py | xianjian-xie/pose-generation | 445 | 11155431 | import torch.nn as nn
import functools
import torch
import functools
import torch.nn.functional as F
class PATBlock(nn.Module):
def __init__(self, dim, padding_type, norm_layer, use_dropout, use_bias, cated_stream2=False):
super(PATBlock, self).__init__()
self.conv_block_stream1 = self.build_conv_... |
src/GridCal/Engine/IO/sqlite_interface.py | mzy2240/GridCal | 284 | 11155432 | # This file is part of GridCal.
#
# GridCal 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 3 of the License, or
# (at your option) any later version.
#
# GridCal is distributed in the hope that... |
optimus/helpers/functions_spark.py | liRONCO11/optimus | 1,045 | 11155436 | from functools import reduce
from optimus.helpers.core import val_to_list
from optimus.helpers.functions import random_int
from optimus.helpers.raiseit import RaiseIt
from optimus.infer import is_
def traverse(obj, path=None, callback=None):
"""
Traverse a deep nested python structure
:param obj: object t... |
tests/constraints/test_int_constraints.py | lyz-code/pydantic-factories | 163 | 11155437 | from typing import Optional
import pytest
from hypothesis import given
from hypothesis.strategies import integers
from pydantic import ConstrainedInt
from pydantic_factories.constraints.constrained_integer_handler import (
handle_constrained_int,
)
from pydantic_factories.utils import passes_pydantic_multiple_val... |
lyrebird/checker/event.py | DuXiao1997/lyrebird | 737 | 11155469 | from lyrebird import application
from .. import checker
class CheckerEventHandler:
def __call__(self, channel, *args, **kw):
def func(origin_func):
if not checker.scripts_tmp_storage.get(checker.TYPE_EVENT):
checker.scripts_tmp_storage[checker.TYPE_EVENT] = []
chec... |
fairlearn/datasets/_constants.py | alliesaizan/fairlearn | 1,142 | 11155483 | # Copyright (c) Microsoft Corporation and Fairlearn contributors.
# Licensed under the MIT License.
_DOWNLOAD_DIRECTORY_NAME = ".fairlearn-data"
|
core/dbt/events/adapter_endpoint.py | f1fe/dbt | 3,156 | 11155500 | from dataclasses import dataclass
from dbt.events.functions import fire_event
from dbt.events.types import (
AdapterEventDebug, AdapterEventInfo, AdapterEventWarning, AdapterEventError
)
@dataclass
class AdapterLogger():
name: str
def debug(self, msg, *args, exc_info=None, extra=None, stack_info=False):
... |
download_bigann.py | DmitryKey/hnswlib | 1,765 | 11155508 | <filename>download_bigann.py
import os.path
import os
links = ['ftp://ftp.irisa.fr/local/texmex/corpus/bigann_query.bvecs.gz',
'ftp://ftp.irisa.fr/local/texmex/corpus/bigann_gnd.tar.gz',
'ftp://ftp.irisa.fr/local/texmex/corpus/bigann_base.bvecs.gz']
os.makedirs('downloads', exist_ok=True)
os.makedir... |
tests/test_blocking.py | ShadowJonathan/txredisapi | 104 | 11155511 | # coding: utf-8
# Copyright 2009 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
pylearn2/utils/tests/test_compile.py | ikervazquezlopez/Pylearn2 | 2,045 | 11155567 | """Tests for compilation utilities."""
import theano
import pickle
from pylearn2.utils.compile import (
compiled_theano_function, HasCompiledFunctions
)
class Dummy(HasCompiledFunctions):
const = 3.14159
@compiled_theano_function
def func(self):
val = theano.tensor.as_tensor_variable(self.co... |
tests/test_getitem.py | Jeremiah-England/Shapely | 2,382 | 11155575 | from . import unittest, shapely20_deprecated
from shapely import geometry
class CoordsGetItemTestCase(unittest.TestCase):
def test_index_2d_coords(self):
c = [(float(x), float(-x)) for x in range(4)]
g = geometry.LineString(c)
for i in range(-4, 4):
self.assertTrue(g.coords[i]... |
tests/stress/recursive_gen.py | sebastien-riou/micropython | 13,648 | 11155583 | <filename>tests/stress/recursive_gen.py
# test deeply recursive generators
# simple "yield from" recursion
def gen():
yield from gen()
try:
list(gen())
except RuntimeError:
print("RuntimeError")
# recursion via an iterator over a generator
def gen2():
for x in gen2():
yield x
try:
next... |
rpython/jit/metainterp/test/test_zvector.py | m4sterchain/mesapy | 381 | 11155588 | <filename>rpython/jit/metainterp/test/test_zvector.py
import py
import sys
import pytest
import math
import functools
from hypothesis import given, note, strategies as st, settings
from rpython.jit.metainterp.warmspot import ll_meta_interp, get_stats
from rpython.jit.metainterp.test.support import LLJitMixin
from rpyth... |
pysad/statistics/median_meter.py | selimfirat/pysad | 155 | 11155593 | from heapq import heappush
from pysad.core.base_statistic import UnivariateStatistic
class MedianMeter(UnivariateStatistic):
"""The statistic that keeps track of the median.
Attrs:
num_items (int): The number of items that are used to update the statistic.
lst (list[float]): The l... |
.modules/.metagoofil/hachoir_core/cmd_line.py | termux-one/EasY_HaCk | 1,103 | 11155621 | <reponame>termux-one/EasY_HaCk
from optparse import OptionGroup
from hachoir_core.log import log
from hachoir_core.i18n import _, getTerminalCharset
from hachoir_core.tools import makePrintable
import hachoir_core.config as config
def getHachoirOptions(parser):
"""
Create an option group (type optparse.OptionG... |
jokekappa/__init__.py | CodeTengu/jokekappa | 107 | 11155632 | # coding: utf-8
from jokekappa.core import get_joke, get_jokes, update_jokes # noqa: F401
__version__ = '0.1.9'
|
demo/cilrs/cilrs_train.py | L-Net-1992/DI-drive | 219 | 11155661 | from collections import defaultdict
import os
import numpy as np
from ding.utils.data.collate_fn import default_collate, default_decollate
from easydict import EasyDict
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
from torch.optim import Adam
from co... |
configs/detection/_base_/datasets/nway_kshot/base_voc.py | BIGWangYuDong/mmfewshot | 376 | 11155667 | <gh_stars>100-1000
# dataset settings
img_norm_cfg = dict(
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
train_multi_pipelines = dict(
query=[
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(type='Resize', img_scale=(1000, 600), k... |
buildroot-2021.05.3/support/testing/tests/package/test_python_gpiozero.py | thvlt/tinyemu | 349 | 11155702 | from tests.package.test_python import TestPythonPackageBase
class TestPythonGpiozero(TestPythonPackageBase):
config = TestPythonPackageBase.config
sample_scripts = ["tests/package/sample_python_gpiozero.py"]
def run_sample_scripts(self):
cmd = self.interpreter + " sample_python_gpiozero.py"
... |
tests/test_0088-read-with-http.py | eic/uproot4 | 133 | 11155713 | <reponame>eic/uproot4
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/main/LICENSE
from __future__ import absolute_import
import pytest
import uproot
@pytest.mark.network
def test_issue176():
with uproot.open(
"https://starterkit.web.cern.ch/starterkit/data/advanced-python-2019/d... |
setup.py | mforbes/anaconda-project | 188 | 11155716 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2017, Anaconda, Inc. All rights reserved.
#
# Licensed under the terms of the BSD 3-Clause License.
# (See LICENSE.txt for details)
# ------------------------------------------------------------------... |
demo/demo_fa.py | Alias-Alan/pypsy | 169 | 11155746 | # coding=utf-8
# 探索性因子分析
from __future__ import print_function, division, unicode_literals
import numpy as np
from psy import Factor, data
score = data['lsat.dat']
factor = Factor(score, 5)
print(factor.loadings)
|
python/app/plugins/http/Weaver Ecology OA/Weaver_Ecology_Oa_Config.py | taomujian/linbing | 351 | 11155757 | #/usr/bin/python3
import json
import pyDes
import urllib3
from app.lib.utils.request import request
from app.lib.utils.common import get_useragent
class Weaver_Ecology_Oa_Config_BaseVerify:
def __init__(self, url):
self.info = {
'name': '泛微-OA Config信息泄露漏洞',
'description': '泛微-OA C... |
tests/test_api_events.py | tonykhbo/ansible-runner-service | 174 | 11155759 | <reponame>tonykhbo/ansible-runner-service<gh_stars>100-1000
import sys
import json
import logging
import unittest
sys.path.extend(["../", "./"])
from common import APITestCase # noqa
# turn of normal logging that the ansible_runner_service will generate
nh = logging.NullHandler()
r = logging.getLogger()
r.addHandl... |
Beginner/Mathison and pangrams (MATPAN)/mathison.py | anishsingh42/CodeChef | 127 | 11155770 | <gh_stars>100-1000
t = int(input())
while t:
N = list(map(int,input().split()))
S = input()
letters = "abcdefghijklmnopqrstuvwxyz"
arr=[]
for i in range(26):
if letters[i] not in S:
arr.append(N[i])
print(sum(arr))
t = t-1 |
tests/docstring/create_param_docstring_test.py | nickgaya/bravado-core | 122 | 11155771 | # -*- coding: utf-8 -*-
import pytest
from bravado_core.docstring import create_param_docstring
def test_param_with_no_default_value(param_spec):
del param_spec['default']
expected = \
":param status: the status, yo! (optional)\n" \
":type status: array\n"
assert expected == create_param_... |
src/tryceratops/fixers/__init__.py | swellander/tryceratops | 269 | 11155789 | from __future__ import annotations
from typing import TYPE_CHECKING, Set, Type
from .base import BaseFixer
from .exception_block import LoggerErrorFixer, RaiseWithoutCauseFixer, VerboseReraiseFixer
if TYPE_CHECKING:
from tryceratops.filters import GlobalSettings
FIXER_CLASSES: Set[Type[BaseFixer]] = {
Raise... |
tests/proofpdf_test.py | NetaP495L/afdko | 732 | 11155803 | import pytest
from runner import main as runner
from differ import main as differ
from test_utils import get_input_path, get_expected_path, get_temp_file_path
def _get_filename_label(file_name):
sep_index = file_name.find('_')
if sep_index == -1:
return ''
return file_name.split('.')[0][sep_index... |
rllib/rollout.py | mgelbart/ray | 21,382 | 11155808 | <reponame>mgelbart/ray<filename>rllib/rollout.py
#!/usr/bin/env python
from ray.rllib import evaluate
from ray.rllib.evaluate import rollout, RolloutSaver, run
from ray.rllib.utils.deprecation import deprecation_warning
deprecation_warning(old="rllib rollout", new="rllib evaluate", error=False)
# For backward compat... |
src/oci/log_analytics/models/label_priority.py | Manny27nyc/oci-python-sdk | 249 | 11155828 | <gh_stars>100-1000
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LIC... |
scripts/kilt/convert_kilt_100w_passage_tsv_to_jsonl.py | keleog/pyserini | 451 | 11155842 | #
# Pyserini: Reproducible IR research with sparse and dense representations
#
# 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... |
server/data_common/fbs/NetEncoding/Matrix.py | atong01/cellxgene | 403 | 11155874 | <filename>server/data_common/fbs/NetEncoding/Matrix.py
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: NetEncoding
import flatbuffers
class Matrix(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsMatrix(cls, buf, offset):
n = flatbuffers.encode.Get(flatbu... |
tars/api/serializers/base.py | js882829/tars | 371 | 11155884 | <gh_stars>100-1000
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.core.validators import ip_address_validators
from django.core.exceptions import ObjectDoesNotExist
from django.utils import timezone
from rest_framework import serializers
from rest_framework.pagination import Pagin... |
ch07/SpiderNode/SpiderWork.py | AaronZhengkk/SpiderBook | 990 | 11155920 | <reponame>AaronZhengkk/SpiderBook
#coding:utf-8
from multiprocessing.managers import BaseManager
from .HtmlDownloader import HtmlDownloader
from .HtmlParser import HtmlParser
class SpiderWork(object):
def __init__(self):
#初始化分布式进程中的工作节点的连接工作
# 实现第一步:使用BaseManager注册获取Queue的方法名称
BaseManager... |
bin/api_connector_splunk/cloudconnectlib/core/template.py | CyberGRX/api-connector-splunk | 106 | 11155948 | from jinja2 import Template
import re
# This pattern matches the template with only one token inside like "{{
# token1}}", "{{ token2 }"
PATTERN = re.compile(r"^\{\{\s*(\w+)\s*\}\}$")
def compile_template(template):
_origin_template = template
_template = Template(template)
def translate_internal(contex... |
theseus/optimizer/manifold_gaussian.py | jeffin07/theseus | 236 | 11155951 | # 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.
from itertools import count
from typing import List, Optional, Sequence, Tuple
import torch
from theseus.geometry import LieGroup, Manifol... |
tests/traces/__init__.py | drewbug/internalblue | 485 | 11155963 | <reponame>drewbug/internalblue
from __future__ import print_function
from __future__ import absolute_import
from tests.traces.testwrapper import trace_test, get_trace_path_cmd_tuple
import unittest
import os
tracedir = os.path.dirname(__file__)
def generate_test_suite_from_traces():
def generate_test_from_file(... |
acl2020_submission/annotation_tools/tools/construct_input_for_turk.py | yjernite/craftassist | 626 | 11155978 | <gh_stars>100-1000
"""
Copyright (c) Facebook, Inc. and its affiliates.
"""
import argparse
from annotation_tool_1 import MAX_WORDS
def print_csv_format(filename, option_num):
if option_num == 1:
# level 1
print("command", *["word{}".format(i) for i in range(MAX_WORDS)], sep=",")
with op... |
autoPyTorch/pipeline/nodes/optimizer_selector.py | mens-artis/Auto-PyTorch | 1,657 | 11155985 | <filename>autoPyTorch/pipeline/nodes/optimizer_selector.py<gh_stars>1000+
__author__ = "<NAME>, <NAME> and <NAME>"
__version__ = "0.0.1"
__license__ = "BSD"
from autoPyTorch.pipeline.base.pipeline_node import PipelineNode
from autoPyTorch.components.optimizer.optimizer import AutoNetOptimizerBase
import torch.nn as... |
python/dgl/backend/tensorflow/sparse_optim.py | ketyi/dgl | 9,516 | 11156002 | <reponame>ketyi/dgl
"""Sparse optimizer is not supported for tensorflow""" |
malaya_speech/utils/aligner.py | huseinzol05/malaya-speech | 111 | 11156023 | import numpy as np
def beta_binomial_prior_distribution(phoneme_count, mel_count, scaling_factor=1.0):
from scipy.stats import betabinom
x = np.arange(0, phoneme_count)
mel_text_probs = []
for i in range(1, mel_count + 1):
a, b = scaling_factor * i, scaling_factor * (mel_count + 1 - i)
... |
tests/helpers.py | fernandobrito/diff_cover | 276 | 11156053 | """
Test helper functions.
"""
import os.path
import random
HUNK_BUFFER = 2
MAX_LINE_LENGTH = 300
LINE_STRINGS = ["test", "+ has a plus sign", "- has a minus sign"]
def fixture_path(rel_path):
"""
Returns the absolute path to a fixture file
given `rel_path` relative to the fixture directory.
"""
... |
src/pandas_profiling/report/structure/variables/render_url.py | abhicantdraw/pandas-profiling | 8,107 | 11156066 | <reponame>abhicantdraw/pandas-profiling
from pandas_profiling.config import Settings
from pandas_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from pandas_profiling.report.presentation.core import (
Container,
FrequencyTable,
FrequencyTableSmall,
Table,
VariableInfo,
)
from panda... |
test/fixtures/python/matching/docstrings.py | matsubara0507/semantic | 8,844 | 11156075 | def foo():
"""here's a docstring"""
pass
def bar():
"""and another"""
pass
|
examples/client/threads/fiddle_client.py | flocko-motion/python-socketio | 2,977 | 11156076 | import socketio
sio = socketio.Client()
@sio.event
def connect():
print('connected to server')
@sio.event
def disconnect():
print('disconnected from server')
@sio.event
def hello(a, b, c):
print(a, b, c)
if __name__ == '__main__':
sio.connect('http://localhost:5000', auth={'token': '<PASSWORD>'... |
tests/trac/test-trac-0232.py | eLBati/pyxb | 123 | 11156087 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb.binding.generate
import pyxb.utils.domutils
from pyxb.utils import six
from xml.dom import Node
import os.path
xsd='''<?xml version="1.0" encoding="UTF-8"?>
<xs:... |
boto/beanstalk/exception.py | Yurzs/boto | 5,079 | 11156124 | <reponame>Yurzs/boto
import sys
from boto.compat import json
from boto.exception import BotoServerError
def simple(e):
code = e.code
if code.endswith('Exception'):
code = code.rstrip('Exception')
try:
# Dynamically get the error class.
simple_e = getattr(sys.modules[__name__], co... |
samples/tutorials/python/jupyter/sample_python_jupyter.py | manikanth/sql-server-samples | 4,474 | 11156130 | <reponame>manikanth/sql-server-samples
import pyodbc
server = 'myserver'
database = 'mydb'
username = 'myusername'
password = '<PASSWORD>'
#Connection String
connection = pyodbc.connect('DRIVER={SQL Server Native Client 11.0};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = connection... |
alipay/aop/api/response/KoubeiRetailWmsInboundorderBatchqueryResponse.py | snowxmas/alipay-sdk-python-all | 213 | 11156152 | <reponame>snowxmas/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.InboundOrderVO import InboundOrderVO
class KoubeiRetailWmsInboundorderBatchqueryResponse(AlipayResponse):
def __init__(s... |
tests/test_dict_loading.py | insolor/pymorphy2 | 859 | 11156181 | <reponame>insolor/pymorphy2
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import pytest
import pymorphy2
from pymorphy2.analyzer import lang_dict_path
def test_old_dictionaries_supported():
pytest.importorskip("pymorphy2_dicts")
m = pymorphy2.MorphAnalyzer(lang='ru-old')
... |
ports/nrf/freeze/test.py | sebastien-riou/micropython | 13,648 | 11156193 | import sys
def hello():
print("Hello %s!" % sys.platform)
|
manager/celery_.py | Jamie-505/playground | 725 | 11156201 | # TODO: Add Documentation.
from collections import defaultdict
import os
import random
import shutil
import sys
import time
import traceback
import docker
from celery import Celery
import requests
import subprocess
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import pommerman
client = docker.from_env()
clien... |
example.py | zhiburt/rtoml | 136 | 11156217 | from datetime import datetime, timezone, timedelta
import rtoml
obj = {
'title': 'TOML Example',
'owner': {
'dob': datetime(1979, 5, 27, 7, 32, tzinfo=timezone(timedelta(hours=-8))),
'name': '<NAME>',
},
'database': {
'connection_max': 5000,
'enabled': True,
'por... |
utils/inference_util.py | RubanSeven/CRAFT_keras | 176 | 11156276 | # -*- coding: utf-8 -*-
# @Author: Ruban
# @License: Apache Licence
# @File: inference_util.py
import cv2
import math
import numpy as np
def getDetBoxes_core(text_map, link_map, text_threshold, link_threshold, low_text):
# prepare data
link_map = link_map.copy()
text_map = text_map.copy()
... |
softlearning/replay_pools/replay_pool.py | limash/softlearning | 920 | 11156299 | <filename>softlearning/replay_pools/replay_pool.py
import abc
class ReplayPool(object):
"""A class used to save and replay data."""
@abc.abstractmethod
def add_sample(self, sample):
"""Add a transition tuple."""
pass
@abc.abstractmethod
def terminate_episode(self):
"""Cle... |
setup.py | dendisuhubdy/attention-lvcsr | 295 | 11156307 | from os import path
from setuptools import find_packages, setup
here = path.abspath(path.dirname(__file__))
setup(
name='lvsr',
description='Fully Neural LVSR',
url='https://github.com/rizar/fully-neural-lvsr',
author='<NAME>',
license='MIT',
packages=find_packages(exclude=['examples', 'docs',... |
zeus/modules/tensformers/output.py | shaido987/vega | 240 | 11156317 | # -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... |
rotkehlchen/utils/version_check.py | rotkehlchenio/rotkehlchen | 137 | 11156322 | from typing import NamedTuple, Optional
from pkg_resources import parse_version
from rotkehlchen.errors.misc import RemoteError
from rotkehlchen.externalapis.github import Github
from rotkehlchen.utils.misc import get_system_spec
class VersionCheckResult(NamedTuple):
our_version: str
latest_version: Optiona... |
datasets/food101.py | zlapp/CoOp | 317 | 11156327 | import os
from dassl.data.datasets import DATASET_REGISTRY, Datum, DatasetBase
from .oxford_pets import OxfordPets
from .dtd import DescribableTextures as DTD
@DATASET_REGISTRY.register()
class Food101(DatasetBase):
dataset_dir = "food-101"
def __init__(self, cfg):
root = os.path.abspath(os.path.e... |
templates/fips-gen.py | mattiasljungstrom/fips | 429 | 11156351 | <reponame>mattiasljungstrom/fips<filename>templates/fips-gen.py
"""
Code generator template file. This is called from a cmake
code generator build target with the full path to a
yaml file which contains detailed code gen params.
"""
import os
import sys
# FIXME PYTHON3
is_python3 = sys.version_info > (3,5)
... |
nbinteract/cli.py | bnavigator/nbinteract | 214 | 11156352 | '''Converts notebooks to interactive HTML pages.
Usage:
nbinteract init
nbinteract NOTEBOOKS ...
nbinteract [options] NOTEBOOKS ...
nbinteract (-h | --help)
`nbinteract init` initializes a GitHub project for nbinteract. It
provides guided help to set up a requirements.txt file (if needed) and a Binder
image f... |
zentral/contrib/osquery/migrations/0008_auto_20210323_1844.py | janheise/zentral | 634 | 11156381 | # Generated by Django 2.2.18 on 2021-03-23 18:44
import django.contrib.postgres.fields
import django.core.validators
from django.db import migrations, models
from django.db.models import F
def update_osquery_queries(apps, schema_editor):
Pack = apps.get_model("osquery", "Pack")
for pack in Pack.objects.all(... |
Examples/6.2.2 Hashing Consumer.py | wangyonghong/RabbitMQ-in-Depth | 111 | 11156402 | <reponame>wangyonghong/RabbitMQ-in-Depth<filename>Examples/6.2.2 Hashing Consumer.py<gh_stars>100-1000
import os
import hashlib
import rabbitpy
# Create the worker queue
queue_name = 'hashing-worker-%s' % os.getpid()
queue = rabbitpy.Queue(channel, queue_name,
auto_delete=True,
... |
entity/cards/LT21_04H/__init__.py | x014/lushi_script | 102 | 11156407 | # -*- coding: utf-8 -*-
import entity.cards.LT21_04H.LT21_019
import entity.cards.LT21_04H.LT21_020
import entity.cards.LT21_04H.LT21_021
import entity.cards.LT21_04H.LT21_022_
import entity.cards.LT21_04H.LT21_023_
import entity.cards.LT21_04H.LT21_024_
|
spacy/tests/lang/tr/test_tokenizer.py | snosrap/spaCy | 22,040 | 11156410 | import pytest
ABBREV_TESTS = [
("Dr. <NAME> ile görüştüm.", ["Dr.", "Murat", "Bey", "ile", "görüştüm", "."]),
("Dr.la görüştüm.", ["Dr.la", "görüştüm", "."]),
("Dr.'la görüştüm.", ["Dr.'la", "görüştüm", "."]),
("TBMM'de çalışıyormuş.", ["TBMM'de", "çalışıyormuş", "."]),
(
"Hem İst. hem Ank... |
fusepy/setup.py | ffroehling/fuse_module_driver_framework | 229 | 11156452 | #!/usr/bin/env python
from __future__ import with_statement
from setuptools import setup
with open('README') as readme:
documentation = readme.read()
setup(
name = 'fusepy',
version = '3.0.1',
description = 'Simple ctypes bindings for FUSE',
long_description = documentation,
author = '<NAME... |
py_entitymatching/explorer/pandastable/pandastable_wrapper.py | kvpradap/py_entitymatching | 165 | 11156473 | <filename>py_entitymatching/explorer/pandastable/pandastable_wrapper.py
try:
from tkinter import *
except ImportError as e:
from Tkinter import *
from py_entitymatching.utils.validation_helper import validate_object_type
import pandas as pd
def data_explore_pandastable(df):
"""
Wrapper function for p... |
rotkehlchen/tests/fixtures/greenlets.py | coblee/rotki | 137 | 11156476 | import pytest
from rotkehlchen.greenlets import GreenletManager
@pytest.fixture(scope='session')
def greenlet_manager(messages_aggregator):
return GreenletManager(msg_aggregator=messages_aggregator)
@pytest.fixture
def function_greenlet_manager(function_scope_messages_aggregator):
return GreenletManager(ms... |
test/apps/_graphql/_fastapi/__init__.py | stannum-l/schemathesis | 563 | 11156491 | from fastapi import FastAPI
from strawberry.fastapi import GraphQLRouter
from ..schema import schema
def create_app(path="/graphql"):
app = FastAPI()
graphql_app = GraphQLRouter(schema)
app.include_router(graphql_app, prefix=path)
return app
|
accountauth/models.py | FuentesFelipe/asvs | 128 | 11156500 | <gh_stars>100-1000
from django.db import models
# Create your models here.
from django.contrib.auth.models import AbstractUser
class CustomUser(AbstractUser):
is_superuser = models.BooleanField()
is_two_factor_enabled = models.BooleanField()
secret= models.CharField(max_length=400)
|
import.py | ChienNguyenVP/kma_ctf | 501 | 11156520 | """
python import.py export.zip
"""
from CTFd import create_app
from CTFd.utils.exports import import_ctf
import sys
app = create_app()
with app.app_context():
import_ctf(sys.argv[1])
|
inter/LiftTicketInit.py | middleprince/12306 | 33,601 | 11156535 | <gh_stars>1000+
# coding=utf-8
import re
class liftTicketInit:
def __init__(self, session):
self.session = session
def reqLiftTicketInit(self):
"""
请求抢票页面
:return:
"""
urls = self.session.urls["left_ticket_init"]
# 获取初始化的结果
result = self.session... |
src/misc/listening_test.py | entn-at/blow | 147 | 11156549 | <reponame>entn-at/blow
import sys,argparse,os,subprocess
import numpy as np
# Arguments
parser=argparse.ArgumentParser(description='Audio listening script')
parser.add_argument('--path_refs_train',default='',type=str,required=True,help='(default=%(default)s)')
parser.add_argument('--path_refs_test',default='',type=str... |
kubeshell/completer.py | manusajith/kube-shell | 2,143 | 11156582 | <filename>kubeshell/completer.py<gh_stars>1000+
from __future__ import absolute_import, unicode_literals, print_function
from subprocess import check_output
from prompt_toolkit.completion import Completer, Completion
from fuzzyfinder import fuzzyfinder
import logging
import shlex
import json
import os
import os.path
f... |
homeassistant/components/tailscale/coordinator.py | MrDelik/core | 30,023 | 11156583 | """DataUpdateCoordinator for the Tailscale integration."""
from __future__ import annotations
from tailscale import Device, Tailscale, TailscaleAuthenticationError
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY
from homeassistant.core import HomeAssistant
from homeas... |
tests/test_reader.py | Vimos/img2dataset | 482 | 11156603 | <reponame>Vimos/img2dataset<filename>tests/test_reader.py
from img2dataset.reader import Reader
import os
from fixtures import generate_input_file, setup_fixtures
import pytest
import math
import time
import gc
import psutil
import shutil
import pandas as pd
def current_memory_usage():
return psutil.Process().mem... |
examples/analog_in.py | Jcc99/Adafruit_Blinka | 294 | 11156615 | """Analog in demo"""
import time
import board
from analogio import AnalogIn
analog_in = AnalogIn(board.A1)
def get_voltage(pin):
return (pin.value * 3.3) / 4096
while True:
print((get_voltage(analog_in),))
time.sleep(0.1)
|
corehq/apps/smsbillables/management/commands/bootstrap_yo_gateway.py | dimagilg/commcare-hq | 471 | 11156646 | <reponame>dimagilg/commcare-hq<gh_stars>100-1000
from decimal import Decimal
from django.core.management.base import BaseCommand
from corehq.apps.accounting.models import Currency
from corehq.apps.sms.models import INCOMING, OUTGOING
from corehq.apps.smsbillables.models import (
SmsGatewayFee,
SmsGatewayFeeCr... |
examples/twitter_inlet.py | Voyz/databay | 175 | 11156647 | import os
import tweepy
from databay import Inlet, Link
from databay.outlets import PrintOutlet
from databay.planners import SchedulePlanner
class TwitterInlet(Inlet):
"""
An implementation of an `Inlet` that uses the Tweepy (https://www.tweepy.org/)
Twitter client to pull tweets from either a specific u... |
examples/python/shakespeare.py | thekuwayama/spark-bigquery-connector | 135 | 11156659 | #!/usr/bin/env python
# Copyright 2018 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 require... |
stonesoup/movable/tests/test_movable.py | Red-Portal/Stone-Soup-1 | 157 | 11156663 | from datetime import datetime, timedelta
import pytest
import numpy as np
from stonesoup.models.transition.linear import ConstantVelocity, ConstantTurn, \
CombinedLinearGaussianTransitionModel
from stonesoup.movable import MovingMovable, FixedMovable, MultiTransitionMovable
from stonesoup.types.array import State... |
rally/plugins/task/exporters/json_exporter.py | lolwww/rally | 263 | 11156747 | <filename>rally/plugins/task/exporters/json_exporter.py<gh_stars>100-1000
# 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/lic... |
cme/modules/get_netdomaincontroller.py | retr0-13/CrackMapExec | 6,044 | 11156749 | <filename>cme/modules/get_netdomaincontroller.py
from cme.helpers.powershell import *
from cme.helpers.logger import write_log, highlight
from datetime import datetime
from io import StringIO
class CMEModule:
name = 'get_netdomaincontroller'
description = "Enumerates all domain controllers"
supported_prot... |
codigo/Live177/aa.py | BrunoPontesLira/live-de-python | 572 | 11156754 | <gh_stars>100-1000
from pprint import pprint
pprint('Eduardo')
|
src/gtk/toga_gtk/widgets/internal/buttons/refresh.py | freespace/toga | 1,261 | 11156793 | from toga_gtk.libs import Gtk
from .base import ParentPosition
class RefreshButtonWidget(Gtk.Revealer):
def __init__(self, position: Gtk.Align, margin: int, *args, **kwargs):
super().__init__(*args, **kwargs)
self.parent = None
self.refresh_btn = Gtk.Button.new_from_icon_name(
... |
gcloud/template_base/domains/importer.py | DomineCore/bk-sops | 881 | 11156825 | <reponame>DomineCore/bk-sops
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may n... |
jax_verify/src/nonconvex/duals.py | lberrada/jax_verify | 109 | 11156834 | # coding=utf-8
# Copyright 2021 The jax_verify 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 applicable la... |
dopamine/jax/networks.py | wwjiang007/dopamine | 9,825 | 11156853 | # coding=utf-8
# Copyright 2018 The Dopamine 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 applicable law... |
applications/HDF5Application/tests/test_hdf5_core_mpi.py | lkusch/Kratos | 778 | 11156857 | <filename>applications/HDF5Application/tests/test_hdf5_core_mpi.py<gh_stars>100-1000
import KratosMultiphysics
import KratosMultiphysics.HDF5Application as KratosHDF5
from KratosMultiphysics.HDF5Application import core
from KratosMultiphysics.HDF5Application.core import operations, file_io
import KratosMultiphysics.Kra... |
benchmarks/operator_benchmark/pt/matrix_mult_test.py | Hacky-DH/pytorch | 60,067 | 11156858 | import operator_benchmark as op_bench
import torch
"""
Microbenchmarks for batch matrix mult with einsum and torch.bmm.
"""
batch_mm_configs_short = op_bench.config_list(
attr_names=["B", "M", "N", "K"],
attrs=[
[4, 5, 3, 2],
[32, 25, 20, 30],
[128, 100, 120, 110],
],
cross_pro... |
pybliometrics/scopus/tests/test_SubjectClassifications.py | herreio/pybliometrics | 186 | 11156866 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for `scopus.SubjectClassifications` module."""
from nose.tools import assert_equal, assert_true
from pybliometrics.scopus import SubjectClassifications
# Search by words in subject description
sub1 = SubjectClassifications({'description': 'Physics'}, refresh=3... |
tests/e2e_tests/test_permissions.py | shikher-chhawchharia/google-play-scraper | 325 | 11156872 | from unittest import TestCase
from google_play_scraper.features.permissions import permissions
class TestPermission(TestCase):
def test_reply_data_all_types(self):
result = permissions("com.spotify.music", lang="en", country="us")
self.assertDictEqual(
{
"Device ID & ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.