code stringlengths 1 199k |
|---|
from __future__ import unicode_literals
from __future__ import print_function
from mock_dbus import MockDBusInterface
import unittest
import pyconnman
import mock
import dbus
class ConnTechnologyTest(unittest.TestCase):
def setUp(self):
patcher = mock.patch('dbus.Interface', MockDBusInterface)
patch... |
import mock
from oslo_serialization import jsonutils
import webob
from jacket import context
from jacket import db
from jacket.objects import storage
from jacket.storage import test
from jacket.tests.storage.unit.api import fakes
from jacket.tests.storage.unit import utils
class VolumeUnmanageTest(test.TestCase):
"... |
"""This module create the GUI
"""
import sys
import os
import PyQt4.QtGui as QtGui
import PyQt4.QtCore as QtCore
import pyfinance.files as pyfiles
import pyfinance.pyf as pyf
class SQLiteAcctChooser(QtGui.QWidget):
"""SQLite account chooser
"""
def __init__(self, parent=None):
super(SQLiteAcctChoose... |
"""Provides service object for T1."""
from __future__ import absolute_import, division
from collections import Iterator
from types import GeneratorType
from .models import ACL
from .t1mappings import SINGULAR, CLASSES, CHILD_PATHS, MODEL_PATHS
from .connection import Connection
from .entity import Entity
from .errors i... |
import re
import time
import binascii
from collections import defaultdict
from . import wcwidth
from .displaying import colorme, FormattedValue, DEFAULT_VALUE_COLORS
from cql import cqltypes
unicode_controlchars_re = re.compile(r'[\x00-\x31\x7f-\xa0]')
controlchars_re = re.compile(r'[\x00-\x31\x7f-\xff]')
def _show_con... |
import __future__
import sys
import json
def banner():
ban = '====' * 30
print("{}\nSAMPLE INP:\n{}\n{}".format(ban,ban,open(ip, 'r').read()))
print("{}\nSAMPLE OUT:\n{}\n{}".format(ban,ban,open(op, 'r').read()))
print("{}\nSTART:\n{}".format(ban,ban))
sys.stdin = open(ip, 'r')
cnt = -1
def comp(inp... |
from neutron_lib.plugins import constants
from neutron_lib.plugins import directory
from gbpservice.common import utils
from gbpservice.neutron.services.grouppolicy.drivers import resource_mapping
from gbpservice.neutron.services.servicechain.plugins.ncp import model
def get_gbp_plugin():
return directory.get_plugi... |
import json
from http import HTTPStatus
from twisted.test.proto_helpers import MemoryReactor
import synapse.rest.admin
from synapse.rest.client import login, room
from synapse.server import HomeServer
from synapse.util import Clock
from tests import unittest
class IdentityTestCase(unittest.HomeserverTestCase):
serv... |
"""
Provides functionality to interact with climate devices.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/climate/
"""
from datetime import timedelta
import logging
import functools as ft
import voluptuous as vol
from homeassistant.loader import bind_h... |
__author__ = 'cooper'
assert __name__ != '__main__'
import logging.config
from utils.injection import *
logging.config.fileConfig('logging.conf')
appctx = ApplicationContextBuilder([
('mysql_url', value('mysql://python_dev:vao8Je1o@localhost/stock_dev')),
('mongo_url', value('mongodb://localhost:27017/')),
('work... |
from __future__ import print_function, unicode_literals
import argparse
import collections
import logging
import os
import sys
import glib
import gobject
from mopidy import config as config_lib, exceptions
from mopidy.audio import Audio
from mopidy.core import Core
from mopidy.utils import deps, process, versioning
log... |
from maintenance.views import RestartFramework, validate_data_files_view
from publications.views import EditPublication
__author__ = 'Ahmed G. Ali'
from django.conf.urls import patterns, url
from accounts import views as accounts_views
from publications import views as publications_views
urlpatterns = patterns(
'',... |
'''
Main modules for summarizer package.
Copyright, 2015.
Authors:
Luis Perez (luis.perez.live@gmail.com)
Kevin Eskici (keskici@college.harvard.edu)
'''
import os
import traceback
import nltk
import argparse
import sys
from . import grasshopper
from . import baselines
from . import textrank
tokenizer = nltk.data.load('... |
import pretend
from pyramid.httpexceptions import HTTPMovedPermanently
from warehouse.legacy.api import simple
from ....common.db.accounts import UserFactory
from ....common.db.packaging import (
ProjectFactory, ReleaseFactory, FileFactory, JournalEntryFactory,
)
class TestSimpleIndex:
def test_no_results_no_se... |
from hashlib import md5
import os
import urllib
import txweb2.dav.test.util
from txweb2 import responsecode
from txweb2.test.test_server import SimpleRequest
from txweb2.dav.test.util import dircmp, serialize
from txweb2.dav.fileop import rmdir
class COPY(txweb2.dav.test.util.TestCase):
"""
COPY request
"""... |
import sys, os, time, paramiko
from vnc_api import vnc_api
from novaclient.v2 import client
def wait():
for i in range(21):
sys.stdout.write('\r')
sys.stdout.write("[%-20s] %d%%" % ('='*i, 5*i))
sys.stdout.flush()
time.sleep(1)
def test_Connectivity(host1, host2, username, password):
""" FUNCT... |
"""Forwarding utils for backwards compatibility."""
from tf_agents.specs import bandit_spec_utils as _utils
GLOBAL_FEATURE_KEY = _utils.GLOBAL_FEATURE_KEY
PER_ARM_FEATURE_KEY = _utils.PER_ARM_FEATURE_KEY
NUM_ACTIONS_FEATURE_KEY = _utils.NUM_ACTIONS_FEATURE_KEY
REWARD_SPEC_KEY = _utils.REWARD_SPEC_KEY
CONSTRAINTS_SPEC_K... |
"""Utility functions supporting FAUCET/Gauge config parsing."""
import hashlib
import logging
import os
import yaml
from yaml.constructor import ConstructorError
try:
from yaml import CLoader as Loader # type: ignore
except ImportError:
from yaml import Loader
CONFIG_HASH_FUNC = 'sha256'
class UniqueKeyLoader(L... |
'''
The caller module is used as a front-end to manage direct calls to the salt
minion modules.
'''
from __future__ import absolute_import, print_function
import os
import sys
import time
import logging
import traceback
import multiprocessing
import salt
import salt.loader
import salt.minion
import salt.output
import s... |
from uploader.settings.test import *
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
'TEST_NAME': ':memory:',
},
} |
"""
Cloudbreak API
Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloudbreak is a RESTful... |
class Solution:
def multiply(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
# return str(int(num1) * int(num2))
if '0' in (num1, num2):
return '0'
m, n = len(num1), len(num2)
res = [0] * (m + n)
for i... |
import wx
from cairis.core.armid import *
from datetime import datetime
from RevisionEntryDialog import RevisionEntryDialog
__author__ = 'Shamal Faily'
class RevisionListCtrl(wx.ListCtrl):
def __init__(self,parent):
wx.ListCtrl.__init__(self,parent,PROJECTSETTINGS_LISTREVISIONS_ID,size=wx.DefaultSize,style=wx.LC_... |
import tensorflow as tf
from preprocessing import crop
MEAN = tf.constant([123.68, 116.78, 103.94], dtype=tf.float32) # IMAGENET
def preprocess_image(image, output_height, output_width, is_training=False):
# Crop
img_crop = crop.preprocess_image(image, output_height, output_width, is_training)
# Subtract th... |
from typing import Optional, Tuple, Union
from . import array_types
from iree.compiler import (
ir,
passmanager,
)
from iree.compiler.transforms import (
ireec,)
import jax.core
import jax.interpreters.mlir
import jax.numpy as jnp
from jax._src.lib.mlir import ir as jax_ir
from jax.interpreters.xla import a... |
import logging
LOG_LEVEL = logging.DEBUG
LOG_DIR = ''
ENVIROMENT_PATH = ''
LOG_FORMAT = "%(asctime)s - %(levelname)s - %(message)s"
DEV_CLOUD_IP_ADDRESS = ''
DEV_CLOUD_DATA = {
'site_domain': DEV_CLOUD_IP_ADDRESS, # Web interface address for activation link
'site_name': 'Dev Cloud' # System name in emails
}
A... |
import sys
sys.path.insert(0, 'lib')
import endpoints
import os
from google.appengine.ext import ndb
from google.appengine.ext.ndb import msgprop
from protorpc import messages
from protorpc import remote
from endpoints_proto_datastore.ndb import EndpointsModel
from endpoints_proto_datastore.ndb import EndpointsAliasPro... |
from __future__ import unicode_literals
import datetime
from six.moves.urllib.request import urlopen
from six.moves.urllib.error import HTTPError
from functools import wraps
from gzip import GzipFile
from io import BytesIO
import zlib
import json
import boto
import boto3
from botocore.client import ClientError
import b... |
class Solution(object):
def sortedArrayToBST(self, nums):
"""
:type nums: List[int]
:rtype: TreeNode
"""
if (not nums):
return None
n = len(nums)
mid = int(math.floor(n/2))
root = TreeNode(nums[mid])
root.left = self.sortedArrayToBS... |
"""
blast2gff.py [options] <blast file>
"""
import sys
from optparse import OptionParser
from blast import BlastFile
import gff
usage = "%prog [options] <blast file>"
parser = OptionParser(usage=usage)
parser.add_option(
"-s", "--source",
dest="source",
help="GFF source (Default: match)",
default='match... |
from setuptools import setup, find_packages
requirements = [
"sphinx",
"requests",
]
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3",
"Topic :: Software Developme... |
def id_generator():
id_ = 0
while True:
yield id_
id_ += 1
class PersistentIDManager:
def __init__(self):
self._id_generator = id_generator()
self._persistent_to_temporary = {}
self._temporary_to_persistent = {}
def create_persistent_id(self, temporary_id):
... |
from jira.client import GreenHopper
options = {
'server': 'https://jira.atlassian.com'}
gh = GreenHopper(options)
boards = gh.boards()
board_id = 441
print("GreenHopper board: %s (%s)" % (boards[0].name, board_id))
sprints = gh.sprints(board_id)
for sprint in sprints:
sprint_id = sprint.id
print("Sprint: %s... |
__all__ = [
'ExecutionError',
'NoDispatch',
'InvalidLibraryDefinition',
'CustomSyntaxError'
]
class ExecutionError(Exception):
"""
Raised when we are unable to execute a certain lazy or immediate
expression.
"""
class NoDispatch(Exception):
def __init__(self, aterm):
self.ate... |
import os
import sys
from barf.barf import BARF
if __name__ == "__main__":
#
# Open file
#
try:
filename = os.path.abspath("../../bin/x86/branch4")
barf = BARF(filename)
except Exception as err:
print err
print "[-] Error opening file : %s" % filename
sys.exit... |
import pytest
from fabric.api import run
from fabtools.utils import run_as_root
pytestmark = pytest.mark.network
@pytest.fixture(scope='module', autouse=True)
def check_for_debian_family():
from fabtools.system import distrib_family
if distrib_family() != 'debian':
pytest.skip("Skipping apt-key test on ... |
from JumpScale import j
parentclass=j.core.osis.getOsisImplementationParentClass("_arakoonmodelobjects") #is the name of the namespace
class mainclass(parentclass):
"""
"""
def getObject(self,ddict={}):
obj=j.core.grid.zobjects.getModelObject(ddict=ddict)
return obj |
"""Utility for converting a bunch of #defined (integer!) constants
into a Python dictionary
To use this, you'll want to create a new header file that just
contains lines such as::
#define FOO 0
Every line that doesn't start with #define will be ignored.
"""
from __future__ import print_function
def convert(defines):
... |
"""
Maintain a ``global'' dict stack
def doit():
Context.curr()['a'] = 10
...
ctx = Context()
with ctx:
doit()
ctx => { 'a' : 10 }
"""
import threading
import types
class Context(dict):
__thstat__ = threading.local()
__thstat__.curr = None
def __init__(self, *args, **kwargs):
dict.__init__(s... |
import os
from uliweb import manage
from uliweb.orm import *
from uliweb.manage import make_simple_application
os.chdir('test_multidb')
manage.call('uliweb syncdb -v')
manage.call('uliweb syncdb -v --engine=b')
manage.call('uliweb syncdb -v --engine=c')
def test_1():
"""
>>> app = make_simple_application(projec... |
import sys
import uvint
import io
from pathlib import Path
def main():
path = Path(sys.argv[1])
out = Path(sys.argv[2])
with open(out, 'wb') as f:
decompress(f, path.read_bytes())
def decompress(file, buf):
input = io.BytesIO(buf)
def read_uvint():
return uvint.decode_from_file(inpu... |
try:
import bluetooth
BT_address = '00:12:02:09:05:16'
BT_port = 1
BT_socket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
BT_socket.connect((BT_address, BT_port))
BT_available = True
except:
BT_available = False
print 'No bluetooth device is available'
class RoMIE:
def _wait_ack(self):
if not BT_available... |
"""
Multiobjective Optimization with Femag
"""
import sys
import json
import femagtools.opt
import logging
import glob
import pathlib
import os
from femagtools.multiproc import Engine
opt = {
"objective_vars": [
{"desc": "Torque / Nm", "name": "dqPar.torque[-1]", "sign": -1},
{"desc": "Torque Ripp... |
"""Command line tool for advanced search on Python Package Index."""
__author__ = 'Radosław Ganczarek'
__email__ = 'radoslaw@ganczarek.in'
__version__ = '0.1.0' |
from django.db import models
from . import settings
class PageElement(models.Model):
"""
Elements of an editable HTML page.
"""
slug = models.CharField(max_length=50)
text = models.TextField(blank=True)
account = models.ForeignKey(
settings.ACCOUNT_MODEL, related_name='account_page_eleme... |
"""
ExternalInstance class module
"""
from pyxform.survey_element import SurveyElement
class ExternalInstance(SurveyElement):
def xml_control(self):
"""
No-op since there is no associated form control to place under <body/>.
Exists here because there's a soft abstractmethod in SurveyElement.... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import re
from indra.statements import *
from indra.assemblers.html.assembler import HtmlAssembler, template_path, \
tag_text
def make_stmt():
src = Agent('SRC', db_ref... |
from nephoria.baseops.botobaseops import BotoBaseOps
import boto
from boto.ec2.regioninfo import RegionInfo
from boto.sts import STSConnection
class STSops(BotoBaseOps):
SERVICE_PREFIX = 'ec2'
EUCARC_URL_NAME = 'sts_url'
CONNECTION_CLASS = STSConnection
def get_session_token( self, duration=None ):
... |
import os
from mi.logging import config
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.driver.cg_cpm_eng.cpm.cg_cpm_eng_cpm_common_driver import CgCpmEngCpmDriver
from mi.core.versioning import version
@version("15.7.0")
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj):
... |
import warnings
from django.template import Library
from django.template import defaulttags
from django.utils.deprecation import RemovedInDjango19Warning
register = Library()
@register.tag
def ssi(parser, token):
warnings.warn(
"Loading the `ssi` tag from the `future` library is deprecated and "
"wi... |
from datetime import timedelta
import operator
from typing import Any, Callable, List, Optional, Sequence, Type, Union
import numpy as np
from pandas._libs.tslibs import (
NaT,
NaTType,
Timedelta,
delta_to_nanoseconds,
frequencies as libfrequencies,
iNaT,
period as libperiod,
to_offset,
... |
import os
print '/'.join(os.path.abspath(__file__).split('/')[:-2]) |
from django.conf import settings
from django.contrib.auth import login as auth_login, REDIRECT_FIELD_NAME
from django.contrib.auth.views import redirect_to_login
from django.core.urlresolvers import resolve, Resolver404, reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.utils.cache import p... |
from . import BOTH
from time import time
def time_no_fracs(target, offset=0, when=BOTH):
def func(dizzy_iterator):
dizzy_iterator[target] = int(time() + offset)
return (func, when)
def time(target, offset=0, when=BOTH):
def func(dizzy_iterator):
now = time.time() + offset
secs = int(... |
"""Clean up all docker caches."""
import subprocess
print(subprocess.check_output(['docker', 'system', 'prune', '-fa'])) |
import datetime
import os
from collections import defaultdict
from django import forms
from django.conf import settings
import basket
import happyforms
import waffle
from tower import ugettext as _, ugettext_lazy as _lazy
import amo
from amo.utils import slug_validator
from mkt.comm.utils import create_comm_note
from m... |
"""
File for specifying the filters handled by mailhandler.
"""
import helpers as h
import sys
sys.path.append('/path/to/django/project')
from django.core.management import setup_environ
from django_project import settings
setup_environ(settings)
from django_app import models
def run_filter(instance):
"""
run_filter fu... |
import os, sys
import shutil
from .utils import get_environment_label
NPATH = os.path.expanduser("~/Library/Services/")
PATH = "%s/bin"%sys.exec_prefix
CONDA_ENV_LABEL = get_environment_label()
def add_jupyter_here():
if not os.path.exists(NPATH):
print("Nothing done. User Library is unavailable, are you su... |
import qpy
import qpy_test
print(qpy.tr("hello")) |
from django.db import models
class Topic(models.Model):
name = models.CharField(editable=True, null=False, max_length=255)
# order = models.IntegerField(null=False,
# default=0,
# editable=True,
# help_text='Position... |
import uuid
from copy import deepcopy
from django.test import SimpleTestCase, TestCase
from pillowtop.checkpoints.manager import PillowCheckpoint
from pillowtop.feed.interface import ChangeMeta
from pillowtop.pillow.interface import ConstructedPillow
from pillowtop.processors.sample import CountingProcessor
from corehq... |
import suffix_array
def crush(script):
escape_chars = [unichr(i).encode('utf-8') for i in range(1024)]
escape_chars[:] = (
escape_chars[32:128] +
escape_chars[0:32] +
escape_chars[128:1024])
used_chars = set()
used_chars.add('"')
for s in script:
used_chars.add(s)
for c in used_chars:
escape_chars.remov... |
"""
sentry.utils.javascript
~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from collections import defaultdict
from datetime import timedelta
from django.core.urlresolvers import ... |
from setuptools import setup, find_packages
import os
version = __import__('cms_themes').__version__
install_requires = [
'setuptools',
'django',
'django-cms',
]
setup(
name = "django-cms-themes",
version = version,
url = 'http://github.com/megamark16/django-cms-themes',
license = 'BSD',
... |
import requests
import pprint
import jsonschema
import json
import logging
import time
import urllib.request
import urllib.parse
import urllib.error
from requests.exceptions import ReadTimeout, ConnectTimeout
from pymacaron_core.exceptions import PyMacaronCoreException, ValidationError
from pymacaron_core.utils import ... |
"""
A class that represents a unit symbol.
"""
import copy
import itertools
import math
import numpy as np
from functools import lru_cache
from numbers import Number as numeric_type
from sympy import (
Expr,
Mul,
Add,
Number,
Pow,
Symbol,
Float,
Basic,
Rational,
Mod,
floor,
)... |
import subprocess
import re
import sys
import os.path
class Crawler:
@staticmethod
def parse_simout(filename):
simout = open(filename, 'r')
for line in simout:
if 'command line:' in line:
tmpcmd = line.replace('command line:', '')
tmpcmd = tmpcmd.repla... |
from copy import deepcopy
import anyjson as json
import logging
import time
from django.db import connection, transaction
from django.db.models.query import QuerySet
from mypage.pages.models import Page
from mypage.pages.layout import WidgetInLayout
log = logging.getLogger('mypage.pages.migrations')
get_page_wips_query... |
from mkt.fireplace.serializers import (FireplaceESAppSerializer,
FireplaceESWebsiteSerializer)
class GamesESAppSerializer(FireplaceESAppSerializer):
"""Include tags."""
class Meta(FireplaceESAppSerializer.Meta):
fields = FireplaceESAppSerializer.Meta.fields + ['tag... |
from django.test import TestCase
from django.contrib.sites.models import Site
from faq.settings import DRAFTED
from faq.models import Topic, Question, OnSiteManager
class BaseTestCase(TestCase):
""""""
fixtures = ['test_data']
def setUp(self):
# Setup some new objects. We want these instead of ones ... |
from __future__ import print_function
from nose import SkipTest
from pythonic_testcase import *
from soapfish import xsd
from soapfish import wsdl2py
from soapfish.testutil import generated_symbols
class XSDCodeGenerationTest(PythonicTestCase):
def test_can_generate_code_for_two_schemas(self):
raise SkipTes... |
import unittest
import sys
import os
import tempfile
import shutil
import textwrap
from alphatwirl.concurrently import HTCondorJobSubmitter
class MockWorkingArea(object):
def open(self):
self.path = tempfile.mkdtemp()
def close(self):
shutil.rmtree(self.path)
self.path = None
def pac... |
"""Task results tests."""
from mock import patch
import requests
import requests.exceptions
import tests.helper
import snowfloat.task
class ResultsTests(tests.helper.Tests):
"""Task results tests."""
task = snowfloat.task.Task(
operation='test_operation_1',
uuid='test_task_1',
uri='/geo/... |
from flask import Blueprint, render_template
touch_panels = Blueprint('touch_panels', __name__, url_prefix='/products/touch_panels')
@touch_panels.route('/')
def touch_panels_landing():
return render_template('/touch_panels/touch_panels_landing_en.html', title='Touch Panels | OPTO Logic TECHNOLOGY')
@touch_panels.r... |
"""
Vumi scalable text messaging engine.
"""
__version__ = "0.5.20a0" |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
# Flag to indicate if this migration is too risky
# to run online and needs to be coordinated for offline
is_dangerous = False
de... |
import os
import io
import unittest
import json
from . import bodystructure
from .fhirdate import FHIRDate
class BodyStructureTests(unittest.TestCase):
def instantiate_from(self, filename):
datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or ''
with io.open(os.path.join(datadir, filename), 'r', enc... |
import math
from .optimizer import Optimizer
class Adam(Optimizer):
"""Implements Adam algorithm.
It has been proposed in `Adam: A Method for Stochastic Optimization`_.
Arguments:
params (iterable): iterable of parameters to optimize or dicts defining
parameter groups
lr (float, ... |
from django import forms
from ietf.iesg.models import TelechatAgendaItem
from ietf.doc.models import State
from ietf.name.models import BallotPositionName, DocTagName
TELECHAT_TAGS = ('point','ad-f-up','extpty','need-rev')
class BallotForm(forms.Form):
name = forms.CharField(max_length=50,widget=forms.HiddenInput)
... |
from django.db import models
from django.test import TestCase
from principals.fields import PrincipalField
class SinglePrinc(models.Model):
name = models.CharField(max_length=255)
principal = PrincipalField(default=False)
class MultiplePrinc(models.Model):
name = models.CharField(max_length=255)
princip... |
import os
from setuptools import find_packages, setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname), encoding="utf-8").read()
def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "... |
"""The app module, containing the app factory function."""
from flask import Flask, render_template
from lego_me import public, user
from lego_me.assets import assets
from lego_me.extensions import bcrypt, cache, db, debug_toolbar, login_manager, migrate
from lego_me.settings import ProdConfig
def create_app(config_obj... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 12, transform = "Logit", sigma = 0.0, exog_count = 20, ar_order = 0); |
from graphserver.core import Graph, TripBoard, HeadwayBoard, HeadwayAlight, Crossing, TripAlight, Timezone, Street, Link, ElapseTime
from optparse import OptionParser
from graphserver.graphdb import GraphDatabase
from graphserver.ext.gtfs.gtfsdb import GTFSDatabase, parse_gtfs_date
import sys
import pytz
from tools imp... |
import datetime
from django.test import TestCase
from dojo.models import Test, Finding
from dojo.tools.cyclonedx.parser import CycloneDXParser
class TestParser(TestCase):
def test_grype_report(self):
with open("dojo/unittests/scans/cyclonedx/grype_dd_1_14_1.xml") as file:
parser = CycloneDXParse... |
"""
===================
NEXRAD Level 2 File
===================
Use MetPy to read information from a NEXRAD Level 2 (volume) file and plot
"""
import matplotlib.pyplot as plt
import numpy as np
from metpy.cbook import get_test_data
from metpy.io import Level2File
from metpy.plots import add_metpy_logo, add_timestamp
na... |
from ....testing import assert_equal
from ..utils import FWHMx
def test_FWHMx_inputs():
input_map = dict(acf=dict(argstr='-acf',
usedefault=True,
),
args=dict(argstr='%s',
),
arith=dict(argstr='-arith',
xor=[u'geom'],
),
automask=dict(argstr='-automask',
usedefault=True,
),
... |
from __future__ import print_function
import sys
import os.path
from pip.req import parse_requirements
try:
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
except ImportError:
from distutils.core import setup
VERSION = "0.0.1"
def get_local_file(path):
... |
import threading
import zmq
import leveldb
import json
import optparse
from time import sleep
class workerThread(threading.Thread):
"""workerThread"""
def __init__(self, context, db):
threading.Thread.__init__ (self)
self.context = context
self.db = db
self.running = True
... |
import pageadmin
import useradmin
import permissionadmin |
""" General descriptor testing code
"""
from rdkit import RDConfig
import unittest,os.path
from rdkit import Chem
from rdkit.Chem import Descriptors
from rdkit.Chem import AllChem
from rdkit.Chem import rdMolDescriptors
import numpy as np
def feq(n1,n2,tol=1e-4):
return abs(n1-n2)<=tol
class TestCase(unittest.TestCas... |
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("stories", "0012_story_written_by")]
operations = [
migrations.AlterField(
model_name="story",
name="created_on",
field=models.DateTimeField(
... |
import tests.periodicities.period_test as per
per.buildModel((5 , 'B' , 1600)); |
"""Generate template values for a callback function.
Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
"""
from v8_globals import includes # pylint: disable=W0403
import v8_utilities # pylint: disable=W0403
CALLBACK_FUNCTION_H_INCLUDES = frozenset([
'bindings/core/v8/NativeValueTraits.h... |
from __future__ import unicode_literals
import logging
from django.views.generic import CreateView, UpdateView, DeleteView
from dj_diabetes.models import InitMixin, SuccessMixin, PaginateMixin
from dj_diabetes.views import LoginRequiredMixin
from dj_diabetes.models.meals import Meals
from dj_diabetes.forms.base import ... |
import numpy as np
from GPy.inference.latent_function_inference.var_dtc import VarDTC
from GPy.util.linalg import jitchol, tdot, dtrtri, dtrtrs, backsub_both_sides,\
dpotrs, dpotri, symmetrify, mdot
from GPy.core.parameterization.variational import VariationalPosterior
from GPy.util import diag
from GPy.inference.l... |
import collections
import datetime
import operator
import os
import time
import subprocess
from PyQt4 import QtCore, QtGui, Qt
import emdash.config
import emdash.log
def starstring(stars):
return emdash.config.get('starclosed') * stars + emdash.config.get('staropen') * (5-stars)
class ControlMenu(QtGui.QMenu):
... |
from django.conf import settings
from django.http import HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.views.generic import ListView, DetailView
from django.db.models import get_model
from django.utils.translation import ugettext_lazy as _
from oscar.core.loading import get_cl... |
from django.conf import settings
def enabled_social_auth(request):
return {'ENABLED_SOCIAL_AUTH': settings.ENABLED_SOCIAL_AUTH} |
""" Test the adaptation manager. """
import sys
from traits.adaptation.api import AdaptationManager, adapt
import traits.adaptation.tests.abc_examples
import traits.adaptation.tests.interface_examples
from traits.testing.unittest_tools import unittest
class TestAdaptationManagerWithABC(unittest.TestCase):
""" Test ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.