code stringlengths 1 199k |
|---|
from luigi_bigquery import ResultProxy
import os
import shutil
import tempfile
class MockClient(object):
def __init__(self, datasets, tables, jobs):
self._datasets = datasets
self._tables = tables
self._jobs = jobs
def create_dataset(self, dataset_id, friendly_name=None, description=None... |
'''
Wheel system wrapper for key system
'''
from __future__ import absolute_import
import os
import hashlib
import salt.key
import salt.crypt
__func_alias__ = {
'list_': 'list'
}
def list_(match):
'''
List all the keys under a named status
'''
skey = salt.key.Key(__opts__)
return skey.list_statu... |
import os
import time
import json
import Image, StringIO
import allura
from mock import patch
from nose.tools import assert_true, assert_false, assert_equal, assert_in
from formencode.variabledecode import variable_encode
from alluratest.controller import TestController
from allura import model as M
from forgewiki impo... |
"""Tests for learn.estimators.tensor_signature."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.contrib.learn.python.learn.estimators import tensor_signature
class TensorSignatureTest(tf.test.TestCase):
def testTen... |
import os
import re
import cx_Oracle
import collections
import datetime
earContentionCode = [2200,2210,2220,3140,3150,4130,4210,4700,4920,5000,5010,5710,6850]
SQL="select rcc.ptcpnt_vet_id, \
bnft_claim_id, \
date_of_claim, \
prfil_dt, \
claim_ro_number, \
cntntn_id, \
cntntn_clsfcn_id, \
cntntn_clmant_txt, \
p... |
import logging
from xml.dom.minidom import *
from jinja2 import Environment, Template
from edge.dateutility import DateUtility
from edge.opensearch.response import Response
class TemplateResponse(Response):
def __init__(self):
super(TemplateResponse, self).__init__()
self.env = Environment()
... |
import mock
from keystoneauth1 import exceptions as kse
import webob
from nova.api.openstack import identity
from nova import test
class FakeResponse(object):
"""A basic response constainer that simulates requests.Response.
One of the critical things is that a success error code makes the
object return true... |
from socket import inet_pton, inet_ntop, AF_INET, AF_INET6
import unittest
from framework import VppTestCase, VppTestRunner
from vpp_ip import DpoProto
from vpp_ip_route import VppIpRoute, VppRoutePath, VppMplsLabel, \
VppIpTable, FibPathProto
from vpp_acl import AclRule, VppAcl
from scapy.packet import Raw
from sc... |
import functools
from functools import partial
import testtools
from tempest import config
from tempest.exceptions import InvalidServiceTag
from tempest.lib.common.utils import data_utils as lib_data_utils
from tempest.lib import decorators
CONF = config.CONF
class DataUtils(object):
def __getattr__(self, attr):
... |
"""
Gathers components according to their history.
This algorithm is a test: it can be a memory hog
:author: Thomas Calmant
:license: Apache Software License 2.0
:version: 3.0.0
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in ... |
"""Implements iptables rules using linux utilities."""
import inspect
import os
import re
from neutron.agent.linux import utils as linux_utils
from neutron.common import utils
from neutron.openstack.common import excutils
from neutron.openstack.common import lockutils
from neutron.openstack.common import log as logging... |
import time
import sqlalchemy as SA
import pushmanager.core.db as db
import pushmanager.core.util
from pushmanager.core.mail import MailQueue
from pushmanager.core.rb import RBQueue
from pushmanager.core.requesthandler import RequestHandler
class LivePushServlet(RequestHandler):
def _arg(self, key):
return ... |
import os
from pathlib import Path
import gi
import logging
from gi.repository import Gtk
import json_config
from .login_window import LoginWindow
TOP_DIR = os.path.dirname(os.path.abspath(__file__))
config = json_config.connect('config.json')
gi.require_version('Gtk', '3.0')
class WatsonCredentialsDialog(Gtk.Dialog):
... |
from py_paddle import swig_paddle, DataProviderConverter
from paddle.trainer.PyDataProvider2 import dense_vector
from paddle.trainer.config_parser import parse_config
TEST_DATA = [[[
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... |
import os
import unittest
import time
from TestUtils import TestUtilsMixin
class NativeMapTest(TestUtilsMixin, unittest.TestCase):
"Native Map Unit Test"
order = 21
testClass=""
def setUp(self):
pass
def runTest(self):
handle = self.runClassOn('localhost', 'org.apache.accumulo.test.f... |
import logging
import os
import shutil
from pants.backend.jvm.subsystems.scoverage_platform import ScoveragePlatform
from pants.backend.jvm.tasks.coverage.cobertura import Cobertura
from pants.backend.jvm.tasks.coverage.engine import NoCoverage
from pants.backend.jvm.tasks.coverage.jacoco import Jacoco
from pants.backe... |
"""Identity v3 User action implementations"""
import copy
import six
import sys
from keystoneauth1 import exceptions as ks_exc
from eclcli.common import command
from eclcli.common import utils
from eclcli.i18n import _ # noqa
from eclcli.identity import common
class CreateUser(command.ShowOne):
"""Create new user"... |
import logging
from inventory_tool.exception import MalformedInputException, GenericException
try:
from ipaddress import ip_address
from ipaddress import ip_network
from ipaddress import IPv4Address
from ipaddress import IPv6Address
ipaddress_name_network = "network_address"
ipaddress_name_broad... |
import os
import re
import mock
from oslo_concurrency import processutils
from cinder import exception
from cinder import test
from cinder.volume import configuration as conf
from cinder.volume.drivers.emc.emc_cli_fc import EMCCLIFCDriver
from cinder.volume.drivers.emc.emc_cli_iscsi import EMCCLIISCSIDriver
import cind... |
"""Tests for the file system implementation using pyfsapfs."""
import unittest
from dfvfs.lib import definitions
from dfvfs.path import factory as path_spec_factory
from dfvfs.resolver import context
from dfvfs.vfs import apfs_file_system
from tests import test_lib as shared_test_lib
class APFSFileSystemTest(shared_tes... |
"""
ZoneManager is responsible to manage access control using FC zoning
when zoning mode is set as 'fabric'.
ZoneManager provides interfaces to add connection and remove connection
for given initiator and target list associated with a FC volume attach and
detach operation.
**Related Flags**
:zone_driver: Used by:class... |
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: f5bigip_sys_crypto_cert
short_description: BIG-IP sys crypto cert module
description:
- Manage cryptographic certificates on the BIG-IP system.
version_added: "2.4"
author... |
import webob.exc
from nova.api.openstack.compute.contrib import agents
from nova import context
from nova import db
from nova.db.sqlalchemy import models
from nova import exception
from nova import test
fake_agents_list = [{'hypervisor': 'kvm', 'os': 'win',
'architecture': 'x86',
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('climate_data', '0029_auto_20170628_1527'),
]
operations = [
migrations.AlterField(
model_name='datatype',
name='short_name',
... |
__author__ = 'alberto'
import time
from functools import wraps
from config import logger
def measure_time(func):
"""
Decorator that reports the execution time.
"""
@wraps(func)
def wrapper(*args, **kwargs):
logger.info("Running %s", func.__name__)
start = time.time()
result =... |
"""Execute Transactions Spec tests."""
import os
import sys
from io import BytesIO
sys.path[0:0] = [""]
from test import client_context, unittest
from test.utils import (
OvertCommandListener,
TestCreator,
rs_client,
single_client,
wait_until,
)
from test.utils_spec_runner import SpecRunner
from gri... |
from oslo_config import fixture as config_fixture
from keystone.identity.backends import ldap
from keystone.tests.unit import core
from keystone.tests.unit.identity.backends import test_base
from keystone.tests.unit.ksfixtures import ldapdb
class TestIdentityDriver(core.BaseTestCase,
test_base.... |
"""Exceptions coverage.py can raise."""
class BaseCoverageException(Exception):
"""The base of all Coverage exceptions."""
pass
class CoverageException(BaseCoverageException):
"""An exception raised by a coverage.py function."""
pass
class NoSource(CoverageException):
"""We couldn't find the source ... |
"""Common configs for compatibility_lib and compatibility_server.
Note that a unit test exists for checking that the configs.py file in
compatibility_lib is the same as the configs.py file in compatibility_server.
The reason for this set up is that these modules need to be isolated from
each other, but there also needs... |
"""This script is used to synthesize generated parts of this library."""
import synthtool as s
import synthtool.gcp as gcp
import logging
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICGenerator()
v1_library = gapic.ruby_library(
'datastore', 'v1',
config_path='/google/datastore/artman_datastore.yaml... |
from proboscis import test
@test(groups=['benchmark.discovery'])
class BenchmarkDiscoveryTests(object):
def __init__(self):
pass |
from __future__ import unicode_literals
from django.apps import AppConfig
class ScheduleConfig(AppConfig):
name = 'schedule' |
import unittest
import mock
def _make_credentials():
import google.auth.credentials
return mock.Mock(spec=google.auth.credentials.Credentials)
def _make_entity_pb(project, kind, integer_id, name=None, str_val=None):
from google.cloud.datastore_v1.proto import entity_pb2
from google.cloud.datastore.helpe... |
"""
"""
from __future__ import absolute_import
from ..msg.Field import *
from ..msg.ImportExportHelper import *
from ..msg.StructValue import *
from ..msg.Type import *
from ..msg.ValueFactory import *
from ..support.Class2TypeMap import *
from ..support.Validator_string import *
from ...util.URL import *
class URLSeri... |
import inviwopy
tf = inviwopy.app.network.VolumeRaycaster.transferFunction
tf.save( inviwopy.app.getPath( inviwopy.PathType.TransferFunctions) + "/transferfunction.itf" ) |
command += oiiotool ("--create 320x240 3 -d uint8 -o black.tif")
command += oiiotool ("--stats black.tif")
command += oiiotool ("--pattern constant:color=.1,.2,.3,1 320x240 4 -o constant.tif")
command += oiiotool ("--stats constant.tif")
command += oiiotool ("--pattern noise:type=uniform:min=0.25:max=0.75 64x64 3 -d ui... |
import foauth.providers
class Cheddar(foauth.providers.OAuth2):
# General info about the provider
provider_url = 'https://cheddarapp.com/'
docs_url = 'https://cheddarapp.com/developer/'
category = 'Tasks'
# URLs to interact with the API
authorize_url = 'https://api.cheddarapp.com/oauth/authorize... |
"""tuple sub-class which holds weak references to objects"""
import weakref
class WeakTuple( tuple ):
"""tuple sub-class holding weakrefs to items
The weak reference tuple is intended to allow you
to store references to a list of objects without
needing to manage weak references directly.
For the mo... |
import re
from rest_framework.serializers import ValidationError
def name(value):
'''Matches names of people, countries and and other things.'''
if re.match(r'^[A-Za-z\s\.\-\'àèéìòóôù]+$', value) is None:
raise ValidationError('This field contains invalid characters.')
def address(value):
'''Matches... |
"""
Integration routines
====================
Methods for Integrating Functions given function object.
quad -- General purpose integration.
dblquad -- General purpose double integration.
tplquad -- General purpose triple integration.
fixed_quad -- Integrate func(x) using Gaussian qu... |
DEPS = [
'recipe_engine/platform',
] |
"""
1.0 version of the API.
"""
from sharrock.descriptors import Descriptor
version = '1.0'
class MultiversionExample(Descriptor):
"""
This is the first version of this particular function.
""" |
number = 0
for a in range(999,99,-1):
for b in range(999,99,-1):
pal=a*b
if (str(pal) == str(pal)[::-1]):
if (pal > number):
number = pal
break
print(number) |
from __future__ import unicode_literals
from unittest import TestCase
from shutil import rmtree
from tempfile import mkdtemp
from os import makedirs
from os.path import join, exists, dirname
from awsfabrictasks.s3.api import dirlist_absfilenames
from awsfabrictasks.s3.api import localpath_to_s3path
from awsfabrictasks.... |
"""
Classes for using robotic or other hardware using Topographica.
This module contains several classes for constructing robotics
interfaces to Topographica simulations. It includes modules that read
input from or send output to robot devices, and a (quasi) real-time
simulation object that attempts to maintain a corr... |
import os
from os import path as op
import shutil
import glob
import warnings
from nose.tools import assert_true, assert_raises
from numpy.testing import assert_equal, assert_allclose
from mne import concatenate_raws, read_bem_surfaces
from mne.commands import (mne_browse_raw, mne_bti2fiff, mne_clean_eog_ecg,
... |
from sqlagg.columns import SimpleColumn
from sqlagg.filters import BETWEEN, IN, EQ
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn
from corehq.apps.reports.sqlreport import SqlData, DataFormatter, TableDataFormat, DatabaseColumn
from custom.tdh.reports import UNNECESSARY_FIELDS, CHILD_HEAD... |
"""
Generate certificates via Let's Encrypt
"""
import re
from subprocess import check_output, check_call
from os import path
import click
from colorama import Fore
import pexpect
CREX = re.compile(
".well-known\/acme-challenge\/(\S+) before continuing:\s+(\S+)",
re.MULTILINE
)
MODULE_CONFIG = 'module.yaml' # ... |
'''
This module provides tools to represent and handle dynamic Bayesian networks with discrete conditional probability distributions. Dynamic Bayesian networks represent systems that change over time. This means that each node in the BN has a finite number of outcomes, the distribution over which is dependent on the ou... |
from django.conf.urls import patterns, url
from django.views.generic import RedirectView
from . import views
APP_SLUGS = {
'chrono': 'Chrono',
'face_value': 'Face_Value',
'podcasts': 'Podcasts',
'roller': 'Roller',
'webfighter': 'Webfighter',
'generalnotes': 'General_Notes',
'rtcamera': 'rtc... |
from __future__ import division
import argparse
import multiprocessing
import numpy as np
import PIL
import chainer
import chainer.functions as F
import chainer.links as L
from chainer.optimizer_hooks import WeightDecay
from chainer import serializers
from chainer import training
from chainer.training import extensions... |
__author__ = 'cgonzalez' |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from flexget import options, plugin
from flexget.event import event
from flexget.terminal import console
from flexget.manager import Session
try:
from flexget.plugins.interna... |
"""
.. module:: admin
"""
from django.contrib import admin
from apps.volontulo.models import Offer
from apps.volontulo.models import Organization
from apps.volontulo.models import UserProfile
admin.site.register(Offer)
admin.site.register(Organization)
admin.site.register(UserProfile) |
"""SCons.Tool.packaging.msi
The msi packager.
"""
__revision__ = "src/engine/SCons/Tool/packaging/msi.py 2014/07/05 09:42:21 garyo"
import os
import SCons
from SCons.Action import Action
from SCons.Builder import Builder
from xml.dom.minidom import *
from xml.sax.saxutils import escape
from SCons.Tool.packaging import... |
import sys
if 'renderdoc' not in sys.modules and '_renderdoc' not in sys.modules:
import renderdoc
rd = renderdoc
import struct
class MeshData(rd.MeshFormat):
indexOffset = 0
name = ''
def biggestDraw(prevBiggest, d):
ret = prevBiggest
if ret == None or d.numIndices > ret.numIndices:
ret = d
for c in d.children... |
"""
Support for Tellstick lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.tellstick/
"""
from homeassistant.components import tellstick
from homeassistant.components.light import ATTR_BRIGHTNESS, Light
from homeassistant.components.tellstick ... |
from StringIO import StringIO
import cPickle
from string import strip
from collections import defaultdict
import logging
import os
log = logging.getLogger("main")
from ete2.tools.phylobuild_lib.master_task import CogSelectorTask
from ete2.tools.phylobuild_lib.errors import DataError, TaskError
from ete2.tools.phylobuil... |
"""Attempt to determine the current user's "system" directories"""
try:
from win32com.shell import shell, shellcon
except ImportError:
shell = None
try:
import _winreg
except ImportError:
_winreg = None
import os, sys
r"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"... |
"""The macros below aren't reliable (e.g., some fail if ``arg_string`` is `None`)
or safe (``include`` doesn't guard against circular reference). For a more complete example, see
`the code used in the sandbox <http://code.google.com/p/urlminer/source/browse/examples/wiki/macros.py>`_.
"""
import genshi.builder as bldr
... |
from __future__ import absolute_import, unicode_literals
from django.contrib.auth.models import User
from django.test.utils import override_settings
from allauth.account import app_settings as account_settings
from allauth.account.models import EmailAddress
from allauth.socialaccount.models import SocialAccount
from al... |
"""
Pretty-printing of discontinuous trees.
Adapted from the disco-dop project, by Andreas van Cranenburgh.
https://github.com/andreasvc/disco-dop
Interesting reference (not used for this code):
T. Eschbach et al., Orth. Hypergraph Drawing, Journal of
Graph Algorithms and Applications, 10(2) 141--157 (2006)149.
http://... |
import networkx as nx
from nose.tools import assert_equal, assert_raises
class TestNetworkSimplex:
def test_simple_digraph(self):
G = nx.DiGraph()
G.add_node('a', demand = -5)
G.add_node('d', demand = 5)
G.add_edge('a', 'b', weight = 3, capacity = 4)
G.add_edge('a', 'c', weig... |
"""Command line wrapper for the multiple alignment program DIALIGN2-2.
"""
from __future__ import print_function
__docformat__ = "restructuredtext en" # Don't just use plain text in epydoc API pages!
from Bio.Application import _Option, _Argument, _Switch, AbstractCommandline
class DialignCommandline(AbstractCommandli... |
from enigma import eDVBFrontendParametersSatellite, eDVBFrontendParametersCable, eDVBFrontendParametersTerrestrial
from Components.NimManager import nimmanager
def ConvertToHumanReadable(tp, type = None):
ret = { }
if type is None:
type = tp.get("tuner_type", "None")
if type == "DVB-S":
ret["tuner_type"] = _("Sa... |
import re
import subprocess
import sys
def get_promotion_chain(git_directory, git_branch, upstream_name='origin'):
"""
For a given git repository & branch, determine the promotion chain
Following the promotion path defined for pulp figure out what the full promotion
path to master is from wherever we ar... |
"""Storage for ports. Set defaults here, then :py:mod:`fixtures.portset` will make overrides."""
import sys
from cfme.utils import clear_property_cache
from cfme.utils.log import logger
class Ports(object):
SSH = 22
DB = 5432
TOWER = 54322
logger = logger
@property
def _top(self, m=sys.modules):... |
'''
Exodus Add-on
Copyright (C) 2016 Exodus
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This pro... |
"""
***************************************************************************
blast2dem.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
****************************************... |
"""
Extended WTForms field
Classes TimeField, DatePickerWidget, DateTimePickerWidget and TimePickerWidget
are taken from `flask-admin` extension.
:copyright: (c) 2011 by wilsaj.
:license: BSD, see LICENSE for more details.
:source: https://raw.github.com/wilsaj/flask-admin/master/flask_admin/wtforms.py
"""
import datet... |
"""Storage for pytest objects during test runs
The objects in the module will change during the course of a test run,
so they have been stashed into the 'store' namespace
Usage:
# imported directly (store is pytest.store)
from cfme.fixtures.pytest_store import store
store.config, store.pluginmanager, store.... |
import re
import xml.dom.minidom
from typing import (
Any,
List,
Optional,
)
from pcs import utils
from pcs.common import (
const,
pacemaker,
)
from pcs.common.str_tools import format_list_custom_last_separator
def parse_argv(argv, extra_options=None):
"""
Commandline options: no options
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('forum', '0004_topic_update_index_date'),
]
database_operations = [
migrations.AlterModelTable('TopicFollowed', 'notification_topicfollowed')
]
st... |
"""
linkcode
~~~~~~~~
Add external links to module code in Python object descriptions.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import division, absolute_import, print_function
import warnings
import collections
warn... |
__version__ = '0.8.5'
__all__ = [ 'CYRUS' ]
__doc__ = """Cyrus admin wrapper
Adds cyrus-specific commands to imaplib IMAP4 Class
and defines new CYRUS class for cyrus imapd commands
"""
from sys import exit, stdout
try:
import imaplib
import re
from binascii import b2a_base64
except ImportError, e:
prin... |
from pymongo import MongoClient
import pymongo
HOST = "wfSciwoncWiki:enw1989@172.31.2.76:27001/?authSource=admin"
c = MongoClient('mongodb://'+HOST)
dbname = "wiki"
sessions = "sessions"
contributors = "contributors"
user_sessions = "user_sessions"
top_sessions = "top_sessions"
c[dbname].drop_collection(contributors)
c... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import os
import traceback
import textwrap
from ansible.compat.six import iteritems, string_types
from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleOptionsError
from ansible.plugins i... |
import select
import socket
import time
import sys
import struct
def pong():
# easy, receive and send back
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('0.0.0.0', 1234))
while True:
c, addr = s.recvfrom(1)
s.sendto(c, (addr[0], 1235))
if c == 'x':
brea... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'core'}
DOCUMENTATION = """
---
module: net_vlan
version_added: "2.4"
author: "Ricardo Carrillo Cruz (@rcarrillocruz)"
short_description: Manage VLANs on network devices
description:
- This mo... |
import pytest
from pyshell.addons.parameter import addValues
from pyshell.addons.parameter import cleanKeyStore
from pyshell.addons.parameter import createValue
from pyshell.addons.parameter import createValues
from pyshell.addons.parameter import getParameter
from pyshell.addons.parameter import getProperties
from pys... |
from cgi import escape
import gzip as gzip_module
import re
import time
import types
import uuid
from cStringIO import StringIO
def resolve_content(response):
rv = "".join(item for item in response.iter_content())
if type(rv) == unicode:
rv = rv.encode(response.encoding)
return rv
class Pipeline(obj... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0016_auto_20160224_1039'),
]
operations = [
migrations.AddField(
model_name='person',
name='language',
field=... |
from __future__ import unicode_literals
from django import forms
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group as PermissionGroup
from django.forms.models import modelform_factory
from django.http.response... |
"""
Utility library for working with the edx-milestones app
"""
from django.conf import settings
from django.utils.translation import gettext as _
from edx_toggles.toggles import SettingDictToggle
from milestones import api as milestones_api
from milestones.exceptions import InvalidMilestoneRelationshipTypeException, I... |
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
from rest.views.blocks.base import BlockSSDataTables, ResourceBlockAction
from consts import EDIT, CONFIRM, EDIT_MULTIPLE, VIEW
from lib.shortcuts import render_to_response, render_to_xml_response, render_to_context_response
from gf.gas.forms.ba... |
import os
import pytest
skipiftravis = pytest.mark.skipif(
os.environ.get('TRAVIS') == 'true', reason='skip on Travis-CI') |
import copy
from torch.optim.lr_scheduler import OneCycleLR
from nupic.research.frameworks.vernon.experiment_utils import create_lr_scheduler
class MultiCycleLR:
"""
Composes a sequence of OneCycleLR regimes, allowing different configurations
for each cycle. This infers args like total_batches, epochs, and ... |
from spack import *
class RPng(RPackage):
"""This package provides an easy and simple way to read, write and display
bitmap images stored in the PNG format. It can read and write both files
and in-memory raw vectors."""
homepage = "http://www.rforge.net/png/"
url = "https://cloud.r-project.org/... |
import gst
from twisted.internet import defer, reactor
from twisted.trial import unittest
from flumotion.common import testsuite
from flumotion.component import padmonitor
attr = testsuite.attr
class TestPadMonitor(testsuite.TestCase):
slow = True
def _run_pipeline(self, pipeline):
pipeline.set_state(gs... |
from test import support
from test import test_multibytecodec_support
import unittest
class TestGB2312Map(test_multibytecodec_support.TestBase_Mapping,
unittest.TestCase):
encoding = 'gb2312'
mapfileurl = 'http://people.freebsd.org/~perky/i18n/EUC-CN.TXT'
class TestGBKMap(test_multibytecodec_... |
"""Implementation of magic functions for interaction with the OS.
Note: this module is named 'osm' instead of 'os' to avoid a collision with the
builtin.
"""
import io
import os
import re
import sys
from pprint import pformat
from IPython.core import magic_arguments
from IPython.core import oinspect
from IPython.core i... |
import unittest
import utils
from testbin import TestBin
class TestBinSlam(TestBin, unittest.TestCase):
def setUp(self):
self.bin = 'slam'
def tearDown(self):
pass |
"""Tensor utility functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import functools
import inspect
import re
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.util import decorator_utils
def _a... |
import unittest
import boto3
from airflow import configuration
from airflow.contrib.sensors.aws_redshift_cluster_sensor import AwsRedshiftClusterSensor
try:
from moto import mock_redshift
except ImportError:
mock_redshift = None
class TestAwsRedshiftClusterSensor(unittest.TestCase):
def setUp(self):
... |
import time
import threading
import cv2
from ikalog.utils import *
from ikalog.inputs.win.videoinput_wrapper import VideoInputWrapper
from ikalog.inputs import VideoInput
class DirectShow(VideoInput):
# override
def _enumerate_sources_func(self):
return self._videoinput_wrapper.get_device_list()
def... |
from django.conf.urls import patterns, include, url
from testapp.api import PersonResource
from django.contrib import admin
admin.autodiscover()
person_resource = PersonResource()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'testapp.views.home', name='home'),
... |
"""Test code for QNN operators."""
import numpy as np
import tvm
from tvm import topi, relay, te
from tvm.contrib import graph_executor
import tvm.topi.testing
def verify_simulated_quantize(data_shape, out_dtype, channels, axis):
# Create placeholder variables for all qnn inputs.
A = te.placeholder(data_shape, ... |
import os
import json
import arcpy
import types
import general
from .._abstract import abstract
class SpatialReference(abstract.AbstractGeometry):
""" creates a spatial reference instance """
_wkid = None
#----------------------------------------------------------------------
def __init__(self, wkid):
... |
"""Implements the Python DB API 2.0 (PEP 249) for Impala"""
from __future__ import absolute_import
import six
import time
import datetime
from impala.error import ( # noqa
Error, Warning, InterfaceError, DatabaseError, InternalError,
OperationalError, ProgrammingError, IntegrityError, DataError,
NotSupport... |
from errors import OperationError, TimeoutExpiredError, MissingCapabilityError
from rpc import RPC, RPCReply, RPCError, RaiseMode
from retrieve import Get, GetConfig, GetReply
from edit import EditConfig, CopyConfig, DeleteConfig, Validate, Commit, DiscardChanges
from session import CloseSession, KillSession
from lock ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.