code stringlengths 1 199k |
|---|
import os
from torchvision import transforms
from torchvision.transforms import RandomResizedCrop
import nupic.research.frameworks.pytorch.dataset_utils.auto_augment as aa
from nupic.research.frameworks.pytorch.dataset_utils import HDF5Dataset
from nupic.research.frameworks.pytorch.datasets.imagenet_factory import (
... |
import base64
import urllib2
import httplib
import simplejson
from openerp.tests import common
class TestOnramp(common.HttpCase):
""" Base class for all Onramp tests. """
def setUp(self):
super(TestOnramp, self).setUp()
self.server_url = self.env['ir.config_parameter'].get_param(
'we... |
import sys
import os
import sphinx_bootstrap_theme
sys.path.append(os.path.abspath('_themes'))
sys.path.append(os.path.abspath('../../../odoo'))
import openerp
BASE_PATH = os.path.abspath(os.path.join(os.getcwd(), '../../..'))
ADDONS_PATHS = ('odoo/openerp/addons',
'odoo/addons',
'connec... |
import matplotlib.pyplot as plt
import numpy as np
from ad3 import simple_grid, general_graph
def example_binary():
# generate trivial data
x = np.ones((10, 10))
x[:, 5:] = -1
x_noisy = x + np.random.normal(0, 0.8, size=x.shape)
x_thresh = x_noisy > .0
# create unaries
unaries = x_noisy
... |
from __future__ import unicode_literals
__license__ = 'Public Domain'
import codecs
import io
import os
import random
import sys
from .options import (
parseOpts,
)
from .compat import (
compat_expanduser,
compat_getpass,
compat_shlex_split,
workaround_optparse_bug9161,
)
from .utils import (
Da... |
"""This example gets a team by its ID.
To determine which teams exist, run get_all_teams.py.
Tags: TeamService.getTeam
"""
__author__ = 'api.shamjeff@gmail.com (Jeff Sham)'
import os
import sys
sys.path.insert(0, os.path.join('..', '..', '..', '..'))
from adspygoogle import DfpClient
client = DfpClient(path=os.path.joi... |
import time
import eventlet
from oslo.config import cfg
from neutron.agent.common import config
from neutron.agent import rpc as agent_rpc
from neutron.common import constants as constants
from neutron.common import topics
from neutron.common import utils
from neutron import context
from neutron import manager
from neu... |
import sys
import os
sys.path.insert(0, os.path.abspath('../../_common'))
from common_conf import *
html_short_title_toc = manuals_dict["faqs"]
html_short_title = u'CDAP %s' % html_short_title_toc
html_context = {"html_short_title_toc":html_short_title_toc}
intersphinx_mapping.pop("faqs", None)
html_theme = 'cdap-faqs' |
"""
relu where each channel has a different leak rate
"""
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
fX = theano.config.floatX
@treeano.register_node("interval_relu")
class IntervalReLUNode(treeano.NodeImpl):
hyperparameter_names = ("leak_min",
... |
"""Parser for IE index.dat files.
Note that this is a very naive and incomplete implementation and should be
replaced with a more intelligent one. Do not implement anything based on this
code, it is a placeholder for something real.
For anyone who wants a useful reference, see this:
http://heanet.dl.sourceforge.net/pro... |
"""Support Google Home units."""
import logging
import asyncio
import voluptuous as vol
from homeassistant.const import CONF_DEVICES, CONF_HOST
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession
_LOGGE... |
import sys
import copy
import time
import asyncio
import hashlib
from unittest import mock
import celery
import pytest
from waterbutler import tasks # noqa
from waterbutler.core import remote_logging
from waterbutler.core import utils as core_utils
from waterbutler.core.path import WaterButlerPath
import tests.utils a... |
"""Tests for HTTP API."""
import json
from grr.gui import api_aff4_object_renderers
from grr.gui import api_call_renderers
from grr.gui import http_api
from grr.lib import flags
from grr.lib import registry
from grr.lib import test_lib
from grr.lib import utils
from grr.lib.rdfvalues import structs as rdf_structs
from ... |
"""## Arithmetic Operators
TensorFlow provides several operations that you can use to add basic arithmetic
operators to your graph.
@@add
@@sub
@@mul
@@div
@@truediv
@@floordiv
@@mod
@@cross
TensorFlow provides several operations that you can use to add basic
mathematical functions to your graph.
@@add_n
@@abs
@@neg
@@... |
import argparse
from singa import device
from singa import sonnx
from singa import tensor
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Load model from pytorch")
parser.add_argument("--use_cpu", action="store_true")
args = parser.parse_args()
if args.use_cpu:
print("Us... |
"""
taiga_ncurses.ui.views.backlog
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import urwid
from taiga_ncurses.ui.widgets import generic, backlog
from . import base
class ProjectBacklogSubView(base.SubView):
help_popup_title = "Backlog Help Info"
help_popup_info = base.SubView.help_popup_info + (
( "Backlog Movem... |
import mock
from ironic.common import driver_factory
from ironic.common import exception
from ironic.conductor import task_manager
from ironic.drivers import base as driver_base
from ironic.drivers.modules import agent
from ironic.drivers.modules import fake
from ironic.drivers.modules import inspector
from ironic.driv... |
'''
JSON related utilities.
This module provides a few things:
1) A handy function for getting an object down to something that can be
JSON serialized. See to_primitive().
2) Wrappers around loads() and dumps(). The dumps() wrapper will
automatically use to_primitive() for you if needed.
3) This s... |
import os
import sys
import json
from datetime import datetime
from django.db import connection, transaction
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from fly_project import constants
from api.mo... |
'''Tracing controller class. This class manages
multiple tracing agents and collects data from all of them. It also
manages the clock sync process.
'''
from __future__ import print_function
import ast
import json
import sys
import tempfile
import uuid
import py_utils
from systrace import trace_result
from systrace impo... |
"""numerictypes: Define the numeric type objects
This module is designed so 'from numerictypes import *' is safe.
Exported symbols include:
Dictionary with all registered number types (including aliases):
typeDict
Type objects (not all will be available, depends on platform):
see variable sctypes for whic... |
from gpiozero import Button
import pygame.mixer
from pygame.mixer import Sound
from signal import pause
pygame.mixer.init()
button_sounds = {
Button(2): Sound("samples/drum_tom_mid_hard.wav"),
Button(3): Sound("samples/drum_cymbal_open.wav"),
}
for button, sound in button_sounds.items():
button.when_pressed... |
from django.db import models
from main.models import BaseModel
STAT_TYPES = (
('user_count', 'User count'),
('host_count', 'Host count'),
('ip_update_count', 'IP update count'),
)
class StatisticsEntry(BaseModel):
class Meta:
verbose_name_plural = 'Statistics Entries'
stat_type = models.Char... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
import logging
import emission.core.wrapper.wrapperbase as ecwb
class Inciden... |
imagedir = parent + "/libtiffpic/depth"
files = [
"flower-minisblack-02.tif", # 73x43 2-bit minisblack gray image
"flower-minisblack-04.tif", # 73x43 4-bit minisblack gray image
"flower-minisblack-06.tif", # 73x43 6-bit minisblack gray image
"flower-minisblack-08.tif", # 73x43 8-bit minisbla... |
from __future__ import unicode_literals
import codecs
import logging
import sys
from io import BytesIO
from threading import Lock
import warnings
from django import http
from django.conf import settings
from django.core import signals
from django.core.handlers import base
from django.core.urlresolvers import set_script... |
from sympy import (Symbol, symbols, factorial, factorial2, binomial,
rf, ff, gamma, polygamma, EulerGamma, O, pi, nan,
oo, simplify, expand_func)
from sympy.functions.combinatorial.factorials import subfactorial
from sympy.utilities.pytest import XFAIL, raises
def test_rf_eval_appl... |
import re
from django import forms
from django.conf import settings
from django.template.defaultfilters import slugify
from tower import ugettext_lazy as _lazy
from kitsune.products.models import Product, Topic
from kitsune.sumo.form_fields import MultiUsernameField, StrippedCharField
from kitsune.wiki.config import SI... |
"""FEM library
Demonstrates some simple finite element definitions, and computes a mass
matrix
$ python fem.py
[ 1/60, 0, -1/360, 0, -1/90, -1/360]
[ 0, 4/45, 0, 2/45, 2/45, -1/90]
[-1/360, 0, 1/60, -1/90, 0, -1/360]
[ 0, 2/45, -1/90, 4/45, 2/45, 0]
[ -1/90, 2/45, 0, ... |
from __future__ import with_statement
import os
import unittest
import maya.cmds
import maya.OpenMaya
import IECore
import IECoreMaya
class TestOp( IECore.Op ) :
def __init__( self ) :
IECore.Op.__init__( self, "Tests stuff",
IECore.IntParameter(
name = "result",
description = "",
defaultValue = 0
... |
import unittest
import os.path as p, sys; sys.path.append(p.join(p.dirname(__file__), ".."))
from _diff import diff, guess_edit
from geometry import Position
def transform(a, cmds):
buf = a.split("\n")
for cmd in cmds:
ctype, line, col, char = cmd
if ctype == "D":
if char != '\n':
... |
import threading
try:
import urllib.parse as parse
except ImportError:
import urlparse as parse # type: ignore
try:
from typing import TYPE_CHECKING
except ImportError:
TYPE_CHECKING = False
if TYPE_CHECKING:
# pylint: disable=unused-import
from typing import Dict
from .http_challenge impor... |
class Solution(object):
def canPlaceFlowers(self, flowerbed, n):
"""
:type flowerbed: List[int]
:type n: int
:rtype: bool
"""
for i in xrange(len(flowerbed)):
if flowerbed[i] == 0 and (i == 0 or flowerbed[i-1] == 0) and \
(i == len(flowerbe... |
from flask import render_template
from . import auth
@auth.route('/login')
def login():
return render_template('auth/login.html') |
import sys
import os
sys.path.insert(0, os.path.abspath('../'))
import mw
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index... |
"""
EasyBuild support for building and installing scipy, implemented as an easyblock
@author: Stijn De Weirdt (Ghent University)
@author: Dries Verdegem (Ghent University)
@author: Kenneth Hoste (Ghent University)
@author: Pieter De Baets (Ghent University)
@author: Jens Timmerman (Ghent University)
"""
from distutils.... |
"""distutils.file_util
Utility functions for operating on single files.
"""
__revision__ = "$Id: file_util.py,v 1.17 2004/11/10 22:23:14 loewis Exp $"
import os
from distutils.errors import DistutilsFileError
from distutils import log
_copy_action = { None: 'copying',
'hard': 'hard linking',
... |
"""Dirac notation for states."""
from __future__ import print_function, division
from sympy import (cacheit, conjugate, Expr, Function, integrate, oo, sqrt,
Tuple)
from sympy.core.compatibility import range
from sympy.printing.pretty.stringpict import stringPict
from sympy.physics.quantum.qexpr impor... |
import uwsgi
from os import path
uwsgi.snmp_set_counter64(1, 0) # Number of requests
uwsgi.snmp_set_counter64(2, 0) # Number of bytes
def application(environ, start_response):
size = path.getsize('logo_uWSGI.png')
start_response('200 OK', [('Content-Type', 'image/png'), ('Content-Length', str(size))])
fd ... |
"""This is a convenience module to import all available types of hosts.
Implementation details:
You should 'import hosts' instead of importing every available host module.
"""
from autotest_lib.client.common_lib import utils
import base_classes
Host = utils.import_site_class(
__file__, "autotest_lib.client.common_l... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, getdate, formatdate, cstr
from erpnext.accounts.report.financial_statements import filter_accounts, filter_out_zero_value_rows
from erpnext.accounts.report.trial_balance.trial_balance import validate_filters
value_f... |
'''
Loader for all 2009 Dorado missions written for Monique's notice of bad
depths in Dorado389_2009_084_02_084_02_decim.nc.
Mike McCann
MBARI 15 January 2013
@var __date__: Date of last svn commit
@undocumented: __doc__ parser
@status: production
@license: GPL
'''
import os
import sys
import datetime
parentDir = os.pa... |
from datetime import date
from openerp.osv import orm, fields
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as OE_DATEFORMAT
class hsbc_export(orm.Model):
"""HSBC Export"""
_name = 'banking.export.hsbc'
_description = __doc__
_rec_name = 'execution_date'
_columns = {
'payment_order_id... |
{
'author': 'ADHOC SA',
'category': 'Accounting & Finance',
'demo_xml': [],
'depends': ['account'],
'description': '''
Account Invoice Prices Update
=============================
''',
'installable': True,
'name': 'Account Invoice Prices Update',
'test': [],
'data': [
'wizard/... |
import os
import pytest
from llnl.util.filesystem import touch, working_dir
import spack.repo
import spack.config
from spack.spec import Spec
from spack.version import ver
from spack.util.executable import which
pytestmark = pytest.mark.skipif(
not which('svn'), reason='requires subversion to be installed')
@pytest... |
__revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py rel_2.3.5:3347:d31d5a4e74b6 2015/07/31 14:36:10 bdbaddog"
__doc__ = """Module to detect the Platform/Windows SDK
PSDK 2003 R1 is the earliest version detected.
"""
import os
import SCons.Errors
import SCons.Util
import common
debug = common.debug
_CURINSTALLED_SDK_H... |
"""SCons.Tool.aixc++
Tool-specific initialization for IBM xlC / Visual Age C++ compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
from SCons.T... |
"""
Graphical user interface functionalities for the
SampleResource Aggregate Manager.
@date: Jun 12, 2013
@author: CarolinaFernandez
"""
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts impor... |
import uuid
from keystone import catalog
from keystone.common import sql
from keystone import config
from keystone import exception
from keystone import identity
from keystone import policy
from keystone import test
from keystone import token
from keystone import trust
import default_fixtures
import test_backend
CONF =... |
from alembic import op
import sqlalchemy as sa
"""Add standard attribute table
Revision ID: 32e5974ada25
Revises: 13cfb89f881a
Create Date: 2015-09-10 00:22:47.618593
"""
revision = '32e5974ada25'
down_revision = '13cfb89f881a'
TABLES = ('ports', 'networks', 'subnets', 'subnetpools', 'securitygroups',
'floati... |
import requests
import sys
import os
import json
from helpers.dbutils import CloudantDbUtils
from helpers.acmeair_utils import AcmeAirUtils
import conftest
test_properties = conftest.test_properties()
class DataLoader:
"""
Test data loader related functions
"""
def load_AcmeData(self, num_of_cust):
"""
Reset da... |
from rest_framework import status as http_status
import itertools
from flask import request
from framework import status
from framework.exceptions import HTTPError
from framework.flask import redirect # VOL-aware redirect
from framework.auth.decorators import must_be_signed
from website.archiver import ARCHIVER_SUCCES... |
from src_util import *
def commandES31InitStatement (command):
memberName = getFunctionMemberName(command.name)
return "dst->%s\t= src.%s;" % (memberName, memberName)
def genES31WrapperFuncs (registry):
iface = getInterface(registry, api='gles2', version="3.1")
genCommandList(iface, commandES31InitStatement,
... |
"""A high-speed, production ready, thread pooled, generic HTTP server.
Simplest example on how to use this module directly
(without using CherryPy's application machinery)::
from cherrypy import wsgiserver
def my_crazy_app(environ, start_response):
status = '200 OK'
response_headers = [('Content... |
import sys
from pyspark import since, SparkContext
from pyspark.ml.common import _java2py, _py2java
from pyspark.ml.linalg import DenseMatrix, Vectors
from pyspark.ml.wrapper import JavaWrapper, _jvm
from pyspark.sql.column import Column, _to_seq
from pyspark.sql.functions import lit
class ChiSquareTest(object):
""... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... |
"""Contains common constants for DFP scripts."""
__author__ = 'api.shamjeff@gmail.com (Jeff Sham)' |
from __future__ import absolute_import
from __future__ import unicode_literals
import unittest
import mock
import google.auth
import google.datalab
import google.datalab.bigquery
import google.datalab.utils
from google.datalab.bigquery._api import Api
class TestCases(unittest.TestCase):
def validate(self, mock_http_r... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class Search(Choreography):
def __init__(self, temboo_session):
"""
Create a new insta... |
"""Support for Xiaomi Gateways."""
from datetime import timedelta
import logging
import voluptuous as vol
from xiaomi_gateway import XiaomiGateway, XiaomiGatewayDiscovery
from homeassistant import config_entries, core
from homeassistant.const import (
ATTR_BATTERY_LEVEL,
ATTR_DEVICE_ID,
ATTR_VOLTAGE,
CO... |
"""Operations often used for initializing tensors.
All variable initializers returned by functions in this file should have the
following signature:
def _initializer(shape, dtype=dtypes.float32):
Args:
shape: List of `int` representing the shape of the output `Tensor`. Some
initializers may also be able to ... |
"""
This module contains Google PubSub operators.
"""
import warnings
from typing import Dict, List, Optional, Sequence, Tuple, Union
from google.api_core.retry import Retry
from google.cloud.pubsub_v1.types import Duration, MessageStoragePolicy, PushConfig
from airflow.models import BaseOperator
from airflow.providers... |
from __future__ import absolute_import
input_name = '../examples/dg/advection_2D.py'
output_name = 'advection_sol.msh'
from tests_basic import TestInput
class Test( TestInput ):
pass |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('demo_models', '0003_auto_20150419_2110'),
]
operations = [
migrations.AddField(
model_name='waiter',
name='days_worked',
... |
import shutil
from io import BytesIO, TextIOWrapper
import logging
import os
from os.path import expanduser, exists
import struct
from configobj import ConfigObj
from Crypto.Cipher import AES
logger = logging.getLogger(__name__)
def load_config(usr_cfg, def_cfg=None):
cfg = ConfigObj()
cfg.merge(ConfigObj(def_c... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ConservationFeature'
db.create_table('seak_conservationfeature', (
('name', self.gf('django.db.models.field... |
from __future__ import absolute_import, unicode_literals
import unittest
from django.test import TestCase
from wagtail.tests.search import models
from .test_backends import BackendTests
class TestDBBackend(BackendTests, TestCase):
backend_path = 'wagtail.wagtailsearch.backends.db'
@unittest.expectedFailure
... |
"""
Read CAN frame, parse into CANopen frame, and dump to STDOUT.
"""
from pycanopen import *
canopen = CANopen()
while True:
canopen_frame = canopen.read_frame()
if canopen_frame:
print canopen_frame
else:
print("CANopen Frame parse error") |
import sys, os, shutil
sys.path.insert(0, os.path.abspath('..'))
for path in ["../pyanaconda/isys/.libs", "../pyanaconda", "../tests", "../tests/lib", "../dracut", "../widgets"]:
sys.path.append(os.path.abspath(path))
extensions = []
if not os.environ.get("READTHEDOCS") == "True":
extensions.extend(['sphinx.ext... |
"""
Docstrings are another source of information for functions and classes.
:mod:`jedi.evaluate.dynamic` tries to find all executions of functions, while
the docstring parsing is much easier. There are three different types of
docstrings that |jedi| understands:
- `Sphinx <http://sphinx-doc.org/markup/desc.html#info-fi... |
from module.plugins.internal.XFSAccount import XFSAccount
class FilerioCom(XFSAccount):
__name__ = "FilerioCom"
__type__ = "account"
__version__ = "0.07"
__status__ = "testing"
__description__ = """FileRio.in account plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", ... |
from __future__ import with_statement
from django.db import connection
from django.db import transaction
import gzip
import sys
def writeOneSkeleton(file, cursor, skid):
cursor.execute('''
select id, parent_id, location_x, location_y, location_z
from treenode
where skeleton_id=%s
''' % skid)
for... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: tower_job_template
author: "Wayne Witzel III (@wwitzel3)"
versi... |
import argparse
import itertools
import re
import sys
import unittest
from tuntap.packet_codec import TunPacketCodec, TunAFPacketCodec, TapPacketCodec
from tuntap.packet_reader import BlockingPacketSource, SelectPacketSource
from tuntap.test_char_dev import TestTunCharDev, TestTapCharDev
from tuntap.test_interface impo... |
from spack import *
class PyFlaskSocketio(PythonPackage):
"""Flask-SocketIO gives Flask applications access to low latency
bi-directional communications between the clients and the server.
The client-side application can use any of the SocketIO official clients
libraries in Javascript, C++, Java and Swi... |
from spack import *
class Prodigal(MakefilePackage):
"""Fast, reliable protein-coding gene prediction for prokaryotic
genomes."""
homepage = "https://github.com/hyattpd/Prodigal"
url = "https://github.com/hyattpd/Prodigal/archive/v2.6.3.tar.gz"
version('2.6.3', '5181809fdb740e9a675cfdbb6c038466... |
import os
import robot
from keywordgroup import KeywordGroup
class _ScreenshotKeywords(KeywordGroup):
def __init__(self):
self._screenshot_index = 0
# Public
def capture_page_screenshot(self, filename=None):
"""Takes a screenshot of the current page and embeds it into the log.
`filen... |
from django_prometheus.db.metrics import * |
from c7n.filters import CrossAccountAccessFilter
from c7n.manager import resources
from c7n.query import QueryResourceManager
from c7n.utils import local_session
@resources.register('sns')
class SNS(QueryResourceManager):
resource_type = 'aws.sns.topic'
def augment(self, resources):
def _augment(r):
... |
"""Test sensor of Brother integration."""
from datetime import datetime, timedelta
import json
from homeassistant.components.brother.const import UNIT_PAGES
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_ENTITY_ID,
ATTR_ICON,
ATTR_UNIT_OF_MEASUREMENT,
DEVICE_CLASS_TIMESTAMP,
PERCENTAG... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import Permission
from django.contrib.auth.forms import PasswordResetForm
from .models import MyUser
from forms import CustomUserRegistrationForm
class PermissionAdmin(admin.ModelAdmin):
search_fields = ... |
import binascii
import glob
import os
import stat
import struct
import time
from distutils.version import LooseVersion
import pytest
import logging
from cassandra import WriteTimeout
from cassandra.cluster import NoHostAvailable, OperationTimedOut
from ccmlib.common import is_win
from ccmlib.node import Node, TimeoutEr... |
from typing import Any, Optional
import sqlalchemy
from django.db import connection
from zerver.lib.db import TimeTrackingConnection
class NonClosingPool(sqlalchemy.pool.NullPool):
def status(self) -> str:
return "NonClosingPool"
def _do_return_conn(self, conn: sqlalchemy.engine.base.Connection) -> None... |
import six
class Base(Exception):
error_code = 500
error_type = None
error_message = None
errors = None
def __init__(self, *args, **kwargs):
self.errors = kwargs.pop('errors', None)
self.object = kwargs.pop('object', None)
super(Base, self).__init__(*args, **kwargs)
i... |
from .utils import DslBase, BoolMixin, _make_dsl_class
from .function import SF, ScoreFunction
__all__ = [
'Q', 'Bool', 'Boosting', 'Common', 'ConstantScore', 'DisMax', 'Filtered',
'FunctionScore', 'Fuzzy', 'FuzzyLikeThis', 'FuzzyLikeThisField',
'GeoShape', 'HasChild', 'HasParent', 'Ids', 'Indices', 'Match'... |
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ScopedEnumType(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIf(dwarf_version=['<', '4'])
def test(self):
self.build()
... |
from collections import OrderedDict
from typing import Dict, Type
from .base import AssetServiceTransport
from .grpc import AssetServiceGrpcTransport
from .grpc_asyncio import AssetServiceGrpcAsyncIOTransport
_transport_registry = OrderedDict() # type: Dict[str, Type[AssetServiceTransport]]
_transport_registry["grpc"]... |
import webob
from keystone import middleware
from keystone import tests
class FakeApp(object):
"""Fakes a WSGI app URL normalized."""
def __call__(self, env, start_response):
resp = webob.Response()
resp.body = 'SUCCESS'
return resp(env, start_response)
class UrlMiddlewareTest(tests.Test... |
"""Define constants for the Ambient PWS component."""
DOMAIN = "ambient_station"
ATTR_LAST_DATA = "last_data"
CONF_APP_KEY = "app_key"
DATA_CLIENT = "data_client"
TOPIC_UPDATE = "update"
TYPE_BINARY_SENSOR = "binary_sensor"
TYPE_SENSOR = "sensor" |
"""
@package mi.dataset.parser.test.test_adcpt_acfgm
@fid marine-integrations/mi/dataset/parser/test/test_adcpt_acfgm.py
@author Ronald Ronquillo
@brief Test code for a Adcpt_Acfgm_Dcl data parser
"""
from nose.plugins.attrib import attr
import os
from mi.core.log import get_logger
from mi.dataset.parser.utilities impo... |
"""
logbook.ticketing
~~~~~~~~~~~~~~~~~
Implements long handlers that write to remote data stores and assign
each logging message a ticket id.
:copyright: (c) 2010 by Armin Ronacher, Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
from time import time
import json
from logbook.bas... |
"""
ML Estimation of Spatial Error Model
"""
__author__ = "Luc Anselin luc.anselin@asu.edu, Serge Rey srey@asu.edu"
import numpy as np
import numpy.linalg as la
import pysal as ps
from pysal.spreg.utils import RegressionPropsY, RegressionPropsVM
import diagnostics as DIAG
import user_output as USER
import summary_outpu... |
from distutils.core import setup
setup(
name='snapboard',
version='0.2.1',
author='Bo Shi',
maintainer='SNAPboard developers',
maintainer_email='snapboard-discuss@googlegroups.com',
url='http://code.google.com/p/snapboard/',
description='Bulletin board application for Django.',
long_desc... |
"""Forest covertype dataset.
A classic dataset for classification benchmarks, featuring categorical and
real-valued features.
The dataset page is available from UCI Machine Learning Repository
https://archive.ics.uci.edu/ml/datasets/Covertype
Courtesy of Jock A. Blackard and Colorado State University.
"""
from gzip... |
from BinPy.combinational.combinational import * |
import datetime
from django.test import TestCase
from django.utils import timezone
from schedule.models import Event, Rule, Calendar, CalendarRelation
class TestCalendar(TestCase):
def setup(self):
pass
def __create_event(self, start, end):
data = {
'title': 'Recent Event',
... |
'''
This program illustrates the use of findContours and drawContours.
The original image is put up along with the image of drawn contours.
Usage:
contours.py
A trackbar is put up which controls the contour level from -3 to 3
'''
from __future__ import print_function
import sys
PY3 = sys.version_info[0] == 3
if PY3... |
from toontown.coghq.SpecImports import *
GlobalEntities = {1000: {'type': 'levelMgr',
'name': 'LevelMgr',
'comment': '',
'parentEntId': 0,
'cogLevel': 0,
'farPlaneDistance': 1500,
'modelFilename': 'phase_11/models/lawbotHQ/LB_Zone04a',
'wantDoors': 1},
1001: {'ty... |
import ibus
import dbus
bus = dbus.SessionBus()
e = ibus.interface.IPanel()
print e.Introspect("/", bus) |
"""
Unit tests for tools/variables.py.
@author: Kenneth Hoste (Ghent University)
@author: Stijn De Weirdt (Ghent University)
"""
from test.framework.utilities import EnhancedTestCase
from unittest import TestLoader, main
from easybuild.tools.variables import CommaList, StrList, Variables
from easybuild.tools.toolchain.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.