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 |
|---|---|---|---|---|
tasks/prequential_drift_evaluator.py | JanSurft/tornado | 103 | 11105267 | """
The Tornado Framework
By <NAME>
University of Ottawa, Ontario, Canada
E-mail: apesaran -at- uottawa -dot- ca / alipsgh -at- gmail -dot- com
"""
import copy
import random
import numpy
from pympler import asizeof
from archiver.archiver import Archiver
from evaluators.classifier_evaluator import Predi... |
environment/settings.py | claytonbrown/lambda-refarch-iotbackend | 181 | 11105277 | <reponame>claytonbrown/lambda-refarch-iotbackend
"""
Modify these values to match your configuration
"""
# AWS IoT endpoint settings
HOST_NAME = "ahrxvb36afpwx-ats.iot.eu-west-1.amazonaws.com" # replace with your AWS IoT endpoint for your region
HOST_PORT = 8883 # leave this as-is
# thing certs & keys
PRIVATE_KEY = "ce... |
motpy/utils.py | HaydenAI/motpy | 337 | 11105281 | import importlib.util
from motpy import Track
def ensure_packages_installed(packages, stop_if_some_missing: bool = True):
some_missing = False
for package in packages:
spec = importlib.util.find_spec(package)
if spec is None:
some_missing = True
print(f'package {packag... |
django/contrib/postgres/serializers.py | ni-ning/django | 61,676 | 11105296 | <filename>django/contrib/postgres/serializers.py
from django.db.migrations.serializer import BaseSerializer
class RangeSerializer(BaseSerializer):
def serialize(self):
module = self.value.__class__.__module__
# Ranges are implemented in psycopg2._range but the public import
# location is p... |
maro/rl/scheduling/__init__.py | yangboz/maro | 598 | 11105342 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from .scheduler import Scheduler
from .simple_parameter_scheduler import LinearParameterScheduler, TwoPhaseLinearParameterScheduler
__all__ = [
"Scheduler",
"LinearParameterScheduler",
"TwoPhaseLinearParameterScheduler"
]
|
tests/issues/test_issue_289.py | pasqoc/heterocl | 236 | 11105349 | import heterocl as hcl
import numpy as np
def test_slice_op():
hcl.init()
def kernel(A):
return hcl.compute(A.shape, lambda x: A[x][8:0] + A[x][16:8])
A = hcl.placeholder((10,))
s = hcl.create_schedule(A, kernel)
f = hcl.build(s)
np_A = np.random.randint(10, size=(10,))
np_B = n... |
tfimm/train/problems/classification.py | hyenal/tensorflow-image-models | 154 | 11105361 | <reponame>hyenal/tensorflow-image-models
import shutil
import tempfile
from dataclasses import dataclass
from pathlib import Path
from typing import Any
import numpy as np
import tensorflow as tf
from ..interface import ProblemBase
from ..registry import cfg_serializable, get_class
@dataclass
class ClassificationCo... |
src/masonite/validation/__init__.py | cercos/masonite | 1,816 | 11105400 | <filename>src/masonite/validation/__init__.py<gh_stars>1000+
from .RuleEnclosure import RuleEnclosure
from .MessageBag import MessageBag
from .Validator import (
BaseValidation,
ValidationFactory,
Validator,
accepted,
active_domain,
after_today,
before_today,
confirmed,
contains,
... |
reviewboard/reviews/urls.py | amalik2/reviewboard | 921 | 11105409 | from __future__ import unicode_literals
from django.conf.urls import include, url
from reviewboard.reviews import views
download_diff_urls = [
url(r'^orig/$',
views.DownloadDiffFileView.as_view(
file_type=views.DownloadDiffFileView.TYPE_ORIG),
name='download-orig-file'),
url(r'^... |
webserver_example/webserver_example.py | iamontresor/unity-experiment-framework | 119 | 11105427 | <gh_stars>100-1000
from flask import Flask, request
from flask_httpauth import HTTPBasicAuth
from flask_cors import CORS
from werkzeug.security import generate_password_hash, check_password_hash
import os
# where data will be stored
OUTPUT_DIR = 'example_output'
# generate username/passwords
users = {
"susan": ge... |
app/spider/reply/test_reply_task.py | kenmingwang/ASoulCnki | 384 | 11105446 | import get_reply_data
if __name__ == '__main__':
reply_param_tuples = [(1, 459141852, 0, 490521832557537540)]
get_reply_data.task(reply_param_tuples)
|
using_dl_to_annotate_protein_universe/hmm_baseline/phmmer.py | DionysisChristopoulos/google-research | 23,901 | 11105499 | <filename>using_dl_to_annotate_protein_universe/hmm_baseline/phmmer.py<gh_stars>1000+
# coding=utf-8
# Copyright 2021 The Google Research 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... |
sam_convnet_drawer/examples/LeNet.py | b2220333/convnet-drawer | 580 | 11105503 | import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from convnet_drawer import Model, Conv2D, MaxPooling2D, Flatten, Dense
from pptx_util import save_model_to_pptx
import config
def main():
config.inter_layer_margin = 65
config.channel_scale = 4 / 5
model = M... |
deep_learning/train_val_model.py | gautard/pystatsml | 123 | 11105537 | import numpy as np
import torch
import time
import copy
def train_val_model(model, criterion, optimizer, dataloaders, num_epochs=25,
scheduler=None, log_interval=None):
since = time.time()
best_model_wts = copy.deepcopy(model.state_dict())
best_acc = 0.0
# Store losses and accuracies accross... |
tests/structures/test_with.py | akubera/batavia | 1,256 | 11105560 | <filename>tests/structures/test_with.py
from unittest import expectedFailure
from ..utils import TranspileTestCase
class WithTests(TranspileTestCase):
def test_enter_exit(self):
self.assertCodeExecution("""
class mgr:
def __enter__(self):
print('__enter__')
... |
deep-rl/lib/python2.7/site-packages/OpenGL/raw/GLES1/OES/single_precision.py | ShujaKhalid/deep-rl | 210 | 11105575 | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GLES1 import _types as _cs
# End users want this...
from OpenGL.raw.GLES1._types import *
from OpenGL.raw.GLES1 import _errors
from OpenGL.constant import Constant as _C
import... |
recipes/Python/310791_skeletal/recipe-310791.py | tdiprima/code | 2,023 | 11105629 | <reponame>tdiprima/code<filename>recipes/Python/310791_skeletal/recipe-310791.py
import compiler.visitor
class NotImplementedException(Exception): pass
class VisitorSkeleton(compiler.visitor.ASTVisitor):
def visitAdd(self, node):
# Add attributes
# left left operand
# ... |
Bin/slice_psd.py | anastasia2607/DeloresDev | 765 | 11105671 | #!/usr/bin/python
import os
import sys
from PIL import Image
from optparse import OptionParser
from psd_tools import PSDImage
# Globals
source_size = None
emited_files = {}
def visit_layer(psd, layer, options):
global source_size, emited_files
name=layer.name
if name.endswith(".png") and not name.startswith("-")... |
toolkit/third_party/apiclient/ext/django_orm.py | suraj-testing2/Flowers_Toilet | 790 | 11105695 | # Copyright (C) 2010 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
transpyle/cpp/parser.py | EraYaN/transpyle | 107 | 11105706 | """Parsing C++."""
import logging
import pathlib
import platform
import tempfile
import xml.etree.ElementTree as ET
import argunparse
from ..general import Parser
from ..general.tools import run_tool
_LOG = logging.getLogger(__name__)
CASTXML_PATH = pathlib.Path('castxml')
def run_castxml(input_path: pathlib.Pat... |
unittests/smstest.py | low456high/Skype4Py | 199 | 11105722 | <gh_stars>100-1000
import unittest
import skype4pytest
from Skype4Py.sms import *
class SmsMessageTest(skype4pytest.TestCase):
def setUpObject(self):
self.obj = SmsMessage(self.skype, '1234')
# Methods
# =======
def testDelete(self):
self.api.enqueue('DELETE SMS 1234')
self.... |
Chapter07/loadcsv-fail.py | VinushaVemuri/learn | 185 | 11105728 | from faker import Faker
import csv
output=open('/home/paulcrickard/peoplepipeline/people.csv','w')
fake=Faker()
header=['name','age','street','city','state','zip','lng','lat']
mywriter=csv.writer(output)
mywriter.writerow(header)
for r in range(1000):
mywriter.writerow([fake.name(),fake.random_int(min=1, max=100, s... |
tests/utils/functions/test_singleobj_returndims.py | goncalogteixeira/pyswarns | 959 | 11105773 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Import standard library
from collections import namedtuple
# Import modules
import numpy as np
import pytest
# Import from pyswarms
from pyswarms.utils.functions import single_obj as fx
def test_ackley_output_size(common_minima, targetdim):
"""Tests ackley output... |
Configuration/ProcessModifiers/python/run3_ecalclustering_cff.py | ckamtsikis/cmssw | 852 | 11105775 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
# This modifier is for ECAL Run3 clustering studies
run3_ecalclustering = cms.Modifier()
|
test-framework/test-suites/integration/tests/list/test_list_vm.py | sammeidinger/stack | 123 | 11105791 | import pytest
import json
from pathlib import Path
class TestListVM:
"""
Tests for the list vm command
"""
def test_list_vm_all(self, add_hypervisor, add_vm_multiple, host):
list_result = host.run(f'stack list vm output-format=json')
assert list_result.rc == 0
assert json.loads(list_result.stdout) == [
... |
modelvshuman/helper/human_categories.py | TizianThieringer/model-vs-human | 158 | 11105831 | #!/usr/bin/env python
"""human_categories.py
Code to define the class that deals with the specifics
of the 16 categories used in Robert's human and DNN
experiments.
"""
import numpy as np
import os
from . import wordnet_functions as wf
def compute_imagenet_indices_for_category(category):
"""Return list of Ima... |
test/unit/network/gremlin/test_gremlin_path_pattern.py | Sam-Martin/graph-notebook | 378 | 11105843 | <filename>test/unit/network/gremlin/test_gremlin_path_pattern.py
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
"""
import unittest
from gremlin_python.structure.graph import Path
from graph_notebook.network.gremlin.GremlinNetwork import GremlinNetwork, Pat... |
coco_synthetic/split_train_test.py | psaboia/RGB-N | 117 | 11105856 | <filename>coco_synthetic/split_train_test.py
import networkx as nx
import numpy as np
import os
from glob import glob
import sys
import skimage.io as io
import pdb
def contain_node(Graph_list,node):
for g in Graph_list:
if g.has_node(node):
return True
return False
data_dir='../../dataset/filter_tamper' #FIXME... |
tests/test_serializers.py | sidarun88/django_private_chat2 | 150 | 11105869 | <gh_stars>100-1000
from django.test import TestCase
from django_private_chat2.models import DialogsModel, MessageModel, UploadedFile
from django_private_chat2.serializers import serialize_message_model, serialize_dialog_model, serialize_file_model
from .factories import DialogsModelFactory, MessageModelFactory, UserFa... |
statannotations/_GroupsPositions.py | orena1/statannotations | 110 | 11105951 | import numpy as np
from statannotations.utils import get_closest
class _GroupsPositions:
def __init__(self, plotter, group_names):
self._plotter = plotter
self._hue_names = self._plotter.hue_names
if self._hue_names is not None:
nb_hues = len(self._hue_names)
if n... |
tars/deployment/models/actions.py | js882829/tars | 371 | 11105961 | from django.db import models
from deployments import TarsDeployment
from roll_engine.models import DeploymentAction
class TarsDeploymentAction(DeploymentAction):
deployment = models.ForeignKey(
TarsDeployment, related_name='actions', db_constraint=False, null=True)
finish_time = models.DateTimeField(... |
ml_logger/ml_logger_tests/conftest.py | mcx/ml_logger | 107 | 11106008 | LOCAL_TEST_DIR = '/tmp/ml-logger-debug'
def pytest_addoption(parser):
parser.addoption('--logdir', action='store', default=LOCAL_TEST_DIR,
help="The logging path for the test.")
|
deephyper/ensemble/_base_ensemble.py | felixeperez/deephyper | 185 | 11106041 | import abc
import json
import os
import traceback
import ray
import tensorflow as tf
class BaseEnsemble(abc.ABC):
"""Base class for ensembles, every new ensemble algorithms needs to extend this class.
Args:
model_dir (str): Path to directory containing saved Keras models in .h5 format.
... |
tests/unit/repo/plots/test_diff.py | lucasalavapena/dvc | 9,136 | 11106063 | import pytest
from dvc.repo.plots.diff import _revisions
@pytest.mark.parametrize(
"arg_revisions,is_dirty,expected_revisions",
[
([], False, ["workspace"]),
([], True, ["HEAD", "workspace"]),
(["v1", "v2", "workspace"], False, ["v1", "v2", "workspace"]),
(["v1", "v2", "worksp... |
alipay/aop/api/domain/KoubeiCateringPosDishgroupSyncModel.py | snowxmas/alipay-sdk-python-all | 213 | 11106081 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.PosDishGroupModel import PosDishGroupModel
class KoubeiCateringPosDishgroupSyncModel(object):
def __init__(self):
self._pos_dish_group_model = None... |
Python3/97.py | rakhi2001/ecom7 | 854 | 11106083 | <reponame>rakhi2001/ecom7<gh_stars>100-1000
__________________________________________________________________________________________________
sample 24 ms submission
class Solution:
def isInterleave(self, s1: str, s2: str, s3: str) -> bool:
if not s1 and not s2 and not s3:
return True
i... |
corrector/bert_modeling/create_data.py | fire717/OCR-Corrector | 367 | 11106091 | import numpy as np
import pickle
import os
import argparse
def cut_line(sentence):
sent = ''
delimiter = ['。', ';', '?', '!']
for i, c in enumerate(sentence):
sent += c
if ((c in delimiter) and (sentence[min(len(sentence)-1, i + 1)] not in ['」', '”', '’'])) or i == len(sentence)-1:
... |
orgutil/temp.py | Sinamore/orgextended | 120 | 11106102 | <filename>orgutil/temp.py
import sublime
import sublime_plugin
import re
from pathlib import Path
import os
import fnmatch
import logging
import sys
import traceback
import tempfile
from shutil import copyfile
log = logging.getLogger(__name__)
def CreateTempFile(source, suffix=".temp",start=None, end=None):
filenam... |
lib/main.py | Rehzende/project-dev-kpis | 113 | 11106105 | import sys
reload(sys)
sys.setdefaultencoding('utf8')
import os
import json
import time
import argparse
from util import logger
from prometheus_client import start_http_server
import inventory
import project_time_metrics
import project_contributors
import project_composition
import project_issue_transition
from api_... |
desktop/core/ext-py/nose-1.3.7/unit_tests/test_suite.py | kokosing/hue | 5,079 | 11106126 | <reponame>kokosing/hue<filename>desktop/core/ext-py/nose-1.3.7/unit_tests/test_suite.py<gh_stars>1000+
from nose.config import Config
from nose import case
from nose.suite import LazySuite, ContextSuite, ContextSuiteFactory, \
ContextList
import imp
import sys
import unittest
from mock import ResultProxyFactory, R... |
crafters/nlp/TikaExtractor/tests/test_tikaextractor.py | Harshdeep1996/jina-hub | 106 | 11106140 | __copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import numpy as np
import pytest
from .. import TikaExtractor
def input_bytes():
with open('cats_are_awesome.pdf', 'rb') as pdf:
i_bytes = pdf.read()
return i_bytes
@pytest.mark.parametrize('uri, ... |
chainercv/links/model/mobilenet/__init__.py | Manny27nyc/chainercv | 1,600 | 11106145 | <filename>chainercv/links/model/mobilenet/__init__.py<gh_stars>1000+
from chainercv.links.model.mobilenet.expanded_conv_2d import ExpandedConv2D # NOQA
from chainercv.links.model.mobilenet.mobilenet_v2 import MobileNetV2 # NOQA
from chainercv.links.model.mobilenet.tf_conv_2d_bn_activ import TFConv2DBNActiv # NOQA
fr... |
util/iso.py | Dennisbonke/toaruos | 429 | 11106159 | <gh_stars>100-1000
#!/usr/bin/env python3
"""
Tool for creating ISO 9660 CD images.
"""
import array
import struct
class Structure(object):
assert_size = -1
def __init__(self):
self.data = {}
for field in self.fields:
if len(field) > 2:
f, s, d = field
... |
sknetwork/utils/tests/test_ward.py | altana-tech/scikit-network | 457 | 11106179 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on October 2019
@author: <NAME> <<EMAIL>>
"""
import unittest
import numpy as np
from sknetwork.utils import WardDense
class TestKMeans(unittest.TestCase):
def test_kmeans(self):
x = np.random.randn(10, 3)
ward = Ward... |
docs/src/util/toml.py | andrevidela/elba | 182 | 11106234 | #!/usr/bin/env python
from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, bygroups, \
using, DelegatingLexer
from pygments.token import Text, Name, Number, String, Comment, Punctuation, \
Other, Keyword, Operator, Literal, Whitespace
class TOMLLexer(RegexLexer):
"""
Lexer for TOML, a ... |
src/python/Somatic/Strelka.py | nh13/hap.py | 315 | 11106251 | <reponame>nh13/hap.py
# coding=utf-8
#
# Copyright (c) 2010-2015 Illumina, Inc.
# All rights reserved.
#
# This file is distributed under the simplified BSD license.
# The full text can be found here (and in LICENSE.txt in the root folder of
# this distribution):
#
# https://github.com/Illumina/licenses/blob/master/Sim... |
PythonVirtEnv/Lib/site-packages/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py | zuhorski/EPL_Project | 349 | 11106263 | <gh_stars>100-1000
r'''
Copyright: Brainwy Software Ltda.
License: EPL.
=============
Works for Windows by using an executable that'll inject a dll to a process and call a function.
Note: https://github.com/fabioz/winappdbg is used just to determine if the target process is 32 or 64 bits.
Works for Linux relying on... |
tests/unit/common/test_common_image.py | muminkoykiran/computervision-recipes | 7,899 | 11106264 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
import numpy as np
from pathlib import Path
from utils_cv.common.image import (
im_width,
im_height,
im_width_height,
im2base64,
ims2strlist,
)
def test_im_width(tiny_ic_data_path):
im_path... |
src/classifier/model_base/base.py | LeslieLeung/2c | 236 | 11106265 | #!/usr/bin/env python
"""
Created by howie.hu at 2021-04-08.
Description:模型父类
Changelog: all notable changes to this file will be documented
"""
from importlib import import_module
class ModelManager:
"""
模型管理类
"""
_model_load_dict = {}
@classmethod
def get_model(cls, model_name:... |
Code/twitter-mining.py | sarah314/SpyPi | 211 | 11106270 | # <NAME>. 2017
import os
import tweepy
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
import time
import string
import sys
import keys
import json
from colors import farben
class MyListener(StreamListener):
def on_data(self, data):
try:
f... |
tests/test_hx.py | CalebBell/ht | 118 | 11106281 | <reponame>CalebBell/ht
# -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, 2017 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to ... |
protonfixes/gamefixes/307690.py | Sirmentio/protonfixes | 213 | 11106290 | """ Game fix for Sleeping Dogs: Definitive Edition
Note: It does not work with WINED3D.
After the game start fullscreen and resolution can be set from game display settings.
Sometimes the game is crashing.
"""
#pylint: disable=C0103
from protonfixes import util
def main():
""" Set virtual desktop
"""
# h... |
anubis/scanners/shodan.py | sdfmmbi/Anubis | 972 | 11106294 | import socket
from json import dumps
import shodan
from anubis.utils.ColorPrint import ColorPrint
def search_shodan(self):
print("Searching Shodan.io for additional information")
try:
from anubis.API import SHODAN_KEY
except ImportError:
ColorPrint.red("Unable to import API keys - make sure API.py exi... |
zeus/networks/tensorflow/detectors/faster_rcnn_trainer_callback.py | shaido987/vega | 240 | 11106302 | <reponame>shaido987/vega<filename>zeus/networks/tensorflow/detectors/faster_rcnn_trainer_callback.py<gh_stars>100-1000
# -*- 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 ... |
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/colorama/__init__.py | brianherrera/lumberyard | 1,738 | 11106331 | <gh_stars>1000+
# Copyright <NAME> 2013. BSD 3-Clause license, see LICENSE file.
from .initialise import init, deinit, reinit, colorama_text
from .ansi import Fore, Back, Style, Cursor
from .ansitowin32 import AnsiToWin32
__version__ = '0.4.4'
|
examples/smoke/smoke.py | Frekby/glumpy | 1,074 | 11106360 | <reponame>Frekby/glumpy
# -----------------------------------------------------------------------------
# Copyright (c) 2009-2016 <NAME>. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
# Porting of the Fluid demo by <NAME> ... |
examples/ordering.py | wyfo/apimodel | 118 | 11106362 | import json
from dataclasses import dataclass, field
from datetime import date
from apischema import order, serialize, serialized
@order({"trigram": order(-1)})
@dataclass
class User:
firstname: str
lastname: str
address: str = field(metadata=order(after="birthdate"))
birthdate: date = field()
@... |
packages/typescript/test/devmode_consumer/devmode_consumer.bzl | Aghassi/rules_nodejs | 645 | 11106375 | <gh_stars>100-1000
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
Chapter07/06_cartpole.py | haohaoxiao/Deep-Reinforcement-Learning-Hands-On-Second-Edition | 621 | 11106381 | <reponame>haohaoxiao/Deep-Reinforcement-Learning-Hands-On-Second-Edition
import gym
import ptan
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
HIDDEN_SIZE = 128
BATCH_SIZE = 16
TGT_NET_SYNC = 10
GAMMA = 0.9
REPLAY_SIZE = 1000
LR = 1e-3
EPS_DECAY=0.99
class Net(nn.Modu... |
rastervision_aws_batch/rastervision/aws_batch/__init__.py | theoway/raster-vision | 1,577 | 11106452 | # flake8: noqa
import rastervision.pipeline
from rastervision.aws_batch.aws_batch_runner import *
def register_plugin(registry):
registry.set_plugin_version('rastervision.aws_batch', 0)
registry.set_plugin_aliases('rastervision.aws_batch',
['rastervision2.aws_batch'])
regi... |
trigger/twister2.py | jccardonar/trigger | 380 | 11106456 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Login and basic command-line interaction support using the Twisted asynchronous
I/O framework. The Trigger Twister is just like the Mersenne Twister, except
not at all.
"""
import fcntl
import os
import re
import signal
import struct
import sys
import tty
from copy impor... |
auctioning_platform/shipping/shipping/application/queries/package.py | nhdinh/smp-modulith | 299 | 11106490 | import abc
from dataclasses import dataclass
from typing import Optional
@dataclass
class PackageDto:
...
class GetNextPackage(abc.ABC):
@abc.abstractmethod
def query(self) -> Optional[PackageDto]:
pass
|
sdk/python/pulumi_azure/avs/_inputs.py | henriktao/pulumi-azure | 109 | 11106526 | <reponame>henriktao/pulumi-azure<filename>sdk/python/pulumi_azure/avs/_inputs.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
fr... |
examples/whatsapp.py | Julian-O/pyadb | 105 | 11106555 | <reponame>Julian-O/pyadb<gh_stars>100-1000
#!/usr/bin/env python
"""
Simple pyadb example to retrieve whatsapp
databases from the selected device.
~/pyadb/example$ python whatsapp.py
[+] Using PyADB version 0.1.1
[+] Verifying ADB path... OK
[+] ADB Version: 1.0.29
[+] Restarting ADB server...
[+] Detecting devices... |
detect_secrets/core/upgrades/__init__.py | paulo-sampaio/detect-secrets | 2,212 | 11106584 | """
All modules in this package needs to have the following boilerplate:
```python
from typing import Any
from typing import Dict
def upgrade(baseline: Dict[str, Any]) -> None:
pass
```
These upgrades SHOULD NOT be used to add new plugins, as that will require more information
than can be obtained from the base... |
dataset/chunked.py | patarapolw/dataset | 207 | 11106640 |
class ChunkedInsert(object):
"""Batch up insert operations
with ChunkedStorer(my_table) as storer:
table.insert(row)
Rows will be inserted in groups of 1000
"""
def __init__(self, table, chunksize=1000):
self.queue = []
self.fields = set()
self.table = table
... |
data/scripts/json-format.py | undeadinu/soletta | 266 | 11106648 | #!/usr/bin/env python3
# This file is part of the Soletta (TM) Project
#
# Copyright (C) 2015 Intel Corporation. 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
#
# ... |
core/feature_extractor.py | jacke121/MBMD | 220 | 11106663 | <filename>core/feature_extractor.py<gh_stars>100-1000
from object_detection.models.ssd_mobilenet_v1_feature_extractor import SSDMobileNetV1FeatureExtractor
from object_detection.models import feature_map_generators
from nets import mobilenet_v1
import tensorflow as tf
import tensorflow.contrib.slim as slim
import colle... |
language/casper/augment/casper_converters.py | greck2908/language | 1,199 | 11106670 | # coding=utf-8
# Copyright 2018 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.0
#
# Unless required by ... |
insights/tests/test_yaml_parser.py | lhuett/insights-core | 121 | 11106721 | import datetime
import pytest
from insights.core import YAMLParser, ParseException, SkipException
from insights.tests import context_wrap
bi_conf_content = """
{"remote_branch": -1, "remote_leaf": -1}
""".strip()
yaml_test_strings = {"""
type: Acquisition
date: 2019-07-09
""": {'type': 'Acquisition', ... |
benchmarks/distributed/rpc/parameter_server/metrics/MetricBase.py | Hacky-DH/pytorch | 60,067 | 11106774 | <reponame>Hacky-DH/pytorch
from abc import ABC, abstractmethod
class MetricBase(ABC):
def __init__(self, name):
self.name = name
self.start = None
self.end = None
@abstractmethod
def record_start(self):
return
@abstractmethod
def record_end(self):
return
... |
src/scripts/reformat_training_data.py | f0r3ns1cat0r/tram | 109 | 11106778 | <filename>src/scripts/reformat_training_data.py
"""
Reformat training data into a report export so that it can be imported into TRAM.
The target format is:
{
"sentence-text": ["<technique-id-1>", "<technique-id-2>", "<technique-id-N>"]
}
The original format is:
* negative_data.json - A file with sentences tha... |
ctpn_crnn_ocr/ctpnport.py | shijieS/Scene-Text-Understanding | 380 | 11106789 | <reponame>shijieS/Scene-Text-Understanding
import sys
import numpy as np
class cfg:
MEAN=np.float32([102.9801, 115.9465, 122.7717])
TEST_GPU_ID=0
SCALE=600
MAX_SCALE=1000
LINE_MIN_SCORE=0.7
TEXT_PROPOSALS_MIN_SCORE=0.7
TEXT_PROPOSALS_NMS_THRESH=0.3
MAX_HORIZONTAL_GAP=50
TEXT_LINE_N... |
Z - Tool Box/LaZagne/Linux/lazagne/softwares/memory/mimipy.py | dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1 | 1,290 | 11106796 | <gh_stars>1000+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: <NAME> (<EMAIL>)
Original idea from @huntergregal (https://github.com/huntergregal/mimipenguin)
This is a port in python of @huntergregal's bash script mimipenguin.sh with some improvments :
- possibility to clean passwords f... |
splash/kernel/kernelbase.py | Germey/splash | 3,612 | 11106847 | <reponame>Germey/splash
# -*- coding: utf-8 -*-
"""
Refactored from IPython.kernel.zmq.kernelbase.Kernel with async execution
support. See https://github.com/ipython/ipython/pull/7713.
"""
import functools
import time
import sys
from ipython_genutils import py3compat
from ipykernel.jsonutil import json_clean
from ipyk... |
PhysicsTools/PatAlgos/python/cleaningLayer1/muonCleaner_cfi.py | ckamtsikis/cmssw | 852 | 11106875 | <filename>PhysicsTools/PatAlgos/python/cleaningLayer1/muonCleaner_cfi.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
cleanPatMuons = cms.EDProducer("PATMuonCleaner",
src = cms.InputTag("selectedPatMuons"),
# preselection (any string-based cut for pat::Muon)
preselection = cms.string(''),
... |
test/test_transforms.py | HarshTrivedi/tnt | 1,463 | 11106887 | <filename>test/test_transforms.py<gh_stars>1000+
import torchnet.transform as transform
import unittest
import torch
class TestTransforms(unittest.TestCase):
def testCompose(self):
self.assertEqual(transform.compose([lambda x: x + 1, lambda x: x + 2, lambda x: x / 2])(1), 2)
def testTableMergeKeys(se... |
tests/test_pool.py | mvaleev/asyncpgsa | 419 | 11106918 | <gh_stars>100-1000
import sqlalchemy as sa
async def test_pool_basic(pool):
async with pool.acquire() as con:
result = await con.fetch('SELECT * FROM sqrt(16)')
assert result[0]['sqrt'] == 4.0
async def test_pool_connection_transaction_context_manager(pool):
async with pool.transaction() as ... |
c7n/resources/cloudsearch.py | al3pht/cloud-custodian | 2,415 | 11106927 | # Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from c7n.actions import Action
from c7n.manager import resources
from c7n.query import QueryResourceManager, TypeInfo
from c7n.utils import local_session, type_schema
@resources.register('cloudsearch')
class CloudSearch(QueryResourceManage... |
fedml_core/distributed/communication/gRPC/ip_config_utils.py | xuwanwei/FedML | 1,120 | 11106945 | import csv
def build_ip_table(path):
ip_config = dict()
with open(path, newline="") as csv_file:
csv_reader = csv.reader(csv_file)
# skip header line
next(csv_reader)
for row in csv_reader:
receiver_id, receiver_ip = row
ip_config[receiver_id] = receive... |
doc/sphinx_preview.py | rohanraja/cgt_distributed | 698 | 11107063 | <filename>doc/sphinx_preview.py<gh_stars>100-1000
import sublime, sublime_plugin
import subprocess, os
class SphinxPreviewCommand(sublime_plugin.TextCommand):
def run(self, edit, **kwargs):
if self.view.file_name():
folder_name, file_name = os.path.split(self.view.file_name())
command ... |
milksnake/_compat.py | srinivas32/milksnake | 771 | 11107095 | import sys
PY2 = sys.version_info[0] == 2
if PY2:
text_type = unicode
else:
text_type = str
|
mlens/estimators/__init__.py | mehrdad-shokri/mlens | 760 | 11107183 | """ML-ENSEMBLE
:author: <NAME>
:copyright: 2017-2018
:licence: MIT
"""
from .estimators import BaseEstimator
from .estimators import LearnerEstimator, TransformerEstimator, LayerEnsemble
__all__ = ['LearnerEstimator', 'TransformerEstimator', 'LayerEnsemble',
'BaseEstimator']
|
mozillians/users/migrations/0021_auto_20171003_0716.py | divyamoncy/mozillians | 202 | 11107205 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('users', '0020_auto_20170908_0257'),
]
operations = [
migrations.AddFie... |
vtr_flow/scripts/python_libs/vtr/yosys/__init__.py | amin1377/vtr-verilog-to-routing | 682 | 11107206 | """
init for the YOSYS module
"""
from .yosys import run
|
brotab/tests/test_utils.py | naeloob/brotab | 239 | 11107253 | from unittest import TestCase
from brotab.utils import split_tab_ids
class TestUtils(TestCase):
def test_split_tab_ids(self):
text = 'c.1.0 c.1.1\tc.1.2\r\nc.1.3 \r\t\n'
expected = ['c.1.0', 'c.1.1', 'c.1.2', 'c.1.3']
self.assertEqual(expected, split_tab_ids(text))
|
Python/TextConverter/text_converter.py | Corentin-Leffy/Racing-Car-Katas | 224 | 11107257 | <reponame>Corentin-Leffy/Racing-Car-Katas
# This is for Python 3
import html as html_converter
# for Python 2 uncomment this line
#import cgi as html_converter
class UnicodeFileToHtmlTextConverter(object):
def __init__(self, full_filename_with_path):
self.full_filename_with_path = full_filename_with_pat... |
safe_control_gym/envs/env_wrappers/vectorized_env/vec_env.py | catgloss/safe-control-gym | 120 | 11107260 | """Adapted from OpenAI Baselines.
See also:
* https://github.com/openai/baselines/blob/master/baselines/common/vec_env/vec_env.py
* https://github.com/DLR-RM/stable-baselines3/blob/master/stable_baselines3/common/vec_env/base_vec_env.py
"""
import os
import numpy as np
from abc import ABC, abstractmethod
f... |
lib/model/train_val_ori.py | yingxingde/FasterRCNN-pytorch | 128 | 11107272 | <filename>lib/model/train_val_ori.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from lib.model.config import cfg
import lib.roi_data_layer.roidb as rdl_roidb
from lib.roi_data_layer.layer import RoIDataLayer
from lib.nets.layers_util import *
from lib.u... |
scale.app/scripts/feature_extraction/tests/test_parse_coverity.py | f4rsh/SCALe | 239 | 11107300 | #!/usr/bin/env python
# Copyright (c) 2007-2018 Carnegie Mellon University. All Rights Reserved.
# See COPYRIGHT file for details.
import unittest
import StringIO
import feature_extraction as fe
from feature_extraction.tests.coverity_input import CoverityJsonV2, CoverityJsonV2Event, CoverityJsonV2Issue
from feature_e... |
dp/62.py | lidongdongbuaa/leetcode | 1,232 | 11107301 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: <NAME>
# 62. Unique Path
# 解题思路:
# 先解决横向竖向第一列,全部设成1,用了个小trick把所有的DP矩阵都设成了1
# 状态:计算从前到现在节点为止所有的路劲
# 状态转移方程:f[x][y] = f[x-1][y] + f[x][y-1]
# 最后返回右下角的数就行。
class Solution(object):
def uniquePaths(self, m, n):
"""
:type m: int
:type n: int
... |
eend/bin/rttm_stats.py | lekynam2000/EEND | 250 | 11107365 | <reponame>lekynam2000/EEND<filename>eend/bin/rttm_stats.py
#!/usr/bin/env python3
# Copyright 2019 Hitachi, Ltd. (author: <NAME>)
# Licensed under the MIT license.
import numpy as np
import argparse
def load_rttm(rttm_file):
""" load rttm file as numpy structured array """
segments = []
for line in open(... |
apex/contrib/transducer/transducer.py | Muflhi01/apex | 6,523 | 11107392 | <filename>apex/contrib/transducer/transducer.py
import torch
import transducer_loss_cuda
import transducer_joint_cuda
class TransducerJoint(torch.nn.Module):
"""Transducer joint
Detail of this loss function can be found in: Sequence Transduction with Recurrent Neural
Networks
Arguments:
... |
tools/qftasm/qftasm_pp.py | gkgoat1/elvm | 803 | 11107402 | <reponame>gkgoat1/elvm
import sys
import re
filepath = sys.argv[1]
with open(filepath, "rt") as f:
text = f.read()
d = {}
for i_line, line in enumerate(text.split("\n")):
m = re.search(r'pc == ([0-9]+):', line)
if m:
d["pc" + m.group(1)] = i_line
text = text.format(**d)
text = text[:-1] # Remove... |
minihack/tiles/glyph_mapper.py | samvelyan/minihack-1 | 217 | 11107415 | # Copyright (c) Facebook, Inc. and its affiliates.
from minihack.tiles import glyph2tile, MAXOTHTILE
from nle.nethack import MAX_GLYPH
import numpy as np
import pkg_resources
import pickle
import os
class GlyphMapper:
"""This class is used to map glyphs to rgb pixels."""
def __init__(self):
self.til... |
test/integration/dpr_w100.py | tuberj/ir_datasets | 149 | 11107457 | <reponame>tuberj/ir_datasets
import re
import unittest
from ir_datasets.datasets.dpr_w100 import DprW100Doc, DprW100Query
from ir_datasets.formats import TrecQrel, TrecQuery
from .base import DatasetIntegrationTest
class TestDprW100(DatasetIntegrationTest):
def test_docs(self):
self._test_docs('dpr-w100',... |
questions/55945085/pyslam_qt_test.py | sesu089/stackoverflow | 302 | 11107515 | import pyslam
from PyQt5 import QtCore, QtGui, QtWidgets
class Thread(QtCore.QThread):
def run(self):
obj = pyslam.Slam()
obj.setParams(10)
print("before")
obj.start()
print("after")
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
... |
apps/autotest/models/monkey.py | rainydaygit/testtcloudserver | 349 | 11107542 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# monkey 任务
from library.api.db import EntityModel, db
class Monkey(EntityModel):
ACTIVE = 0
DISABLE = 1
TEST_TYPE = {'monkey': 1, 'performance': 2}
app_name = db.Column(db.String(100)) # app 名称,例如:萌推
package_name = db.Column(db.String(100)) # 要测试的包名
... |
ml_editor/model_v3.py | VestiDev/ml-powered-applications-2020-book | 542 | 11107583 | <reponame>VestiDev/ml-powered-applications-2020-book
import os
from pathlib import Path
import spacy
from sklearn.externals import joblib
from tqdm import tqdm
import pandas as pd
import nltk
from ml_editor.explanation_generation import (
parse_explanations,
get_recommendation_string_from_parsed_exps,
EXP... |
tests/test_rosbag.py | v-mehta/kapture | 264 | 11107586 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright 2020-present NAVER Corp. Under BSD 3-clause license
"""
Tests of various rosbag to kapture converters.
"""
import os
import os.path as path
import tempfile
import unittest
# kapture
import path_to_kapture # enables import kapture # noqa: F401
import kapture
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.