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 |
|---|---|---|---|---|
snmpsim/reporting/formats/alljson.py | RuiCunhaM/snmpsim | 298 | 12702029 | <filename>snmpsim/reporting/formats/alljson.py
#
# This file is part of snmpsim software.
#
# Copyright (c) 2010-2019, <NAME> <<EMAIL>>
# License: http://snmplabs.com/snmpsim/license.html
#
# SNMP Agent Simulator
#
import json
import os
import re
import tempfile
import time
import uuid
from functools import wraps
from... |
PWGJE/EMCALJetTasks/Tracks/analysis/base/ComparisonData.py | maroozm/AliPhysics | 114 | 12702038 | #**************************************************************************
#* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
#* *
#* Author: The ALICE Off-line Project. *
#* Contributors ... |
cea/analysis/costs/system_costs.py | architecture-building-systems/cea-toolbox | 121 | 12702047 | <reponame>architecture-building-systems/cea-toolbox
"""
costs according to supply systems
"""
import numpy as np
import pandas as pd
from geopandas import GeoDataFrame as gpdf
import itertools
import cea.config
import cea.inputlocator
from cea.analysis.costs.equations import calc_capex_annualized, calc_opex_annualized... |
cloudmarker/events/azvmextensionevent.py | TinLe/cloudmarker | 208 | 12702048 | """Microsoft Azure VM extension event.
This module defines the :class:`AzVMExtensionEvent` class that
evaluates Azure VM extensions. This plugin works on the virtual
machine properties found in the ``ext`` bucket of ``vm_instance_view``
records.
"""
import logging
from cloudmarker import util
_log = logging.getLog... |
tests/test_s1_download.py | d-chambers/OpenSarToolkit | 131 | 12702057 | <filename>tests/test_s1_download.py
import pytest
import os
import pandas as pd
from tempfile import TemporaryDirectory
from ost.helpers.asf import check_connection as check_connection_asf
from ost.helpers.scihub import check_connection as check_connection_scihub, connect
from ost.helpers.settings import HERBERT_USER... |
tests/pyvs/html_validator.py | tlalexander/stitchEm | 182 | 12702089 | <reponame>tlalexander/stitchEm
from HTMLParser import HTMLParser
class HTMLValidator(HTMLParser):
"""
super simple html validator : check that each opening tag is closed
with respect to tag hierarchy
"""
def __init__(self):
HTMLParser.__init__(self)
def handle_starttag(self, tag, ... |
malaya_speech/utils/__init__.py | ishine/malaya-speech | 111 | 12702097 | <gh_stars>100-1000
from malaya_boilerplate.utils import (
available_device,
available_gpu,
close_session,
describe_availability,
)
from malaya_boilerplate.frozen_graph import (
nodes_session,
generate_session,
get_device,
)
from malaya_boilerplate import backblaze
from malaya_boilerplate imp... |
deluca/agents/_gpc.py | google/deluca | 105 | 12702119 | <reponame>google/deluca<filename>deluca/agents/_gpc.py
# Copyright 2021 The Deluca 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
... |
python/afdko/buildcff2vf.py | liuxilu/afdko | 732 | 12702121 | <filename>python/afdko/buildcff2vf.py
# Copyright 2017 Adobe. All rights reserved.
"""
Builds a CFF2 variable font from a designspace file and its UFO masters.
"""
import argparse
from ast import literal_eval
from copy import deepcopy
import logging
import os
import re
import sys
from fontTools import varLib
from fo... |
codigo_das_aulas/aula_03/aula_03.py | VeirichR/curso-python-selenium | 234 | 12702127 | <gh_stars>100-1000
from selenium.webdriver import Firefox
from time import sleep
url = 'https://curso-python-selenium.netlify.app/aula_03.html'
navegador = Firefox()
navegador.get(url)
sleep(1)
a = navegador.find_element_by_tag_name('a')
for click in range(10):
ps = navegador.find_elements_by_tag_name('p')
... |
build/python/examples/ClusteringModulesExamples/cluster_tree_example.py | torydebra/grt | 818 | 12702140 | import GRT
import sys
import numpy as np
import argparse
def main():
# Parse the data filename from the argument list
parser = argparse.ArgumentParser(description='Process some data.')
parser.add_argument('filename', help='A data file')
args = parser.parse_args()
filename = args.filename
# Lo... |
modules/countdown.py | nikolas/jenni | 133 | 12702164 | #!/usr/bin/env python
"""
countdown.py - jenni Countdown Module
Copyright 2011-2013, yano (yanovich.net)
Licensed under the Eiffel Forum License 2.
More info:
* jenni: https://github.com/myano/jenni/
* Phenny: http://inamidst.com/phenny/
"""
from datetime import datetime, timedelta
## TODO: just scrape, https://ww... |
awx/main/tests/unit/api/serializers/test_token_serializer.py | bhyunki/awx | 11,396 | 12702166 | <filename>awx/main/tests/unit/api/serializers/test_token_serializer.py
import pytest
from awx.api.serializers import OAuth2TokenSerializer
@pytest.mark.parametrize('scope, expect', [('', False), ('read', True), ('read read', False), ('write read', True), ('read rainbow', False)])
def test_invalid_scopes(scope, expec... |
java/java2py/java2python-0.5.1/java2python/mod/__init__.py | DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 3,266 | 12702182 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# java2python.mod -> provides simple modification routines for the
# library and projects using it.
#
# The java2python.mod.basic module contains various functions for
# sprinkling generated source with docstrings, comments, decorators,
# etc.
#
# The java2python.mod.inclue... |
examples/django_qrcode/qrcode/views.py | dbajar/segno | 254 | 12702191 | <filename>examples/django_qrcode/qrcode/views.py
import io
from django.http import HttpResponse, HttpResponseRedirect
from django.core.files.base import ContentFile
from django.shortcuts import render
import segno
from .models import Ticket
from .forms import TicketForm
def index(request):
"""Renders the form to ... |
custom_components/waste_collection_schedule/waste_collection_schedule/source/rh_entsorgung_de.py | UBS-P/hacs_waste_collection_schedule | 142 | 12702229 | <gh_stars>100-1000
import re
from datetime import date
from html.parser import HTMLParser
import requests
from waste_collection_schedule import Collection # type: ignore[attr-defined]
TITLE = "RH Entsorgung"
DESCRIPTION = "Source for RHE (Rhein Hunsrück Entsorgung)."
URL = "https://www.rh-entsorgung.de"
TEST_CASES =... |
observations/r/mathpnl.py | hajime9652/observations | 199 | 12702238 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def mathpnl(path):
"""mathpnl
Data loads lazily. Type data(mathpnl) in... |
toyplot/reportlab/__init__.py | eaton-lab/toyplot | 438 | 12702248 | <filename>toyplot/reportlab/__init__.py
# Copyright 2014, Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain
# rights in this software.
"""Support functions for rendering using ReportLab."""
import base64
import io
import re
import numpy
... |
ATMega48 2013-05-14 SHRFP monitor/GUI/theory.py | swharden/AVR-projects | 121 | 12702252 | import matplotlib
matplotlib.use('TkAgg') # THIS MAKES IT FAST!
import numpy
import random
import pylab
import scipy.signal
docs="""
BIG PICTURE:
continuously record sound in buffers.
if buffer is detected:
### POPULATE DELAYS ###
downsample data
find Is w... |
rgbd_seg/models/__init__.py | tomchol/ShapeConv | 438 | 12702286 | <reponame>tomchol/ShapeConv
from .builder import build_model
from .registry import MODELS
|
jaxrl/wrappers/absorbing_states.py | dibyaghosh/jaxrl | 157 | 12702305 | import gym
import numpy as np
from gym import Wrapper
def make_non_absorbing(observation):
return np.concatenate([observation, [0.0]], -1)
class AbsorbingStatesWrapper(Wrapper):
def __init__(self, env):
super().__init__(env)
low = env.observation_space.low
high = env.observation_spa... |
Configuration/DataProcessing/python/Impl/HeavyIonsEra_Run2_2018.py | Purva-Chaudhari/cmssw | 852 | 12702310 | #!/usr/bin/env python3
"""
_HeavyIonsEra_Run2_2018_
Scenario supporting heavy ions collisions
"""
import os
import sys
from Configuration.DataProcessing.Reco import Reco
import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
from Configuration.DataProcessing.Impl.HeavyI... |
src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/callchannel.py | sridish123/htcondor | 217 | 12702332 | '''Data channels for calls.
'''
from utils import *
from enums import *
from errors import ISkypeError
import time
class ICallChannel(object):
'''Represents a call channel.
'''
def __init__(self, Manager, Call, Stream, Type):
'''__init__.
@param Manager: Manager
@type Manager: L... |
telegram/API/main-test.py | whitmans-max/python-examples | 140 | 12702349 | #!/usr/bin/env python3
import os
import requests
from pprint import pprint
#token = '<MY TOKEN>'
token = os.environ['TELEGRAM_TOKEN']
# get infromation about bot
url = f'https://api.telegram.org/bot{token}/getMe'
r = requests.get(url)
pprint(r.json())
print('---')
# get messages for bot
url = f'https://api.telegr... |
venv/Lib/site-packages/ipython_genutils/tests/test_tempdir.py | ajayiagbebaku/NFL-Model | 1,318 | 12702426 |
import os
from ..tempdir import NamedFileInTemporaryDirectory
from ..tempdir import TemporaryWorkingDirectory
def test_named_file_in_temporary_directory():
with NamedFileInTemporaryDirectory('filename') as file:
name = file.name
assert not file.closed
assert os.path.exists(name)
... |
self_organising_systems/texture_ca/texture_synth.py | Bathsheba/self-organising-systems | 121 | 12702428 | <reponame>Bathsheba/self-organising-systems
# Lint as: python3
"""
Texture synth experiments.
"""
from absl import app
from absl import flags
from absl import logging
FLAGS = flags.FLAGS
from self_organising_systems.texture_ca.config import cfg
tcfg = cfg.texture_ca
from self_organising_systems.texture_ca.losses impor... |
metrics/totto/evaluator.py | HKUNLP/UnifiedSKG | 191 | 12702564 | # encoding=utf8
import numpy as np
from datasets import load_metric
# the code below refers to the https://github.com/Yale-LILY/FeTaQA/blob/main/end2end/train.py
def postprocess_text(preds, references_s, metric_name):
preds = [pred.strip() for pred in preds]
references_s = [[reference.strip() for ref... |
chapter4_serving_patterns/batch_pattern/src/db/initialize.py | sudabon/ml-system-in-actions | 133 | 12702577 | from logging import getLogger
from src.configurations import PlatformConfigurations
from src.db import cruds, models, schemas
from src.db.database import get_context_db
logger = getLogger(__name__)
def initialize_database(engine, checkfirst: bool = True):
models.create_tables(engine=engine, checkfirst=checkfirs... |
python/tvm/tir/schedule/_type_checker.py | shengxinhu/tvm | 4,640 | 12702589 | # 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 copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
example_scripts/gzip_mzml.py | RJMW/pymzML | 117 | 12702614 | <reponame>RJMW/pymzML<filename>example_scripts/gzip_mzml.py
#!/usr/bin/env python3
import sys
import os
from pymzml.utils.utils import index_gzip
from pymzml.run import Reader
def main(mzml_path, out_path):
"""
Create and indexed gzip mzML file from a plain mzML.
Usage: python3 gzip_mzml.py <path/to/mzm... |
envs/hns/mujoco-worldgen/mujoco_worldgen/util/sim_funcs.py | jiayu-ch15/curriculum | 424 | 12702653 | import logging
import numpy as np
import itertools
logger = logging.getLogger(__name__)
# #######################################
# ############ set_action ###############
# #######################################
def ctrl_set_action(sim, action):
"""
For torque actuators it copies the action into mujoco ct... |
tests/functions/test_render.py | tteaka/sqlalchemy-utils | 879 | 12702668 | <reponame>tteaka/sqlalchemy-utils<filename>tests/functions/test_render.py
import pytest
import sqlalchemy as sa
from sqlalchemy_utils.functions import (
mock_engine,
render_expression,
render_statement
)
class TestRender(object):
@pytest.fixture
def User(self, Base):
class User(Base):
... |
analysis/combine_ckpt.py | taokong/ibot | 327 | 12702731 | import torch
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--checkpoint_backbone', required=True, type=str)
parser.add_argument('--checkpoint_linear', required=True, type=str)
parser.add_argument('--output_file', required=True, type=str)
if __name__ == "__main__":
args = parse... |
rlpy/Policies/UniformRandom.py | okkhoy/rlpy | 265 | 12702732 | <gh_stars>100-1000
"""Uniform Random policy"""
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from builtins import super
from future import standard_library
standard_library.install_aliases()
from past.utils import ol... |
recipes/Python/135700_win32_service_administration/recipe-135700.py | tdiprima/code | 2,023 | 12702735 | # svcAdmin.py
# in principal this could be expanded to support linux operations
# such as the RedHat style: service <name> status|start|stop|restart
#
import os
import time
from types import *
if os.name == 'nt':
import win32service
import win32serviceutil
RUNNING = win32service.SERVICE_RUNNING
STARTING = win32serv... |
src/gamemodes/__init__.py | codebam/lykos | 122 | 12702738 | <reponame>codebam/lykos
# Imports all gamemode definitions
import os.path
import glob
import importlib
import src.settings as var
from src.messages import messages
from src.events import Event, EventListener
from src.cats import All, Cursed, Wolf, Wolfchat, Innocent, Village, Neutral, Hidden, Team_Switcher, Win_Stealer... |
src/encoded/tests/fixtures/schemas/correlation_quality_metric.py | procha2/encoded | 102 | 12702743 | import pytest
@pytest.fixture
def correlation_quality_metric(testapp, analysis_step_run_bam, file_tsv_1_2, award, lab):
item = {
'step_run': analysis_step_run_bam['@id'],
'quality_metric_of': [file_tsv_1_2['@id']],
'Pearson correlation': 0.1,
'award': award['@id'],
'lab': l... |
vendor/github.com/paulsmith/gogeos/geos/geoscapi.py | venicegeo/pzsvc-catalog | 197 | 12702753 | import sys
from string import Template
from collections import namedtuple
from pycparser import c_parser, c_ast, parse_file
Func = namedtuple('Func', ('name', 'type', 'args'))
Arg = namedtuple('Arg', ('name', 'type'))
Type = namedtuple('Type', ('ptr', 'name', 'array'))
class FuncDeclVisitor(c_ast.NodeVisitor):
de... |
bcs-ui/backend/resources/node/client.py | laodiu/bk-bcs | 599 | 12702815 | <filename>bcs-ui/backend/resources/node/client.py
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "Licens... |
boto3_type_annotations/boto3_type_annotations/appstream/client.py | cowboygneox/boto3_type_annotations | 119 | 12702831 | <reponame>cowboygneox/boto3_type_annotations
from typing import Optional
from botocore.client import BaseClient
from typing import Dict
from typing import Union
from botocore.paginate import Paginator
from botocore.waiter import Waiter
from typing import List
class Client(BaseClient):
def associate_fleet(self, Fl... |
inventory/admin.py | TechNic11/Try-Django-3.2 | 136 | 12702844 | from django.contrib import admin
# Register your models here.
from .models import InventoryRequest
class InventoryRequestAdmin(admin.ModelAdmin):
list_display = ['user', 'name', 'total', 'unit', 'status']
admin.site.register(InventoryRequest, InventoryRequestAdmin) |
test.py | cuicaihao/STANet | 220 | 12702846 | from data import create_dataset
from models import create_model
from util.util import save_images
import numpy as np
from util.util import mkdir
import argparse
from PIL import Image
import torchvision.transforms as transforms
def transform():
transform_list = []
transform_list += [transforms.ToTensor()]
... |
system.d/library/tools_installer/tools_to_install/responder/tools/MultiRelay/creddump/framework/addrspace.py | CraftyBastard/PiBunny | 201 | 12702855 | <reponame>CraftyBastard/PiBunny<gh_stars>100-1000
# Volatility
# Copyright (C) 2007 Volatile Systems
#
# Original Source:
# Copyright (C) 2004,2005,2006 4tphi Research
# Author: {npetroni,<EMAIL> (<NAME> and <NAME>)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU... |
johnny/backends/locmem.py | bennylope/johnny-cache | 124 | 12702869 | """
Infinite caching locmem class. Caches forever when passed timeout of 0.
This actually doesn't cache "forever", just for a very long time. On
32 bit systems, it will cache for 68 years, quite a bit longer than any
computer will last. On a 64 bit machine, your cache will expire about
285 billion years after the S... |
src/foremast/configs/outputs.py | dnava013/foremast | 157 | 12702883 | # Foremast - Pipeline Tooling
#
# Copyright 2018 Gogo, LLC
#
# 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... |
libtbx/configure.py | rimmartin/cctbx_project | 155 | 12702889 | from __future__ import absolute_import, division, print_function
import sys, os
def run():
if sys.hexversion < 0x02070000:
print()
print("*" * 78)
print("FATAL: Python 2.7 or higher is required.")
print("Version currently in use:", sys.version)
print("*" * 78)
print()
return False
# tes... |
tests/onnx/test_onnx.py | techthiyanes/optimum | 414 | 12702911 | # Copyright 2022 The HuggingFace Team. 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 app... |
easyrobust/test_scripts/utils.py | thu-ml/realsafe | 107 | 12702955 | import torch
import torch.nn as nn
robust_model_urls = {
'resnet50': 'http://alisec-competition.oss-cn-shanghai.aliyuncs.com/xiaofeng/imagenet_pretrained_models/advtrain_models/advtrain_resnet50_ep4.pth',
'resnet101': 'http://alisec-competition.oss-cn-shanghai.aliyuncs.com/xiaofeng/imagenet_pretrained_models/a... |
gmplot/drawables/marker_dropper.py | Monti03/gmplot | 606 | 12702969 | <gh_stars>100-1000
from gmplot.drawables.marker_icon import _MarkerIcon
from gmplot.drawables.raw_marker import _RawMarker
class _MarkerDropper(object):
'''
Handler that drops markers on map clicks.
The markers can be deleted when clicked on.
'''
_MARKER_NAME = 'dropped_marker'
_EVENT_OBJECT_N... |
usefulscripts/hcxgrep.py | roycewilliams/hcxtools | 1,382 | 12702973 | #!/usr/bin/env python2
'''
greps inside hccapx/pmkid structs by essid, mac_ap or mac_sta
This software is Copyright (c) 2019-2020, <NAME> <alex at stanev.org> and it is
hereby released to the general public under the following terms:
Redistribution and use in source and binary forms, with or without
modification, are... |
billing/tests/test_bitcoin.py | timgates42/merchant | 332 | 12702979 | <gh_stars>100-1000
import mock
import decimal
from bitcoinrpc.data import TransactionInfo
from django.conf import settings
from django.test import TestCase
from django.utils.unittest import skipIf
from billing import get_gateway
from billing.signals import transaction_was_successful, transaction_was_unsuccessful
T... |
Sign-Language-Recognition/code/generate_images_labels.py | lhvubtqn/Sign-Language-Recognition | 131 | 12702995 | """
Contains code to generate the <image-path> vs <image-label> list for a set of
images and write it to disk.
"""
import sys
import logging
import os
from common.config import get_config
logging_format = '[%(asctime)s||%(name)s||%(levelname)s]::%(message)s'
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO... |
dlt/train/wganct.py | dmarnerides/pydlt | 236 | 12703037 | <gh_stars>100-1000
import torch
from torch import autograd
from torch.autograd import Variable
from .ganbasetrainer import GANBaseTrainer
class WGANCTTrainer(GANBaseTrainer):
"""Wasserstein GAN Trainer with gradient penalty and correction term.
From Improving the Improved Training of Wasserstein GAN... |
code/utils/augs.py | noammy/videowalk | 227 | 12703048 | import torchvision
import skimage
import torch
from torchvision import transforms
import numpy as np
from PIL import Image
IMG_MEAN = (0.4914, 0.4822, 0.4465)
IMG_STD = (0.2023, 0.1994, 0.2010)
NORM = [transforms.ToTensor(),
transforms.Normalize(IMG_MEAN, IMG_STD)]
class MapTransform(object):
def __i... |
tools/network/detectify-modules.py | wxyyxc1992/ChaosWarden | 123 | 12703055 | <filename>tools/network/detectify-modules.py
#
# Get CVE list:
# wget https://cve.mitre.org/data/downloads/allitems.csv
#
# Get Detectify modules list:
# 1/ login on Detectify
# 2/ Perform the following request:
# POST /ajax/application_load/50bdd32f114d2e889f29f31e3e79a1ac/
# with body: navigation[mode]=modules
# 3/ s... |
Ryven/packages/auto_generated/glob/nodes.py | tfroehlich82/Ryven | 2,872 | 12703056 |
from NENV import *
import glob
class NodeBase(Node):
pass
class _Glob0_Node(NodeBase):
"""
"""
title = '_glob0'
type_ = 'glob'
init_inputs = [
NodeInputBP(label='dirname'),
NodeInputBP(label='basename'),
NodeInputBP(label='dironly'),
]
init_outputs = [
... |
my/pinboard.py | aluhrs13/HPI | 1,026 | 12703062 | <gh_stars>1000+
"""
[[https://pinboard.in][Pinboard]] bookmarks
"""
REQUIRES = [
'git+https://github.com/karlicoss/pinbexport',
]
from my.config import pinboard as config
import pinbexport.dal as pinbexport
Bookmark = pinbexport.Bookmark
# yep; clearly looks that the purpose of my. package is to wire files to... |
neural_compressor/adaptor/tf_utils/graph_rewriter/generic/fuse_conv_with_math.py | kevinintel/neural-compressor | 172 | 12703069 | <filename>neural_compressor/adaptor/tf_utils/graph_rewriter/generic/fuse_conv_with_math.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 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 m... |
contrib/opencensus-ext-azure/examples/metrics/sum.py | Flared/opencensus-python | 650 | 12703071 | # Copyright 2019, OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
utils/commons/hparams.py | leminhnguyen/NATSpeech | 561 | 12703086 | import argparse
import os
import yaml
from utils.os_utils import remove_file
global_print_hparams = True
hparams = {}
class Args:
def __init__(self, **kwargs):
for k, v in kwargs.items():
self.__setattr__(k, v)
def override_config(old_config: dict, new_config: dict):
for k, v in new_co... |
src/main/python/khaiii/train/evaluator.py | cjdans5545/khaiii | 1,235 | 12703129 | # -*- coding: utf-8 -*-
"""
evaluation related module
__author__ = 'Jamie (<EMAIL>)'
__copyright__ = 'Copyright (C) 2019-, Kakao Corp. All rights reserved.'
"""
###########
# imports #
###########
from collections import Counter
import logging
from typing import List, TextIO, Tuple
from khaiii.train.sentence impor... |
demo/infinity/fast_api_server_onnx.py | dumpmemory/transformer-deploy | 698 | 12703151 | # Copyright 2022, <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
platform/resources/challenges/templates/template.py | WHYSOEASY/emkc | 173 | 12703172 | <filename>platform/resources/challenges/templates/template.py
import sys
%%_INSERTVALUES_%%
# write your solution here
|
backpack/core/derivatives/conv_transpose2d.py | jabader97/backpack | 395 | 12703181 | """Partial derivatives for `torch.nn.ConvTranspose2d`."""
from backpack.core.derivatives.conv_transposend import ConvTransposeNDDerivatives
class ConvTranspose2DDerivatives(ConvTransposeNDDerivatives):
def __init__(self):
super().__init__(N=2)
|
zhuaxia/option.py | yangchuansheng/zhuaxia | 332 | 12703185 | <filename>zhuaxia/option.py<gh_stars>100-1000
# -*- coding:utf-8 -*-
import log
import zhuaxia.config as config
LOG = log.get_logger("zxLogger")
class Option(object):
"""
a class containing user given options
"""
def __init__(self):
self.is_hq = False
self.need_proxy_pool = Fa... |
utils/preprocess.py | jeasinema/MV3D_plus | 177 | 12703211 | #!/usr/bin/env python
# -*- coding:UTF-8 -*-
# File Name : preprocess.py
# Purpose :
# Creation Date : 10-12-2017
# Last Modified : Thu 18 Jan 2018 05:34:42 PM CST
# Created By : <NAME> [jeasinema[at]gmail[dot]com]
import os
import multiprocessing
import numpy as np
from config import cfg
data_dir = 'velodyne'
def... |
util/online.py | MohammedAljahdali/shrinkbench | 345 | 12703234 | <filename>util/online.py
import numpy as np
class OnlineStats:
"""
Welford's algorithm to compute sample mean and sample variance incrementally.
https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#On-line_algorithm
"""
def __init__(self, iterable=None):
"""Online Mean and Va... |
napari/layers/utils/_tests/test_color_manager_utils.py | MaksHess/napari | 1,345 | 12703280 | import numpy as np
from napari.layers.utils.color_manager_utils import (
guess_continuous,
is_color_mapped,
)
def test_guess_continuous():
continuous_annotation = np.array([1, 2, 3], dtype=np.float32)
assert guess_continuous(continuous_annotation)
categorical_annotation_1 = np.array([True, False... |
tests/deployment/sagemaker/sagemaker_moto/response.py | co42/BentoML | 3,451 | 12703286 | import json
from moto.core.responses import BaseResponse
from tests.deployment.sagemaker.sagemaker_moto.model import sagemaker_backends
class SageMakerResponse(BaseResponse):
"""SageMaker response for moto mock.
References API operations and result from
https://docs.aws.amazon.com/sagemaker/latest/dg/AP... |
settings.py | nnivruth/simple_api | 150 | 12703287 | <gh_stars>100-1000
DB_URI = 'sqlite:///./main.db'
|
tensorflow/standard/reinforcement_learning/rl_on_gcp_demo/trainer/agent.py | VanessaDo/cloudml-samples | 1,552 | 12703294 | # Copyright 2018 Google LLC
#
# 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, ... |
tests/test_performance.py | Sunkist-Cherry/Spam-Filter | 433 | 12703298 | <reponame>Sunkist-Cherry/Spam-Filter
import os
import unittest
import cherry
from unittest import mock
from cherry.base import DATA_DIR, load_data
class PerformanceTest(unittest.TestCase):
# __init__()
@mock.patch('cherry.performancer.load_all')
def test_init(self, mock_load):
mock_load.return_val... |
tods/sk_interface/detection_algorithm/ABOD_skinterface.py | ZhuangweiKang/tods | 544 | 12703332 | <gh_stars>100-1000
import numpy as np
from ..base import BaseSKI
from tods.detection_algorithm.PyodABOD import ABODPrimitive
class ABODSKI(BaseSKI):
def __init__(self, **hyperparams):
super().__init__(primitive=ABODPrimitive, **hyperparams)
self.fit_available = True
self.predict_available = True
self.produce... |
packs/pagerduty/actions/lib/action.py | jonico/st2contrib | 164 | 12703333 | <reponame>jonico/st2contrib<filename>packs/pagerduty/actions/lib/action.py
import pygerduty
from st2actions.runners.pythonrunner import Action
class PagerDutyAction(Action):
def __init__(self, config):
super(PagerDutyAction, self).__init__(config)
self.pager = self._init_client()
self.tri... |
proxy/models.py | cklewar/wistar | 152 | 12703382 | from __future__ import unicode_literals
from django.db import models
from django.forms import ModelForm
|
examples/plot_cross_session_motor_imagery.py | plcrodrigues/moabb | 321 | 12703390 | """
===========================
Cross Session Motor Imagery
===========================
This Example show how to perform a cross session motor imagery analysis on the
very popular dataset 2a from the BCI competition IV.
We will compare two pipelines :
- CSP+LDA
- Riemannian Geometry+Logistic Regression
We will use ... |
numpyro/contrib/optim.py | vishalbelsare/numpyro | 1,394 | 12703395 | <gh_stars>1000+
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
"""
This module provides a wrapper for Optax optimizers so that they can be used with
NumPyro inference algorithms.
"""
from typing import Tuple, TypeVar
import optax
from numpyro.optim import _NumPyroOptim
_Params ... |
examples/05_aws_batch/scripts/workflow2.py | cclauss/redun | 303 | 12703400 | import subprocess
from redun import task
from task_lib2.utils import lib_task_on_batch
redun_namespace = "redun.examples.aws_batch"
@task()
def task_on_default(x: int):
return [
'task_on_default',
subprocess.check_output(['uname', '-a']),
x
]
@task(executor='batch', version="12")... |
tests/update.py | robstein/rules_go | 1,099 | 12703404 | #!/usr/bin/env python
# Copyright 2018 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 req... |
vumi/application/sandbox_rlimiter.py | seidu626/vumi | 199 | 12703421 | <filename>vumi/application/sandbox_rlimiter.py
# -*- test-case-name: vumi.application.tests.test_sandbox_rlimiter -*-
"""NOTE:
This module is also used as a standalone Python program that is executed by
the sandbox machinery. It must never, ever import non-stdlib modules.
"""
import os
import sys
import json... |
autobahntestsuite/autobahntestsuite/interfaces.py | rishabh-bector/autobahn-testsuite | 595 | 12703423 | ###############################################################################
##
## Copyright (c) Crossbar.io Technologies GmbH
##
## 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
##
##... |
utils/palette_davis.py | Nitin-Mane/dense-ulearn-vos | 157 | 12703427 | palette_str = '''0 0 0
128 0 0
0 128 0
128 128 0
0 0 128
128 0 128
0 128 128
128 128 128
64 0 0
191 0 0
64 128 0
191 128 0
64 0 128
191 0 128
64 128 128
191 128 128
0 64 0
128 64 0
0 191 0
128 191 0
0 64 128
128 64 128
22 22 22
23 23 23
24 24 24
25 25 25
26 26 26
27 27 27
28 28 28
29 29 29
30 30 30
31 31 31
32 32 32
33... |
doc/support/generate_doxygen.py | dark-richie/crashpad | 14,668 | 12703428 | <reponame>dark-richie/crashpad<gh_stars>1000+
#!/usr/bin/env python
# Copyright 2017 The Crashpad 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:/... |
pyvex/errors.py | Pascal-0x90/pyvex | 261 | 12703441 |
class PyVEXError(Exception):
pass
class SkipStatementsError(PyVEXError):
pass
#
# Exceptions and notifications that post-processors can raise
#
class LiftingException(Exception):
pass
class NeedStatementsNotification(LiftingException):
"""
A post-processor may raise a NeedStatementsNotifica... |
lasagne/random.py | goncaloperes/Library_Lasagne | 3,986 | 12703449 | """
A module with a package-wide random number generator,
used for weight initialization and seeding noise layers.
This can be replaced by a :class:`numpy.random.RandomState` instance with a
particular seed to facilitate reproducibility.
Note: When using cuDNN, the backward passes of convolutional and max-pooling
laye... |
sanitycheck/test_sanity_check.py | philipperemy/tensorflow-phased-lstm | 133 | 12703472 | import collections
import numpy as np
import tensorflow as tf
from tensorflow.python.ops.rnn import dynamic_rnn
from tensorflow.contrib.rnn import BasicLSTMCell
from helpers import FileLogger
from ml_utils import create_adam_optimizer
from ml_utils import create_weight_variable
from phased_lstm import PhasedLSTMCell
f... |
clearml/utilities/pigar/log.py | arielleoren/clearml | 2,097 | 12703519 | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import logging.handlers
logger = logging.getLogger('pigar')
logger.setLevel(logging.WARNING)
|
lldb/scripts/swig_bot_lib/server.py | dan-zheng/llvm-project | 765 | 12703558 | #!/usr/bin/env python
"""
SWIG generation server. Listens for connections from swig generation clients
and runs swig in the requested fashion, sending back the results.
"""
# Future imports
from __future__ import absolute_import
from __future__ import print_function
# Python modules
import argparse
import io
import... |
flask_rest_jsonapi/schema.py | fossasia/flask-rest-jsonapi | 1,757 | 12703571 | <filename>flask_rest_jsonapi/schema.py
# -*- coding: utf-8 -*-
from marshmallow import class_registry
from marshmallow.base import SchemaABC
from marshmallow_jsonapi.fields import Relationship
from flask_rest_jsonapi.exceptions import InvalidField, InvalidInclude
def compute_schema(schema_cls, default_kwargs, qs, i... |
arch/arm/tests/adr_t2.py | Samsung/ADBI | 312 | 12703581 | <gh_stars>100-1000
from test import *
import random
print ' .thumb'
def test(rd, imm12):
name = 'test_adr_t2_%s' % tn()
cleanup = asm_wrap(name, rd)
print '%s_tinsn:' % name
print ' sub.w %s, pc, #%i' % (rd, imm12)
cleanup()
def iter_cases():
while True:
yield random.ch... |
manga_py/providers/manga_online_com_ua.py | sonvt1710/manga-py | 337 | 12703583 | from manga_py.provider import Provider
from .helpers.std import Std
class MangaOnlineCom(Provider, Std):
__local_storage = None
def __init_storage(self):
if not self.__local_storage:
self.__local_storage = {}
def get_chapter_index(self) -> str:
self.__init_storage()
i... |
ggplot/geoms/geom_tile.py | themiwi/ggplot | 1,133 | 12703610 | <reponame>themiwi/ggplot<gh_stars>1000+
import pandas as pd
import matplotlib.patches as patches
from .geom import geom
from ..utils import calc_n_bins
class geom_tile(geom):
"""
Frequency table / heatmap
Parameters
----------
x:
x values for bins/categories
y:
y values for bin... |
examples/keras_recipes/quasi_svm.py | rickiepark/keras-io | 1,542 | 12703612 | <reponame>rickiepark/keras-io
"""
Title: A Quasi-SVM in Keras
Author: [fchollet](https://twitter.com/fchollet)
Date created: 2020/04/17
Last modified: 2020/04/17
Description: Demonstration of how to train a Keras model that approximates a SVM.
"""
"""
## Introduction
This example demonstrates how to train a Keras mode... |
ding/framework/tests/test_task.py | opendilab/DI-engine | 464 | 12703628 | from concurrent.futures import thread
from os import spawnl
from attr.validators import instance_of
import pytest
import time
import copy
import random
from mpire import WorkerPool
from ding.framework import Task
from ding.framework.context import Context
from ding.framework.parallel import Parallel
from ding.utils.des... |
tests/examples/test_custom_object_repr.py | dtczest/syrupy | 147 | 12703633 | <reponame>dtczest/syrupy<filename>tests/examples/test_custom_object_repr.py
class MyCustomClass:
prop1 = 1
prop2 = "a"
prop3 = {1, 2, 3}
def test_snapshot_custom_class(snapshot):
assert MyCustomClass() == snapshot
class MyCustomReprClass(MyCustomClass):
def __repr__(self):
state = "\n".j... |
jixianjiancha/check/main.py | zx273983653/vulscan | 582 | 12703635 | <filename>jixianjiancha/check/main.py
#!/usr/bin/env python
#encoding=utf-8
# __author__ test
# __time__ 2018-4-25
import sys
import paramiko
import time
import json
import commands
import ast
import threading
reload(sys)
sys.setdefaultencoding('utf-8')
lock=threading.Lock()
#登录远程服务器并执行命令
def remote_ssh(ip,use... |
packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/events.py | RichiCoder1/aws-cdk | 6,159 | 12703681 | from lib.records import TaskInfo, EniInfo
def extract_event_task_info(task_description) -> TaskInfo:
arn = task_description['taskArn']
# Parse the eni info out of the the attachments
enis = [
EniInfo(eni_id=detail['value']) for network_interface in task_description['attachments']
if netwo... |
book_manager/bookman.py | anshul2807/Automation-scripts | 496 | 12703695 | <filename>book_manager/bookman.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'GUI.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what... |
leetcode/322.coin-change.py | geemaple/algorithm | 177 | 12703732 | <reponame>geemaple/algorithm
#
# @lc app=leetcode id=322 lang=python3
#
# [322] Coin Change
#
# https://leetcode.com/problems/coin-change/description/
#
# algorithms
# Medium (27.95%)
# Total Accepted: 261.6K
# Total Submissions: 810K
# Testcase Example: '[1,2,5]\n11'
#
# You are given coins of different denominati... |
tests/functional/services/catalog/utils/api/__init__.py | rbrady/anchore-engine | 1,484 | 12703755 | from tests.functional.services.catalog.utils.api import objects
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.