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 |
|---|---|---|---|---|
RecoTauTag/RecoTau/python/PFRecoTauProducer_cfi.py | ckamtsikis/cmssw | 852 | 92663 | from RecoTauTag.RecoTau.pfRecoTauProducerDef_cfi import pfRecoTauProducerDef
pfRecoTauProducer = pfRecoTauProducerDef.clone()
|
test/test_c.py | EraYaN/transpyle | 107 | 92668 | <gh_stars>100-1000
"""Tests of C language support."""
import logging
import unittest
import timing
import typed_astunparse
from transpyle.general.code_reader import CodeReader
from transpyle.c.parser import C99Parser
from transpyle.c.ast_generalizer import CAstGeneralizer
from .common import basic_check_c_ast, basi... |
loafer/runners.py | hartungstenio/loafer | 111 | 92693 | <filename>loafer/runners.py
import asyncio
import logging
import signal
from concurrent.futures import CancelledError, ThreadPoolExecutor
from contextlib import suppress
logger = logging.getLogger(__name__)
class LoaferRunner:
def __init__(self, max_workers=None, on_stop_callback=None):
self._on_stop_ca... |
tests/tck/utils/mmh2.py | tom-chensf/nebula-graph | 816 | 92740 | # Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.
def __bytes2ul(b):
return int.from_bytes(b, byteorder='little', signed=False)
def mmh2(bstr, seed=0xc70f6907, signed=True)... |
tests/cpydiff/modules_struct_fewargs.py | sebastien-riou/micropython | 13,648 | 92747 | """
categories: Modules,struct
description: Struct pack with too few args, not checked by uPy
cause: Unknown
workaround: Unknown
"""
import struct
try:
print(struct.pack("bb", 1))
print("Should not get here")
except:
print("struct.error")
|
model/gac.py | hdliu21/openISP | 384 | 92753 | #!/usr/bin/python
import numpy as np
class GC:
'Gamma Correction'
def __init__(self, img, lut, mode):
self.img = img
self.lut = lut
self.mode = mode
def execute(self):
img_h = self.img.shape[0]
img_w = self.img.shape[1]
img_c = self.img.shape[2]
gc_... |
configs/__init__.py | light1726/VAENAR-TTS | 125 | 92767 | from .hparams import *
from .logger import Logger
|
Stock/Data/Gateway/DyStockDataWind.py | AdrianGuo/DevilYuan | 135 | 92772 | <filename>Stock/Data/Gateway/DyStockDataWind.py
from time import sleep
import pandas as pd
from collections import OrderedDict
try:
from WindPy import *
except ImportError:
pass
from DyCommon.DyCommon import *
from ...Common.DyStockCommon import *
class DyStockDataWind(object):
""" Wind数据接口 """
sec... |
talkgenerator/sources/text_generator.py | korymath/talk-generator | 110 | 92788 | """ This module helps out with generating text using templates """
import json
import random
import re
from functools import lru_cache
import tracery
from tracery.modifiers import base_english
from talkgenerator.sources import conceptnet
from talkgenerator.sources import phrasefinder
from talkgenerator.sources import... |
server/libs/notification_enum.py | teemosauce/rpi-cube | 195 | 92807 | <reponame>teemosauce/rpi-cube<gh_stars>100-1000
from enum import Enum
class NotificationEnum(Enum):
config_refresh = 1
config_refresh_finished = 2
config_refresh_failed = 3
process_stop = 4
process_pause = 5
process_continue = 6
|
mobly/controllers/android_device_lib/services/logcat.py | booneng/mobly | 532 | 92861 | <reponame>booneng/mobly<filename>mobly/controllers/android_device_lib/services/logcat.py
# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache... |
release/stubs.min/System/ComponentModel/__init___parts/HandledEventArgs.py | htlcnn/ironpython-stubs | 182 | 92883 | <reponame>htlcnn/ironpython-stubs
class HandledEventArgs(EventArgs):
"""
Provides data for events that can be handled completely in an event handler.
HandledEventArgs()
HandledEventArgs(defaultHandledValue: bool)
"""
@staticmethod
def __new__(self,defaultHandledValue=None):
"""
__new__(cls:... |
pytext/metric_reporters/intent_slot_detection_metric_reporter.py | Titousensei/pytext-1 | 6,199 | 92884 | <reponame>Titousensei/pytext-1
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import Dict, List, Optional
from pytext.common.constants import DatasetFieldName, Stage
from pytext.data.data_structures.annotation import CLOSE, OPEN, escape_brackets
from pytext.m... |
trainer/base.py | merlinarer/scrl | 102 | 92898 | import copy
import errno
import os
import logging
import math
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.parallel import DistributedDataParallel
from .helper import TensorBoardWriter
from .linear_eval import iter_eval_epoch, linear_eval_online, linear_eval_offline
from data import... |
common/parametric_distribution.py | Timothy102/seed_rl | 733 | 92902 | <filename>common/parametric_distribution.py<gh_stars>100-1000
# coding=utf-8
# Copyright 2019 The SEED 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/lice... |
Notebooks/Target-lane.py | keuntaeklee/pytorch-PPUU | 159 | 92912 | <gh_stars>100-1000
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 1.2.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# ... |
rest_client/clients/core.py | js882829/tars | 371 | 92929 | <reponame>js882829/tars
from __future__ import absolute_import
import json
import urlparse
import requests
from requests.exceptions import RequestException
from django.conf import settings
from rest_client.decorators import json_format
from rest_client.utils import ConfigDict, get_logger, Guardor
from rest_client.e... |
test/tst_create_mem.py | timgates42/netcdf4-python | 574 | 92939 | <filename>test/tst_create_mem.py
import unittest
import netCDF4
import numpy as np
from numpy.testing import assert_array_equal
class TestCreateMem(unittest.TestCase):
def test_mem_create(self):
def check_inmemory(format):
# memory is 'advisory size' - not needed for NETCDF4/HDF5
# ... |
metal/mmtl/metal_model.py | inimino/metal | 437 | 92980 | <gh_stars>100-1000
from collections import defaultdict
import numpy as np
import torch
import torch.nn as nn
from metal.utils import move_to_device, recursive_merge_dicts, set_seed
model_defaults = {
"seed": None,
"device": 0, # gpu id (int) or -1 for cpu
"verbose": True,
"fp16": False,
"model_w... |
torchtext/datasets/conll2000chunking.py | parmeet/text | 3,172 | 92983 | from torchtext.data.datasets_utils import (
_RawTextIterableDataset,
_wrap_split_argument,
_add_docstring_header,
_download_extract_validate,
_create_dataset_directory,
_create_data_from_iob,
)
import os
import logging
URL = {
'train': "https://www.clips.uantwerpen.be/conll2000/chunking/tra... |
LeetCode/python3/650.py | ZintrulCre/LeetCode_Archiver | 279 | 92990 | class Solution:
def minSteps(self, n: int) -> int:
res, m = 0, 2
while n > 1:
while n % m == 0:
res += m
n //= m
m += 1
return res |
websauna/system/core/traversal.py | stevepiercy/websauna | 286 | 93073 | <filename>websauna/system/core/traversal.py<gh_stars>100-1000
"""Traversing core logic."""
# Pyramid
from pyramid.interfaces import ILocation
from zope.interface import implementer
@implementer(ILocation)
class Resource:
"""Traversable resource in a nested tree hierarchy with basic breadcrumbs support.
All t... |
python/londiste/handlers/shard.py | zzahti/skytools | 116 | 93115 | <filename>python/londiste/handlers/shard.py
"""Event filtering by hash, for partitioned databases.
Parameters:
key=COLUMN: column name to use for hashing
hash_key=COLUMN: column name to use for hashing (overrides 'key' parameter)
hashfunc=NAME: function to use for hashing (default: partconf.get_hash_raw)
hashe... |
rbp_eclip/custom_keras_objects.py | Luma-1994/lama | 137 | 93117 | <reponame>Luma-1994/lama
import concise
# all the custom objects are already loaded through importing concise
OBJECTS = None
# new concise version
# OBJECTS = concise.custom_objects
|
notebooks/plotting.py | syllogismos/wandb_trpo | 379 | 93126 | """
Short Plotting Routine to Plot Pandas Dataframes by Column Label
1. Takes list of dateframes to compare multiple trials
2. Takes list of y-variables to combine on 1 plot
3. Legend location and y-axis limits can be customized
Written by <NAME> (pat-coady.github.io)
"""
import matplotlib.pyplot as plt
def df_plot... |
gpflowopt/scaling.py | kyu999/GPflowOpt | 258 | 93130 | <filename>gpflowopt/scaling.py<gh_stars>100-1000
# Copyright 2017 <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 ... |
test/test_clamp.py | SimlaBurcu/QPyTorch | 172 | 93166 | import torch
import unittest
from qtorch.quant import *
from qtorch import FixedPoint, BlockFloatingPoint, FloatingPoint
DEBUG = False
log = lambda m: print(m) if DEBUG else False
class TestStochastic(unittest.TestCase):
"""
invariant: quantized numbers cannot be greater than the maximum representable number... |
Maya/cicd/python/libMayaExtended/libMayaExtended/mayaSceneApi.py | Mu-L/Exporters | 445 | 93180 | <filename>Maya/cicd/python/libMayaExtended/libMayaExtended/mayaSceneApi.py
import maya.OpenMaya as OpenMaya
import maya.OpenMayaRender as OpenMayaRender |
test.py | kentsommer/tensorflow-posenet | 302 | 93209 | # Import the converted model's class
import numpy as np
import random
import tensorflow as tf
from tensorflow.python.ops import rnn, rnn_cell
from posenet import GoogLeNet as PoseNet
import cv2
from tqdm import tqdm
import math
batch_size = 75
max_iterations = 30000
# Set this path to your project directory
path = 'p... |
gamestonk_terminal/portfolio/brokers/ally/ally_model.py | Aerex/GamestonkTerminal | 1,835 | 93248 | <filename>gamestonk_terminal/portfolio/brokers/ally/ally_model.py<gh_stars>1000+
"""Ally Model"""
__docformat__ = "numpy"
import ally
import pandas as pd
def get_holdings() -> pd.DataFrame:
"""Get holdings from Ally account in pandas df
Returns
-------
pd.DataFrame
Dataframe of positions
... |
src/homework/tests/cross_check/tests_crosscheck_is_checked.py | denkasyanov/education-backend | 151 | 93282 | <gh_stars>100-1000
import pytest
pytestmark = [pytest.mark.django_db]
@pytest.fixture
def answer(answers):
return answers[0]
@pytest.fixture
def crosscheck(mixer, answer, another_user):
return mixer.blend('homework.AnswerCrossCheck', answer=answer, checker=another_user)
def test_not_by_default(crosscheck... |
pyclustering/utils/color.py | JosephChataignon/pyclustering | 1,013 | 93284 | <gh_stars>1000+
"""!
@brief Colors used by pyclustering library for visualization.
@authors <NAME> (<EMAIL>)
@date 2014-2020
@copyright BSD-3-Clause
"""
class color:
"""!
@brief Consists titles of colors that are used by pyclustering for visualization.
"""
@staticmethod
... |
migrations/versions/0983f1227366_add_reported_post_count_column_to_.py | RobbiNespu/forget | 157 | 93286 | <filename>migrations/versions/0983f1227366_add_reported_post_count_column_to_.py
"""add reported post count column to account
Revision ID: 0983f1227366
Revises: <PASSWORD>
Create Date: 2017-08-03 19:16:55.883575
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '... |
packages/pegasus-python/test/db/test_trigger.py | ahnitz/pegasus | 127 | 93288 | import datetime
import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import Pegasus.db.schema as schema
from Pegasus.db.ensembles import EMError, Triggers, TriggerType
@pytest.fixture(scope="function")
def session():
"""
Create in-memory sqlite database with tables setu... |
cactus/utils/packaging.py | danielchasehooper/Cactus | 1,048 | 93290 | <reponame>danielchasehooper/Cactus<filename>cactus/utils/packaging.py<gh_stars>1000+
import posixpath
import pkg_resources
def pkg_walk(package, top):
"""
Walk the package resources. Implementation from os.walk.
"""
names = pkg_resources.resource_listdir(package, top)
dirs, nondirs = [], []
... |
SimG4CMS/Calo/python/GeometryAPD_cff.py | ckamtsikis/cmssw | 852 | 93297 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
#
# Geometry master configuration
# forStandalone APD
#
# Ideal geometry, needed for simulation
from Geometry.EcalTestBeam.APDXML_cfi import *
# Calorimeters
from Geometry.CaloEventSetup.CaloTopology_cfi import *
from Geometry.CaloEventSetup.CaloGeo... |
data_collection/gazette/spiders/sp_sao_roque.py | kaiocp/querido-diario | 454 | 93299 | <filename>data_collection/gazette/spiders/sp_sao_roque.py
from gazette.spiders.base.instar import BaseInstarSpider
class SpSaoRoqueSpider(BaseInstarSpider):
TERRITORY_ID = "3550605"
name = "sp_sao_roque"
allowed_domains = ["saoroque.sp.gov.br"]
start_urls = ["https://www.saoroque.sp.gov.br/portal/diar... |
fbrp/src/fbrp/cmd/down.py | ali-senguel/fairo | 669 | 93314 | from fbrp import life_cycle
from fbrp import registrar
import argparse
@registrar.register_command("down")
class down_cmd:
@classmethod
def define_argparse(cls, parser: argparse.ArgumentParser):
parser.add_argument("proc", action="append", nargs="*")
@staticmethod
def exec(args: argparse.Name... |
examples/web.py | msabramo/diesel | 224 | 93338 | from diesel.web import DieselFlask, request
app = DieselFlask(__name__)
@app.route("/")
def hello():
name = request.args.get('name', 'world')
return "hello, %s!" % name
@app.route("/err")
def err():
a = b
return "never happens.."
if __name__ == '__main__':
import diesel
def t():
whil... |
gluon/gluoncv2/models/dabnet.py | naviocean/imgclsmob | 2,649 | 93352 | <reponame>naviocean/imgclsmob
"""
DABNet for image segmentation, implemented in Gluon.
Original paper: 'DABNet: Depth-wise Asymmetric Bottleneck for Real-time Semantic Segmentation,'
https://arxiv.org/abs/1907.11357.
"""
__all__ = ['DABNet', 'dabnet_cityscapes']
import os
from mxnet import cpu
from mxnet.... |
support/misc.py | rknop/amuse | 131 | 93395 | import sys
import re
import os
import fnmatch
from os import walk as py_walk
def walk(top, callback, args):
for root, dirs, files in py_walk(top):
callback(args, root, files)
def find_data_files(srcdir, destdir, *wildcards, **kw):
"""
get a list of all files under the srcdir matching wildcards,
... |
classification_training/imagenet/resnet_vovnet_darknet_train_example/test_config.py | LANCEREN/simpleAICV-pytorch-ImageNet-COCO-training | 154 | 93398 | <gh_stars>100-1000
import os
import sys
BASE_DIR = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.dirname(
os.path.abspath(__file__)))))
sys.path.append(BASE_DIR)
from tools.path import ILSVRC2012_path
from simpleAICV.classification import backbones
from simpleAICV.classification import losses
... |
tensorflow_federated/python/core/impl/executors/data_conversions_test.py | zhihansh/federated-oss | 1,918 | 93400 | <filename>tensorflow_federated/python/core/impl/executors/data_conversions_test.py
# Copyright 2021, The TensorFlow Federated 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
#
# ... |
corehq/apps/groups/dbaccessors.py | dimagilg/commcare-hq | 471 | 93402 | <gh_stars>100-1000
from collections import namedtuple
from django.conf import settings
from corehq.apps.domain.dbaccessors import (
get_doc_ids_in_domain_by_class,
get_docs_in_domain_by_class,
)
def group_by_domain(domain):
from corehq.apps.groups.models import Group
return get_docs_in_domain_by_cla... |
tests/changes/api/test_jenkins_master_blacklist.py | vault-the/changes | 443 | 93424 | <gh_stars>100-1000
from changes.testutils import APITestCase
class JenkinsMasterBlacklist(APITestCase):
def test_add_remove_blacklist(self):
path = '/api/0/jenkins_master_blacklist/'
# Add to blacklist
data = dict(master_url='https://jenkins-master-a')
resp = self.client.post(path... |
tools/Ubertooth/host/python/specan_ui/setup.py | Charmve/BLE-Security-Att-Def | 149 | 93441 | <filename>tools/Ubertooth/host/python/specan_ui/setup.py
#!/usr/bin/env python
"""
Specan setup
Install script for the Ubertooth spectrum analyzer tool
Usage: python setup.py install
This file is part of project Ubertooth
Copyright 2012 <NAME>
"""
from distutils.core import setup
setup(
name = "specan",... |
train.py | xingranzh/CocosNet-v2 | 251 | 93445 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import sys
import torch
from torchvision.utils import save_image
from options.train_options import TrainOptions
import data
from util.iter_counter import IterationCounter
from util.util import print_current_errors
from util.util import ... |
changes/api/project_build_index.py | vault-the/changes | 443 | 93446 | <filename>changes/api/project_build_index.py
from __future__ import absolute_import, division, unicode_literals
from flask_restful.reqparse import RequestParser
from sqlalchemy import or_
from sqlalchemy.orm import contains_eager, joinedload
from changes.api.auth import get_current_user
from changes.api.base import A... |
tests/functional/modules/pyi_testmod_relimp/relimp1.py | hawkhai/pyinstaller | 9,267 | 93448 | #-----------------------------------------------------------------------------
# Copyright (c) 2005-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... |
examples/pipeline_sensitivity.py | rozlana-g/FEDOT | 358 | 93456 | from os import makedirs
from os.path import exists, join
from fedot.core.composer.gp_composer.gp_composer import GPComposerBuilder, GPComposerRequirements
from fedot.core.data.data import InputData
from fedot.core.data.data_split import train_test_data_setup
from fedot.core.optimisers.gp_comp.gp_optimiser import GPGra... |
src/debugpy/_vendored/pydevd/tests_python/resources/_debugger_case15.py | r3m0t/debugpy | 695 | 93471 |
class Car(object):
"""A car class"""
def __init__(self, model, make, color):
self.model = model
self.make = make
self.color = color
self.price = None
def get_price(self):
return self.price
def set_price(self, value):
self.price = value
availableCars = ... |
modules/dbnd/test_dbnd/scenarios/pipelines/double_fault.py | ipattarapong/dbnd | 224 | 93497 | <gh_stars>100-1000
import logging
import sys
from dbnd import PipelineTask, PythonTask, output, parameter
logger = logging.getLogger(__name__)
class T1(PythonTask):
p1 = parameter.value("somep")
o_1 = output[str]
def run(self):
self.o_1 = self.p1
class T2(PythonTask):
p1 = parameter.valu... |
mmtbx/ions/geometry.py | dperl-sol/cctbx_project | 155 | 93498 | # -*- coding: utf-8; py-indent-offset: 2 -*-
"""
This module provides tools for examining a set of vectors and find the geometry
that best fits from a set of built in shapes.
"""
from __future__ import absolute_import, division, print_function
from scitbx.matrix import col
from collections import OrderedDict
try:
fr... |
mcsniperpy/util/ping_tester.py | veil-ctf/MCsniperPY | 1,320 | 93527 | # type: ignore
# ^ that's necessary to prevent a false linting error of some kind
import asyncio
import urllib.parse
from time import perf_counter
import typer
from mcsniperpy.util.logs_manager import Color as color
from mcsniperpy.util.logs_manager import Logger as log
async def check(url: str, iterations:... |
create-template-script/createtemplatefile.py | TechnicalConsultant123/material-design-icons-adt-template | 352 | 93535 | import os
from os.path import join
from collections import OrderedDict
templateFile = open('../MaterialDesignIcons/template.xml', 'w')
file1 = open('part1.txt', 'r')
for line in file1:
templateFile.write(line),
file1.close()
icons_path = "../MaterialDesignIcons/root/material-design-icons"
walk = os.listdir(icons... |
testing/example.py | gndctrl2mjrtm/dkeras | 195 | 93559 | # Ideas
"""
server = dkeras.DataServer()
model1.link(model3)
model1.postprocess = lambda z: np.float16(z)
server = model1 + model2 + model3
server.add(camera1, dest=('m1', 'm2'))
server.add_address('192.168.1.42')
"""
|
tests/isolated/green_ssl_py36_properties.py | li-caspar/eventlet_0.30.2 | 5,079 | 93570 | <gh_stars>1000+
__test__ = False
if __name__ == '__main__':
import eventlet
eventlet.monkey_patch()
try:
eventlet.wrap_ssl(
eventlet.listen(('localhost', 0)),
certfile='does-not-exist',
keyfile='does-not-exist',
server_side=True)
except IOError ... |
problog/version.py | HEmile/problog | 189 | 93587 | <gh_stars>100-1000
version = '2.2.2'
|
exp/comm/comm_model_utils.py | PeterouZh/CIPS-3D | 308 | 93588 | <reponame>PeterouZh/CIPS-3D
import logging
import random
import numpy as np
import math
import torch
import torch.nn as nn
class PosEmbedding(nn.Module):
def __init__(self,
max_logscale,
N_freqs,
logscale=True,
multi_pi=False,):
"""
Defines a func... |
lldb/test/API/python_api/frame/inlines/TestInlinedFrame.py | mkinsner/llvm | 2,338 | 93603 | """
Testlldb Python SBFrame APIs IsInlined() and GetFunctionName().
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class InlinedFrameAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__... |
trackstats/trackers.py | keranno/django-trackstats | 369 | 93640 | from datetime import date, timedelta, datetime, time
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from django.db import models
from django.db import connections
from django.utils import timezone
from .models import Period, StatisticByDate, StatisticByDateAndObject
clas... |
harness/determined/deploy/aws/gen_vcpu_mapping.py | gh-determined-ai/determined | 1,729 | 93654 | <gh_stars>1000+
import argparse
import json
from pathlib import Path
from typing import Dict, Iterable, List, Tuple
import boto3
import yaml
def _fetch_vcpu_mapping() -> Iterable[Tuple[str, Dict]]:
# Price List api is only available in us-east-1 and ap-southeast-1.
client = boto3.client("pricing", region_nam... |
semseg/models/heads/__init__.py | Genevievekim/semantic-segmentation-1 | 196 | 93662 | <filename>semseg/models/heads/__init__.py
from .upernet import UPerHead
from .segformer import SegFormerHead
from .sfnet import SFHead
from .fpn import FPNHead
from .fapn import FaPNHead
from .fcn import FCNHead
from .condnet import CondHead
__all__ = ['UPerHead', 'SegFormerHead', 'SFHead', 'FPNHead', 'FaPNHead', 'FCN... |
code/exercises/ex_8_8/update_distribution_example.py | ElliotMunro200/reinforcement_learning_an_introduction | 234 | 93673 | <reponame>ElliotMunro200/reinforcement_learning_an_introduction
#!/usr/bin/env python
"""
--------------------------------
project: code
created: 12/07/2018 10:34
---------------------------------
"""
import itertools
from concurrent.futures import ProcessPoolExecutor
import numpy as np
from generic import policies
... |
saleor/account/migrations/0009_auto_20170206_0407.py | elwoodxblues/saleor | 15,337 | 93679 | <reponame>elwoodxblues/saleor<gh_stars>1000+
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-06 10:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("account", "0008_auto_20161115_1011")]
replaces = [(... |
venv/lib/python3.8/site-packages/restructuredtext_lint/__init__.py | trkohler/biopython | 142 | 93680 | # Load in our dependencies
from __future__ import absolute_import
from restructuredtext_lint.lint import lint, lint_file
# Export lint functions
lint = lint
lint_file = lint_file
|
client/channellog.py | heartsoso/Discline | 535 | 93715 | # Wrapper class to make dealing with logs easier
class ChannelLog():
__channel = ""
__logs = []
unread = False
mentioned_in = False
# the index of where to start printing the messages
__index = 0
def __init__(self, channel, logs):
self.__channel = channel
self.__logs = list... |
scripts/remove_input_references.py | rlamoureux/Python- | 263 | 93723 | <gh_stars>100-1000
# This script removes the input reference numbers from html pages.
# They play a useful role in scientific notebooks, but they are really
# just visual clutter in this project.
# Could be an nbconvert setting, but it's an easy enough scripting job.
import os
import sys
print("\nStripping input re... |
tests/geo_test.py | sethvargo/vaex | 337 | 93748 | from common import *
def test_virtual_columns_spherical():
df = vaex.from_scalars(alpha=0, delta=0, distance=1)
df.add_virtual_columns_spherical_to_cartesian("alpha", "delta", "distance", "x", "y", "z", radians=False)
x, y, z = df['x'].values[0], df['y'].values[0], df['z'].values[0]
np.testing.asser... |
caffe/ultra_face_caffe_inference.py | Yucao42/Ultra-Light-Fast-Generic-Face-Detector-1MB | 6,602 | 93765 | # coding=utf-8
import argparse
import os
import time
from math import ceil
import caffe
import cv2
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('--caffe_prototxt_path', default="model/RFB-320/RFB-320.prototxt", type=str, help='caffe_prototxt_path')
parser.add_argument('--caffe_model_path'... |
awsume/awsumepy/lib/logger.py | ignatenkobrain/awsume | 654 | 93780 | <filename>awsume/awsumepy/lib/logger.py
import sys
import logging
import re
class LogFormatter(logging.Formatter):
@staticmethod
def _filter(s):
no_access_key_id = re.sub(r'(?<![A-Z0-9])[A-Z0-9]{20}(?![A-Z0-9])', 'SECRET', s)
no_secret_access_key = re.sub(r'(?<![A-Za-z0-9/+=])[A-Za-z0-9/+=]{40... |
common/request.py | ujlbu4/vas3k.club | 496 | 93798 | from django.http import JsonResponse, Http404
from django.shortcuts import redirect
def parse_ip_address(request):
ipaddress = request.META.get("HTTP_X_REAL_IP") \
or request.META.get("HTTP_X_FORWARDED_FOR") \
or request.environ.get("REMOTE_ADDR") or ""
if "," in ipaddress: # multiple ips in... |
sportsbetting/bookmakers/netbet.py | pretrehr/Sports-betting | 169 | 93807 | """
NetBet odds scraper
"""
import datetime
import http.client
import re
import urllib
import urllib.error
import urllib.request
import fake_useragent
from bs4 import BeautifulSoup
import sportsbetting as sb
from sportsbetting.auxiliary_functions import truncate_datetime
def parse_netbet(url):
"""
Retourn... |
scripts/storage/secondary/cloud-install-sys-tmplt.py | ycyun/ablestack-cloud | 1,131 | 93826 | <filename>scripts/storage/secondary/cloud-install-sys-tmplt.py<gh_stars>1000+
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyrigh... |
examples/pkg1/test_mod2.py | altendky/pytest-monitor | 136 | 93835 | <gh_stars>100-1000
import time
def test_sleep_400ms():
time.sleep(0.4)
|
glumpy/gloo/framebuffer.py | Frekby/glumpy | 1,074 | 93858 | # -----------------------------------------------------------------------------
# Copyright (c) 2009-2016 <NAME>. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
"""
A framebuffer is a collection of buffers that can be used ... |
math/josepheus_problem/python/josephus.py | CarbonDDR/al-go-rithms | 1,253 | 93862 | from __future__ import print_function
def josephus(list_of_players, step):
#skipdeadguy
step -= 1
index = step
while len(list_of_players) > 1:
print("Player Died : " , list_of_players.pop(index))
index = (index + step) % len(list_of_players)
print('Player Survived : ', list_of_players[0])
def main():
print(... |
tools/android/tracing/systrace-extract-startup.py | zealoussnow/chromium | 14,668 | 93884 | #!/usr/bin/env python
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script parses result of build/android/adb_profile_chrome_startup and
# prints various information.
from __future__ import print... |
mmtbx/geometry/tests/tst_topology.py | dperl-sol/cctbx_project | 155 | 93888 | from __future__ import absolute_import, division, print_function
from mmtbx.geometry import topology
import unittest
class TestAtom(unittest.TestCase):
def test_1(self):
foo = object()
bar = object()
a = topology.Atom( foo = foo, bar = bar )
self.assertEqual( a.foo, foo )
self.assertEqual( a... |
tests/schema/get_spec_for_prop_test.py | nickgaya/bravado-core | 122 | 93890 | <reponame>nickgaya/bravado-core<filename>tests/schema/get_spec_for_prop_test.py
# -*- coding: utf-8 -*-
import pytest
from bravado_core.exception import SwaggerMappingError
from bravado_core.schema import get_spec_for_prop
from bravado_core.spec import Spec
@pytest.fixture
def address_spec():
return {
't... |
Lib/objc/CryptoTokenKit.py | snazari/Pyto | 701 | 93909 | <reponame>snazari/Pyto<gh_stars>100-1000
"""
Classes from the 'CryptoTokenKit' framework.
"""
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
TKTokenWatch... |
dist/cygwin-prebuilts/make-cygwin-prebuilts.py | gnaggnoyil/wslbridge | 376 | 93931 | <reponame>gnaggnoyil/wslbridge
#!python3
import os
import sys
sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import util
import re
import shutil
import subprocess
import dllversion
from os.path import abspath
from subprocess import check_call
from util import glob_paths, rmpath, mkdi... |
servefiles/sendurls.py | Jerry-Shaw/FBI | 1,684 | 93953 | <gh_stars>1000+
#!/usr/bin/env python
# coding: utf-8 -*-
import socket
import struct
import sys
import time
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
if len(sys.argv) < 3:
print('Usage: ' + sys.argv[0] + ' <target ip> <url>...')
sys.exit(1)
target_ip =... |
examples/libtest/DatetimeModuleTest.py | takipsizad/pyjs | 739 | 93976 | # Testing datetime module
import sys
import UnitTest
import datetime
class DatetimeModuleTest(UnitTest.UnitTest):
def testDate(self):
d = datetime.date(2010, 4, 9)
self.assertEqual(d.year, 2010)
self.assertEqual(d.month, 4)
self.assertEqual(d.day, 9)
self.assertEqual(d.we... |
pandas_vs_datatable/code/mutate.py | korur/Blog | 108 | 93985 | import os
import re
import json
import time
import numpy as np
import pandas as pd
from plotnine import *
# Config
PATH = os.getcwd()
path_n = re.split(pattern=r"/|\\", string=PATH)[1:]
if os.name == "posix":
path_n = "/" + os.path.join(*path_n)
else:
drive = PATH[0:3]
path_n = drive + os.path.join(*path_n... |
test/test_durable.py | timgates42/paxos | 420 | 93993 | <gh_stars>100-1000
import sys
import os
import os.path
import hashlib
import struct
import tempfile
import shutil
import pickle
#from twisted.trial import unittest
import unittest
this_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append( os.path.dirname(this_dir) )
from paxos import durable
class DOb... |
Algo and DSA/LeetCode-Solutions-master/Python/time-based-key-value-store.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 93999 | <filename>Algo and DSA/LeetCode-Solutions-master/Python/time-based-key-value-store.py<gh_stars>1000+
# Time: set: O(1)
# get: O(logn)
# Space: O(n)
import collections
import bisect
class TimeMap(object):
def __init__(self):
"""
Initialize your data structure here.
"""
sel... |
model_compiler/src/model_compiler/compilers/keras_model_file_to_tflite_model.py | yuanliya/Adlik | 548 | 94050 | # Copyright 2019 ZTE corporation. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import tensorflow as tf
from . import repository
from ..models.sources.keras_model_file import KerasModelFile
from ..models.targets.tflite_model import TfLiteModel
from .. import tflite_util
from .. import keras_util
@repo... |
HelperTools/CAV_to_constraint_arr.py | kataya/arcade-expressions | 119 | 94077 | import arcpy
import pandas as pd
import os
fc = r"C:\\temp\\GasPipelineEnterpriseDataManagement\\Databases\\UPDM_UtilityNetwork.gdb\\UtilityNetwork\\PipelineLine"
field_group_name = 'Limit Material By Asset Type'
def view_cav(table, subtype_field):
index = ['fieldGroupName', 'subtype', 'isRetired', 'id']
dat... |
mayan/apps/authentication/urls.py | eshbeata/open-paperless | 2,743 | 94091 | <filename>mayan/apps/authentication/urls.py<gh_stars>1000+
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import url
from django.contrib.auth.views import logout
from .views import (
login_view, password_change_done, password_change_view,
password_reset_complete... |
lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_spgw_initiated_ded_bearer.py | Aitend/magma | 849 | 94094 | """
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
import ipaddress
import time... |
model/prd_evaluation.py | hengfei-wang/SCNeRF | 272 | 94095 | from reprojection import runSuperGlueSinglePair,image_pair_candidates, runSIFTSinglePair
from ray_dist_loss import preprocess_match, proj_ray_dist_loss_single
import torch
import numpy as np
import os
from random import random
import numpy as np
import torch
import torchvision.transforms as TF
import matplotlib.pypl... |
robomimic/scripts/get_dataset_info.py | akolobov/robomimic | 107 | 94097 | <filename>robomimic/scripts/get_dataset_info.py<gh_stars>100-1000
"""
Helper script to report dataset information. By default, will print trajectory length statistics,
the maximum and minimum action element in the dataset, filter keys present, environment
metadata, and the structure of the first demonstration. If --ver... |
CPAC/nuisance/__init__.py | gkiar/C-PAC | 125 | 94102 | from .utils import (
find_offending_time_points,
temporal_variance_mask,
generate_summarize_tissue_mask,
NuisanceRegressor
)
from .nuisance import (
create_regressor_workflow,
create_nuisance_regression_workflow,
filtering_bold_and_regressors
)
from .bandpass import (
bandpass_voxels
)... |
sqlalchemy_utils/types/encrypted/padding.py | susnux/sqlalchemy-utils | 879 | 94113 | import six
class InvalidPaddingError(Exception):
pass
class Padding(object):
"""Base class for padding and unpadding."""
def __init__(self, block_size):
self.block_size = block_size
def pad(self, value):
raise NotImplementedError('Subclasses must implement this!')
def unpad(se... |
PWGJE/EMCALJetTasks/Tracks/analysis/util/PtReachCalculation.py | maroozm/AliPhysics | 114 | 94118 | #**************************************************************************
#* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
#* *
#* Author: The ALICE Off-line Project. *
#* Contributors ... |
lib/gcn/sparse/torch_vertex.py | ChenFengYe/relightable-nr | 105 | 94146 | <reponame>ChenFengYe/relightable-nr
import torch
from torch import nn
import torch_geometric as tg
from .torch_nn import MLP
from .torch_edge import DilatedKnnGraph
class MRConv(nn.Module):
"""
Max-Relative Graph Convolution (Paper: https://arxiv.org/abs/1904.03751)
"""
def __init__(self, in_channels,... |
ipymd/formats/python.py | nathanfdunn/ipymd | 521 | 94174 | <reponame>nathanfdunn/ipymd
# -*- coding: utf-8 -*-
"""Python reader and writer."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import re
import ast
from collections import OrderedDict
from ... |
plyer/platforms/linux/battery.py | EdwardCoventry/plyer | 1,184 | 94185 | '''
Module of Linux API for plyer.battery.
'''
from math import floor
from os import environ
from os.path import exists, join
from subprocess import Popen, PIPE
from plyer.facades import Battery
from plyer.utils import whereis_exe
class LinuxBattery(Battery):
'''
Implementation of Linux battery API via acces... |
tapas/utils/constants.py | Martin36/tapas | 816 | 94196 | <reponame>Martin36/tapas
# coding=utf-8
# Copyright 2019 The Google AI Language Team 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.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.