code
stringlengths
1
199k
"""The WebDriver implementation.""" from ..common.exceptions import ErrorInResponseException from ..common.exceptions import InvalidSwitchToTargetException from ..common.exceptions import NoSuchElementException import utils from webelement import WebElement from remote_connection import RemoteConnection class WebDriver...
"""Helper classes to implement caching.""" __author__ = 'Pavel Simakov (psimakov@google.com)' import collections import datetime import logging import sys import threading import unittest import appengine_config from models.counters import PerfCounter def iter_all(query, batch_size=100): """Yields query results ite...
"""The tests for the time_pattern automation.""" from datetime import timedelta from unittest.mock import patch import pytest import voluptuous as vol import homeassistant.components.automation as automation import homeassistant.components.homeassistant.triggers.time_pattern as time_pattern from homeassistant.const imp...
""" PlugIn for Nexus OS driver """ import logging from neutron.common import exceptions as exc from neutron.openstack.common import excutils from neutron.openstack.common import importutils from neutron.plugins.cisco.common import cisco_constants as const from neutron.plugins.cisco.common import cisco_credentials_v2 as...
""" Provider info for CloudStack """ from perfkitbenchmarker import providers from perfkitbenchmarker import provider_info class CloudStackProviderInfo(provider_info.BaseProviderInfo): UNSUPPORTED_BENCHMARKS = ['mysql_service'] CLOUD = providers.CLOUDSTACK
import mock from st2actions.runners import announcementrunner from st2common.constants.action import LIVEACTION_STATUS_SUCCEEDED from st2common.models.api.trace import TraceContext from base import RunnerTestCase import st2tests.config as tests_config mock_dispatcher = mock.Mock() @mock.patch('st2common.transport.annou...
"""Utils for use from the console. Includes functions that are used by interactive console utilities such as approval or token handling. """ import getpass import os import time import logging from grr.lib import access_control from grr.lib import aff4 from grr.lib import data_store from grr.lib import flow from grr.li...
import logging import json import re from webob import Response from ryu.app import conf_switch_key as cs_key from ryu.app.wsgi import ControllerBase, WSGIApplication, route from ryu.base import app_manager from ryu.controller import conf_switch from ryu.controller import ofp_event from ryu.controller import dpset from...
import unittest try: import unittest.mock as mock except ImportError: import mock from cloudbaseinit import conf as cloudbaseinit_conf from cloudbaseinit.plugins.common.userdataplugins import cloudconfig from cloudbaseinit.tests import testutils CONF = cloudbaseinit_conf.CONF class CloudConfigPluginTests(unitte...
import mock from oslo.config import cfg from neutron.common import constants as n_const import neutron.db.api as ndb from neutron.extensions import portbindings from neutron.plugins.ml2.drivers.arista import db from neutron.plugins.ml2.drivers.arista import exceptions as arista_exc from neutron.plugins.ml2.drivers.aris...
"""Unit tests to cover Logger.""" __author__ = 'api.jdilallo@gmail.com (Joseph DiLallo)' import logging import os import sys sys.path.insert(0, os.path.join('..', '..', '..', '..')) import unittest from adspygoogle.common import Utils from tests.adspygoogle.dfa.v1_19 import client from tests.adspygoogle.dfa.v1_19 impor...
import copy from tempest import auth from tempest import exceptions from tempest.services.identity.v2.json import token_client as v2_client from tempest.services.identity.v3.json import token_client as v3_client from tempest.tests import base from tempest.tests import fake_identity class CredentialsTests(base.TestCase)...
from oslo_config import cfg from nova import db from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit.api.openstack import fakes CONF = cfg.CONF CONF.import_opt('osapi_compute_extension', 'nova.api.openstack.compute.legacy_v2.extensions') class ExtendedVolumesSampleJsonTes...
"""Tests for the image export front-end.""" import os import shutil import tempfile import unittest from dfvfs.lib import definitions as dfvfs_definitions from dfvfs.path import factory as path_spec_factory from dfvfs.resolver import resolver as path_spec_resolver from plaso.frontend import image_export from tests.fron...
from django.core.urlresolvers import reverse from django import forms from django import http from django import shortcuts from django.template import defaultfilters from mox import IsA # noqa from horizon import tables from horizon.tables import formset as table_formset from horizon.tables import views as table_views...
"""This file contains a class to provide a hashing framework to Plaso. This class contains a base framework class for parsing files. """ import abc class BaseHasher(object): """Class that provides the interface for hashing functionality.""" NAME = u'base_hasher' DESCRIPTION = u'' @abc.abstractmethod def Updat...
import json from tests.api import test_api class TestAPICompanies(test_api.TestAPI): def test_get_companies(self): with test_api.make_runtime_storage( {'repos': [{'module': 'nova', 'project_type': 'openstack', 'organization': 'openstack', ...
input = """ num(2). node(a). p(N) :- num(N), #count{Y:node(Y)} = N1, <=(N,N1). """ output = """ {node(a), num(2)} """
"""Operations for np_box_mask_list.BoxMaskList. Example box operations that are supported: * Areas: compute bounding box areas * IOU: pairwise intersection-over-union scores """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from six.m...
import unittest import cbs class AttrSettings(): PROJECT_NAME = 'fancy_project' class MethodSettings(): def PROJECT_NAME(self): return 'fancy_project' class TestApply(unittest.TestCase): def test_apply_settings_attr(self): cbs.apply(AttrSettings, globals()) self.assertEqual(PROJECT_N...
""" Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. Follow up: Could you do it without any loop/recursion in O(1) runtime? """ class Solution(object): ...
""" ========================================================================== Gaussian processes on discrete data structures ========================================================================== This example illustrates the use of Gaussian processes for regression and classification tasks on data that are not in ...
from __future__ import print_function import os import sys import ast import textwrap import warnings import functools import traceback import collections from . import crypt from .str import format from .file import mktemp from . import minisix from . import internationalization as _ def warn_non_constant_time(f): ...
import numpy as np import os def get_b777_engine(): this_dir = os.path.split(__file__)[0] nt = 12 * 11 * 8 xt = np.loadtxt(os.path.join(this_dir, "b777_engine_inputs.dat")).reshape((nt, 3)) yt = np.loadtxt(os.path.join(this_dir, "b777_engine_outputs.dat")).reshape((nt, 2)) dyt_dxt = np.loadtxt(os.pa...
import os import click from .. import multiprocess def fetch_config(ctx): """ Fetch `config_file` from context """ config = ctx.obj and ctx.obj.get('config', None) if not config: _opts = dict((o.name, o) for o in ctx.parent.command.params) raise click.BadParameter('Must specify configura...
from __future__ import absolute_import, division, print_function, unicode_literals import pytest ; pytest import six from bokeh.document import Document import bokeh.application.handlers.code as bahc script_adds_two_roots = """ from bokeh.io import curdoc from bokeh.model import Model from bokeh.core.properties import ...
""" A top level harness to run all unit-tests in a specific engine build. """ import argparse import glob import os import re import subprocess import sys import time buildroot_dir = os.path.abspath(os.path.join(os.path.realpath(__file__), '..', '..', '..')) out_dir = os.path.join(buildroot_dir, 'out') golden_dir = os....
import sys import exceptions import vtk import array from vtk.test import Testing class TestDataEncoder(Testing.vtkTest): def testEncodings(self): # Render something cylinder = vtk.vtkCylinderSource() cylinder.SetResolution(8) cylinderMapper = vtk.vtkPolyDataMapper() cylinder...
from geode import * import ast def test_list(): x = [1,2,3] y = list_convert_test(x) assert type(x)==type(y) assert x==y def test_set(): x = set([1,2,3]) y = set_convert_test(x) assert type(x)==type(y) def test_dict(): x = {1:'a',2:'b',3:'c'} y = dict_convert_test(x) assert type(x)==type(y) assert...
import unittest import sys sys.path.insert(0, '..') sys.path.insert(0, '../.libs') sys.path.insert(0, '../../../build/bindings/python') from pywsman import * class TestAddSelector(unittest.TestCase): def test_add_selector(self): client = Client( "http://wsman:secret@localhost:5985/wsman" ) assert cl...
from django.test import TestCase import uuid from dimagi.utils.parsing import json_format_datetime from casexml.apps.case.mock import CaseBlock from casexml.apps.case.models import CommCareCase from casexml.apps.case.util import post_case_blocks from casexml.apps.case.xml import V2 from corehq.apps.domain.shortcuts imp...
import unittest import thread_cert BR = 1 ROUTER = 2 HOST = 3 SMALL_NAT64_PREFIX = "fd00:00:00:01:00:00::/96" class Nat64SingleBorderRouter(thread_cert.TestCase): USE_MESSAGE_FACTORY = False TOPOLOGY = { BR: { 'name': 'BR', 'allowlist': [ROUTER], 'is_otbr': True, ...
from logging import Logger from os.path import join from django.utils.timezone import now from django.contrib.sites.models import Site from django.core.urlresolvers import reverse from django.core.cache import cache from django.conf import settings from django.db import models from django.shortcuts import get_object_or...
import qiime2.core.path as qpath class FormatBase: def __init__(self, path=None, mode='w'): import qiime2.plugin.model as model if path is None: if mode != 'w': raise ValueError("A path must be provided when reading.") else: if mode != 'r': ...
from flask import Blueprint suggestion = Blueprint('suggestion', __name__) from . import views # noqa
"""对应于save all""" from QUANTAXIS.QASU.main import (QA_SU_save_etf_day, QA_SU_save_etf_min, QA_SU_save_financialfiles, QA_SU_save_index_day, QA_SU_save_index_min, QA_SU_save_stock_block, QA_SU_save_stock_day, ...
"""Base class for a Comm""" import threading import uuid from zmq.eventloop.ioloop import IOLoop from IPython.config import LoggingConfigurable from IPython.kernel.zmq.kernelbase import Kernel from IPython.utils.jsonutil import json_clean from IPython.utils.traitlets import Instance, Unicode, Bytes, Bool, Dict, Any cla...
"""Calliope parsing errors for logging and collecting metrics. Refer to the calliope.parser_extensions module for a detailed overview. """ import argparse class ArgumentError(argparse.ArgumentError): """Base class for argument errors with metrics. ArgumentError instances are intercepted by parser_extensions.Argum...
def match(command, settings): return (command.script.startswith('go run ') and not command.script.endswith('.go')) def get_new_command(command, settings): return command.script + '.go'
import numpy as np class Skeleton: def __init__(self, parents, joints_left, joints_right): assert len(joints_left) == len(joints_right) self._parents = np.array(parents) self._joints_left = joints_left self._joints_right = joints_right self._compute_metadata() def num_joints(self): return le...
from . import base __all__ = ['TestExecutor'] class TestExecutor(object): """ An executor that just stores the request and passes a pre-set response to the parser. """ def set_response(self, content, code, headers): self.content = content self.code = code self.headers = heade...
""" Dummy easyblock for software that uses the GNU installation procedure, i.e. configure/make/make install. @author: Kenneth Hoste (Ghent University) """ from easybuild.framework.easyblock import EasyBlock from easybuild.framework.easyconfig import CUSTOM class ConfigureMake(EasyBlock): """Dummy support for buildi...
"""Utility methods to help find, authenticate or register a remote user.""" from flask import current_app from flask_login import logout_user from invenio.base.globals import cfg from invenio.ext.login import UserInfo, authenticate from invenio.ext.sqlalchemy import db from invenio_accounts.models import User, UserEXT ...
""" WebJournal templates - Defines the look of various parts of the WebJournal modules. Most customizations will however be done through BibFormat format templates files. """ import os from six import iteritems from invenio.config import \ CFG_SITE_SUPPORT_EMAIL, \ CFG_ETCDIR, \ CFG_SITE_URL, \ CFG_...
from __future__ import absolute_import from __future__ import print_function from twisted.internet import defer from twisted.internet import task from twisted.trial import unittest from buildbot import util from buildbot.util import misc class deferredLocked(unittest.TestCase): def test_name(self): self.ass...
_FEATURES_H = 1 _GNU_SOURCE = 1 __USE_ANSI = 1 __FAVOR_BSD = 1 _BSD_SOURCE = 1 _SVID_SOURCE = 1 _POSIX_SOURCE = 1 _POSIX_C_SOURCE = 2 __USE_POSIX = 1 __USE_POSIX2 = 1 __USE_MISC = 1 __USE_BSD = 1 __USE_SVID = 1 __USE_GNU = 1 __GNU_LIBRARY__ = 1 _SYS_CDEFS_H = 1 def __P(args): return args def __P(args): return args def ...
""" Integrity test of a big guest vmcore, using the dump-guest-memory QMP command and the "crash" utility. :copyright: 2013 Red Hat, Inc. :author: Laszlo Ersek <lersek@redhat.com> Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=990118 """ import logging from virttest.aexpect import ShellCmdError from autotest...
""" """ from pygame.locals import * from const import * import widget, surface import basic class _button(widget.Widget): def __init__(self,**params): widget.Widget.__init__(self,**params) self.state = 0 def event(self,e): if e.type == ENTER: self.repaint() elif e.type == EXIT: s...
from setuptools import setup, find_packages from hooker_common import release install_requires = [ 'colorama', 'elasticsearch>=1.0.0,<2.0.0' ] setup( name = release.name, packages = find_packages(), version = release.version, license = release.licenseName, description = release.description, ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: rax_dns_record short_description: Manage DNS records on Rackspa...
from using_extend import * f = FooBar() if f.blah(3) != 3: raise RuntimeError, "blah(int)" if f.blah(3.5) != 3.5: raise RuntimeError, "blah(double)" if f.blah("hello") != "hello": raise RuntimeError, "blah(char *)" if f.blah(3, 4) != 7: raise RuntimeError, "blah(int,int)" if f.blah(3.5, 7.5) != (3.5 + 7...
try: import docker HAS_DOCKER = True except ImportError: HAS_DOCKER = False from distutils.version import StrictVersion from bases.FrameworkServices.SimpleService import SimpleService ORDER = [ 'running_containers', 'healthy_containers', 'unhealthy_containers' ] CHARTS = { 'running_container...
import zipfile import xml.sax from xml.sax import handler from xml.sax.xmlreader import InputSource from xml.sax.saxutils import escape, quoteattr try: from cStringIO import StringIO except ImportError: from StringIO import StringIO from namespaces import ANIMNS, CHARTNS, CONFIGNS, DCNS, DR3DNS, DRAWNS, FONS, \...
import os import subprocess import integration_tests class NilPluginTestCase(integration_tests.TestCase): def test_snap_nil_plugin(self): project_dir = 'simple-nil' self.run_snapcraft('snap', project_dir) dirs = os.listdir(os.path.join(project_dir, 'prime')) self.assertEqual(['meta']...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: aci_vrf short_description: Manage VRF (private networks aka. c...
""" Acceptance tests for Video. """ import json from unittest import skipIf, skip import requests from box.test.flaky import flaky from ..helpers import UniqueCourseTest, is_youtube_available from ...pages.lms.video.video import VideoPage from ...pages.lms.tab_nav import TabNavPage from ...pages.lms.course_nav import C...
""" Tools for creating discussion content fixture data. """ from datetime import datetime import json import factory import requests from . import COMMENTS_STUB_URL class ContentFactory(factory.Factory): FACTORY_FOR = dict id = None user_id = "dummy-user-id" username = "dummy-username" course_id = "...
from spack import * class Cppzmq(CMakePackage): """C++ binding for 0MQ""" homepage = "https://www.zeromq.org" url = "https://github.com/zeromq/cppzmq/archive/v4.2.2.tar.gz" git = "https://github.com/zeromq/cppzmq.git" version('master', branch='master') version('4.7.1', sha256='9853e043...
"""Get useful information from live Python objects. This module encapsulates the interface provided by the internal special attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion. It also provides some help for examining source code and class layout. Here are some of the useful functions provided by this module: ...
from .base import BaseOp from .array import ArrLoad, ArrStore, ArrLength from .checkcast import CheckCast, InstanceOf from .convert import Convert from .fieldaccess import FieldAccess from .fmath import FAdd, FDiv, FMul, FRem, FSub, FNeg, FCmp from .invoke import Invoke, InvokeDynamic from .imath import IAdd, IDiv, IMu...
import iris.tests as tests from .gallerytest_util import ( add_gallery_to_path, fail_any_deprecation_warnings, show_replaced_by_check_graphic, ) class TestProjectionsAndAnnotations(tests.GraphicsTest): """Test the atlantic_profiles gallery code.""" def test_plot_projections_and_annotations(self): ...
""" Manages information about the guest. This class encapsulates libvirt domain provides certain higher level APIs around the raw libvirt API. These APIs are then used by all the other libvirt related classes """ from lxml import etree from oslo_log import log as logging from oslo_utils import encodeutils from oslo_uti...
"""Views for Zinnia comments""" from django.contrib import comments from django.template.defaultfilters import slugify from django.http import HttpResponsePermanentRedirect from django.core.exceptions import ObjectDoesNotExist from django.views.generic.base import View from django.views.generic.base import TemplateResp...
import os import fixtures from tempest.cmd import init from tempest.tests import base class TestTempestInit(base.TestCase): def test_generate_testr_conf(self): # Create fake conf dir conf_dir = self.useFixture(fixtures.TempDir()) init_cmd = init.TempestInit(None, None) init_cmd.gener...
"""docstring """ __revision__ = '0.1' global_read_user_interceptor = None global_access_secret_key = None global_login_page = None
from context import seqfindr from context import pytest import numpy as np def test_strip_uninteresting(): """ Test the strip_uninteresting function Function signature:: strip_uninteresting(matrix, query_classes, query_list, cons, invert) """ # No cons matrix = np.array([(0.5, 2, 3), (0....
from tempest.api.identity import base from tempest.common.utils import data_utils from tempest.test import attr class TenantsTestJSON(base.BaseIdentityAdminTest): _interface = 'json' @attr(type='gate') def test_tenant_list_delete(self): # Create several tenants and delete them tenants = [] ...
""" Management class for host-related functions (start, reboot, etc). """ from nova.compute import task_states from nova.compute import vm_states from nova import context from nova import exception from nova.objects import instance as instance_obj from nova.openstack.common import jsonutils from nova.openstack.common i...
"""Functional tests for Stack and ParallelStack Ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework impo...
"""Add cascade to FileCoverage Revision ID: 21c9439330f Revises: 1f5caa34d9c2 Create Date: 2014-04-01 15:29:26.765288 """ revision = '21c9439330f' down_revision = '1f5caa34d9c2' from alembic import op def upgrade(): op.create_index('idx_filecoverage_job_id', 'filecoverage', ['job_id']) op.create_index('idx_file...
import numpy as np from scipy import interpolate from ..utils import check_random_state class FunctionDistribution(object): """Generate random variables distributed according to an arbitrary function Parameters ---------- func : function func should take an array of x values, and return an array...
""" Test helper functions from numba.numpy_support. """ import sys from itertools import product import numpy as np import unittest from numba.core import types from numba.tests.support import TestCase from numba.tests.enum_usecases import Shake, RequestError from numba.np import numpy_support class TestFromDtype(TestC...
import copy import sys import gc import tempfile import pytest from os import path from io import BytesIO from itertools import chain import numpy as np from numpy.testing import ( assert_, assert_equal, IS_PYPY, assert_almost_equal, assert_array_equal, assert_array_almost_equal, assert_raises, ...
import json import os import platform import sys import unittest from telemetry.internal.util import find_dependencies from telemetry.internal.util import path _TELEMETRY_DEPS_PATH = os.path.join( path.GetTelemetryDir(), 'telemetry', 'TELEMETRY_DEPS') def _GetCurrentTelemetryDependencies(): parser = find_dependen...
import functools import gzip import os import re from difflib import SequenceMatcher from django.conf import settings from django.core.exceptions import ( FieldDoesNotExist, ImproperlyConfigured, ValidationError, ) from django.utils.encoding import force_text from django.utils.functional import lazy from django.uti...
""" Settings and configuration for Django. Values will be read from the module specified by the DJANGO_SETTINGS_MODULE environment variable, and then from django.conf.global_settings; see the global settings file for a list of all possible variables. """ import os import time # Needed for Windows import warnings fr...
from __future__ import division from functools import partial from pathlib import Path from menpo.base import MenpoMissingDependencyError try: import dlib except ImportError: raise MenpoMissingDependencyError('dlib') from menpodetect.detect import detect from menpodetect.compatibility import STRING_TYPES from ....
from django.contrib.auth.backends import ModelBackend from django.contrib.auth import get_user_model class CaseInsensitiveModelBackend(ModelBackend): """ By default ModelBackend does case _sensitive_ username authentication, which isn't what is generally expected. This backend supports case insensitive...
from pylatex.base_classes import LatexObject from nose.tools import raises class BadObject(LatexObject): pass @raises(TypeError) def test_latex_object(): LatexObject() @raises(TypeError) def test_bad_object(): BadObject()
from filer.models.foldermodels import * from filer.models.filemodels import * from filer.models.imagemodels import * from filer.models.clipboardmodels import * from filer.models.virtualitems import *
def keyvault_client_factory(**_): from azure.cli.core.commands.client_factory import get_mgmt_service_client from azure.mgmt.keyvault import KeyVaultManagementClient return get_mgmt_service_client(KeyVaultManagementClient) def keyvault_client_vaults_factory(kwargs): return keyvault_client_factory(**kwar...
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2012-2014 Alex Forencich 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 ri...
__author__ = 'sen'
"""DBus interface to Veusz document.""" from __future__ import division import numpy as N from ..compat import cstr from ..utils import vzdbus from . import commandinterpreter class DBusInterface(vzdbus.Object): """DBus interface to Veusz document command interface.""" _ctr = 1 interface = 'org.veusz.docume...
"""LatexEU serializer for records.""" from __future__ import absolute_import, division, print_function from inspirehep.utils.latex import Latex class LATEXEUSerializer(object): """LatexEU serializer for records.""" def serialize(self, pid, record, links_factory=None): """Serialize a single latexeu from ...
import sh import json import os import ConfigParser root_dir = os.path.abspath(os.path.join(os.path.realpath(os.path.dirname(__file__)), '..', '..', '..')) class Version: _source_version = None config = ConfigParser.ConfigParser() config.read(os.path.join(root_dir, 'utils', 'config.ini')) @classmethod ...
from django.conf import settings from django.utils import timezone from pytz import utc from bedrock import externalfiles from bedrock.externalfiles.models import ExternalFile as EFModel from bedrock.mozorg.tests import TestCase class TestExternalFile(TestCase): @classmethod def setUpClass(cls): super()...
from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone from django.conf import settings import model_utils.fields import uuid class Migration(migrations.Migration): dependencies = [ ('student', '0013_delete_historical_enrollment_records'), migra...
"""Testcases for cssutils.css.CSSValue and CSSPrimitiveValue.""" __version__ = '$Id: test_cssvalue.py 1473 2008-09-15 21:15:54Z cthedot $' import xml.dom import basetest import cssutils import types class XTestCase(basetest.BaseTestCase): def setUp(self): cssutils.ser.prefs.useDefaults() def tearDown(se...
""" Test Factory classes for ExternalUserIds """ from uuid import uuid4 import factory from factory.fuzzy import FuzzyChoice, FuzzyText from openedx.core.djangoapps.external_user_ids.models import ExternalId, ExternalIdType class ExternalIDTypeFactory(factory.django.DjangoModelFactory): # lint-amnesty, pylint: disable...
import os import sys execfile('/etc/courtlistener') sys.path.append(INSTALL_ROOT) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") from alert import settings from alert.corpus_importer.lawbox.import_law_box import get_court_object from alert.lib.sunburnt import sunburnt from alert.search.models import Docume...
from default import Test, db, with_context from factories import ProjectFactory, TaskFactory, UserFactory from mock import patch from pybossa.repositories import ProjectRepository project_repo = ProjectRepository(db) def configure_mock_current_user_from(user, mock): def is_anonymous(): return user is None ...
"""Extract pre-computed feature vectors from BERT.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import codecs import collections import json import re import modeling import tokenization import tensorflow as tf flags = tf.flags FLAGS = flags.FLAGS flags...
import sys sys.path.insert(1, "../../../") import h2o, tests def ozoneKM(): # Connect to a pre-existing cluster # connect to localhost:54321 train = h2o.import_file(path=h2o.locate("smalldata/glm_test/ozone.csv")) # See that the data is ready print train.describe() # Run KMeans my_km = h2o.kmeans(x=trai...
import struct from ryu import exception from ryu.lib import mac from ryu.lib.pack_utils import msg_pack_into from . import ofproto_parser from . import ofproto_v1_0 from . import inet import logging LOG = logging.getLogger('ryu.ofproto.nx_match') UINT64_MAX = (1 << 64) - 1 UINT32_MAX = (1 << 32) - 1 UINT16_MAX = (1 << ...
from functools import wraps import os from docker.utils.ports import split_port import json from jsonschema import Draft4Validator, FormatChecker, ValidationError from .errors import ConfigurationError DOCKER_CONFIG_HINTS = { 'cpu_share': 'cpu_shares', 'add_host': 'extra_hosts', 'hosts': 'extra_hosts', ...
from ryu.base import app_manager from ryu.topology import event def get_switch(app, dpid=None): rep = app.send_request(event.EventSwitchRequest(dpid)) return rep.switches def get_all_switch(app): return get_switch(app) def get_link(app, dpid=None): rep = app.send_request(event.EventLinkRequest(dpid)) ...
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 GetEntitiesWithRelationship(Choreography): def __init__(self, temboo_session): """ ...
"""The tests for the Scene component.""" import io import unittest from homeassistant.setup import setup_component from homeassistant.components import light, scene from homeassistant.util import yaml from tests.common import get_test_home_assistant from tests.components.light import common as common_light from tests.c...
import os import sys import logging import crontab from website import settings logger = logging.getLogger(__name__) logging.basicConfig(level=logging.INFO) def app_prefix(path): return os.path.join(settings.APP_PATH, path) def ensure_item(cron, command): items = list(cron.find_command(command)) return item...