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 |
|---|---|---|---|---|
setup.py | liudongliangHI/ProLIF | 123 | 11122489 | <filename>setup.py
from setuptools import setup
import versioneer
import re
# manually check RDKit version
try:
from rdkit import __version__ as rdkit_version
except ImportError:
raise ImportError("ProLIF requires RDKit but it is not installed")
else:
if re.match(r"^20[0-1][0-9]\.", rdkit_version):
... |
DQM/RPCMonitorClient/python/RPCEventSummary_cfi.py | ckamtsikis/cmssw | 852 | 11122541 | import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
rpcEventSummary = DQMEDHarvester("RPCEventSummary",
EventInfoPath = cms.untracked.string('RPC/EventInfo'),
PrescaleFactor = cms.untracked.int32(5),
... |
yabgp/message/attribute/nlri/ipv6_flowspec.py | mengjunyi/yabgp | 203 | 11122561 | # Copyright 2015 Cisco Systems, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... |
hata/discord/activity/activity_types.py | Multiface24111/hata | 173 | 11122592 | <reponame>Multiface24111/hata<filename>hata/discord/activity/activity_types.py
__all__ = ()
__doc__ = """
A module, which contains the activity types' discord side value.
+-----------+-------+
| Name | Value |
+===========+=======+
| game | 0 |
+-----------+-------+
| stream | 1 |
+-----------+--... |
Python/orangeHello.py | saurabhcommand/Hello-world | 1,428 | 11122602 | def helloName(name):
print ("Hello " + name)
helloName("John")
|
evalml/utils/update_checker.py | Mahesh1822/evalml | 454 | 11122603 | <reponame>Mahesh1822/evalml<filename>evalml/utils/update_checker.py
"""Check if EvalML has updated since the user installed."""
from pkg_resources import iter_entry_points
for entry_point in iter_entry_points("alteryx_open_src_initialize"):
try:
method = entry_point.load()
if callable(method):
... |
grove/alpha/fermion_transforms/tests/test_bravyi_kitaev.py | mkeshita/grove | 229 | 11122635 | import numpy as np
import pytest
from grove.alpha.fermion_transforms.bktransform import BKTransform
from grove.alpha.fermion_transforms.jwtransform import JWTransform
"""
Some tests inspired by:
https://github.com/ProjectQ-Framework/FermiLib/blob/develop/src/fermilib/transforms/_bravyi_kitaev_test.py
"""
def test_h... |
director/migrations/versions/05cf96d6fcae_add_task_result.py | apikay/celery-director | 351 | 11122646 | """Add task result
Revision ID: 05cf96d6fcae
Revises: <PASSWORD>
Create Date: 2020-03-20 19:16:48.520652
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "<KEY>e"
down_revision = "<PASSWORD>"
branch_labels = None
depends_on = None
def upgrade():
op.add_col... |
qtl/src/ase_aggregate_by_individual.py | richardslab/gtex-pipeline | 247 | 11122769 | # Author: <NAME>
import numpy as np
import scipy.stats
import pandas as pd
import argparse
import pyBigWig
import os
import subprocess
import io
import gzip
import pickle
def padjust_bh(p):
"""
Benjamini-Hochberg ajdusted p-values
Replicates p.adjust(p, method="BH") from R
"""
n = len(p)
... |
tests/functional/api/views/route_by_content_test.py | hypothesis/via | 113 | 11122864 | <gh_stars>100-1000
from urllib.parse import quote_plus
import httpretty
import pytest
from h_matchers import Any
from tests.conftest import assert_cache_control
class TestRouteByContent:
DEFAULT_OPTIONS = {
"via.client.ignoreOtherConfiguration": "1",
"via.client.openSidebar": "1",
"via.e... |
observations/r/wong.py | hajime9652/observations | 199 | 11122869 | <gh_stars>100-1000
# -*- 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 wong(path):
"""Post-Coma Recovery of IQ
The `Wo... |
fastapi_contrib/auth/permissions.py | mumtozvalijonov/fastapi_contrib | 504 | 11122882 | <reponame>mumtozvalijonov/fastapi_contrib<filename>fastapi_contrib/auth/permissions.py<gh_stars>100-1000
from starlette.requests import Request
from starlette import status
from fastapi_contrib.permissions import BasePermission
class IsAuthenticated(BasePermission):
"""
Permission that checks if the user has... |
messaging/api/views.py | maznu/peering-manager | 127 | 11122891 | <gh_stars>100-1000
from rest_framework.routers import APIRootView
from messaging.api.serializers import (
ContactAssignmentSerializer,
ContactRoleSerializer,
ContactSerializer,
EmailSerializer,
)
from messaging.filters import (
ContactAssignmentFilterSet,
ContactFilterSet,
ContactRoleFilter... |
skidl/libs/xilinx_sklib.py | arjenroodselaar/skidl | 700 | 11122908 | <filename>skidl/libs/xilinx_sklib.py
from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib
SKIDL_lib_version = '0.0.1'
xilinx = SchLib(tool=SKIDL).add_parts(*[
Part(name='4003APG120',dest=TEMPLATE,tool=SKIDL,do_erc=True,aliases=['4003PG120']),
Part(name='4003HPQ208',dest=TEMPLATE,tool=SKIDL,do_erc=True... |
mpi4jax/_src/collective_ops/alltoall.py | Thenerdstation/mpi4jax | 122 | 11122943 | <filename>mpi4jax/_src/collective_ops/alltoall.py
import numpy as _np
from mpi4py import MPI as _MPI
from jax import abstract_arrays, core
from jax.core import Primitive
from jax.interpreters import xla
from jax.lax import create_token
from jax.lib import xla_client
from ..utils import (
HashableMPIType,
defa... |
test/e101_example.py | shardros/autopep8 | 3,459 | 11122971 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# From https://github.com/coto/gae-boilerplate/blob/233a88c59e46bb10de7a901ef4e6a5b60d0006a5/web/handlers.py
"""
This example will take a long time if we don't filter innocuous E101
errors from pep8.
"""
import models.models as models
from webapp2_extras.auth import InvalidAu... |
examples/wordle-cairo.py | josh95117/freetype-py | 242 | 11122973 | <reponame>josh95117/freetype-py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
#
# pycairo/cairocffi-based wordle example - Copyright 2017 <NAME>
# Distributed under the terms of the new BSD license.
#
# rewrite of the numply,matplotlib-b... |
lib/chips/chip_generator.py | pigtamer/SNIPER | 2,722 | 11122998 | # --------------------------------------------------------------
# SNIPER: Efficient Multi-Scale Training
# Licensed under The Apache-2.0 License [see LICENSE for details]
# by <NAME> and <NAME>
# --------------------------------------------------------------
import chips
from bbox.bbox_transform import clip_boxes, ign... |
Competitions/Skillenza/Focuthon/String Replacement.py | cnm06/Competitive-Programming | 994 | 11123102 | <gh_stars>100-1000
n = int(raw_input())
for i in xrange(0, n):
s = raw_input()
s = s.replace('a', 'v#nt&r#s!ty').replace('e', 'v#nt&r#s!ty').replace('i', 'v#nt&r#s!ty').replace('o', 'v#nt&r#s!ty').replace('u', 'v#nt&r#s!ty').replace('A', 'v#nt&r#s!ty').replace('E', 'v#nt&r#s!ty').replace('I', 'v#nt&r#s!ty').replace('... |
pipeline/trainers/segmentation.py | PavelOstyakov/pipeline | 214 | 11123117 | from .base import TrainerBase
class TrainerSegmentation(TrainerBase):
pass
|
eda/implementacoes/estruturas_de_dados/SingleLinkedList.py | gabrielmbs/Tamburetei | 209 | 11123144 | # # Esta implementação foi feita em Python 3.
# Esteja ciente disso ao executar :)
# Nesse arquivo, focaremos na implementação da Single
# Linked List, uma estrutura similar a um array, mas
# de tamanho dinâmico, e que funciona por meio de nós,
# onde a lista mantém uma referência ao primeiro nó,
# e cada nó mantém o ... |
djrill/__init__.py | timgates42/Djrill | 172 | 11123152 | from ._version import __version__, VERSION
from .exceptions import (MandrillAPIError, MandrillRecipientsRefused,
NotSerializableForMandrillError, NotSupportedByMandrillError)
|
prod/stock_gj/run_es_restful_server.py | UtorYeung/vnpy | 323 | 11123162 | # flake8: noqa
import os
import sys
# 将repostory的目录i,作为根目录,添加到系统环境中。
ROOT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.append(ROOT_PATH)
print(f'append {ROOT_PATH} into sys.path')
from vnpy.api.easytrader import server
server.run(port=1430)
|
DQMOffline/CalibTracker/test/CRAFTCalib/SiStripDQMBadStrips_cfg.py | ckamtsikis/cmssw | 852 | 11123198 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
process = cms.Process( "SiStripDQMBadStrips" )
### Miscellanous ###
## Logging ##
process.options = cms.untracked.PSet(
wantSummary = cms.untracked.bool( True )
)
process.MessageLogger = cms.Service( "MessageLogger",
destinations = cms.untra... |
modules/nltk_contrib/tiger/query/constraints.py | h4ck3rm1k3/NLP-project | 123 | 11123225 | <filename>modules/nltk_contrib/tiger/query/constraints.py
# -*- coding: utf-8 -*-
# Copyright © 2007-2008 Stockholm TreeAligner Project
# Author: <NAME> <<EMAIL>>
# Licensed under the GNU GPLv2
"""Contains the classes for constraint checking.
The code and the interfaces of this module are still subject to change. Plea... |
examples/origin_str.py | huihui7987/blind_watermark | 1,699 | 11123299 | <filename>examples/origin_str.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# embed string
import numpy as np
from blind_watermark import WaterMark
bwm1 = WaterMark(password_img=1, password_wm=1)
bwm1.read_img('pic/ori_img.jpg')
wm = '@guofei9987 开源万岁!'
bwm1.read_wm(wm, mode='str')
bwm1.embed('output/embedded.png'... |
tests/test_fragment_select.py | zverok/wikipedia_ql | 334 | 11123301 | <gh_stars>100-1000
import re
import pytest
from bs4 import BeautifulSoup
from wikipedia_ql.fragment import Fragment
from wikipedia_ql.selectors import text, text_group, sentence, section, css, alt, page
def make_fragment(html):
# Because fragment is Wikipedia-oriented and always looks for this div :shrug:
re... |
packages/vaex-astro/vaex/astro/tap.py | sethvargo/vaex | 337 | 11123308 | import numpy as np
from vaex.dataset import DatasetArrays
class DatasetTap(DatasetArrays):
class TapColumn(object):
def __init__(self, tap_dataset, column_name, column_type, ucd):
self.tap_dataset = tap_dataset
self.column_name = column_name
self.column_type = column_... |
Face Reconstruction/Fast Few-shot Face alignment by Reconstruction/constants.py | swapnilgarg7/Face-X | 175 | 11123310 | TRAIN = 'train'
VAL = 'val'
TEST = 'test'
|
tests/regressiontests/id_package.py | kylehodgson/SimpleIDML | 136 | 11123348 | <reponame>kylehodgson/SimpleIDML
# -*- coding: utf-8 -*-
import os
import unittest
from simple_idml.id_package import ZipInDesignPackage
from simple_idml.id_package import merge_font_lst
CURRENT_DIR = os.path.dirname(__file__)
IDMLFILES_DIR = os.path.join(CURRENT_DIR, "IDML")
class ZipInDesignPackageTestCase(unitt... |
commandment/pki/ca.py | pythonModule/commandment | 138 | 11123352 | <gh_stars>100-1000
from flask import g, current_app
import sqlalchemy.orm.exc
from .models import CertificateAuthority
from commandment.models import db, Device
from commandment.pki.models import CertificateType, Certificate
def get_ca() -> CertificateAuthority:
if 'ca' not in g:
try:
ca = db... |
generators/datagenerator/segment.py | honey-sangtani-c5i/retail-demo-store | 404 | 11123389 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import datagenerator
import json
import requests
# Segment event support
# This follows the Segment HTTP API spec, here:
# https://segment.com/docs/connections/sources/catalog/libraries/server/http-api/
#
# These cla... |
paz/datasets/fat.py | niqbal996/paz | 300 | 11123395 | import os
from glob import glob
import json
import numpy as np
from tensorflow.keras.utils import Progbar
from ..abstract import Loader
from .utils import get_class_names
class FAT(Loader):
""" Dataset loader for the falling things dataset (FAT).
# Arguments
path: String indicating full path to dat... |
Python/demos/d13_HelicalGeometry.py | tsadakane/TIGRE | 326 | 11123439 | <reponame>tsadakane/TIGRE
#%% Demo 13: Helical Geometry tests
#
#
# This demo shows an example of TIGRE working on Helical scan geometries
#
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------
# This file is part of th... |
BlogPosts/Hyperparameter_tuning_comparison/hyperparameter_tuning_comparison_code.py | markgraves/roamresearch | 190 | 11123442 | """
Companion code for the Roam blog post on hyperparameter optimization.
"""
import itertools as it
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from operator import itemgetter
import pandas as pd
import random
from scipy import stats
from time import time
from hyperopt import fmin, tpe, hp, S... |
爬虫小demo/31 下载bilibili视频.py | lb2281075105/Python-Spider | 713 | 11123455 | import requests
from lxml import html
import re
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
def star(url):
url2 = "https://api.bilibili.com/x/player/playurl?avid={avid}&cid={cid}&qn=32&type=&otype=json"
headers2 = {
"host": "",
"Referer": "https://www.bili... |
benchexec/tools/skink.py | MartinSpiessl/benchexec | 137 | 11123506 | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 <NAME> <https://www.sosy-lab.org>
# SPDX-FileCopyrightText: 2015 <NAME>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.util as util
import benchexec.tools.tem... |
dask/tests/test_ml.py | marcelned/dask | 9,684 | 11123523 | def test_basic():
try:
import dask_ml # noqa: F401
except ImportError:
try:
from dask.ml.model_selection import GridSearchCV # noqa: F401
except ImportError as e:
assert "conda install dask-ml" in str(e)
else:
assert False
else:
f... |
njunmt/encoders/rnn_encoder.py | whr94621/NJUNMT-tf | 111 | 11123534 | <reponame>whr94621/NJUNMT-tf
# Copyright 2017 Natural Language Processing Group, Nanjing University, <EMAIL>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... |
pypower/int2ext.py | Bengt/PYPOWER | 221 | 11123572 | <gh_stars>100-1000
# Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Converts internal to external bus numbering.
"""
import sys
from warnings import warn
from copy import deepcopy
from pypower.idx_bus impo... |
mongodb/mongodb_consistent_backup/official/mongodb_consistent_backup/Common/__init__.py | smthkissinger/docker-images | 282 | 11123586 | from Config import Config, parse_config_bool # NOQA
from DB import DB, parse_read_pref_tags # NOQA
from LocalCommand import LocalCommand # NOQA
from Lock import Lock # NOQA
from MongoUri import MongoUri # NOQA
from Timer import Timer # NOQA
from Util import config_to_string, is_datetime, parse_method, validate_ho... |
search/show_search_results.py | dongan-beta/PyRetri | 1,063 | 11123622 | # -*- coding: utf-8 -*-
import os
import argparse
import json
import codecs
from utils.misc import save_to_csv, filter_by_keywords
def parse_args():
parser = argparse.ArgumentParser(description='A tool box for deep learning-based image retrieval')
parser.add_argument('opts', default=None, nargs=argparse.RE... |
alibi_detect/cd/tests/test_mmd_online.py | sugatoray/alibi-detect | 1,227 | 11123630 | import numpy as np
import pytest
from alibi_detect.cd import MMDDriftOnline
from alibi_detect.cd.pytorch.mmd_online import MMDDriftOnlineTorch
from alibi_detect.cd.tensorflow.mmd_online import MMDDriftOnlineTF
n, n_features = 100, 5
tests_mmddriftonline = ['tensorflow', 'pytorch', 'PyToRcH', 'mxnet']
n_tests = len(te... |
test/test_oneview_ethernet_network_facts.py | nabhajit-ray/oneview-ansible | 108 | 11123673 | #!/usr/bin/python
# -*- coding: utf-8 -*-
###
# Copyright (2016-2019) Hewlett Packard Enterprise Development LP
#
# 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/licen... |
solutions/problem_114.py | ksvr444/daily-coding-problem | 1,921 | 11123720 | <reponame>ksvr444/daily-coding-problem<gh_stars>1000+
def reverse_words(string, delimiters):
words = list()
delims = list()
delim_positions = list() # stores positions of the delimiters seen
start = 0
i = 0
while i < len(string):
char = string[i]
if char in delimiters:
... |
tools/benchmark.py | Genevievekim/semantic-segmentation-1 | 196 | 11123766 | <reponame>Genevievekim/semantic-segmentation-1
import torch
import argparse
import time
from fvcore.nn import flop_count_table, FlopCountAnalysis
import sys
sys.path.insert(0, '.')
from semseg.models import *
def main(
model_name: str,
backbone_name: str,
image_size: list,
num_classes: int,
device... |
uecli/CMakeCustomFlags.py | MonsterClosetGames/ue4cli | 179 | 11123775 | <reponame>MonsterClosetGames/ue4cli
import os
# The list of include directory substrings that trigger custom CMake flags
CUSTOM_FLAGS_FOR_INCLUDE_DIRS = {
'libPNG-': 'PNG_PNG_INCLUDE_DIR'
}
# The list of library files that trigger custom CMake flags
CUSTOM_FLAGS_FOR_LIBS = {
'png': 'PNG_LIBRARY',
'z': ... |
houdini/handlers/play/card.py | Oblivion-Max/houdini | 444 | 11123793 | import random
from houdini import handlers
from houdini.data.ninja import CardCollection, CardStarterDeck, PenguinCardCollection
from houdini.handlers import Priority, XMLPacket, XTPacket
@handlers.boot
async def cards_load(server):
server.cards = await CardCollection.get_collection()
server.logger.info(f'Lo... |
autoPyTorch/pipeline/nodes/one_hot_encoding.py | mens-artis/Auto-PyTorch | 1,657 | 11123799 | <filename>autoPyTorch/pipeline/nodes/one_hot_encoding.py
__author__ = "<NAME>, <NAME> and <NAME>"
__version__ = "0.0.1"
__license__ = "BSD"
from autoPyTorch.pipeline.base.pipeline_node import PipelineNode
from autoPyTorch.utils.config.config_option import ConfigOption, to_bool
from sklearn.preprocessing import OneHotE... |
src/maestral/utils/caches.py | gliptak/maestral | 436 | 11123803 | """Module containing cache implementations."""
from collections import OrderedDict
from threading import RLock
from typing import Any
class LRUCache:
"""A simple LRU cache implementation
:param capacity: Maximum number of entries to keep.
"""
_cache: OrderedDict
def __init__(self, capacity: in... |
examples/tutorials/05_async_python/02_cube_blinker.py | rootless4real/cozmo-python-sdk | 794 | 11123830 | <filename>examples/tutorials/05_async_python/02_cube_blinker.py
#!/usr/bin/env python3
# Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or... |
openff/toolkit/utils/ambertools_wrapper.py | andrew-abimansour/openff-toolkit | 120 | 11123868 | """
Wrapper class providing a minimal consistent interface to `AmberTools <http://ambermd.org/AmberTools.php>`_.
"""
__all__ = ("AmberToolsToolkitWrapper",)
# =============================================================================================
# IMPORTS
# =====================================================... |
xfdnn/rt/scripts/layerwise.py | yarenty/ml-suite | 334 | 11123876 | <filename>xfdnn/rt/scripts/layerwise.py<gh_stars>100-1000
#!/usr/bin/env python
#
# // SPDX-License-Identifier: BSD-3-CLAUSE
#
# (C) Copyright 2018, Xilinx, Inc.
#
import sys, os
sys.path.append(os.environ['MLSUITE_ROOT'] + '/xfdnn/rt')
import xdnn, xdnn_io
import numpy as np
import json, copy
def generateLayerwiseJ... |
example/market/sub_pricedepth_bbo.py | bailzx5522/huobi_Python | 611 | 11123889 |
from huobi.client.market import MarketClient
def callback(price_depth_event: 'PriceDepthBboEvent'):
price_depth_event.print_object()
print()
def error(e: 'HuobiApiException'):
print(e.error_code + e.error_message)
market_client = MarketClient()
market_client.sub_pricedepth_bbo("btcusdt", callback, er... |
RecoTracker/DebugTools/python/TrackAlgoCompareUtil_cff.py | ckamtsikis/cmssw | 852 | 11123892 | import FWCore.ParameterSet.Config as cms
from RecoTracker.DebugTools.TrackAlgoCompareUtil_cfi import *
|
cflearn/models/cv/encoder/backbone/settings/mobilenet.py | carefree0910/carefree-learn | 400 | 11123893 | from typing import List
from collections import OrderedDict
from ..api import Preset
remove_layers: List[str] = []
target_layers = OrderedDict(
slice0="stage0",
slice1="stage1",
slice2="stage2",
slice3="stage3",
slice4="stage4",
)
@Preset.register_settings()
class MobileNetPreset(Preset):
r... |
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_sysadmin_vm.py | CiscoDevNet/ydk-py | 177 | 11123901 | <reponame>CiscoDevNet/ydk-py
""" Cisco_IOS_XR_sysadmin_vm
This module contains definitions
for the Calvados model objects.
This module contains the YANG definitions
for the Cisco IOS\-XR SysAdmin
'vm profile\|cpu\|memory' commands.
Copyright(c) 2018 by Cisco Systems, Inc.
All rights reserved.
Copyright (c) 2012\-2... |
integration/continuous_test.py | drozzy/autonomous-learning-library | 584 | 11123948 | import unittest
from all.environments import GymEnvironment
from all.presets.continuous import ddpg, ppo, sac
from validate_agent import validate_agent
class TestContinuousPresets(unittest.TestCase):
def test_ddpg(self):
validate_agent(
ddpg.device('cpu').hyperparameters(replay_start_size=50),... |
deep_privacy/inference/deep_privacy_anonymizer.py | chinitaberrio/DeepPrivacy | 1,128 | 11124003 | <gh_stars>1000+
import numpy as np
import torch
import deep_privacy.torch_utils as torch_utils
import cv2
import pathlib
import typing
from deep_privacy.detection.detection_api import ImageAnnotation
from .anonymizer import Anonymizer
from . import infer
def batched_iterator(batch, batch_size):
k = list(batch.key... |
moonshot/commission/fx.py | windblood/moonshot | 122 | 11124020 | <gh_stars>100-1000
# Copyright 2017-2021 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 re... |
scripts/search.py | phasorhand/PyTorchText | 1,136 | 11124034 | <gh_stars>1000+
#coding:utf8
import sys
sys.path.append('../')
from utils import get_score
import json
import pickle
file1='/mnt/zhihu/data/RCNN_deep_word_val_4115'
file2='/mnt/zhihu/data/rccndeep_char_val_4037.pth'
file3='/mnt/zhihu/data/multicnntextbndeep40705_val_word.pth'
label_path = '/mnt/zhihu/data/labels.js... |
test/integration/test_setup.py | wnojopra/dsub | 146 | 11124049 | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
examples/kitchensink/KitchenSink.py | takipsizad/pyjs | 739 | 11124068 | import pyjd # this is dummy in pyjs
from pyjamas import logging
from pyjamas.ui.Button import Button
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.HTML import HTML
from pyjamas.ui.DockPanel import DockPanel
from pyjamas.ui import HasAlignment
from pyjamas.ui.Hyperlink import Hyperlink
from pyjamas.ui.Vert... |
tests/data/translated_titles/conf.py | asmeurer/nikola | 1,901 | 11124076 | # -*- coding: utf-8 -*-
import time
BLOG_AUTHOR = "<NAME>" # (translatable)
BLOG_TITLE = "Demo Site" # (translatable)
SITE_URL = "https://example.com/"
BLOG_EMAIL = "<EMAIL>"
BLOG_DESCRIPTION = "This is a demo site for Nikola." # (translatable)
DEFAULT_LANG = "en"
TRANSLATIONS = {
"en": "",
"pl": "./pl",
}
T... |
CurvesGenerator/draw.py | CodesHub/PathPlanning | 3,693 | 11124078 | import matplotlib.pyplot as plt
import numpy as np
PI = np.pi
class Arrow:
def __init__(self, x, y, theta, L, c):
angle = np.deg2rad(30)
d = 0.5 * L
w = 2
x_start = x
y_start = y
x_end = x + L * np.cos(theta)
y_end = y + L * np.sin(theta)
theta_hat... |
tests/test_manage.py | klen/muffin | 704 | 11124183 | <filename>tests/test_manage.py<gh_stars>100-1000
import pytest
from unittest import mock
@pytest.fixture(params=['curio', 'trio', 'asyncio'])
def cmd_aiolib(request):
return request.param
def test_command(app):
@app.manage
def cmd1(name, lower=False):
"""Custom description.
:param name... |
test/unit/__init__.py | daltonconley/amazon-redshift-python-driver | 125 | 11124233 | <gh_stars>100-1000
from .mocks import MockCredentialsProvider
|
plugins/discovery/shodan/__init__.py | otherbeast/hackers-tool-kit | 655 | 11124254 | <filename>plugins/discovery/shodan/__init__.py<gh_stars>100-1000
from api import WebAPI
__version__ = "0.5.0"
__all__ = ['WebAPI']
|
tests/config/test_file_browser.py | kubajir/msticpy | 820 | 11124269 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""Module ... |
tests/trac/test-trac-0204.py | eLBati/pyxb | 123 | 11124278 | # -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb.binding.generate
import pyxb.utils.domutils
from xml.dom import Node
import os.path
xsd='''<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSch... |
resotocore/core/dependencies.py | someengineering/cloudkeeper | 316 | 11124302 | import argparse
import logging
import multiprocessing as mp
import os.path
from argparse import Namespace
from typing import Optional, List, Callable
from urllib.parse import urlparse
from arango.database import StandardDatabase
from resotolib.args import ArgumentParser
from resotolib.jwt import add_args as jwt_add_ar... |
lib/pylayer/mask_layer.py | giladsharir/MNC-1 | 544 | 11124315 | <reponame>giladsharir/MNC-1
# --------------------------------------------------------
# Multitask Network Cascade
# Written by <NAME>
# Copyright (c) 2016, <NAME>
# Licensed under The MIT License [see LICENSE for details]
# --------------------------------------------------------
import caffe
import cv2
import numpy ... |
benchmark/okon_grep_benchmark.py | droidmonkey/okon | 194 | 11124322 | import subprocess
import sys
import os
import timeit
from okon_benchmark_utils import *
NUMBER_OF_HASHES_TO_BENCHMARK = int(sys.argv[1])
PATH_TO_ORIGINAL_FILE = sys.argv[2]
NUMBER_OF_HASHES_IN_ORIGINAL_FILE = int(sys.argv[3])
BENCHMARK_SEED = int(sys.argv[4]) if len(sys.argv) > 4 else 0
def run_benchmark(hash_to_ben... |
devtools/src/klio_devtools/cli.py | gaybro8777/klio | 705 | 11124335 | # Copyright 2020 Spotify AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
examples/xtensa/wasm_fac/make_flash.py | rakati/ppci-mirror | 161 | 11124337 | #!/usr/bin/python
from ppci.api import construct
construct('build.xml')
with open('hello.bin', 'rb') as f:
hello_bin = f.read()
flash_size = 4 * 1024 * 1024
with open('lx60.flash', 'wb') as f:
f.write(hello_bin)
padding = flash_size - len(hello_bin)
f.write(bytes(padding))
|
python codes/Queue.py | mflilian/Hacktoberfest2020-1 | 266 | 11124430 | class Queue:
def __init__(self):
self.items = []
def add_item(self, item):
return self.items.insert(0, item)
def remove_item(self):
if self.is_empty():
return print("Queue is Empty")
return self.items.pop()
def is_empty(self):
return self.items == [... |
h2o-docs/src/booklets/v2_2015/source/Python_Vignette_code_examples/python_display_day_of_month.py | ahmedengu/h2o-3 | 6,098 | 11124476 | <filename>h2o-docs/src/booklets/v2_2015/source/Python_Vignette_code_examples/python_display_day_of_month.py
df14['D'].day()
# D
# ---
# 18
# 19
# 20 |
Applications/ctkSimplePythonShell/Python/ctkSimplePythonShell.py | ntoussaint/CTK | 515 | 11124489 | <filename>Applications/ctkSimplePythonShell/Python/ctkSimplePythonShell.py
import qt, ctk
def app():
return _ctkSimplePythonShellInstance
def quit():
exit()
def exit():
app().quit()
|
__scraping__/newegg.ca - urllib, BS/main.py | furas/python-code | 140 | 11124506 | <reponame>furas/python-code
# author: Bartlomiej "furas" Burek (https://blog.furas.pl)
# date: 2021.10.07
#
# title: 'NoneType' object is not subscriptable when webscraping image title
# url: https://stackoverflow.com/questions/69475748/nonetype-object-is-not-subscriptable-when-webscraping-image-title/69477667#6947766... |
concordia/migrations/0004_auto_20181010_1715.py | juliecentofanti172/juliecentofanti.github.io | 134 | 11124523 | # Generated by Django 2.0.9 on 2018-10-10 17:15
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("concordia", "0003_auto_2... |
benchmarks/_bench/robust_plot_synthetic.py | rth/scikit-learn-extra | 120 | 11124529 | """
==================================================================
Plot of accuracy and time as sample_size and num_features increase
==================================================================
We show that the increase in computation time is linear when
increasing the number of features or the sample size i... |
manga_py/providers/mangahi_net.py | sonvt1710/manga-py | 337 | 11124561 | <reponame>sonvt1710/manga-py
from .zmanga_net import ZMangaNet
class MangaHiNet(ZMangaNet):
_type = 'chapter'
main = MangaHiNet
|
samples/invoice/third_party_invoicing.py | Hey-Marvelous/PayPal-Python-SDK | 653 | 11124573 | from paypalrestsdk import Invoice
import logging
from paypalrestsdk.openid_connect import Tokeninfo
logging.basicConfig(level=logging.INFO)
# Using Log In with PayPal, third party merchants can authorize your application to create and submit invoices on their behalf.
# See https://developer.paypal.com/docs/integratio... |
convlab2/laug/Speech_Recognition/TTS.py | ljw23/ConvLab-2 | 339 | 11124610 | #coding: UTF-8
from gtts import gTTS
from pydub.audio_segment import AudioSegment
import os
def text2wav(text,language='en',filename='temp',tld='cn'):
gTTS(text=text, tld=tld,lang=language).save(filename+".mp3")
AudioSegment.from_mp3(filename+".mp3").set_frame_rate(16000).export(filename+".wav", format="wav")... |
packages/pyright-internal/src/tests/samples/descriptor2.py | Microsoft/pyright | 3,934 | 11124611 | <filename>packages/pyright-internal/src/tests/samples/descriptor2.py
# This sample validates that a member's descriptor protocol is
# accessed via a member access expression only when accessing it
# through a class variable, not through an instance variable.
from typing import Any
class Descriptor:
def __get__(s... |
src/commands/refactor/extract_variable.py | PranjalPansuriya/JavaScriptEnhancements | 690 | 11124644 | import sublime, sublime_plugin
import os
from ...libs import util
from ...libs import FlowCLI
class JavascriptEnhancementsRefactorExtractVariableCommand(sublime_plugin.TextCommand):
def run(self, edit, **args):
view = self.view
selection = view.sel()[0]
contents = view.substr(selection).strip()
conte... |
assembler.py | zshift/chungus-2-assembler | 183 | 11124652 | <reponame>zshift/chungus-2-assembler
from os import path
from typing import List, Tuple
import formats
from schem import generate_schematic
###############################################################################
# assembler
###############################################################################
clas... |
dagda/remote/agent.py | hoominkani/dagda | 947 | 11124673 | #
# Licensed to Dagda under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Dagda licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance... |
text-generation/tests/test_text_generator.py | dumpmemory/serverless-transformers-on-aws-lambda | 103 | 11124694 | from src.text_generator import TextGenerator
pipeline = TextGenerator()
def test_response(requests, response):
assert response == pipeline(requests)
|
econml/dynamic/dml/__init__.py | imatiach-msft/EconML | 1,846 | 11124720 | <gh_stars>1000+
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Double Machine Learning for Dynamic Treatment Effects.
A Double/Orthogonal machine learning approach to estimation of heterogeneous
treatment effect in the dynamic treatment regime. For the theoretic... |
pytorch-DRIT-PONO-MS/src/model_pono.py | Boyiliee/PONO | 133 | 11124730 | import networks_pono as networks
import torch
import torch.nn as nn
import torch.nn.functional as F
class DRIT(nn.Module):
def __init__(self, opts):
super(DRIT, self).__init__()
# parameters
lr = 0.0001
lr_dcontent = lr / 2.5
self.nz = 8
self.concat = opts.concat
... |
BRATS/compress_data.py | eanemo/KiU-Net-pytorch | 236 | 11124758 | <gh_stars>100-1000
import argparse
import os
import numpy as np
from multiprocessing import Pool
def float2uint(file_path):
filename = file_path[:file_path.find('.npy')]+'.npz'
data_float32 = np.load(file_path)
data_temp = 255 * data_float32
data_uint8 = data_temp.astype(np.uint8)
print(filename)
np.savez_compr... |
tests/test_aliases.py | orsinium/condition | 311 | 11124781 | from inspect import getdoc
from typing import get_type_hints
import pytest
import deal
def get_func():
@deal.pre(lambda x: x > 0)
@deal.post(lambda x: x > 0)
@deal.ensure(lambda *args, **kwargs: True)
@deal.raises(ValueError)
@deal.safe
@deal.safe()
@deal.pure
@deal.chain(deal.safe, ... |
vaas-app/src/vaas/external/oauth.py | allegro/vaas | 251 | 11124789 | <reponame>allegro/vaas
import importlib
from django.conf import settings
from tastypie.authentication import MultiAuthentication
# If Oauth for API is enabled & custom module (OAUTH_AUTH_MODULE) is not present,
# default TastyPie OAuthAuthentication backend will be used
API_OAUTH_ENABLED = getattr(settings, 'API_OAUT... |
applications/MultilevelMonteCarloApplication/external_libraries/PyCOMPSs/exaqute/common/exception.py | lkusch/Kratos | 778 | 11124802 | <reponame>lkusch/Kratos<filename>applications/MultilevelMonteCarloApplication/external_libraries/PyCOMPSs/exaqute/common/exception.py<gh_stars>100-1000
class ExaquteException(Exception):
pass
|
tests/test_repo.py | Bing1012/3 | 1,040 | 11124823 | <reponame>Bing1012/3
import os
import subprocess
import sys
from pathlib import Path
import pytest
from pyscaffold import actions, api, cli, repo, shell, structure, toml
from pyscaffold.file_system import chdir, move, rm_rf
def test_init_commit_repo(tmpfolder):
with tmpfolder.mkdir("my_porject").as_cwd():
... |
site/search-index/pagerank.py | vishalbelsare/neupy | 801 | 11124890 | <gh_stars>100-1000
import scipy
import numpy as np
import scipy.sparse as sp
def pagerank(graph_matrix, n_iter=100, alpha=0.9, tol=1e-6):
n_nodes = graph_matrix.shape[0]
n_edges_per_node = graph_matrix.sum(axis=1)
n_edges_per_node = np.array(n_edges_per_node).flatten()
np.seterr(divide='ignore')
... |
algoexpert.io/python/Longest_Common_Subsequence.py | its-sushant/coding-interview-gym | 713 | 11124895 | <reponame>its-sushant/coding-interview-gym
# Solution: My solution using 2d dp
# O(nm) time | O(nm) space
def longestCommonSubsequence(string1, string2):
dp = [[[] for _ in range(len(string2) + 1)] for _ in range(len(string1) + 1)]
for i in range(1, len(string1) + 1):
x = string1[i - 1]
for j in range(1, len(... |
one_step_app.py | Questions1/Rong360_2nd | 107 | 11124909 |
import numpy as np
import pandas as pd
def read_app(file_path):
reader = pd.read_table(file_path, header=None, chunksize=10000)
data = pd.concat(reader, axis=0, ignore_index=True)
data.columns = ['id', 'apps']
return data
def get_apps_dummy(data):
"""
把dat_app里用户装的app信息0-1化
1. 读取需要的104... |
controllers/admin/admin_offseason_scraper_controller.py | tervay/the-blue-alliance | 266 | 11124925 | import datetime
import logging
import os
from google.appengine.ext import ndb
from google.appengine.ext.webapp import template
from controllers.base_controller import LoggedInHandler
from datafeeds.datafeed_usfirst_offseason import DatafeedUsfirstOffseason
from consts.event_type import EventType
from helpers.event_m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.