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 |
|---|---|---|---|---|
nncf/torch/graph/transformations/layout.py | xiao1228/nncf | 310 | 11131439 | from nncf.common.graph.transformations.layout import TransformationLayout
class PTTransformationLayout(TransformationLayout):
pass
|
SoftLayer/CLI/ticket/subjects.py | dvzrv/softlayer-python | 126 | 11131454 | """List Subject IDs for ticket creation."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
@click.command()
@environment.pass_env
def cli(env):
"""List Subject IDs for ticket creation."""
ticket_mgr = So... |
util/chplenv/chpl_arch.py | jhh67/chapel | 1,602 | 11131455 | <reponame>jhh67/chapel
#!/usr/bin/env python3
import optparse
import sys
import chpl_cpu, overrides
from utils import error, memoize, warning
@memoize
def get(flag='host'):
if flag == 'host':
arch_val = overrides.get('CHPL_HOST_ARCH', '')
elif flag == 'target':
arch_val = overrides.get('CHPL_... |
test/files/generate.py | yssource/xtensor | 1,592 | 11131478 | #!/usr/bin/env python3
import glob
fs = glob.glob("xio_expected_results/*.txt")
include_file = "#include <string>\n\n"
for f in fs:
with open(f) as ff:
ctn = ff.read()
n = f.split("/")[1]
include_file += "static std::string {} = R\"xio({})xio\";\n\n\n".format(n[:-4], ctn)
with open("xio_expected_results.hpp... |
tests/test_init.py | michaeljoseph/changes | 135 | 11131485 | import os
import textwrap
from pathlib import Path
import pytest
import responses
import changes
from .conftest import AUTH_TOKEN_ENVVAR, BUG_LABEL_JSON, LABEL_URL
@pytest.fixture
def answer_prompts(mocker):
mocker.patch('changes.config.click.launch', autospec=True)
prompt = mocker.patch('changes.config.c... |
hector_quadrotor/geodesy/src/geodesy/props.py | Eashwar-S/Swarm_Drones | 742 | 11131501 | <reponame>Eashwar-S/Swarm_Drones
# Software License Agreement (BSD License)
#
# Copyright (C) 2012, <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:
#
# * Redistributions of source code m... |
DQM/SiStripMonitorDigi/python/SiStripMonitorDigi_cfi.py | ckamtsikis/cmssw | 852 | 11131505 | <reponame>ckamtsikis/cmssw<filename>DQM/SiStripMonitorDigi/python/SiStripMonitorDigi_cfi.py
import FWCore.ParameterSet.Config as cms
# SiStripMonitorDigi
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
SiStripMonitorDigi = DQMEDAnalyzer('SiStripMonitorDigi',
TopFolderName = cms.string('SiStrip'),
# a... |
src/python/nimbusml/internal/entrypoints/_ensemblesubsetselector_randompartitionselector.py | michaelgsharp/NimbusML | 134 | 11131522 | # - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
RandomPartitionSelector
"""
from ..utils.entrypoints import Component
from ..utils.utils import try_set
def random_partition_selector(
feature_selector=None,
**params):
"""
**Description**
None
:param feature... |
numpyro/compat/infer.py | MarcoGorelli/numpyro | 1,394 | 11131542 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import math
from jax import jit
import numpyro
from numpyro.compat.pyro import get_param_store
from numpyro.infer import elbo, hmc, mcmc, svi
class HMC(hmc.HMC):
def __init__(
self,
model=None,
potential... |
yellowbrick/datasets/path.py | mrtrkmn/yellowbrick | 3,662 | 11131543 | # yellowbrick.datasets.path
# Helper functions for looking up dataset paths.
#
# Author: <NAME>
# Created: Thu Jul 26 14:10:51 2018 -0400
#
# Copyright (C) 2018 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: path.py [7082742] <EMAIL> $
"""
Helper functions for looking up dataset paths.
""... |
env/lib/python3.8/site-packages/fiona/fio/load.py | CristianCristanchoT/predyctiva | 778 | 11131550 | <gh_stars>100-1000
"""$ fio load"""
from functools import partial
import logging
import click
import cligj
import fiona
from fiona.fio import options, with_context_env
from fiona.schema import FIELD_TYPES_MAP_REV
from fiona.transform import transform_geom
def _cb_key_val(ctx, param, value):
"""
click call... |
pythonforandroid/recipes/numpy/__init__.py | syrykh/python-for-android | 6,278 | 11131561 | from pythonforandroid.recipe import CompiledComponentsPythonRecipe
from pythonforandroid.logger import shprint, info
from pythonforandroid.util import current_directory
from multiprocessing import cpu_count
from os.path import join
import glob
import sh
class NumpyRecipe(CompiledComponentsPythonRecipe):
version ... |
tools/localedata/extract_icu_data.py | rio-31/android_frameworks_base-1 | 164 | 11131563 | <reponame>rio-31/android_frameworks_base-1
#!/usr/bin/env python
#
# Copyright 2016 The Android Open Source Project. 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
#
# ... |
hail/python/hail/typecheck/check.py | tdeboer-ilmn/hail | 789 | 11131565 | <gh_stars>100-1000
import re
import inspect
import abc
import collections
from decorator import decorator
class TypecheckFailure(Exception):
pass
def identity(x):
return x
def extract(t):
m = re.match("<(type|class) '(.*)'>", str(t))
if m:
return m.groups()[1]
else:
return str(... |
sportsipy/decorators.py | MArtinherz/sportsipy | 221 | 11131570 | <reponame>MArtinherz/sportsipy<filename>sportsipy/decorators.py
from functools import wraps
def int_property_decorator(func):
@property
@wraps(func)
def wrapper(*args):
value = func(*args)
try:
return int(value)
except (TypeError, ValueError):
# If there is ... |
tests/graphics/test_base.py | paradoxcell/jcvi | 517 | 11131592 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import pytest
@pytest.mark.parametrize(
"s,expected",
[
("a short name", "a short name"),
(
"a really really long name for you a really really long name for you",
"a really...e for you",
),
... |
tests/reraise.py | ZYAZP/python2 | 1,062 | 11131615 | <gh_stars>1000+
try:
try:
0/0
except Exception:
raise
except Exception as e:
print repr(e)
|
py_eureka_client/netint_utils.py | dev-89/python-eureka-client | 143 | 11131619 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Copyright (c) 2018 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy,... |
blacklist/custom.py | yilang0001/gfw_whitelist | 3,462 | 11131622 | #!/usr/bin/python
# -*- coding: utf-8 -*-
def getlist():
liststr = """
cloudfront.net
googlecode.com
verisign.com
qpic.cn
translate-tab.com
layervault.com
list-manage.com
goagent.co
goo.gl
"""
return set(liststr.splitlines(False))
|
bin/snn.py | ppmdatix/rtdl | 298 | 11131631 | <filename>bin/snn.py
# %%
import math
import typing as ty
from pathlib import Path
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import zero
from torch import Tensor
import lib
# %%
class SNN(nn.Module):
def __init__(
self,
*,
d_in: int,
d_... |
tests/integration/test_org_it.py | corylevine/okta-sdk-python | 145 | 11131632 | import copy
import pytest
from datetime import datetime
from tests.mocks import MockOktaClient
from okta.models import (OrgSetting,
OrgContactType,
OrgContactTypeObj,
OrgContactUser,
OrgPreferences,
... |
frelatage/report/report.py | Rog3rSm1th/Frelatage | 130 | 11131644 | <reponame>Rog3rSm1th/Frelatage
from typing import Any
class Report:
def __init__(
self,
trace: Any,
input: list,
error: bool,
timeout: bool,
new_error_instruction: bool,
reached_instructions_count: int,
new_reached_instructions_count: int,
in... |
tests/commands/conftest.py | jaromil/bigchaindb | 4,196 | 11131653 | <reponame>jaromil/bigchaindb
# Copyright © 2020 Interplanetary Database Association e.V.,
# BigchainDB and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
from argparse import Namespace
import pytest
@pytest.fixture
def mock_run_configure... |
mozillians/common/monkeypatches.py | divyamoncy/mozillians | 202 | 11131654 | # Code based on funfactory with some modification in order to work with django 1.7
# https://github.com/mozilla/funfactory/blob/master/funfactory/monkeypatches.py
import logging
from django.conf import settings
__all__ = ['patch']
# Idempotence! http://en.wikipedia.org/wiki/Idempotence
_has_patched = False
def pat... |
docs/conf.py | eendebakpt/symengine.py | 133 | 11131669 | <filename>docs/conf.py
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup ------------------------------------------------... |
util/detr_weights_to_vistr.py | lukadvisor/VisTR | 646 | 11131687 | '''
convert detr pretrained weights to vistr format
'''
import sys
import torch
import collections
if __name__ == "__main__":
input_path = sys.argv[1]
detr_weights = torch.load(input_path)['model']
vistr_weights = collections.OrderedDict()
for k,v in detr_weights.items():
if k.startswith("detr... |
simple_settings/dynamic_settings/database_reader.py | pichatelli/simple-settings | 213 | 11131707 | <filename>simple_settings/dynamic_settings/database_reader.py
from .base import BaseReader
try:
from sqlalchemy import Column, String, engine_from_config
from sqlalchemy.ext.declarative import as_declarative
from sqlalchemy.orm import sessionmaker
except ImportError: # pragma: no cover
raise ImportErr... |
src/python/txtai/pipeline/tensors.py | malywonsz/txtai | 1,893 | 11131710 | <reponame>malywonsz/txtai<filename>src/python/txtai/pipeline/tensors.py
"""
Tensor processing framework module
"""
import torch
from .base import Pipeline
class Tensors(Pipeline):
"""
Pipeline backed by a tensor processing framework. Currently supports PyTorch.
"""
def quantize(self, model):
... |
tests/perf/test_long_cycles_nbrows_cycle_length_41000_80.py | shaido987/pyaf | 377 | 11131713 | <filename>tests/perf/test_long_cycles_nbrows_cycle_length_41000_80.py
import tests.perf.test_cycles_full_long_long as gen
gen.test_nbrows_cycle(41000 , 80)
|
922 Sort Array By Parity II.py | krishna13052001/LeetCode | 872 | 11131733 | <filename>922 Sort Array By Parity II.py
#!/usr/bin/python3
"""
Given an array A of non-negative integers, half of the integers in A are odd,
and half of the integers are even.
Sort the array so that whenever A[i] is odd, i is odd; and whenever A[i] is even
, i is even.
You may return any answer array that satisfies ... |
python/graphscope/nx/convert.py | LI-Mingyu/GraphScope-MY | 1,521 | 11131751 | <gh_stars>1000+
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file convert.py is referred and derived from project NetworkX,
#
# https://github.com/networkx/networkx/blob/master/networkx/convert.py
#
# which has the following license:
#
# Copyright (C) 2004-2020, NetworkX Developers
# <NAME> <<EMAIL>>
# <NAM... |
Cogs/PciUsb.py | cheesycod/CorpBot.py | 368 | 11131755 | <reponame>cheesycod/CorpBot.py
import discord
from discord.ext import commands
from Cogs import DL
from Cogs import Message
def setup(bot):
# Add the bot
bot.add_cog(PciUsb(bot))
class PciUsb(commands.Cog):
# Init with the bot reference, and a reference to the settings var
def __init__(self, bo... |
DQM/Integration/python/clients/es_dqm_sourceclient-live_cfg.py | malbouis/cmssw | 852 | 11131783 | from __future__ import print_function
import FWCore.ParameterSet.Config as cms
import sys
process = cms.Process("ESDQM")
unitTest = False
if 'unitTest=True' in sys.argv:
unitTest=True
process.load('Configuration/StandardSequences/Services_cff')
process.load('FWCore/MessageService/MessageLogger_cfi')
process.load... |
tests/requests/invalid/003.py | ashishmjn/gunicorn | 6,851 | 11131807 | from gunicorn.http.errors import InvalidRequestMethod
request = InvalidRequestMethod |
timemachines/skaters/pypi.py | microprediction/timemachines | 253 | 11131811 | PYPI = {'tsa':'statsmodels',
'fbprophet':'prophet',
'pmd':'pmdarima',
'rvr':'river',
'nprophet':'neuralprophet',
'dlm':'pydlm',
'divine':'divinity',
'orbit':'orbit-ml',
'bats':'tbats',
'glu':'gluonts',
'flux':'pyflux',
'sk':'sktime'... |
v3/as_demos/gather.py | Dilepa/micropython-async | 443 | 11131821 | # gather.py Demo of Gatherable coroutines. Includes 3 cases:
# 1. A normal coro
# 2. A coro with a timeout
# 3. A cancellable coro
import uasyncio as asyncio
async def barking(n):
print('Start normal coro barking()')
for _ in range(6):
await asyncio.sleep(1)
print('Done barking.')
return 2 * n... |
source/agent/webrtc/rtcConn/binding.gyp | yfdandy/owt-server | 890 | 11131826 | {
'targets': [{
'target_name': 'rtcConn',
'variables': {
'source_rel_dir': '../../..', # relative source dir path
'source_abs_dir%': '<(module_root_dir)/../../..', # absolute source dir path
},
'sources': [
'addon.cc',
'WebRtcConnection.cc',
'ThreadPool.cc',
'IOThre... |
fbrp/tests/fbrp/runtime/test_base.py | ali-senguel/fairo | 669 | 11131828 | <reponame>ali-senguel/fairo
import asyncio
import unittest
from fbrp.life_cycle import Ask, ProcInfo, State
from fbrp.process import ProcDef
from fbrp.runtime.base import BaseLauncher
from unittest import IsolatedAsyncioTestCase
from unittest.mock import MagicMock, Mock, patch
class AsyncIter:
def __init__... |
slovnet/visitor.py | harri-pltr/slovnet | 147 | 11131833 |
class Visitor(object):
def resolve_method(self, item):
for cls in item.__class__.__mro__:
name = 'visit_' + cls.__name__
method = getattr(self, name, None)
if method:
return method
raise ValueError('no method for {type!r}'.format(
typ... |
etc/pending_ugens/PartConv.py | butayama/supriya | 191 | 11131835 | <reponame>butayama/supriya
import collections
from supriya.enums import CalculationRate
from supriya.synthdefs import UGen
class PartConv(UGen):
"""
::
>>> source = supriya.ugens.In.ar(bus=0)
>>> part_conv = supriya.ugens.PartConv.ar(
... fftsize=fftsize,
... irbufnum... |
Document-Word-Detection/Word_detection.py | A-kriti/Amazing-Python-Scripts | 930 | 11131853 | <reponame>A-kriti/Amazing-Python-Scripts
'''
output : word detection on document (Simple OCR type of application)
'''
import cv2
import numpy as np
import imutils
# frame read
frame = cv2.imread('test.jpeg')
# resize
frame = cv2.resize(frame, (600, 600))
# grayscale
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
#... |
droidbot/adapter/minicap.py | RRua/droidbot | 563 | 11131857 | import logging
import socket
import subprocess
import time
import os
from datetime import datetime
from .adapter import Adapter
MINICAP_REMOTE_ADDR = "localabstract:minicap"
ROTATION_CHECK_INTERVAL_S = 1 # Check rotation once per second
class MinicapException(Exception):
"""
Exception in minicap connection
... |
src/virtual-wan/azext_vwan/vendored_sdks/v2018_08_01/v2018_08_01/models/available_providers_list_state.py | Mannan2812/azure-cli-extensions | 207 | 11131866 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
homeassistant/components/google_assistant/logbook.py | MrDelik/core | 22,481 | 11131872 | """Describe logbook events."""
from homeassistant.core import callback
from .const import DOMAIN, EVENT_COMMAND_RECEIVED, SOURCE_CLOUD
COMMON_COMMAND_PREFIX = "action.devices.commands."
@callback
def async_describe_events(hass, async_describe_event):
"""Describe logbook events."""
@callback
def async_d... |
generate-xml.py | canarduck/Fontawesome-Icons-for-Pencil | 293 | 11131875 | from lxml import etree
from pathlib import Path
import cairosvg
import os
import shutil
import re
sprite_files = sorted(list(Path('./MaterialDesign/icons/svg/').glob('*.svg')), key=lambda file: file.as_posix())
files_element = etree.Element("files")
# set up the output dir
out = Path('gen/')
icons_out = Path(out, 'ic... |
caliban/cli.py | Anon-Artist/caliban | 425 | 11131886 | #!/usr/bin/python
#
# Copyright 2020 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 ag... |
release/stubs.min/Grasshopper/Kernel/Undo/Actions.py | htlcnn/ironpython-stubs | 182 | 11131894 | <reponame>htlcnn/ironpython-stubs
# encoding: utf-8
# module Grasshopper.Kernel.Undo.Actions calls itself Actions
# from Grasshopper,Version=1.0.0.20,Culture=neutral,PublicKeyToken=dda4f5ec2cd80803
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# no functions
# classes
... |
docs/10/recursion.py | 15921483570/python_data_structures_and_algorithms | 2,468 | 11131895 | # -*- coding: utf-8 -*-
def fact(n):
if n == 0:
return 1
else:
return n * fact(n - 1)
def print_num(n):
for i in range(1, n + 1): # 注意很多编程语言使用的都是 从 0 开始的左闭右开区间, python 也不例外
print(i)
def print_num_recursive(n):
if n > 0:
print_num_recursive(n - 1)
print(n)... |
inclearn/convnet/cifar_resnet.py | Zotkin/incremental_learning.pytorch | 277 | 11131899 | ''' Incremental-Classifier Learning
Authors : <NAME>, <NAME>
Maintainer : <NAME>
Lab : TUKL-SEECS R&D Lab
Email : <EMAIL> '''
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
class DownsampleA(nn.Module):
def __init__(self, nIn, nOut, stride):
... |
crawl.py | aosp-caf-upstream/platform_external_python_futures | 244 | 11131918 | <filename>crawl.py
"""Compare the speed of downloading URLs sequentially vs. using futures."""
import functools
import time
import timeit
import sys
try:
from urllib2 import urlopen
except ImportError:
from urllib.request import urlopen
from concurrent.futures import (as_completed, ThreadPoolExecutor,
... |
tutorials/SnippetsForStaticAndSkeletalMeshes_Assets/threejs_importer.py | avivazran/UnrealEnginePython | 2,350 | 11131954 | <filename>tutorials/SnippetsForStaticAndSkeletalMeshes_Assets/threejs_importer.py
import json
import unreal_engine as ue
from unreal_engine.classes import Skeleton, AnimSequence, SkeletalMesh, Material, MorphTarget, AnimSequence, AnimSequenceFactory
from unreal_engine import FTransform, FVector, FRotator, FQuat, FSoftS... |
AppServer/lib/django-1.2/tests/regressiontests/delete_regress/models.py | loftwah/appscale | 790 | 11131988 | from django.db import models
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
class Award(models.Model):
name = models.CharField(max_length=25)
object_id = models.PositiveIntegerField()
content_type = models.ForeignKey(ContentType)
content_obje... |
test/python/server_port/asgi.py | afxcn/unit | 2,633 | 11131990 | <reponame>afxcn/unit
async def application(scope, receive, send):
assert scope['type'] == 'http'
await send(
{
'type': 'http.response.start',
'status': 200,
'headers': [
(b'content-length', b'0'),
(b'server-port', str(scope['server'][1... |
3d-tracking/model/model_cen.py | vietnhatthai/3d-vehicle-tracking | 603 | 11132003 | import numpy as np
import torch
import torch.nn as nn
import utils.network_utils as nu
import utils.tracking_utils as tu
from model import dla_up
from lib.model.roi_layers import ROIAlign, ROIPool
class Model(nn.Module):
def __init__(self, arch_name, roi_name, down_ratio, roi_kernel):
super(Model, self)... |
hata/discord/application/preinstanced.py | Multiface24111/hata | 173 | 11132011 | __all__ = ('EntitlementType', 'SKUAccessType', 'SKUFeatureType', 'SKUGenre', 'SKUType', 'TeamMembershipState', )
from ..bases import PreinstancedBase, Preinstance as P
class TeamMembershipState(PreinstancedBase):
"""
Represents a ``TeamMember``'s state at a ``Team``.
Attributes
----------
nam... |
tools/apilint/apilint_test.py | rio-31/android_frameworks_base-1 | 164 | 11132030 | #!/usr/bin/env python
# Copyright (C) 2018 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
contrib/python/xapiand-py/xapiand/utils/client.py | Kronuz/Xapiand | 370 | 11132056 | <filename>contrib/python/xapiand-py/xapiand/utils/client.py
# Copyright (c) 2019 Dubalu LLC
# Copyright (c) 2017 Elasticsearch
#
# 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 c... |
tests/complex/nsaugment/tst-app.py | eLBati/pyxb | 123 | 11132076 | # -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import unittest
import app
import common
import pyxb.utils.domutils
from pyxb.utils import six
pyxb.utils.domutils.BindingDOMSupport.DeclareNamespace(app.Namespace, 'app')
pyxb.utils.domutils... |
alipay/aop/api/domain/AlipayOpenMiniInnerversionUploadModel.py | antopen/alipay-sdk-python-all | 213 | 11132085 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.MiniAppPluginReference import MiniAppPluginReference
class AlipayOpenMiniInnerversionUploadModel(object):
def __init__(self):
self._app_origin = No... |
corehq/apps/smsforms/app.py | akashkj/commcare-hq | 471 | 11132096 | <filename>corehq/apps/smsforms/app.py
import re
from xml.etree.cElementTree import XML, tostring
from dimagi.utils.parsing import json_format_datetime
from corehq.apps.app_manager.util import get_cloudcare_session_data
from corehq.apps.cloudcare.touchforms_api import CaseSessionDataHelper
from corehq.apps.formplayer_... |
tests/engine/test_version_parsing.py | 0scarB/piccolo | 750 | 11132104 | from unittest import TestCase
from piccolo.engine.postgres import PostgresEngine
from ..base import postgres_only
@postgres_only
class TestVersionParsing(TestCase):
def test_version_parsing(self):
"""
Make sure the version number can correctly be parsed from a range
of known formats.
... |
open_spiel/python/bots/human.py | texasmichelle/open_spiel | 3,167 | 11132108 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
tests/pylon_tests/gigE/pylongigetestcase.py | matt-phair/pypylon | 358 | 11132115 | import unittest
from pypylon import pylon
def get_class_and_filter():
device_class = "BaslerGigE"
di = pylon.DeviceInfo()
di.SetDeviceClass(device_class)
return device_class, [di]
class PylonTestCase(unittest.TestCase):
device_class, device_filter = get_class_and_filter()
def create_first(sel... |
setup.py | alek5k/pytransform3d | 304 | 11132118 | <reponame>alek5k/pytransform3d
#!/usr/bin/env python
from setuptools import setup, find_packages
import pytransform3d
if __name__ == "__main__":
with open("README.md", "r") as f:
long_description = f.read()
setup(name="pytransform3d",
version=pytransform3d.__version__,
author='<NAM... |
test/integration/test_tone_analyzer_v3.py | johann-petrak/python-sdk | 1,579 | 11132125 | <filename>test/integration/test_tone_analyzer_v3.py
# coding: utf-8
from unittest import TestCase
import os
import ibm_watson
import pytest
import json
import time
from os.path import join
from ibm_watson.tone_analyzer_v3 import ToneInput
@pytest.mark.skipif(os.getenv('TONE_ANALYZER_APIKEY') is None,
... |
openfold/model/model.py | aqlaboratory/openfold | 789 | 11132164 | # Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# 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
#
# U... |
Trakttv.bundle/Contents/Libraries/Shared/plugin/core/logger/filters/duplicate.py | disrupted/Trakttv.bundle | 1,346 | 11132176 | <reponame>disrupted/Trakttv.bundle<gh_stars>1000+
from logging import Filter
import logging
log = logging.getLogger(__name__)
class DuplicateReportFilter(Filter):
def filter(self, record):
if self.is_duplicate_message(record):
return False
return True
@classmethod
def is_dup... |
gamestonk_terminal/stocks/fundamental_analysis/yahoo_finance_view.py | elan17/GamestonkTerminal | 1,835 | 11132203 | """ Yahoo Finance View """
__docformat__ = "numpy"
import os
import webbrowser
import matplotlib.pyplot as plt
import pandas as pd
from tabulate import tabulate
from gamestonk_terminal.stocks.fundamental_analysis import yahoo_finance_model
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.h... |
tests/integration/s3/mock_storage_service.py | mariocesar/boto | 2,906 | 11132206 | # Copyright 2010 Google Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
# trib... |
torchelie/nn/graph.py | maxferrari/Torchelie | 117 | 11132219 | <gh_stars>100-1000
import torch.nn as nn
from typing import Union, Tuple, List
from torchelie.utils import experimental
def tup(x):
if isinstance(x, (tuple, list)):
return list(x)
return [x]
ArgNames = Union[str, List[str]]
NamedModule = Tuple[str, nn.Module]
class ModuleGraph(nn.Sequential):
... |
benchexec/tools/goblint.py | SvenUmbricht/benchexec | 137 | 11132237 | <gh_stars>100-1000
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 <NAME> <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.tools.template
import benchexec.result as result
import r... |
update/src/testing.py | isaiasfsilva/ROLO | 962 | 11132247 | from utils_dataset import *
from utils_draw_coord import debug_decimal_coord
from utils_io_folder import *
from utils_io_coord import *
def get_batch_by_repeat(ndarray, batchsize):
batch_ndarray = []
for id in range(batchsize):
batch_ndarray.append(ndarray)
return batch_ndarray
def test(self, ses... |
test/test_global_vars.py | robertmaynard/hpc-container-maker | 340 | 11132291 |
from __future__ import unicode_literals
from __future__ import print_function
import logging # pylint: disable=unused-import
import unittest
import os
from helpers import docker, ubuntu
from hpccm.common import container_type
from hpccm.recipe import recipe
class Test_global_vars(unittest.TestCase):
def test_g... |
data/dataloader.py | xxchenxx/classifier-balancing | 734 | 11132311 | <reponame>xxchenxx/classifier-balancing
"""Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the license found in the
LICENSE file in the root directory of this source tree.
Portions of the source code are from the OLTR project which
notice below and in LICENSE i... |
var/spack/repos/builtin/packages/py-libensemble/package.py | LiamBindle/spack | 2,360 | 11132319 | <gh_stars>1000+
# 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)
import os
from spack import *
class PyLibensemble(PythonPackage):
"""Library for managing ensemble-... |
metrics.py | Fred62879/ACORN | 186 | 11132324 | import numpy as np
import torch
import trimesh
from scipy.spatial import cKDTree as KDTree
from inside_mesh.triangle_hash import TriangleHash as _TriangleHash
'''
Some code included from 'inside_mesh' library of Occupancy Networks
https://github.com/autonomousvision/occupancy_networks
'''
def define_grid_3d(N, vox... |
.circleci/codegen_validation/normalize_yaml_fragment.py | Hacky-DH/pytorch | 60,067 | 11132329 | #!/usr/bin/env python3
import os
import sys
import yaml
# Need to import modules that lie on an upward-relative path
sys.path.append(os.path.join(sys.path[0], '..'))
import cimodel.lib.miniyaml as miniyaml
def regurgitate(depth, use_pyyaml_formatter=False):
data = yaml.safe_load(sys.stdin)
if use_pyyaml_f... |
.venv/lib/python3.10/site-packages/lunr/utils.py | plocandido/docinfrati | 128 | 11132337 | <gh_stars>100-1000
def as_string(obj):
return "" if not obj else str(obj)
class CompleteSet(set):
def union(self, other):
return self
def intersection(self, other):
return set(other)
def __contains__(self, y):
return True
|
scripts/external_libs/python-daemon-2.0.5/daemon/daemon.py | timgates42/trex-core | 956 | 11132344 | # -*- coding: utf-8 -*-
# daemon/daemon.py
# Part of ‘python-daemon’, an implementation of PEP 3143.
#
# Copyright © 2008–2015 <NAME> <<EMAIL>>
# Copyright © 2007–2008 <NAME>, <NAME>
# Copyright © 2004–2005 <NAME>
# Copyright © 2003 <NAME>
# Copyright © 2002 <NAME>
# Copyright © 2001 <NAME>
#
# This is free software: ... |
torchrec/fx/tracer.py | xing-liu/torchrec | 814 | 11132351 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from typing import Any, Callable, Dict, Optional, Union
import torch
from torch.fx.node... |
pysnmp/smi/mibs/instances/__SNMP-FRAMEWORK-MIB.py | RKinsey/pysnmp | 492 | 11132386 | #
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2019, <NAME> <<EMAIL>>
# License: http://snmplabs.com/pysnmp/license.html
#
# This file instantiates some of the MIB managed objects for SNMP engine use
#
import time
if 'mibBuilder' not in globals():
import sys
sys.stderr.write(__doc__)
sy... |
custom_components/hacs/tasks/activate_categories.py | rubicon/home-assistant-config-1 | 1,383 | 11132398 | <filename>custom_components/hacs/tasks/activate_categories.py
"""Starting setup task: extra stores."""
from __future__ import annotations
from homeassistant.core import HomeAssistant
from ..base import HacsBase
from ..enums import HacsCategory, HacsStage
from .base import HacsTask
async def async_setup_task(hacs: H... |
pencil.py | duduainankai/pencil-python | 127 | 11132414 | <filename>pencil.py<gh_stars>100-1000
#!/usr/bin/env python
# encoding: utf-8
"""
=================================================
The python version implementation
"Combining Sketch and Tone for Pencil Drawing Production"
<NAME>, <NAME>, <NAME>
International Symposium on Non-Photorealistic Animation and Rendering
(... |
hulearn/datasets.py | ParikhKadam/human-learn | 575 | 11132419 | <reponame>ParikhKadam/human-learn
import os
from pkg_resources import resource_filename
import pandas as pd
def load_titanic(return_X_y: bool = False, as_frame: bool = False):
"""
Loads in a subset of the titanic dataset. You can find the full dataset [here](https://www.kaggle.com/c/titanic/data).
Argum... |
tridet/utils/geometry.py | flipson/dd3d | 227 | 11132421 | <reponame>flipson/dd3d
# Copyright 2021 Toyota Research Institute. All rights reserved.
import logging
import cv2
import numpy as np
import torch
from pytorch3d.transforms.rotation_conversions import matrix_to_quaternion, quaternion_to_matrix
LOG = logging.getLogger(__name__)
PI = 3.14159265358979323846
EPS = 1e-7
... |
rally/task/processing/utils.py | lolwww/rally | 263 | 11132424 | <gh_stars>100-1000
# Copyright 2014: Mirantis Inc.
# 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
#
# ... |
external/model-preparation-algorithm/mpa_tasks/extensions/datasets/mpa_cls_dataset.py | opencv/openvino_training_extensions | 775 | 11132453 | # Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
import torch
import numpy as np
from mmcv.utils.registry import build_from_cfg
from mmcls.datasets.builder import DATASETS, PIPELINES
from mmcls.datasets.pipelines import Compose
from mmcls.datasets.base_dataset import BaseDataset
from mpa... |
modules/gif/config.py | ppiecuch/gd_goost | 323 | 11132458 | #!/usr/bin/env python3
def can_build(env, platform):
# This module is part of the Goost project, but can be built independently.
# Refer to https://github.com/goostengine/goost for more information.
if "goost_image_enabled" in env:
return env["goost_image_enabled"]
return True
def configure(e... |
tests/integration/platform/__init__.py | AnantTiwari-Naman/pyglet | 1,160 | 11132470 | <filename>tests/integration/platform/__init__.py
"""
Platform integration tests. These tests are specific to certain platforms.
"""
|
packages/pyright-internal/src/tests/samples/assignmentExpr1.py | Jasha10/pyright | 3,934 | 11132480 | # This sample tests the Python 3.8 assignment expressions.
# pyright: reportUnusedExpression=false
def func1():
b = 'a'
d = 'b'
a = (b := 3)
# This should generate an error because the
# item to the left of an assignment expression
# must be a name.
a + 3 := 3
# This should generate... |
tests/core/factory_test.py | ndennler/pyribs | 108 | 11132490 | """Tests for ribs.factory."""
import numpy as np
import pytest
import toml
import ribs.factory
from ribs.archives import GridArchive
from ribs.emitters import GaussianEmitter
from ribs.optimizers import Optimizer
@pytest.mark.parametrize(
"registration_func",
[
ribs.factory.register_archive,
... |
colossalai/gemini/memory_tracer/memstats_collector.py | RichardoLuo/ColossalAI | 1,630 | 11132491 | from colossalai.gemini.memory_tracer import SyncCudaMemoryMonitor
from colossalai.utils.memory import colo_device_memory_used
from colossalai.gemini.stateful_tensor import StatefulTensor
import torch
import time
from typing import List
class MemStatsCollector:
"""
A Memory statistic collector.
It works i... |
tools.py | lonePatient/lookahead_pytorch | 171 | 11132508 | import numpy as np
from pathlib import Path
import json
import random
import torch
import os
def save_json(data, file_path):
'''
save json
:param data:
:param json_path:
:param file_name:
:return:
'''
if not isinstance(file_path, Path):
file_path = Path(file_pa... |
scripts/bigrams.py | clim140/im2recipe-Pytorch | 217 | 11132526 | import json
import re
import utils
import copy
import pickle
from proc import *
from params import get_parser
parser = get_parser()
params = parser.parse_args()
create = params.create_bigrams # true to compute and store bigrams to disk
# false to go through top N bigrams and create annotations
print('L... |
mayan/apps/sources/source_backends/mixins.py | bonitobonita24/Mayan-EDMS | 343 | 11132527 | <reponame>bonitobonita24/Mayan-EDMS
import json
import logging
from django import forms
from django.apps import apps
from django.utils.encoding import force_text
from django.utils.translation import ugettext, ugettext_lazy as _
from mayan.apps.documents.models.document_file_models import DocumentFile
from mayan.apps.... |
mmcv/fileio/file_client.py | lyttonhao/mmcv | 549 | 11132541 | import inspect
import warnings
from abc import ABCMeta, abstractmethod
class BaseStorageBackend(metaclass=ABCMeta):
"""Abstract class of storage backends.
All backends need to implement two apis: ``get()`` and ``get_text()``.
``get()`` reads the file as a byte stream and ``get_text()`` reads the file
... |
trankit/adapter_transformers/configuration_xlnet.py | jsteggink/trankit | 613 | 11132543 | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the... |
var/spack/repos/builtin/packages/cppcheck/package.py | LiamBindle/spack | 2,360 | 11132548 | <gh_stars>1000+
# 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 Cppcheck(MakefilePackage):
"""A tool for static C/C++ code analysis."""
... |
third_party/cppclean/cpp/headers.py | thomwiggers/toggldesktop | 544 | 11132573 | <reponame>thomwiggers/toggldesktop
# Copyright 2007 <NAME>
# Portions Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
scripts/calc_gt_distribution.py | gist-ailab/bop_toolkit | 201 | 11132576 | <reponame>gist-ailab/bop_toolkit<filename>scripts/calc_gt_distribution.py
# Author: <NAME> (<EMAIL>)
# Center for Machine Perception, Czech Technical University in Prague
"""Calculates distribution of GT poses."""
import math
import numpy as np
import matplotlib.pyplot as plt
from bop_toolkit_lib import config
from b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.