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 |
|---|---|---|---|---|
es_enas/server.py | DionysisChristopoulos/google-research | 23,901 | 11008780 | <filename>es_enas/server.py
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... |
modules/PluginsManager.py | cfatduck/poloniexlendingbot | 640 | 11008795 | <reponame>cfatduck/poloniexlendingbot
from plugins import *
config = None
api = None
log = None
notify_conf = None
plugins = []
def init_plugin(plugin_name):
"""
:return: instance of requested class
:rtype: Plugin
"""
klass = globals()[plugin_name] # type: Plugin
instance = klass... |
tests/test_permission.py | hustlzp/permission | 109 | 11008796 | <filename>tests/test_permission.py<gh_stars>100-1000
import pytest
from permission import Permission, PermissionDeniedException
from .utils import FailingCheckException, make_permission, make_rule
@pytest.mark.parametrize('rule_result', [True, False], ids=['ok', 'fail'])
def test_check_result(rule_result):
rule... |
tests/test_gan.py | limberc/HyperGAN | 889 | 11008818 | import hypergan as hg
from mocks import MockDiscriminator, mock_gan
class TestGan:
def test_hg_gan(self):
assert type(mock_gan()) == hg.gans.standard_gan.StandardGAN
def test_can_create_default(self):
config = hg.Configuration.load('default.json')
assert type(mock_gan()) == hg.gans.sta... |
Python/search/Interpolation_Search.py | zhcet19/NeoAlgo-1 | 897 | 11008831 | <reponame>zhcet19/NeoAlgo-1
# INTERPOLATION SEARCH
# If the searching element is present in array,
# then it returns index of it, else returns -1
def interpolationSearch(arr, size, search_element):
# Assigning indexes
low = 0
high = size - 1
# As array is going to be sorted
# an element present i... |
dsls/python/setup.py | marviniter/argo-dataflow | 173 | 11008835 | <filename>dsls/python/setup.py
from distutils.core import setup
setup(
name='argo_dataflow',
packages=['argo_dataflow'],
install_requires=['kubernetes'],
version='v0.0.62',
license='apache-2.0',
description='Argo Dataflow',
author='<NAME>',
author_email='<EMAIL>',
url='https://githu... |
docs/examples/use_cases/video_superres/tools/extract_frames.py | cyyever/DALI | 3,967 | 11008843 | import argparse
import os
import subprocess
default_format = "png"
default_qscale_jpg = "4"
def extract_frames(main_data, resolution, format, q, quiet,
transcoded, codec, crf, keyint):
if transcoded:
desc = [resolution, 'scenes']
desc += [codec] if codec else []
desc +=... |
conf/pgadmin4/config_local.py | cbandy/crunchy-containers | 987 | 11008856 | <filename>conf/pgadmin4/config_local.py
# overides for containerized compatibility of pgAdmin4
# pgAdmin4 should be accessible publicly
DEFAULT_SERVER = '0.0.0.0'
# this is the default pgAdmin4 port, but this is left here for someone who wants
# to override the default port
DEFAULT_SERVER_PORT = 5050
# this is the p... |
tensorboard_plugin/tensorboard_plugin_fairness_indicators/summary_v2.py | kevinrobinson/fairness-indicators | 248 | 11008865 | <filename>tensorboard_plugin/tensorboard_plugin_fairness_indicators/summary_v2.py
# Copyright 2019 The TensorFlow 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... |
sknn/tests/__init__.py | hero9968/scikit-neuralnetwork | 1,375 | 11008867 | from sknn.backend import lasagne
|
foolbox/attacks/boundary_attack.py | SamplingAndEnsemblingSolvers/foolbox | 2,292 | 11008878 | from typing import Union, Tuple, Optional, Any
from typing_extensions import Literal
import numpy as np
import eagerpy as ep
import logging
from ..devutils import flatten
from ..devutils import atleast_kd
from ..types import Bounds
from ..models import Model
from ..criteria import Criterion
from ..distances import... |
vit/formatter/due_remaining.py | kinifwyne/vit | 179 | 11008879 | <gh_stars>100-1000
from vit.formatter.due import Due
class DueRemaining(Due):
def format_datetime(self, due, task):
return self.remaining(due)
|
release/stubs.min/Autodesk/Revit/DB/__init___parts/ExportFontTable.py | htlcnn/ironpython-stubs | 182 | 11008897 | <filename>release/stubs.min/Autodesk/Revit/DB/__init___parts/ExportFontTable.py
class ExportFontTable(object,IEnumerable[KeyValuePair[ExportFontKey,ExportFontInfo]],IEnumerable,IDisposable):
"""
A table supporting a mapping of Revit font names to font names that will be set
in the target export format.
... |
util/order/etf/BasketOrder.py | arinachison/abides | 196 | 11008913 | <reponame>arinachison/abides
# BasketOrder class, inherits from Order class. These are the
# Orders that typically go in a Primary Exchange and immediately get filled.
# A buy order translates to a creation order for an ETF share
# A sell order translates to a redemption order for shares of the underlying.
from util.... |
tests/test_model/test_backbone/test_ghost_backbone.py | ZJCV/PyCls | 110 | 11008915 | # -*- coding: utf-8 -*-
"""
@date: 2021/6/4 下午4:34
@file: test_ghost_backbone.py
@author: zj
@description:
"""
import torch
from zcls.model.backbones.ghostnet.ghost_backbone import GhostBackbone, build_ghostnet_backbone
from zcls.model.backbones.misc import round_to_multiple_of
def test_backbone():
data = tor... |
bin/gftools-fix-familymetadata.py | hyvyys/gftools | 150 | 11008916 | #!/usr/bin/env python3
# Copyright 2016 The Fontbakery Authors
# Copyright 2017 The Google Font Tools 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... |
Analysis/pin_pin_beam_equations_classes.py | hotmailbox/Structural-Engineering | 152 | 11008944 | <reponame>hotmailbox/Structural-Engineering<filename>Analysis/pin_pin_beam_equations_classes.py
'''
BSD 3-Clause License
Copyright (c) 2019, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* ... |
L18/helper_utils.py | dumpmemory/stat453-deep-learning-ss21 | 175 | 11008946 | <reponame>dumpmemory/stat453-deep-learning-ss21<filename>L18/helper_utils.py<gh_stars>100-1000
import random
import torch
import numpy as np
import os
def set_deterministic():
if torch.cuda.is_available():
torch.backends.cudnn.benchmark = False
torch.backends.cudnn.deterministic = True
torch.s... |
src/pockexport/export.py | jordan8037310/pockexport | 112 | 11008975 | <gh_stars>100-1000
#!/usr/bin/env python3
import json
import pocket # type: ignore
class Exporter:
def __init__(self, *args, **kwargs) -> None:
self.api = pocket.Pocket(*args, **kwargs)
def export_json(self):
# When pocket web app queries api it's got some undocumented parameters, so this sma... |
labs/04_conv_nets/solutions/mnist_conv.py | soufiomario/labs-Deep-learning | 1,398 | 11008990 | <reponame>soufiomario/labs-Deep-learning
W_conv1 = weight_variable([5, 5, 1, 32])
b_conv1 = bias_variable([32])
h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)
h_pool1 = max_pool_2x2(h_conv1)
W_conv2 = weight_variable([5, 5, 32, 64])
b_conv2 = bias_variable([64])
h_conv2 = tf.nn.relu(conv2d(h_pool1, W_conv2... |
examples/prefix_example.py | timoklimmer/environs | 828 | 11009007 | import os
from environs import Env
# Prefixed envvars
os.environ["CANTEEN_HOST"] = "lolcathost"
os.environ["CANTEEN_PORT"] = "3000"
# A non-prefixed envvar
os.environ["NODE_ENV"] = "production"
env = Env()
with env.prefixed("CANTEEN_"):
host = env.str("HOST", "localhost")
port = env.int("PORT", 5000)
node_e... |
beartype/_util/hint/pep/proposal/pep484/utilpep484generic.py | posita/beartype | 1,056 | 11009017 | <reponame>posita/beartype<gh_stars>1000+
#!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2021 Beartype authors.
# See "LICENSE" for further details.
'''
Project-wide :pep:`484`-compliant **generic type hint utilities** (i.e.,
callables generic... |
hs_geo_raster_resource/migrations/0003_auto_20150813_1315.py | hydroshare/hydroshare | 178 | 11009032 | # -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hs_core', '0004_auto_20150721_1125'),
('hs_geo_raster_resource', '0002_auto_20150813_1313'),
]
operations = [
migrations.RemoveField(
model_nam... |
docker/build_files/entrypoint-ubuntu.py | PeihongYu/surreal | 471 | 11009045 | <reponame>PeihongYu/surreal
#!/usr/bin/env python
import os
import sys
import shlex
import shutil
def init():
os.system('/usr/bin/Xorg -noreset +extension GLX '
'+extension RANDR +extension RENDER -logfile /etc/fakeX/10.log '
'-config /etc/fakeX/xorg.conf :10 > /dev/null 2>&1 &')
i... |
app/lib/base/template.py | didi9575/crackerjack | 237 | 11009089 | class TemplateManager:
def get_hashcat_running_text(self, state):
state = int(state)
text = 'Unknown'
if state == 0:
text = 'Not Started'
elif state == 1:
text = 'Running'
elif state == 2:
text = 'Stopped'
elif state == 3:
... |
rlgraph/tests/components/test_time_dependent_parameters.py | RLGraph/RLGraph | 290 | 11009102 | <gh_stars>100-1000
# Copyright 2018/2019 The RLgraph 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
#
# Unles... |
keystone/tests/functional/shared/test_running.py | ferag/keystone | 615 | 11009106 | # 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, software
# distributed under t... |
ninja/compatibility/util.py | eadwinCode/django-ninja | 2,809 | 11009121 | <reponame>eadwinCode/django-ninja
from typing import Any, Optional
try:
from typing import get_origin # type: ignore
except ImportError: # pragma: no coverage
def get_origin(tp: Any) -> Optional[Any]:
"typing.get_origin introduced in python3.8"
return getattr(tp, "__origin__", None)
__all_... |
scripts/monitoring/cron-fix-ovs-rules.py | fahlmant/openshift-tools | 164 | 11009127 | #!/usr/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
#This is not a module, but pylint thinks it is. This is a command.
#pylint: disable=invalid-name
'''
Find and remove "bad" OVS rules/flows.
A bad flow is one whose action/output references a non-existent port
'''
import re
import subprocess
from subpro... |
lib-src/lv2/suil/waflib/Tools/gxx.py | joshrose/audacity | 7,892 | 11009133 | <reponame>joshrose/audacity
#!/usr/bin/env python
# encoding: utf-8
# <NAME>, 2006-2018 (ita)
# <NAME>, 2006 (rh)
# <NAME>, 2009
"""
g++/llvm detection.
"""
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
@conf
def find_gxx(conf):
"""
Finds the program g++, and if present, try to detect its v... |
server/protocols/volgactf.py | suiljex/DestructiveFarm | 159 | 11009157 | <reponame>suiljex/DestructiveFarm<filename>server/protocols/volgactf.py
from themis.finals.attack.helper import Helper
from themis.finals.attack.result import Result
from server.models import FlagStatus, SubmitResult
RESPONSES = {
FlagStatus.ACCEPTED: [Result.SUCCESS_FLAG_ACCEPTED],
FlagStatus.REJECTED: [Res... |
sdk/python/pulumi_aws/wafregional/rule.py | rapzo/pulumi-aws | 260 | 11009161 | <filename>sdk/python/pulumi_aws/wafregional/rule.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
from typing import Any, Mapping... |
solutions/problem_142.py | ksvr444/daily-coding-problem | 1,921 | 11009171 | def valid_paren(string, stack=list()):
if not string and not stack:
return True
elif not string:
return False
cchar = string[0]
remaining = string[1:]
if cchar == '*':
return \
valid_paren('(' + remaining, stack) or \
valid_paren(')' + remaining, sta... |
utils/futures_tools.py | Velocities/QuantResearch | 623 | 11009178 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from datetime import datetime
from typing import List
import logging
def get_futures_chain(meta_data: pd.DataFrame, asofdate: datetime.date) -> pd.DataFrame:
"""
get current futures chain on asofdate
:param meta_data: data... |
aliyun-python-sdk-core/tests/http/test_http_response.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 11009181 | <reponame>yndu13/aliyun-openapi-python-sdk
# coding=utf-8
import os
import sys
from tests import unittest, MyServer
from aliyunsdkcore.http.http_response import HttpResponse
from aliyunsdkcore.http.protocol_type import HTTPS
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.request import CommonRequest
... |
tests/hubstorage/testutil.py | pardo/python-scrapinghub | 163 | 11009229 | <filename>tests/hubstorage/testutil.py
from contextlib import contextmanager
from requests import Timeout
@contextmanager
def failing_downloader(downloader, N=5, exc=Timeout, msg='test error'):
# reduce wait times and simulate network timeout
orig_iter = downloader._iter_lines
orig_wait = downloader.RETRY... |
tests/suite/test_ts_tls_passthrough.py | Taymindis/kubernetes-ingress | 3,803 | 11009240 | <filename>tests/suite/test_ts_tls_passthrough.py
import pytest, ssl
import requests
from pprint import pprint
from suite.fixtures import PublicEndpoint
from suite.resources_utils import (
wait_before_test,
create_items_from_yaml,
delete_items_from_yaml,
wait_until_all_pods_are_ready,
get_first_pod_n... |
examples/plot_letters.py | LemonLison/pystruct | 501 | 11009269 | """
===============================
OCR Letter sequence recognition
===============================
This example illustrates the use of a chain CRF for optical character
recognition. The example is taken from Taskar et al "Max-margin markov random
fields".
Each example consists of a handwritten word, that was presegme... |
vendor/penguin_client/penguin_client/models/__init__.py | Sait0Yuuki/ArknightsAutoHelper | 1,035 | 11009270 | # coding: utf-8
# flake8: noqa
"""
Penguin Statistics - REST APIs
Backend APIs for Arknights drop rate statistics website 'Penguin Statistics': https://penguin-stats.io/ # noqa: E501
OpenAPI spec version: 2.0.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""... |
paddlespeech/t2s/modules/geometry.py | JiehangXie/PaddleSpeech | 1,540 | 11009303 | # Copyright (c) 2020 PaddlePaddle 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 required by appli... |
molotov/tests/test_api.py | jldiaz-uniovi/molotov | 401 | 11009307 | from molotov.api import pick_scenario, scenario, get_scenarios, setup
from molotov.tests.support import TestLoop, async_test
class TestUtil(TestLoop):
def test_pick_scenario(self):
@scenario(weight=10)
async def _one(self):
pass
@scenario(weight=90)
async def _two(self... |
release/stubs.min/System/__init___parts/LoaderOptimizationAttribute.py | htlcnn/ironpython-stubs | 182 | 11009331 | <filename>release/stubs.min/System/__init___parts/LoaderOptimizationAttribute.py
class LoaderOptimizationAttribute(Attribute,_Attribute):
"""
Used to set the default loader optimization policy for the main method of an executable application.
LoaderOptimizationAttribute(value: Byte)
LoaderOptimizationA... |
colbert/utils/utils.py | techthiyanes/ColBERT | 421 | 11009343 | <filename>colbert/utils/utils.py
import os
import tqdm
import torch
import datetime
import itertools
from multiprocessing import Pool
from collections import OrderedDict, defaultdict
def print_message(*s, condition=True):
s = ' '.join([str(x) for x in s])
msg = "[{}] {}".format(datetime.datetime.now().strfti... |
torch_geometric/nn/conv/arma_conv.py | Kenneth-Schroeder/pytorch_geometric | 12,651 | 11009348 | from typing import Callable, Optional
from torch_geometric.typing import Adj, OptTensor
import torch
from torch import nn
from torch import Tensor
from torch.nn import Parameter, ReLU
import torch.nn.functional as F
from torch_sparse import SparseTensor, matmul
from torch_geometric.nn.conv import MessagePassing
from t... |
data/micro-benchmark/dicts/param/main.py | vitsalis/pycg-evaluation | 121 | 11009367 | <reponame>vitsalis/pycg-evaluation<gh_stars>100-1000
def func2():
pass
def func1(d):
d["a"]()
d = {"a": func2}
func1(d)
|
RecoJets/FFTJetProducers/python/fftjetpileupestimator_calo_cfi.py | ckamtsikis/cmssw | 852 | 11009387 | <reponame>ckamtsikis/cmssw
# MC-mix calibrated pile-up estimator for CaloJets
import FWCore.ParameterSet.Config as cms
import RecoJets.FFTJetProducers.mixed_calib_calo_ttbar_result as calib_calo
# FFTJet puleup estimator module configuration
fftjetPileupEstimatorCalo = cms.EDProducer(
"FFTJetPileupEstimator",
... |
rosplan_rqt/src/rosplan_rqt/action_config_widget.py | kvnptl/ROSPlan | 278 | 11009396 | <filename>rosplan_rqt/src/rosplan_rqt/action_config_widget.py
import os
import rospkg
import yaml
from os.path import expanduser
from python_qt_binding import loadUi, QT_BINDING_VERSION
from python_qt_binding.QtGui import QStandardItem, QStandardItemModel, QPixmap
from python_qt_binding.QtWidgets import QMainWindow, Q... |
rlstructures/env_wrappers/__init__.py | Purple-PI/rlstructures | 281 | 11009405 | from .gymenv import GymEnv, GymEnvInf
from .devicewrapper import DeviceEnv
|
tests/device/test_otp.py | pavel-petrenko/yubikey-manager | 513 | 11009428 | from yubikit.core import TRANSPORT
from yubikit.core.otp import OtpConnection
from yubikit.core.smartcard import SmartCardConnection
from yubikit.yubiotp import (
YubiOtpSession,
SLOT,
HmacSha1SlotConfiguration,
StaticPasswordSlotConfiguration,
)
from yubikit.management import CAPABILITY, ManagementSess... |
pepper_variant/modules/python/models/predict_distributed_cpu.py | kishwarshafin/pepper | 155 | 11009440 | <filename>pepper_variant/modules/python/models/predict_distributed_cpu.py
import sys
import os
import torch
import time
import torch.onnx
import torch.nn as nn
import onnxruntime
from datetime import datetime
import concurrent.futures
from torch.utils.data import DataLoader
import numpy as np
from numpy import argmax
i... |
hb_quant/huobi/model/account/account_point_result.py | wenli135/Binance-volatility-trading-bot | 611 | 11009441 | <reponame>wenli135/Binance-volatility-trading-bot<gh_stars>100-1000
from huobi.constant import *
from huobi.model.account.account_point_group import AccountPointGroup
from huobi.utils import default_parse, default_parse_list_dict
class AccountPointResult:
"""
The account information for spot account, margin a... |
models/main.py | kachiO/KagNet | 244 | 11009451 | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import dgl.function as fn
import numpy as np
from torch.nn import init
import torch.utils.data as data
from torch.autograd import Variable
import torch.autograd as autograd
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_seque... |
task_other.py | hydgladiator/Themis | 356 | 11009471 | <filename>task_other.py
# -*- coding: utf-8 -*-
from celery import Celery
import settings
from command import Command
celery = Celery("task_other",
backend=settings.REDIS_BACKEND, broker=settings.REDIS_BROKER)
@celery.task
def analysis(**args):
command = Command()
command.run_analysis(**args)
|
train_DAE_CelebA.py | zhixinshu/DeformingAutoencoders-pytorch | 112 | 11009493 | from __future__ import print_function
import argparse
import os
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchv... |
test/systemtest/earlgrey/test_fpga_nexysvideo.py | asb/opentitan | 1,375 | 11009503 | <reponame>asb/opentitan
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
import logging
import re
import pytest
from . import config
from .. import utils
log = logging.getLogger(__name__)
@pytest.fixture(scope="modul... |
tests/test_train.py | ming-hai/spleeter | 19,827 | 11009511 | <reponame>ming-hai/spleeter<filename>tests/test_train.py
#!/usr/bin/env python
# coding: utf8
""" Unit testing for Separator class. """
__email__ = '<EMAIL>'
__author__ = '<NAME>'
__license__ = 'MIT License'
import json
import os
from os import makedirs
from os.path import join
from tempfile import TemporaryDirecto... |
tests/unit/broker/portfolio/test_position_handler.py | calumrussell/qstrader | 2,220 | 11009523 | <reponame>calumrussell/qstrader
from collections import OrderedDict
import numpy as np
import pandas as pd
import pytz
from qstrader.broker.portfolio.position_handler import PositionHandler
from qstrader.broker.transaction.transaction import Transaction
def test_transact_position_new_position():
"""
Tests t... |
Burp/lib/scanner_table_listener.py | wisdark/HUNT | 1,628 | 11009559 | from javax.swing.event import TableModelListener
class ScannerTableListener(TableModelListener):
def __init__(self, view, scanner_table, issue_name, issue_param):
self.view = view
self.scanner_table = scanner_table
self.issue_name = issue_name
self.issue_param = issue_param
def... |
tests/modules/namespace_420/sub1/__init__.py | AboudFayad/coveragepy | 2,254 | 11009581 | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
sub1 = "namespace_420 sub1"
|
peering/urls.py | jasjukaitis/peering-manager | 127 | 11009604 | <gh_stars>100-1000
from django.urls import path
from utils.views import ObjectChangeLog
from . import models, views
app_name = "peering"
urlpatterns = [
# Autonomous Systems
path(
"autonomous-systems/",
views.AutonomousSystemList.as_view(),
name="autonomoussystem_list",
),
pa... |
lib/log_utils/time_utils.py | FanKuan44/TENAS | 138 | 11009606 | <gh_stars>100-1000
import time
def time_for_file():
ISOTIMEFORMAT='%d-%h-at-%H-%M-%S'
return '{:}'.format(time.strftime( ISOTIMEFORMAT, time.gmtime(time.time()) ))
def time_string():
ISOTIMEFORMAT='%Y-%m-%d %X'
string = '[{:}]'.format(time.strftime( ISOTIMEFORMAT, time.gmtime(time.time()) ))
ret... |
python/jittor/test/test_lr_scheduler.py | Exusial/jittor | 2,571 | 11009614 | <reponame>Exusial/jittor
# ***************************************************************
# Copyright (c) 2021 Jittor. All Rights Reserved.
# Maintainers:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>.
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this sour... |
docs/basics.py | pratiman-91/proplot | 633 | 11009626 | <gh_stars>100-1000
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [raw] raw_mimetype="text/res... |
tests/test_hook.py | IMULMUL/PythonForWindows | 479 | 11009628 | <gh_stars>100-1000
import pytest
import textwrap
import ctypes
import windows
import windows.generated_def as gdef
import windows.native_exec.simple_x86 as x86
import windows.native_exec.simple_x64 as x64
try:
import _winreg as winreg
except ImportError as e:
import winreg
from .pfwtest import *
pytestmark... |
tests/test_storage_filecache.py | alvistack/ionrock-cachecontrol | 353 | 11009657 | <filename>tests/test_storage_filecache.py<gh_stars>100-1000
# SPDX-FileCopyrightText: 2015 <NAME>
#
# SPDX-License-Identifier: Apache-2.0
"""
Unit tests that verify FileCache storage works correctly.
"""
import os
import string
from random import randint, sample
import pytest
import requests
from cachecontrol import... |
ue4docker/dockerfiles/ue4-source/windows/patch-ubt.py | meetakshay99/ue4-docker | 579 | 11009688 | <filename>ue4docker/dockerfiles/ue4-source/windows/patch-ubt.py
#!/usr/bin/env python3
import os, re, sys
def readFile(filename):
with open(filename, "rb") as f:
return f.read().decode("utf-8")
def writeFile(filename, data):
with open(filename, "wb") as f:
f.write(data.encode("utf-8"))
def... |
installer/generate_update_json.py | jat-jat/openmpt | 335 | 11009706 | #!/usr/bin/env python3
import datetime
import hashlib
import json
import os
from subprocess import Popen
OPENMPT_VERSION_MAJORMAJOR = os.environ['OPENMPT_VERSION_MAJORMAJOR']
OPENMPT_VERSION_MAJOR = os.environ['OPENMPT_VERSION_MAJOR']
OPENMPT_VERSION_MINOR = os.environ['OPENMPT_VERSION_MINOR']
OPENMPT_VERSION_MINORM... |
ex24_urlrouter/dllist.py | techieguy007/learn-more-python-the-hard-way-solutions | 466 | 11009715 | class DoubleLinkedListNode(object):
def __init__(self, value, nxt, prev):
self.value = value
self.next = nxt
self.prev = prev
def __repr__(self):
nval = self.next and self.next.value or None
pval = self.prev and self.prev.value or None
return f"[{self.value}, {r... |
hdf_compass/compass_viewer/container/frame.py | HDFGroup/hdf-compass | 124 | 11009717 | <gh_stars>100-1000
##############################################################################
# Copyright by The HDF Group. #
# All rights reserved. #
# ... |
junc/datasets/config.py | moliushang/wireframe_ | 148 | 11009719 | <reponame>moliushang/wireframe_<filename>junc/datasets/config.py
import numpy as np
# 0 menas no rotation.
#rotation_angles = [i * 30. for i in range(12)]
rotation_angles = [0, 180]
# [0, 30, 60, 90, 120, 150, ..., 330]
crop_ration = [(0.25, 0.25, 0.75, 0.75)]
#pixel_mean = np.array([116.46479065, 126.95309567, 13... |
src/meltano/core/plugin/singer/tap.py | hashdeps/meltano | 122 | 11009720 | <gh_stars>100-1000
"""SingerTap and supporting classes.
This module contains the SingerTap class as well as a supporting methods.
"""
import asyncio
import json
import logging
import shutil
import sys
from asyncio import Task
from asyncio.streams import StreamReader
from hashlib import sha1
from pathlib import Path
fr... |
SqlmapCelery/sqlmap/lib/utils/purge.py | tt9133github/hunter | 322 | 11009723 | #!/usr/bin/env python
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import os
import random
import shutil
import stat
import string
from lib.core.common import getSafeExString
from lib.core.data import logger
def purge(directory):
"""
... |
twisted/internet/test/test_win32events.py | hawkowl/twisted | 9,953 | 11009741 | <filename>twisted/internet/test/test_win32events.py<gh_stars>1000+
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for implementations of L{IReactorWin32Events}.
"""
try:
import win32event
except ImportError:
win32event = None
from zope.interface.verify import verifyObject
... |
tgintegration/utils/frame_utils.py | JosXa/TgIntegration | 109 | 11009770 | <reponame>JosXa/TgIntegration<gh_stars>100-1000
import inspect
def get_caller_function_name() -> str:
return inspect.stack()[2].function
|
sdk/python/pulumi_aws/get_caller_identity.py | chivandikwa/pulumi-aws | 260 | 11009826 | <gh_stars>100-1000
# 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
from typing import Any, Mapping, Optional, Sequence, Union, over... |
misc/debug.py | zachbarrow/talon_community | 125 | 11009868 | <gh_stars>100-1000
from talon.engine import engine
from talon import ui, voice, tap
import os
SAMPLE_DRAGON_KEY = "f1"
# Note: order of handlers matters
APPLIED_HANDLERS = (
"catch_all",
"hide_grammar",
"abbr_listset",
"ignore_successful_listset",
"ignore_ui_event",
"simplify_parse_result",
... |
tests/conftest.py | kianmeng/graphviz | 1,209 | 11009877 | """pytest command line options and fixtures."""
import pathlib
import platform as platform_
import pytest
DIRECTORY = pathlib.Path(__file__).parent
SKIP_EXE = '--skip-exe'
def pytest_addoption(parser):
parser.addoption(SKIP_EXE, action='store_true',
help='skip tests that run Graphviz exec... |
L1TriggerConfig/DTTPGConfigProducers/python/L1DTTPGConfig_cff.py | ckamtsikis/cmssw | 852 | 11009893 | import FWCore.ParameterSet.Config as cms
from L1TriggerConfig.DTTPGConfigProducers.L1DTConfigRecords_cff import *
from L1TriggerConfig.DTTPGConfigProducers.L1DTConfig_cfi import *
|
tests/numpy/columns/test_datetime.py | 1024inc/clickhouse-driver | 823 | 11009905 | <gh_stars>100-1000
from datetime import datetime, date
from unittest.mock import patch
try:
import numpy as np
except ImportError:
np = None
try:
import pandas as pd
except ImportError:
pd = None
from pytz import timezone, utc, UnknownTimeZoneError
import tzlocal
from tests.numpy.testcase import Num... |
src/genie/libs/parser/junos/tests/PingMplsRsvp/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 11009911 | <filename>src/genie/libs/parser/junos/tests/PingMplsRsvp/cli/equal/golden_output_expected.py<gh_stars>100-1000
expected_output = {"lsping-statistics": {"loss-rate": 0, "received": 5, "send": 5}}
|
tests/settings/mixin_inheritance.py | andriyor/django-configurations | 566 | 11009915 | <gh_stars>100-1000
from configurations import Configuration
class Mixin1:
@property
def ALLOWED_HOSTS(self):
allowed_hosts = super().ALLOWED_HOSTS[:]
allowed_hosts.append('test1')
return allowed_hosts
class Mixin2:
@property
def ALLOWED_HOSTS(self):
allowed_hosts = s... |
ec2_output_pixel_shuffle/deep_image_prior.py | atiyo/deep_image_prior | 197 | 11009938 | <filename>ec2_output_pixel_shuffle/deep_image_prior.py
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import torchvision
import numpy as np
from PIL import Image
use_cuda = True
ground_truth_path = 'bunny_512.jpg'
#proportion of pixels to black out
prop = 0.5
#s... |
scripts/scripts/IDAPro/find_symbols.py | quarkslab/samsung-trustzone-research | 101 | 11009945 | import inspect
import json
import os
import sys
import ida_allins
import ida_bytes
import ida_funcs
import ida_gdl
import ida_idaapi
import ida_idp
import ida_name
import ida_segment
import ida_typeinf
import ida_ua
import ida_xref
TL_APIS = {}
MAX_TL_API = 0xC2
DR_APIS = {}
MAX_DR_API = 0x3D
if sys.version_info[0... |
usaspending_api/common/sqs/sqs_job_logging.py | g4brielvs/usaspending-api | 217 | 11009948 | <gh_stars>100-1000
import os
def log_job_message(
logger,
message,
job_type,
job_id=None,
attempt=None,
is_debug=False,
is_warning=False,
is_error=False,
is_exception=False,
other_params=None,
):
"""Handles logging a message about a Bulk Download job, with additional job me... |
script/preprocess.py | marcotcr/MnemonicReader | 155 | 11009950 | <filename>script/preprocess.py
#!/usr/bin/env python3
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""Preprocess the SQuAD dataset for training."""
import sys
sys.path.append('.'... |
aws_lambda_builders/registry.py | ekmixon/aws-lambda-builders | 180 | 11009954 | """
Registry of auto-discovered workflows. Classes and methods in this module are thread-safe.
"""
import threading
from aws_lambda_builders.exceptions import WorkflowNotFoundError
class Registry(object):
"""
Stores a registry of workflows. Only one workflow matching a given capability can be stored. If att... |
mayan/apps/document_parsing/apps.py | atitaya1412/Mayan-EDMS | 343 | 11009979 | <gh_stars>100-1000
import logging
from django.apps import apps
from django.db.models.signals import post_save
from django.utils.translation import ugettext_lazy as _
from mayan.apps.acls.classes import ModelPermission
from mayan.apps.common.apps import MayanAppConfig
from mayan.apps.common.classes import ModelFieldRe... |
rpython/jit/backend/x86/test/test_runner.py | m4sterchain/mesapy | 381 | 11010015 | import py
from rpython.rtyper.lltypesystem import lltype, llmemory, rffi, rstr
from rpython.jit.metainterp.history import ResOperation, TargetToken,\
JitCellToken
from rpython.jit.metainterp.history import (ConstInt, ConstPtr, Const,
BasicFailDescr, BasicFinalDescr)
from... |
wafw00f/plugins/netscaler.py | 84KaliPleXon3/EnableSecurity-wafw00f | 3,069 | 11010034 | <gh_stars>1000+
#!/usr/bin/env python
'''
Copyright (C) 2020, WAFW00F Developers.
See the LICENSE file for copying permission.
'''
NAME = 'NetScaler AppFirewall (Citrix Systems)'
def is_waf(self):
schemes = [
# This header can be obtained without attack mode
self.matchHeader(('Via', r'NS\-CACHE')... |
misc/pytorch_toolkit/question_answering/utils.py | dqawami/openvino_training_extensions | 256 | 11010049 | """
Copyright (c) 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... |
booknlp/english/bert_coref_quote_pronouns.py | ishine/booknlp | 539 | 11010078 | import re
import os
from collections import Counter
import sys
import argparse
from transformers import BertModel
from transformers import BertTokenizer
import torch
from torch import nn
import torch.optim as optim
import numpy as np
import random
from booknlp.common.pipelines import Token, Entity
from booknlp.engli... |
release/stubs.min/System/ComponentModel/__init___parts/MarshalByValueComponent.py | htlcnn/ironpython-stubs | 182 | 11010142 | class MarshalByValueComponent(object,IComponent,IDisposable,IServiceProvider):
"""
Implements System.ComponentModel.IComponent and provides the base implementation for remotable components that are marshaled by value (a copy of the serialized object is passed).
MarshalByValueComponent()
"""
def Dispose... |
tensorflow_constrained_optimization/python/rates/operations.py | RMKruse/tensorflow_constrained_optimization | 276 | 11010174 | # Copyright 2018 The TensorFlow Constrained Optimization 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
#
#... |
mssqlscripter/scriptercallbacks.py | ReneNyffenegger/mssql-scripter | 302 | 11010179 | <reponame>ReneNyffenegger/mssql-scripter
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------... |
test/nn/linalg/cholesky.py | dinhtuyen/PRML01 | 7,581 | 11010207 | import unittest
import numpy as np
from prml import nn
class TestCholesky(unittest.TestCase):
def test_cholesky(self):
A = np.array([
[2., -1],
[-1., 5.]
])
L = np.linalg.cholesky(A)
Ap = nn.Parameter(A)
L_test = nn.linalg.cholesky(Ap)
self.... |
histomicstk/segmentation/rag_add_layer.py | basanto/HistomicsTK | 249 | 11010219 | <gh_stars>100-1000
import numpy as np
def rag_add_layer(adj_mat):
"""Adds an additional layer of dependence to a region adjacency graph,
connecting each node to the neighbors of its immediate neighbors.
Parameters
----------
adj_mat : array_like
A binary matrix of size N x N, where N is t... |
release/stubs.min/Autodesk/Revit/DB/__init___parts/ConicalSurface.py | htlcnn/ironpython-stubs | 182 | 11010242 | <gh_stars>100-1000
class ConicalSurface(Surface,IDisposable):
""" A Conical Surface. """
@staticmethod
def Create(frameOfReference,halfAngle):
"""
Create(frameOfReference: Frame,halfAngle: float) -> ConicalSurface
Creates a conical surface defined by a local reference frame and a half angle.
... |
corehq/apps/cleanup/management/commands/dedupe_case_indices.py | dimagilg/commcare-hq | 471 | 11010246 | """
Use this in preparation ``for form_processor/0067_auto_20170915_1506.py`` migration
"""
from itertools import groupby
from django.core.management.base import BaseCommand
from django.db import connections
from dimagi.utils.chunked import chunked
from corehq.form_processor.models import CommCareCaseIndexSQL
from... |
tensorbuilder/patches/__init__.py | cgarciae/tensorbuilder | 109 | 11010345 | <filename>tensorbuilder/patches/__init__.py
#import layers_patch
import tensorflow_patch
import summaries_patch
import layers_patch
import rnn_utilities_patch
import custom_patch
|
src/apps/datatables/models/draw_response.py | RogerTangos/datahub-stub | 192 | 11010421 | <gh_stars>100-1000
import json
import decimal
class DrawResponse:
def __init__(self, draw):
self.draw = draw
self.records_total = 0
self.records_filtered = 0
self.data = []
self.query = ""
self.error = None
def to_json(self):
response = {}
respons... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.