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 |
|---|---|---|---|---|
tests/loading/definition/responses/headers/single/test_items_validation.py | maroux/flex | 160 | 12618414 | <reponame>maroux/flex
import pytest
from flex.constants import (
ARRAY,
)
from flex.exceptions import (
ValidationError,
)
from flex.loading.definitions.responses.single.headers.single import (
single_header_validator,
)
def test_items_is_not_required(msg_assertions):
try:
single_header_valid... |
tests/posting/test_log2k8s.py | MarkusH/kopf | 1,038 | 12618417 | import logging
import pytest
from kopf.engines.logging import ObjectLogger, LocalObjectLogger
OBJ1 = {'apiVersion': 'group1/version1', 'kind': 'Kind1',
'metadata': {'uid': 'uid1', 'name': 'name1', 'namespace': 'ns1'}}
REF1 = {'apiVersion': 'group1/version1', 'kind': 'Kind1',
'uid': 'uid1', 'name': 'n... |
mindsdb/api/mongo/responders/update_range_deletions.py | yarenty/mindsdb | 261 | 12618422 | <gh_stars>100-1000
from mindsdb.api.mongo.classes import Responder
class Responce(Responder):
when = {'update': 'rangeDeletions'}
result = {
"ok": 1
}
responder = Responce()
|
sharppy/sharptab/profile.py | skovic/SHARPpy | 163 | 12618429 | ''' Create the Sounding (Profile) Object '''
from __future__ import division
import numpy as np
import numpy.ma as ma
import getpass
from datetime import datetime
from sharppy.sharptab import utils, winds, params, interp, thermo, watch_type, fire
import sharppy.io.qc_tools as qc_tools
from sharppy.databases.sars import... |
10_pipeline/sagemaker_mlops/sagemaker-project-modelbuild/tests/test_pipelines.py | dpai/workshop | 2,327 | 12618430 | <reponame>dpai/workshop
import pytest
@pytest.mark.xfail
def test_that_you_wrote_tests():
assert False, "No tests written"
def test_pipelines_importable():
import pipelines # noqa: F401
|
interop_2016/ex2_conditionals/test_condition3.py | fallenfuzz/pynet | 528 | 12618478 | # Testing truth
if 1:
print "1 is True"
if not "":
print "Null string is False"
if not None:
print "None is False"
if ['whatever']:
print "List with one element is True"
|
integrations/wandb/scripts/sweeps_using_config.py | apjanco/projects | 823 | 12618481 | import typer
from pathlib import Path
from spacy.training.loop import train
from spacy.training.initialize import init_nlp
from spacy import util
from thinc.api import Config
import wandb
def main(default_config: Path, output_path: Path):
loaded_local_config = util.load_config(default_config)
with wandb.init()... |
problog/nnf_formula.py | HEmile/problog | 189 | 12618486 | import warnings
warnings.warn(
"The class nnf_formula.NNF has been renamed to ddnnf_formula.DDNNF. Please update your code!"
)
|
djstripe/models/__init__.py | ExtraE113/dj-stripe | 937 | 12618492 | <filename>djstripe/models/__init__.py
from .account import Account
from .api import APIKey
from .base import IdempotencyKey, StripeModel
from .billing import (
Coupon,
Invoice,
InvoiceItem,
Plan,
Subscription,
SubscriptionItem,
SubscriptionSchedule,
TaxId,
TaxRate,
UpcomingInvoic... |
var/spack/repos/builtin/packages/camellia/package.py | BenWibking/spack | 2,360 | 12618497 | <reponame>BenWibking/spack
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Camellia(CMakePackage):
"""Camellia: user-friendly MPI-parallel... |
anuga/culvert_flows/tests/run_culvert_flat_water_lev.py | samcom12/anuga_core | 136 | 12618500 | """ Testing CULVERT (Changing from Horizontal Abstraction to Vertical Abstraction
This example includes a Model Topography that shows a TYPICAL Headwall Configuration
The aim is to change the Culvert Routine to Model more precisely the abstraction
from a vertical face.
The inflow must include the impact of Approach ... |
rainbow/4-multistep/memory.py | g6ling/Pytorch-Cartpole | 116 | 12618525 | import random
from collections import namedtuple, deque
from config import n_step, gamma
Transition = namedtuple('Transition', ('state', 'next_state', 'action', 'reward', 'mask'))
class Memory(object):
def __init__(self, capacity):
self.memory = deque(maxlen=capacity)
self.capacity = capacity
... |
cython/setup.py | KKobuszewski/cuda | 126 | 12618529 | # from future.utils import iteritems
import os
from os.path import join as pjoin
from setuptools import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
def find_in_path(name, path):
"""Find a file in a search path"""
# Adapted fom http://code.activestate.co... |
fs/tests/zipfs_binary_test.py | jwilk-forks/pyfilesystem | 314 | 12618541 | <filename>fs/tests/zipfs_binary_test.py<gh_stars>100-1000
"""
Test case for ZipFS binary file reading/writing
Passes ok on Linux, fails on Windows (tested: Win7, 64-bit):
AssertionError: ' \r\n' != ' \n'
"""
import unittest
from fs.zipfs import ZipFS
import os
from six import b
class ZipFsBinaryWriteRead(unittest.T... |
tests/test_transchex.py | dylanbuchi/MONAI | 2,971 | 12618543 | <filename>tests/test_transchex.py
# Copyright 2020 - 2021 MONAI Consortium
# 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 ... |
Allura/allura/lib/decorators.py | rohankumardubey/allura | 113 | 12618590 | # 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 (t... |
tests/system_health/test_system_status.py | lolyu/sonic-mgmt | 132 | 12618596 | <gh_stars>100-1000
import time
import pytest
from tests.common.utilities import wait_until
pytestmark = [
pytest.mark.topology('any')
]
def test_system_is_running(duthost):
def is_system_ready(duthost):
status = duthost.shell('sudo systemctl is-system-running', module_ignore_errors=True)['stdout']
... |
src/args.py | imatge-upc/rsis | 132 | 12618614 | import argparse
def get_parser():
parser = argparse.ArgumentParser(description='RIASS')
## TRAINING parameters ##
parser.add_argument('--resume', dest='resume',action='store_true',
help=('whether to resume training an existing model '
'(the one wit... |
twisted/test/test_defgen.py | hawkowl/twisted | 9,953 | 12618677 | <gh_stars>1000+
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.internet.defer.deferredGenerator} and related APIs.
"""
from __future__ import division, absolute_import
from twisted.internet import reactor
from twisted.trial import unittest
from twisted.internet.defe... |
deeppavlov/models/go_bot/nlu/dto/text_vectorization_response.py | xbodx/DeepPavlov | 5,893 | 12618683 | class TextVectorizationResponse:
"""
Stores the BOW-encodings and (padded or aggregated e.g. averaged) embeddings for text.
"""
def __init__(self, tokens_bow_encoded, tokens_aggregated_embedding, tokens_embeddings_padded):
self.tokens_bow_encoded = tokens_bow_encoded
self.tokens_aggrega... |
src/sage/categories/commutative_rings.py | UCD4IDS/sage | 1,742 | 12618688 | <reponame>UCD4IDS/sage
r"""
Commutative rings
"""
# ****************************************************************************
# Copyright (C) 2005 <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# 2008 <NAME> (CNRS) <<EMAIL>>
# 2008-2013 <NAME> <nthiery at users.... |
device/usb/tools/usb_ids.py | kjthegod/chromium | 231 | 12618697 | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import itertools
import optparse
import re
VENDOR_PATTERN = re.compile("^(?P<id>[0-9a-fA-F]{4})\s+(?P<name>.+)$")
PRODUCT_PATTERN = re.compile("^\t(?P<i... |
django/CVE-2021-35042/web/vuln/models.py | nobgr/vulhub | 9,681 | 12618700 | from django.db import models
# Create your models here.
class Collection(models.Model):
name = models.CharField(max_length=128)
|
ansible/roles/lib_git/build/lib/base.py | fahlmant/openshift-tools | 164 | 12618720 | # pylint: skip-file
# pylint: disable=too-many-lines
# these are already imported inside of the ssh library
#import os
#import subprocess
class GitCLIError(Exception):
'''Exception class for openshiftcli'''
pass
# pylint: disable=too-few-public-methods
class GitCLI(object):
''' Class to wrap the command ... |
CodeIA/venv/Lib/site-packages/coremltools/converters/mil/backend/nn/passes/test_passes.py | Finasty-lab/IA-Python | 11,356 | 12618724 | <filename>CodeIA/venv/Lib/site-packages/coremltools/converters/mil/backend/nn/passes/test_passes.py
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
i... |
064_Dense_Depth/nyu/01_float32/12_weight_quantization.py | IgiArdiyanto/PINTO_model_zoo | 1,529 | 12618751 | <reponame>IgiArdiyanto/PINTO_model_zoo
### tensorflow==2.3.1
import tensorflow as tf
# Weight Quantization - Input/Output=float32
height = 480
width = 640
converter = tf.lite.TFLiteConverter.from_saved_model('saved_model_nyu_{}x{}'.format(height, width))
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]... |
Trakttv.bundle/Contents/Libraries/Shared/plugin/core/logger/filters/trakt_.py | disrupted/Trakttv.bundle | 1,346 | 12618756 | <reponame>disrupted/Trakttv.bundle
from logging import Filter
from six import string_types
from trakt.core.exceptions import ServerError, RequestError
import logging
IGNORED_MESSAGE_PREFIXES = [
'Continue retry since status is',
'OAuth - Unable to refresh expired token',
'request failed:',
'Retry #'
]
... |
object_detection/Swin/det_necks/__init__.py | no-name-xiaosheng/PaddleViT | 993 | 12618762 | <filename>object_detection/Swin/det_necks/__init__.py
from . import fpn
|
src/mem/slicc/ast/InPortDeclAST.py | mandaltj/gem5_chips | 135 | 12618765 | <filename>src/mem/slicc/ast/InPortDeclAST.py
# Copyright (c) 1999-2008 <NAME> and <NAME>
# Copyright (c) 2009 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# m... |
testfixtures/tests/__init__.py | abcdenis/testfixtures | 184 | 12618777 | import warnings
warnings.simplefilter('default', ImportWarning)
|
serieswatcher/sqlobject/inheritance/tests/test_asdict.py | lightcode/SeriesWatcher | 303 | 12618790 | from sqlobject import *
from sqlobject.inheritance import *
from sqlobject.tests.dbtest import *
########################################
## sqlmeta.asDict
########################################
class InheritablePerson(InheritableSQLObject):
first = StringCol()
last = StringCol(alternateID=True, length=255)... |
docs/conf.py | amirmalekicom/py_vollib | 145 | 12618860 | <filename>docs/conf.py<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function
import sphinx_rtd_theme
from recommonmark.parser import CommonMarkParser
project = 'py_vollib'
copyright = '2017, Gammon Capital LLC.'
author = 'Gammon Capital LL... |
DQM/EcalMonitorTasks/python/SelectiveReadoutTask_cfi.py | ckamtsikis/cmssw | 852 | 12618874 | <reponame>ckamtsikis/cmssw<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
dccSizeBinEdges = []
for i in range(11) :
dccSizeBinEdges.append(0.608 / 10. * i)
for i in range(11, 79) :
dccSizeBinEdges.append(0.608 * (i - 10.))
ecalSelectiveReadoutTask = cms.untracked.PSet(
params = cms.untracked.P... |
Python/View_and_Combine_STL/combine.py | iamakkkhil/Rotten-Scripts | 1,127 | 12618900 | import math
import stl
from stl import mesh
import numpy
import glob
def combine_stl():
'''This function combines all the STL file in a directory and merges them together
Params: data_dir = stores the directory of stl files
stl_dir = list all the stl files
data = total number of vertices and th... |
fwtool/archive/fat.py | ma1co/fwtool.py | 115 | 12618906 | <gh_stars>100-1000
"""A parser for FAT file system images"""
import io
import posixpath
import shutil
from stat import *
import time
from . import *
from ..io import *
from ..util import *
FatHeader = Struct('FatHeader', [
('jump', Struct.STR % 3),
('oemName', Struct.STR % 8),
('bytesPerSector', Struct.INT16),
(... |
trackeval/_timing.py | AlexanderSing/TrackEval | 325 | 12618907 | from functools import wraps
from time import perf_counter
import inspect
DO_TIMING = False
DISPLAY_LESS_PROGRESS = False
timer_dict = {}
counter = 0
def time(f):
@wraps(f)
def wrap(*args, **kw):
if DO_TIMING:
# Run function with timing
ts = perf_counter()
result = ... |
tools/ceilslam/gui.py | ParikhKadam/cycloid | 156 | 12618919 | # -*- coding: utf-8 -*-
from __future__ import print_function
import cv2
import numpy as np
import time
import glfw
import OpenGL.GL as gl
import imgui
from imgui.integrations.glfw import GlfwRenderer
import ceiltrack
import recordreader
# starting position for localization
# negative x because we also mirror the tr... |
src/asp/IceBridge/full_processing_script.py | PicoJr/StereoPipeline | 323 | 12618929 | #!/usr/bin/env python
# __BEGIN_LICENSE__
# Copyright (c) 2009-2013, United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The NGT platform is licensed under the Apache License, Version 2.0 (the
# "License"); you may not use ... |
my_package/FilterInterpolation/__init__.py | JamesPerlman/Dain-App | 7,517 | 12618963 | from .FilterInterpolationModule import *
|
softgym/registered_env.py | ipab-rad/softgym | 147 | 12618966 | <reponame>ipab-rad/softgym
from softgym.envs.pour_water import PourWaterPosControlEnv
from softgym.envs.pour_water_amount import PourWaterAmountPosControlEnv
from softgym.envs.pass_water import PassWater1DEnv
from softgym.envs.rope_flatten import RopeFlattenEnv
from softgym.envs.rope_configuration import RopeConfigurat... |
python_modules/dagit/dagit_tests/starlette/test_app.py | makotonium/dagster | 4,606 | 12618977 | <filename>python_modules/dagit/dagit_tests/starlette/test_app.py<gh_stars>1000+
import gc
import objgraph
from dagit.graphql import GraphQLWS
from dagit.starlette import ROOT_ADDRESS_STATIC_RESOURCES
from dagit.version import __version__ as dagit_version
from dagster import __version__ as dagster_version
from dagster ... |
AdminServer/appscale/admin/instance_manager/utils.py | loftwah/appscale | 790 | 12618992 | """ Common functions for managing AppServer instances. """
import fnmatch
import glob
import logging
import os
import shutil
import subprocess
from appscale.admin.constants import InvalidSource
from appscale.admin.instance_manager.constants import (
CONFLICTING_JARS, LOGROTATE_CONFIG_DIR, MODIFIED_JARS)
from appsca... |
tests/transforms/label/test_remap_labels.py | siahuat0727/torchio | 1,340 | 12619013 | from torchio.transforms import RemapLabels
from ...utils import TorchioTestCase
class TestRemapLabels(TorchioTestCase):
"""Tests for `RemapLabels`."""
def test_remap(self):
remapping = {1: 2, 2: 1, 5: 10, 6: 11}
remap_labels = RemapLabels(remapping=remapping)
subject = self.get_subjec... |
examples/tensorflow/object_detection/preprocessing/yolo_v4_preprocessing.py | MaximProshin/nncf | 136 | 12619046 | <filename>examples/tensorflow/object_detection/preprocessing/yolo_v4_preprocessing.py
"""
Copyright (c) 2022 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.apa... |
smtbx/refinement/constraints/geometrical/all.py | dperl-sol/cctbx_project | 155 | 12619052 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function
from smtbx.refinement.constraints.geometrical.hydrogens import *
|
bcs-ui/backend/container_service/clusters/flow_views/configs/k8s.py | laodiu/bk-bcs | 599 | 12619082 | <filename>bcs-ui/backend/container_service/clusters/flow_views/configs/k8s.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 THL A29 Limited, a Tencent company. All rights reserved.
Licensed... |
library/oci_tenancy_facts.py | slmjy/oci-ansible-modules | 106 | 12619095 | <gh_stars>100-1000
#!/usr/bin/python
# Copyright (c) 2017, 2018, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# S... |
tests/model_tests/app/signals.py | if1live/importd | 183 | 12619099 | from django.conf import settings
settings.SIGNALS_IMPORTED=True |
picoCTF-web/tests/integration/test_teams.py | minhnq1618/picoCTF | 280 | 12619212 | """Tests for the /api/v1/teams routes."""
from pytest_mongo import factories
from pytest_redis import factories
from .common import ( # noqa (fixture)
ADMIN_DEMOGRAPHICS,
clear_db,
client,
decode_response,
get_csrf_token,
register_test_accounts,
TEACHER_DEMOGRAPHICS,
STUDENT_DEMOGRAPHIC... |
torchpq/legacy/IVFPQTopk.py | mhamilton723/TorchPQ | 103 | 12619214 | <filename>torchpq/legacy/IVFPQTopk.py
import torch
import numpy as np
import math
from ..kernels import ComputeProductCuda
class IVFPQTopk:
def __init__(self,
n_subvectors,
n_clusters,
n_cs=4,
):
assert torch.cuda.is_available()
self.n_subvectors = n_subvectors
self.n_clusters = n_cluster... |
applications/FluidTransportApplication/python_scripts/apply_vector_constraint_function_process.py | lkusch/Kratos | 778 | 12619219 | <filename>applications/FluidTransportApplication/python_scripts/apply_vector_constraint_function_process.py
import KratosMultiphysics
import KratosMultiphysics.FluidTransportApplication as KratosFluidTransport
import math
def Factory(settings, Model):
if(type(settings) != KratosMultiphysics.Parameters):
... |
utils/lib/pb_type_xml.py | bl0x/symbiflow-arch-defs | 183 | 12619245 | <reponame>bl0x/symbiflow-arch-defs
import os
import lxml.etree as ET
XI_URL = "http://www.w3.org/2001/XInclude"
XI_INCLUDE = "{%s}include" % XI_URL
VPR_TILE_PREFIX = 'BLK-TL-'
def add_vpr_tile_prefix(tile):
""" Add tile prefix.
This avoids namespace collision when embedding a site (e.g. SLICEL) as a
ti... |
homeassistant/components/twentemilieu/calendar.py | mtarjoianu/core | 30,023 | 12619283 | """Support for Twente Milieu Calendar."""
from __future__ import annotations
from datetime import datetime
from homeassistant.components.calendar import CalendarEntity, CalendarEvent
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ID
from homeassistant.core import HomeAssista... |
components/mpas-seaice/testing_and_setup/testing/DATA/get_data.py | Fa-Li/E3SM | 235 | 12619289 | from __future__ import print_function
import subprocess
import argparse
from six.moves.urllib.parse import urlparse
import string
import os.path
#-------------------------------------------------------------------------------
def download_file(url, destination, proxy):
import subprocess
print(url, proxy)
... |
libs/configs/DOTA/retinanet/cfgs_res50_dota_atan_v2.py | Karlinik/RotationDetection | 850 | 12619290 | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import numpy as np
from libs.configs._base_.models.retinanet_r50_fpn import *
from libs.configs._base_.datasets.dota_detection import *
from libs.configs._base_.schedules.schedule_1x import *
from dataloader.pretrained_weights.pr... |
tests/functional/regressions/test_issue163.py | matt-koevort/tartiflette | 530 | 12619307 | import pytest
async def _resolver(*args, **kwargs):
return {"name": "a", "nickname": "b"}
@pytest.mark.asyncio
@pytest.mark.ttftt_engine(resolvers={"Query.dog": _resolver})
async def test_issue163(engine):
assert await engine.execute("query { dog { ... { name nickname }} }") == {
"data": {"dog": {"n... |
recipes/Python/174627_Treat_Win32_Registry_like/recipe-174627.py | tdiprima/code | 2,023 | 12619326 | """Slightly magical Win32api Registry -> Dictionary-like-object wrapper"""
from __future__ import generators
import win32api, win32con, cPickle
class RegistryDict(object):
def __init__(self, keyhandle = win32con.HKEY_LOCAL_MACHINE, keypath = [], flags = None):
"""If flags=None, then it will create the key... |
modules/dbnd-airflow/src/dbnd_airflow/tracking/wrap_operators.py | busunkim96/dbnd | 224 | 12619352 | import logging
import typing
import uuid
from collections import OrderedDict
from contextlib import contextmanager
from typing import Any, ContextManager, Dict, Optional
import six
from dbnd import dbnd_context
from dbnd._core.configuration.environ_config import (
DBND_ROOT_RUN_UID,
ENV_DBND_SCRIPT_NAME,
)
f... |
cfgov/housing_counselor/management/commands/hud_generate_html.py | Colin-Seifer/consumerfinance.gov | 156 | 12619357 | <reponame>Colin-Seifer/consumerfinance.gov
from django.core.management.base import BaseCommand
from housing_counselor.generator import generate_counselor_html
class Command(BaseCommand):
help = "Generate bulk housing counselor HTML data"
def add_arguments(self, parser):
parser.add_argument("source")... |
mimic/rest/maas_api.py | mfens98/mimic | 141 | 12619376 | """
MAAS Mock API
"""
from __future__ import division, unicode_literals
import json
import collections
from six.moves.urllib.parse import parse_qs
import random
import re
from uuid import uuid4
import attr
from six import text_type
from zope.interface import implementer
from twisted.plugin import IPlugin
from mim... |
checkov/terraform/checks/resource/aws/DocDBAuditLogs.py | vangundy-jason-pfg/checkov | 4,013 | 12619401 | from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceCheck
class DocDBAuditLogs(BaseResourceCheck):
def __init__(self):
name = "Ensure DocDB has audit logs enabled"
id = "CKV_AWS_104"
suppor... |
libsparse/simg_dump.py | XperiaZProject/system_core | 1,144 | 12619410 | <reponame>XperiaZProject/system_core<filename>libsparse/simg_dump.py
#! /usr/bin/env python
# Copyright (C) 2012 The Android Open Source Project
#
# 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 ... |
netmiko4/send_multiline/old_solution_timing/ping.py | fallenfuzz/pynet | 528 | 12619414 | from getpass import getpass
from netmiko import ConnectHandler
device = {
"host": "cisco3.lasthop.io",
"username": "pyclass",
"password": getpass(),
"device_type": "cisco_ios",
"session_log": "my_output.txt",
}
with ConnectHandler(**device) as net_connect:
cmd = "ping"
target_ip = "8.8.8.... |
orgexporter.py | Sinamore/orgextended | 120 | 12619455 | import sublime
import sublime_plugin
import re
import regex
from pathlib import Path
import os
import fnmatch
import logging
import sys
import traceback
import OrgExtended.asettings as sets
import OrgExtended.orgdb as db
import OrgExtended.orgparse.date as date
log = logging.getLogger(__name__)
RE_TITLE = regex.comp... |
facelib/InsightFace/verifier.py | tuncayka/FaceLib | 147 | 12619458 | import cv2
import torch
import argparse
from facelib import get_config, special_draw
from facelib import update_facebank, load_facebank
from facelib import FaceRecognizer
from facelib import FaceDetector
class WebcamVerify:
"""
WebcamVerify: face verfication with cv2
if you add new person in to faceb... |
examples/MACLR/mpu_utils.py | OctoberChang/pecos | 288 | 12619493 | <filename>examples/MACLR/mpu_utils.py
import torch
import torch.nn as nn
import torch.distributed as dist
# Intra-layer model parallel group that the current rank belongs to.
_TENSOR_MODEL_PARALLEL_GROUP = None
# Inter-layer model parallel group that the current rank belongs to.
_PIPELINE_MODEL_PARALLEL_GROUP = Non... |
surreal/learner/ppo.py | PeihongYu/surreal | 471 | 12619500 | import torch
import torch.nn as nn
import torchx as tx
from torchx.nn.hyper_scheduler import *
import numpy as np
from .base import Learner
from .aggregator import MultistepAggregatorWithInfo
from surreal.model.ppo_net import PPOModel, DiagGauss
from surreal.model.reward_filter import RewardFilter
from surreal.session... |
controller/api/tests/test_build.py | yun-an/deis | 3,375 | 12619541 | """
Unit tests for the Deis api app.
Run the tests with "./manage.py test api"
"""
from __future__ import unicode_literals
import json
from django.contrib.auth.models import User
from django.test import TransactionTestCase
import mock
from rest_framework.authtoken.models import Token
from api.models import Build
f... |
tests/test_router.py | cclauss/rb | 335 | 12619556 | import pytest
from rb.cluster import Cluster
from rb.router import UnroutableCommand, extract_keys, BadHostSetup
def test_router_key_routing():
cluster = Cluster({0: {"db": 0},})
router = cluster.get_router()
assert router.get_key("INCR", ["foo"]) == "foo"
assert router.get_key("GET", ["bar"]) == "b... |
Depth_First_Search/dfs_recursive.py | Neiva07/Algorithms | 199 | 12619566 | <reponame>Neiva07/Algorithms<filename>Depth_First_Search/dfs_recursive.py
class SimpleGraph:
def __init__(self):
self.edges = {}
@property
def nodes(self):
return self.edges.keys()
def neighbors(self, id):
return self.edges[id]
class DFS(object):
'''
Implementation of ... |
malaya_speech/train/model/tacotron2_nvidia/__init__.py | ishine/malaya-speech | 111 | 12619611 | from .model import Model
from ..tacotron2 import generate_guided_attention
|
astroquery/nasa_ads/tests/test_nasaads.py | rickynilsson/astroquery | 577 | 12619617 | <filename>astroquery/nasa_ads/tests/test_nasaads.py<gh_stars>100-1000
import os
import requests
import pytest
from ... import nasa_ads
from ...utils.testing_tools import MockResponse
class MockResponseADS(MockResponse):
"""
Fixing the init issues
"""
def __init__(self, content=None, url=None, headers... |
Firmware/tools/atcommander.py | davidbuzz/SiK | 120 | 12619631 | #!/usr/bin/env python
#
# Provide command line access to AT command set on radios
#
import serial, sys, argparse, time, fdpexpect
class ATCommandSet(object):
''' Interface to the AT command set '''
### AT Command Constants ###
# Prefix determines if commanding attached or linked radio
AT_LOC... |
libsaas/services/pipedrive/filters.py | MidtownFellowship/libsaas | 155 | 12619679 | <filename>libsaas/services/pipedrive/filters.py
from libsaas import http, parsers
from libsaas.services import base
class FiltersResource(base.RESTResource):
path = 'filters'
def create(self, *args, **kwargs):
raise base.MethodNotSupported()
def update(self, *args, **kwargs):
raise base... |
tools/new_plugin.py | e7p/hal | 407 | 12619697 | <reponame>e7p/hal<filename>tools/new_plugin.py
#!/usr/bin/env python3
import sys
import os
import re
def print_usage():
print("HAL plugin template generator")
print(" usage: new_plugin <name>")
print("")
print("Sets up the directory structure and respective files in the current directory:")
print(... |
package/tests/application/models/test_theme.py | Jhsmit/awesome-panel | 179 | 12619698 | # pylint: disable=redefined-outer-name,protected-access
# pylint: disable=missing-function-docstring,missing-module-docstring,missing-class-docstring
from bokeh.themes.theme import Theme as BokehTheme
from holoviews import Cycle as HoloviewsCycle
def test_can_construct(theme):
assert isinstance(theme.spinn... |
chapter06/cliff_walking.py | psxz/reinforcement-learning-an-introduction | 12,197 | 12619702 | #######################################################################
# Copyright (C) #
# 2016-2018 <NAME>(<EMAIL>) #
# 2016 <NAME>(<EMAIL>) #
# Permission given to modify the code as long as you keep this #
# declaration... |
tlaplus_jupyter/__init__.py | ajdavis/tlaplus_jupyter | 113 | 12619722 | __version__ = '0.1'
from .kernel import TLAPlusKernel
|
validation_tests/analytical_exact/lake_at_rest_immersed_bump/numerical_immersed_bump.py | samcom12/anuga_core | 136 | 12619740 | <filename>validation_tests/analytical_exact/lake_at_rest_immersed_bump/numerical_immersed_bump.py
"""Simple water flow example using ANUGA
Water driven up a linear slope and time varying boundary,
similar to a beach environment
"""
#------------------------------------------------------------------------------
# Impo... |
dragnet/__init__.py | jdddog/dragnet | 535 | 12619747 | <gh_stars>100-1000
from dragnet.blocks import Blockifier, PartialBlock, BlockifyError
from dragnet import features
from dragnet.extractor import Extractor
from dragnet.util import load_pickled_model
_LOADED_MODELS = {}
def extract_content(html, encoding=None, as_blocks=False):
if 'content' not in _LOADED_MODELS:... |
tests/integration/test_matrix_power.py | fduguet-nv/cunumeric | 304 | 12619767 | <gh_stars>100-1000
# Copyright 2022 NVIDIA 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... |
mbuild/utils/jsutils.py | daico007/mbuild | 101 | 12619769 | """Utilities for communicating with Javascript (js) libraries.
These are the set of utility methods which are used to communicate with
underlying 'js' libraries by the various notebook visualization libraries used
by mBuild.
"""
from .io import import_
def overwrite_nglview_default(widget):
"""Change the default... |
scripts/tests/macros_test.py | Duroktar/Wolf | 105 | 12619778 | from ..wolf import test as wolftest
snippet = r"""
inputs = [
[6.4, 2.8, 5.6, 2.2, 2], # ?
[5.0, 2.3, 3.3, 1.0, 1],
[4.9, 2.5, 4.5, 1.7, 2],
]
labels = [x[-1] for x in inputs] # ?
hat = labels # ?
"""
def test_macros(snapshot):
res = wolftest(snippet)
snapshot.assert_match(res)
|
app/config_test.py | modoupi/git-webhook | 1,617 | 12619804 | # -*- coding: utf-8 -*-
DEBUG = True
TESTING = True
SECRET_KEY = 'SECRET_KEY'
DATABASE_URI = 'mysql+pymysql://root:root@127.0.0.1/git_webhook'
CELERY_BROKER_URL = 'redis://:@127.0.0.1:6379/0'
CELERY_RESULT_BACKEND = 'redis://:@127.0.0.1:6379/0'
SOCKET_MESSAGE_QUEUE = 'redis://:@127.0.0.1:6379/0'
GITHUB_CLIENT_ID = '... |
py_backwards/transformers/string_types.py | graingert/py-backwards | 338 | 12619820 | from typed_ast import ast3 as ast
from ..utils.tree import find
from ..types import TransformationResult
from .base import BaseTransformer
class StringTypesTransformer(BaseTransformer):
"""Replaces `str` with `unicode`.
"""
target = (2, 7)
@classmethod
def transform(cls, tree: ast.AST) -> Trans... |
example/numpy-ops/weighted_logistic_regression.py | Vikas-kum/incubator-mxnet | 228 | 12619828 | <reponame>Vikas-kum/incubator-mxnet<filename>example/numpy-ops/weighted_logistic_regression.py
# 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 lic... |
notebook/opencv_videocapture_camera.py | vhn0912/python-snippets | 174 | 12619829 | import cv2
cap_cam = cv2.VideoCapture(0)
print(type(cap_cam))
# <class 'cv2.VideoCapture'>
print(cap_cam.isOpened())
# True
cap_cam_wrong = cv2.VideoCapture(1)
print(type(cap_cam_wrong))
# <class 'cv2.VideoCapture'>
print(cap_cam_wrong.isOpened())
# False
cap_cam.release()
|
findsmallbaseball.py | leidix/images-to-osm | 487 | 12619840 | <filename>findsmallbaseball.py
import imagestoosm.config as cfg
import os
import QuadKey.quadkey as quadkey
import numpy as np
import shapely.geometry as geometry
from skimage import draw
from skimage import io
import csv
# load up the OSM features into hash of arrays of polygons, in pixels
for classDir in os.listdi... |
RecoRomanPot/RecoFP420/test/data/runEDTrack_cfg.py | ckamtsikis/cmssw | 852 | 12619843 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
process = cms.Process("TrackFP420Test")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.load("Geometry.FP420CommonData.FP420GeometryXML_cfi")
process.load("RecoRomanPot.RecoFP420.FP420Track_cfi")
process.RandomNumberGeneratorService = cms.S... |
grove/button/button_gpio.py | Hansen0314/grove.py | 122 | 12619858 | <filename>grove/button/button_gpio.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Grove Base Hat for the Raspberry Pi, used to connect grove sensors.
# Copyright (C) 2018 Seeed Technology Co.,Ltd.
#
'''
This is the code for GPIO Button event detection.
'''
from __future__ import divis... |
pyNastran/gui/test/all_tests_gui.py | ACea15/pyNastran | 293 | 12619892 | <reponame>ACea15/pyNastran
"""with pyQt5/pySide2 and vtk"""
#import os
import sys
from pyNastran.gui.menus.test.test_about import *
# if 'XVFB' in os.environ or sys.platform == 'win32': # XVFB is for TravisCI and doesn't work
if sys.platform == 'win32' and len(sys.argv) == 1:
from pyNastran.gui.menus.test.test_g... |
tests/errors/semantic/blocking/ex1.py | dina-fouad/pyccel | 206 | 12619929 | <gh_stars>100-1000
# pylint: disable=missing-function-docstring, missing-module-docstring/
# coding: utf-8
x = 1
e1 = x + a
e3 = f(x) + 1
# TODO e4 not working yet. we must get 2 errors
#e4 = f(x,y) + 1
|
zeus/networks/pytorch/heads/auxiliary_head.py | shaido987/vega | 240 | 12619942 | <reponame>shaido987/vega<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 License.
# This program is distributed in the hope that it will be useful,
# ... |
refinery/bnpy/bnpy-dev/bnpy/allocmodel/mix/DPMixModel.py | csa0001/Refinery | 103 | 12619950 | <filename>refinery/bnpy/bnpy-dev/bnpy/allocmodel/mix/DPMixModel.py
'''
DPMixModel.py
Bayesian parametric mixture model with a unbounded number of components K
Attributes
-------
K : # of components
alpha0 : scalar concentration hyperparameter of Dirichlet process prior
qalpha0 : K-length vector, para... |
clubManagement/admin.py | akshaya9/fosswebsite | 369 | 12620033 | # -*- coding: utf-8 -*-
# created by <NAME>, <EMAIL>
from __future__ import unicode_literals
from django.contrib import admin
from clubManagement.models import Attendance, Team, Responsibility, TeamMember, \
StatusUpdate
admin.site.register(Attendance)
admin.site.register(Team)
admin.site.register(Responsibility)... |
segment/analytics/client.py | wbbradley/analytics-python | 168 | 12620072 | <filename>segment/analytics/client.py<gh_stars>100-1000
from datetime import datetime
from uuid import uuid4
import logging
import numbers
import atexit
from dateutil.tz import tzutc
from six import string_types
from segment.analytics.utils import guess_timezone, clean
from segment.analytics.consumer import Consumer
... |
pulsar/common/networking.py | N0nent1ty/pulsar | 326 | 12620081 |
import socket
class Client:
def __init__(self, host, port, timeout, bsize):
# network client configuration
self.connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.connection.connect((host, port))
self.connection.settimeout(timeout)
self.bsize = bsize
... |
emails/testsuite/message/helpers.py | MrTango/python-emails | 348 | 12620085 | <filename>emails/testsuite/message/helpers.py
# coding: utf-8
from __future__ import unicode_literals
import os
import emails
from emails.template import JinjaTemplate
TO_EMAIL = os.environ.get('SMTP_TEST_MAIL_TO') or '<EMAIL>'
FROM_EMAIL = os.environ.get('SMTP_TEST_MAIL_FROM') or '<EMAIL>'
ROOT = os.path.dirname(__f... |
src/SALib/util/results.py | zjzh/SALib | 573 | 12620092 | import pandas as pd # type: ignore
from SALib.plotting.bar import plot as barplot
class ResultDict(dict):
'''Dictionary holding analysis results.
Conversion methods (e.g. to Pandas DataFrames) to be attached as necessary
by each implementing method
'''
def __init__(self, *args, **kwargs):
... |
tests/test_init.py | acivgin1/sphinx-js | 103 | 12620112 | import pytest
from sphinx.errors import SphinxError
from sphinx_js import root_or_fallback
def test_relative_path_root():
"""Make sure the computation of the root path for relative JS entity
pathnames is right."""
# Fall back to the only source path if not specified.
assert root_or_fallback(None, ['a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.