content
stringlengths
4
20k
"""Tests for Wake On LAN component.""" from unittest.mock import patch import pytest import voluptuous as vol from homeassistant.components.wake_on_lan import DOMAIN, SERVICE_SEND_MAGIC_PACKET from homeassistant.setup import async_setup_component async def test_send_magic_packet(hass): """Test of send magic pac...
""" Elliptic integrals. """ from __future__ import print_function, division from sympy.core import S, pi, I from sympy.core.function import Function, ArgumentIndexError from sympy.functions.elementary.hyperbolic import atanh from sympy.functions.elementary.trigonometric import sin, tan from sympy.functions.elementary...
from openerp.openupgrade import openupgrade column_renames = { 'email_template': [ ('email_recipients', 'partner_to'), ] } @openupgrade.migrate() def migrate(cr, version): openupgrade.rename_columns(cr, column_renames)
from __future__ import division import argparse import logging import time import numpy as np from bottleneck import argpartition import mxnet as mx from data import cub200_iterator from mxnet import gluon from mxnet.gluon.model_zoo import vision as models from mxnet import autograd as ag, nd from model import Margi...
"""Test truncated SVD transformer.""" import numpy as np import scipy.sparse as sp from sklearn.decomposition import TruncatedSVD from sklearn.utils import check_random_state from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_raises, assert_greater, ...
import os import subprocess import shlex import signal import sys import locale from pexpect.popen_spawn import PopenSpawn # Include `unicode` in STR_TYPES for Python 2.X try: STR_TYPES = (str, unicode) except NameError: STR_TYPES = (str, ) TIMEOUT = 30 class Command(object): def __init__(self, cmd, ti...
""" Automatic Python reference documentation generator. Epydoc processes Python modules and docstrings to generate formatted API documentation, in the form of HTML pages. Epydoc can be used via a command-line interface (`epydoc.cli`) and a graphical interface (`epydoc.gui`). Both interfaces let the user specify a set...
from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import ( compat_urllib_request, ) from ..utils import ( parse_duration, parse_iso8601, str_to_int, ) class FourTubeIE(InfoExtractor): IE_NAME = '4tube' _VALID_URL = r'https?://(?:www\.)?4tube\.c...
from .. import fixtures, config from ..assertions import eq_ from sqlalchemy import util from sqlalchemy import Integer, String, select, func, bindparam from sqlalchemy import testing from ..schema import Table, Column class OrderByLabelTest(fixtures.TablesTest): """Test the dialect sends appropriate ORDER BY e...
RELEASE_LEVELS = [ALPHA, BETA, RELEASE_CANDIDATE, FINAL] = ['alpha', 'beta', 'candidate', 'final'] RELEASE_LEVELS_DISPLAY = {ALPHA: ALPHA, BETA: BETA, RELEASE_CANDIDATE: 'rc', FINAL: ''} # version_info format: (MAJOR, MINOR, MICRO, RELEASE_L...
data = ( 'A', # 0x00 'a', # 0x01 'B', # 0x02 'b', # 0x03 'B', # 0x04 'b', # 0x05 'B', # 0x06 'b', # 0x07 'C', # 0x08 'c', # 0x09 'D', # 0x0a 'd', # 0x0b 'D', # 0x0c 'd', # 0x0d 'D', # 0x0e 'd', # 0x0f 'D', # 0x10 'd', # 0x11 'D', # 0x12 'd', # 0x13 'E', # 0...
from oslo_config import cfg from webob import exc as web_exc from neutron.api.v2 import attributes from neutron.db import db_base_plugin_v2 from neutron.db import vlantransparent_db as vlt_db from neutron.extensions import vlantransparent as vlt from neutron import quota from neutron.tests.unit.db import test_db_base_...
from ndb import * # Pay no attention to the testbed behind the curtain. from google.appengine.ext import testbed tb = testbed.Testbed() tb.activate() tb.init_datastore_v3_stub() tb.init_memcache_stub() from datetime import date class FuzzyDate(object): def __init__(self, first, last=None): assert isinstance(...
from urllib2 import urlopen from flask import request from flask.json import JSONEncoder from jinja2 import Undefined from slugify import SLUG_OK from slugify import slugify as unicode_slugify def get_real_ip(local_correct=False): try: if 'X-Forwarded-For' in request.headers: ip = request.hea...
import json from ansible.compat.tests import unittest from ansible.compat.tests.mock import patch from ansible.module_utils import basic from ansible.module_utils._text import to_bytes from nose.plugins.skip import SkipTest try: from vspk import v5_0 as vsdk from bambou import nurest_session except ImportError...
import os import sys import copy import logging import logging.config import asyncio import aiotask_context as context from typing import Union class config: """Config pre-filled with default Options""" conf: dict = {} initialized = False @staticmethod def load_from_dict(config_dictionary: dict...
""" Views for a student's profile information. """ from django.conf import settings from django.contrib.auth.decorators import login_required from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from django.http import Http404 from django.views.decorators.http import requi...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network.netv...
import unittest from test import test_support from _testcapi import getargs_keywords import warnings warnings.filterwarnings("ignore", category=DeprecationWarning, message=".*integer argument expected, got float", module=__name__) warnings.filterw...
import os from numpy import array, arange, cumsum, resize, clip, logical_and, where, concatenate, ones from opus_core.logger import logger from opus_core.storage_factory import StorageFactory from opus_core.datasets.dataset_pool import DatasetPool from opus_core.sampling_toolbox import sample_noreplace from urbansim_pa...
from functools import wraps import collections import unittest def add_metaclass(metaclass): """Class decorator for creating a class with a metaclass.""" def wrapper(cls): orig_vars = cls.__dict__.copy() orig_vars.pop('__dict__', None) orig_vars.pop('__weakref__', None) slots = ...
from __future__ import absolute_import from __future__ import print_function from twisted.internet import defer from twisted.python import log from twisted.web import resource from twisted.web import server from twisted.web.error import Error from buildbot.util import unicode2bytes class Redirect(Error): def _...
# -*- coding: utf-8 -*- """ .. module:: test_offer_delete """ from django.test import Client from django.test import TestCase from apps.volontulo.tests.views.offers.commons import TestOffersCommons class TestOfferDelete(TestOffersCommons, TestCase): """Class responsible for testing offers deletion.""" def...
import unittest from django.utils import checksums class TestUtilsChecksums(unittest.TestCase): def check_output(self, function, value, output=None): """ Check that function(value) equals output. If output is None, check that function(value) equals value. """ if output i...
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from PyQt4.QtCore import * from PyQt4.QtGui import * from froi.algorithm.imtool import label_edge_detection from roimergedialog import ROIMergeDialog from roi2gwmidialog import Roi2gwmiDialog from regular...
from .fish import Fish class Shark(Fish): """Shark. :param species: :type species: str :param length: :type length: float :param siblings: :type siblings: list of :class:`Fish <fixtures.acceptancetestsbodycomplex.models.Fish>` :param fishtype: Polymorphic Discriminator :type ...
#!/usr/bin/env python """ duecredit -- publications (donations, etc) tracer """ import re import os import sys from datetime import datetime from setuptools import setup from pkgutil import walk_packages from subprocess import Popen, PIPE # Adopted from citeproc-py # License: BSD-2 # Copyright 2011-2013 Brecht Mac...
import copy from types import GeneratorType class MergeDict(object): """ A simple class for creating new "virtual" dictionaries that actually look up values in more than one dictionary, passed in the constructor. If a key appears in more than one of the given dictionaries, only the first occurrenc...
import os import sys import subprocess def ping(co): if os.name == "posix": with open(os.devnull, 'w') as dev_null: if subprocess.call(["ping", "-c", "1", "-w", "1", "netlogin.kuleuven.be"], \ stdout=dev_null, stderr=dev_null) == 0: ## 0 staat voor een exit code ...
# -*- coding: utf-8 -*- """ pygments.styles.emacs ~~~~~~~~~~~~~~~~~~~~~ A highlighting style for Pygments, inspired by Emacs. :copyright: 2006-2007 by Georg Brandl. :license: BSD, see LICENSE for more details. """ from pygments.style import Style from pygments.token import Keyword, Name, Comment,...
#!/usr/bin/python import sys import re import time from XmTestLib import * from pools import * # # Check requirements of test case # - min 2 free cpus (not assigned to a pool) # if int(getInfo("free_cpus")) < 2: SKIP("Need at least 2 free cpus") # # Create 2 pools with one cpu per pool. # createStdPool({'na...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import copy import os import json import subprocess import tempfile from yaml import YAMLError from ansible.compat.six import text_type, string_types from ansible.errors import AnsibleFileNotFound, AnsibleParserError, AnsibleError...
#!/usr/bin/env python """valitadion_of_LIMS_upgrade.py is a script to compare extraction output from lims stage server and lims production server. The comparison is based on the objects created to build documents in the projects database on status db. A recursive function compares all values in the objects and any ...
""" Tests for testing the modulestore settings migration code. """ import copy import ddt from openedx.core.lib.tempdir import mkdtemp_clean from unittest import TestCase from xmodule.modulestore.modulestore_settings import ( convert_module_store_setting_if_needed, update_module_store_settings, get_mixed_...
# SF [ 729683 ] html output method can garble mixed HTML and XML # Submitted By: # Nils Klarlund (klarlund) from Xml.Xslt import test_harness source_1 = """<?xml version="1.0" encoding="UTF-8"?> <html> <head> <contents> <a title="...">tab_1</a> <a title="...">tab_2</a> </contents> </head> <body></...
#!/usr/bin/python # -*- coding: utf-8 -*- """ Copyright (c) 2017-2018 Alan Frost, All rights reserved. Implementation of Vault Manager """ from __future__ import print_function import os import base64 import simplejson as json from crypto import derive_key, decrypt_aes_gcm, encrypt_aes_gcm from utils import genera...
import logging from xmodule.fields import Timedelta log = logging.getLogger(__name__) class TimeInfo(object): """ This is a simple object that calculates and stores datetime information for an XModule based on the due date and the grace period string So far it parses out three different pieces of tim...
#!/usr/bin/env python3 ''' AI classes for Python Ultima Online text client Copyright (C) 2015-2016 Gabriele Tozzi 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 ...
from __future__ import absolute_import, unicode_literals from datetime import datetime from django.conf import settings from django.contrib import admin from django.contrib.admin import helpers from django.contrib.admin.util import (display_for_field, label_for_field, lookup_field, NestedObjects) from django.cont...
from tempest import config import tempest.test as test from tempest.tests import base from tempest.tests import fake_config class TestNegativeAutoTest(base.TestCase): # Fake entries _service = 'compute' fake_input_desc = {"name": "list-flavors-with-detail", "http-method": "GET", ...
"""Runner objects execute a Pipeline. This package defines runners, which are used to execute a pipeline. """ from apache_beam.runners.direct.direct_runner import DirectRunner from apache_beam.runners.direct.direct_runner import EagerRunner from apache_beam.runners.runner import PipelineRunner from apache_beam.runner...
import os import unittest import warnings from lsst.utils import getPackageDir import lsst.utils.tests import lsst.daf.persistence as dafPersist import lsst.pex.exceptions as pexExcept class WcsCardsTestCase(lsst.utils.tests.TestCase): """Test wcs keywords in the metadata""" def setUp(self): try: ...
"""Traveling Salesman Sample. This is a sample using the routing library python wrapper to solve a Traveling Salesman Problem. The description of the problem can be found here: http://en.wikipedia.org/wiki/Travelling_salesman_problem. The optimization engine uses local search to improve solutions, first...
import os from glob import glob import time import numpy as np from skimage.io import imread from skimage import color from skimage import feature from skimage import filters from rpscv import utils import cv2 def crop(img): """Returns a cropped image to pre-defined shape.""" return img[75:275, 125:425] d...
import mock import pytest from anacode.api import writers def dummy_write(*args, **kwargs): pass @pytest.mark.parametrize('data,inc', [ ({'concepts': [None] * 3}, 3), ({'categories': [None] * 5}, 5), ({'sentiment': [None] * 3}, 3), ({'absa': [None] * 20}, 20), ({'concepts': [None] * 3, 'cate...
"""benchmarks for the scipy.sparse.linalg._expm_multiply module""" import math import numpy as np from .common import Benchmark, safe_import with safe_import(): import scipy.linalg from scipy.sparse.linalg import expm_multiply def random_sparse_csr(m, n, nnz_per_row): # Copied from the scipy.sparse benc...
from openerp.osv import fields from . import geo_field class GeoMultiPolygon(geo_field.Geom): """New type of column in the ORM for POSTGIS geometry MultiPolygon type""" _type = 'geo_multi_polygon' _geo_type = 'MULTIPOLYGON' def __init__(self, string, dim=2, srid=900913, gist_index=True, **args): ...
"""Case data in internal format. """ from numpy import array def t_case_int(): """Case data in internal format used to test C{ext2int} and C{int2ext}. """ ppc = {} ## PYPOWER Case Format : Version 2 ppc['version'] = '2' ##----- Power Flow Data -----## ## system MVA base ppc['baseM...
#!/usr/bin/env python # -*- coding: utf-8 -*- from runner.koan import * class AboutControlStatements(Koan): def test_if_then_else_statements(self): if True: result = 'true value' else: result = 'false value' self.assertEqual('true value', result) def test_if_t...
"""This file implements all-or-nothing package transformations. An all-or-nothing package transformation is one in which some text is transformed into message blocks, such that all blocks must be obtained before the reverse transformation can be applied. Thus, if any blocks are corrupted or lost, the original message...
from JumpScale import j from CodeGeneratorBase import CodeGeneratorBase class CodeGeneratoractorLocal(CodeGeneratorBase): def __init__(self, spec, typecheck=True, dieInGenCode=True): CodeGeneratorBase.__init__(self, spec, typecheck, dieInGenCode) self.actorpath = j.sal.fs.joinPaths( ...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import json import os from pants.base.build_environment import get_buildroot from pants.util.contextutil import temporary_dir from pants_test.pants_run_integration_te...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import re from ansible.errors import AnsibleError from ansible.module_utils._text import to_native from ansible.module_utils.six import string_types from ansible.plugins.lookup import LookupBase class LookupModule(LookupBase): ...
from openerp.osv import fields, osv class account_report_general_ledger(osv.osv_memory): _inherit = "account.common.account.report" _name = "account.report.general.ledger" _description = "General Ledger Report" _columns = { 'landscape': fields.boolean("Landscape Mode"), 'initial_balan...
import json from social.tests.backends.oauth import OAuth2Test class CoinbaseOAuth2Test(OAuth2Test): backend_path = 'social.backends.coinbase.CoinbaseOAuth2' user_data_url = 'https://coinbase.com/api/v1/users' expected_username = 'SatoshiNakamoto' access_token_body = json.dumps({ 'access_toke...
''' Arciv Stream ciphering ''' __all__='''ArcIV encode decode'''.split() __version__=''' 1.0 ''' from reportlab.lib.utils import isUnicode, isPy3 class ArcIV: ''' performs 'ArcIV' Stream Encryption of S using key Based on what is widely thought to be RSA's ArcIV algorithm. It produces output streams that are ident...
""" Provides output support for Azure Blob Storage using the 'azure://' prefix """ import logging import os import shutil import tempfile from c7n_azure.storage_utils import StorageUtilities from c7n_azure.utils import AppInsightsHelper from c7n.output import ( blob_outputs, log_outputs, metrics_outputs, ...
""" Braces for function definition should be located in the seperate line. == Violation == void A() { <== Violation } void A() { } <== Violation. It has different columns. == Good == void A() { <== OK } void K() { while(True) { <== Don't care } } """ f...
#!/usr/bin/env python import vtk from vtk.test import Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() ren1 = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.SetMultiSamples(0) renWin.AddRenderer(ren1) iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) # read d...
from __future__ import unicode_literals from django.conf import settings from django.contrib.redirects.models import Redirect from django.contrib.sites.models import get_current_site from django.core.exceptions import ImproperlyConfigured from django import http class RedirectFallbackMiddleware(object): def __in...
"""Defines a number of module-scope gRPC scenarios to test clean exit.""" import argparse import threading import time import grpc from tests.unit.framework.common import test_constants WAIT_TIME = 1000 REQUEST = b'request' UNSTARTED_SERVER = 'unstarted_server' RUNNING_SERVER = 'running_server' POLL_CONNECTIVITY_...
import os from os.path import join import shutil import filecmp # Files to not sync across support/ directories fileExcludes = ('README') dirExcludes = ('.svn', '.hg', 'CVS') # To prevent support files from being propagated into a particular support/ # directory, add a file named LOCK def propagate(source, dest, erro...
""" Miscellaneous utility functions. """ import re from xmodule.annotator_mixin import html_to_text def escape_invalid_characters(name, invalid_char_list, replace_with='_'): """ Remove invalid characters from a variable and replace it with given character. Few chars are not allowed in asset displayname, ...
"""Benchmarks for Cudnn RNN models.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import time from tensorflow.contrib.cudnn_rnn.python.ops import cudnn_rnn_ops from tensorflow.contrib.rnn.python.ops import core_rnn from tensorflow.contrib.rnn.python.o...
# -*- coding: utf-8 -*- # UPDATE THIS VARIABLE mapping = {"St": "Street", "St.": "Street", "Rd.": "Road", "Ave": "Avenue", "Ave.": "Avenue", "Blvd": "Boulevard", "Blvd.": "Boulevard", } # UPDATE THIS VARIABLE mappingCities = {"jose": "Jose", ...
""" API that are reported to numba.cuda """ from __future__ import print_function, absolute_import import contextlib import numpy as np from .cudadrv import devicearray, devices, driver from .args import In, Out, InOut try: long except NameError: long = int # NDarray device helper require_context = devi...
"""ANTLR3 runtime package""" # begin[licence] # # [The "BSD licence"] # Copyright (c) 2005-2008 Terence Parr # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code ...
""" Adapter to isolate django-oauth-toolkit dependencies """ from oauth2_provider import models class DOTAdapter(object): """ Standard interface for working with django-oauth-toolkit """ backend = object() def create_confidential_client(self, name, ...
from setuptools import setup, find_packages NAME = "autorestresourceflatteningtestservice" VERSION = "1.0.0" # To install the library, run the following # # python setup.py install # # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools REQUIRES = ["msrestazure>=0.4.7"] setup( name=NAME, versi...
"""SCons.Defaults Builders and other things for the local site. Here's where we'll duplicate the functionality of autoconf until we move it into the installation procedure or use something like qmconf. The code that reads the registry to find MSVC components was borrowed from distutils.msvccompiler. """ # # Copyri...
"""Add IPv6 Subnet properties Revision ID: 2447ad0e9585 Revises: 33dd0a9fa487 Create Date: 2013-10-23 16:36:44.188904 """ # revision identifiers, used by Alembic. revision = '2447ad0e9585' down_revision = '33dd0a9fa487' from alembic import op import sqlalchemy as sa def upgrade(): # Workaround for Alemic bug ...
data = ( 'ff', # 0x00 'fi', # 0x01 'fl', # 0x02 'ffi', # 0x03 'ffl', # 0x04 'st', # 0x05 'st', # 0x06 '[?]', # 0x07 '[?]', # 0x08 '[?]', # 0x09 '[?]', # 0x0a '[?]', # 0x0b '[?]', # 0x0c '[?]', # 0x0d '[?]', # 0x0e '[?]', # 0x0f '[?]', # 0x10 '[?]', # 0x11 '[?]', ...
import datetime import pickle from random import shuffle, randint import numpy as np def floater(val): try: return float(val) except: return 0.0 def parameter_divider(params, para_name): lower_params = [] for p in params: lower_params.append(p.lower()) selected_parameter = [] for i in range(0,...
# April 4, 2011 from __future__ import division, print_function, absolute_import import numpy as np from numpy.testing import TestCase, run_module_suite, assert_equal, \ assert_array_almost_equal, assert_array_equal, \ assert_allclose from scipy.signal import dlsim,...
from io import BytesIO import logging import os import re import struct import sys from .compat import sysconfig, fsencode, detect_encoding, ZipFile from .resources import finder from .util import (FileOperator, get_export_entry, convert_path, get_executable, in_venv) logger = logging.getLogger(__n...
from _common import unittest import doctest from yampdqmgr.album import Album class AlbumTest(unittest.TestCase): def test_album(self): a = Album(min_cache=1,max_cache=1) self.assertEqual(a.get_id('the beatles', 'please please me'), 0) self.assertEqual(a.get_id('thE BEATles', 'pleASE PLease me'), 0) ...
"""RNN helpers for TensorFlow models.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from tensorflow.python.ops import variable_scope as vs def stack_bidirectional_rnn(cells_fw, cells_bw, ...
from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy import testing from sqlalchemy.testing.util import function_named from sqlalchemy.testing import fixtures from sqlalchemy.testing.schema import Table, Column class BaseObject(object): def __init__(self, *args, **kwargs): for key, value ...
""" Support for RSS/Atom feeds. For more details about this component, please refer to the documentation at https://home-assistant.io/components/feedreader/ """ from datetime import datetime, timedelta from logging import getLogger from os.path import exists from threading import Lock import pickle import voluptuous ...
""" ========================= FOOTNOTES ================================= This section adds footnote handling to markdown. It can be used as an example for extending python-markdown with relatively complex functionality. While in this case the extension is included inside the module itself, it could just as easily b...
from math import pi import numpy as np from scipy.optimize import newton import pylab from openmdao.core.component import Component from openmdao.core.group import Group from openmdao.units.units import convert_units as cu from openmdao.components.param_comp import ParamComp from openmdao.components.constraint import...
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains th...
"""Tests for transitfeed.shapelib.py""" __author__ = '<EMAIL> (Chris Harrelson)' import math from transitfeed import shapelib from transitfeed.shapelib import Point from transitfeed.shapelib import Poly from transitfeed.shapelib import PolyCollection from transitfeed.shapelib import PolyGraph import unittest import u...
#!/usr/bin/env python """Test functions for fftpack.helper module Copied from fftpack.helper by Pearu Peterson, October 2005 """ from __future__ import division, absolute_import, print_function import numpy as np from numpy.testing import TestCase, run_module_suite, assert_array_almost_equal from numpy import fft fr...
from __future__ import unicode_literals """ Contributing: 1. Add the .csv file 2. Run import 3. Then run translate """ # loading # doctype, page, report # boot(startup) # frappe.require # frappe._ import frappe, os, re, codecs, json from frappe.utils.jinja import render_include from jinja2 import TemplateError def ...
"""Special Math Ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import numpy as np from tensorflow.python.framework import constant_op from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops from tensorfl...
import os import logging from .devicedisk import VirtualDisk from .osxml import OSXML class Installer(object): """ Installer classes attempt to encapsulate all the parameters needed to 'install' a guest: essentially, booting the guest with the correct media for the OS install phase (if there is one),...
import os, sys from ctypes import * up=2 def setlibpath(up): import sys path=os.path.normpath(os.path.split(os.path.realpath(__file__))[0]+'\..'*up) if path not in sys.path: sys.path.append(path) setlibpath(up) from haru import * from haru.c_func import * from haru.hpdf_errorcode im...
from oslo_log import log as logging from oslo_utils import excutils from cinder import exception from cinder.i18n import _ from cinder.volume.drivers.huawei import constants from cinder.volume.drivers.huawei import huawei_utils LOG = logging.getLogger(__name__) class SmartQos(object): def __init__(self, client)...
""" Gini based Inequality Metrics """ __author__ = "Sergio J. Rey <<EMAIL>> " #from pysal.common import * import numpy as np from scipy.stats import norm as NORM __all__ = ['Gini', 'Gini_Spatial'] class Gini: """ Classic Gini coefficient in absolute deviation form Parameters ---------- y : ar...
"""Tests for polynomial module. """ from __future__ import division import numpy as np import numpy.polynomial.polynomial as poly from numpy.testing import * def trim(x) : return poly.polytrim(x, tol=1e-6) T0 = [ 1] T1 = [ 0, 1] T2 = [-1, 0, 2] T3 = [ 0, -3, 0, 4] T4 = [ 1, 0, -8, 0, 8] T5 = [ 0...
#!/usr/bin/env python """ 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");...
#!/usr/bin/env python from PyQt5 import QtWidgets from peacock import PeacockApp from peacock.utils import Testing import os class TestExodusState(Testing.PeacockImageTestCase): """ Test for ExodusViewer state when executable is re-run. """ qapp = QtWidgets.QApplication([]) def setUp(self): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_stack ---------------------------------- Tests for `python_algorithms.stack` module. """ import unittest from python_algorithms.basic.stack import Stack class TestStack(unittest.TestCase): def setUp(self): self.empty_stack = Stack() self....
# -*- coding: utf-8 -*- from django.conf import settings from django.core.exceptions import ImproperlyConfigured TRANSLATION_FILES = tuple(getattr(settings, 'MODELTRANSLATION_TRANSLATION_FILES', ())) AVAILABLE_LANGUAGES = getattr(settings, 'MODELTRANSLATION_LANGUAGES', [l[0] for l in se...
import json import webapp2 from datetime import datetime from google.appengine.ext import ndb from controllers.api.api_base_controller import ApiBaseController from database.award_query import TeamAwardsQuery, TeamEventAwardsQuery from database.event_query import TeamEventsQuery, TeamYearEventsQuery from database.m...
"""Manage TCP ports for unit tests; started by run_tests.py""" from __future__ import print_function import argparse from six.moves.BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler from six.moves.socketserver import ThreadingMixIn import hashlib import os import socket import sys import time import random imp...
"""Collection of various functions and function wrappers.""" from typing import Optional import math import tensorflow as tf def inverse_sigmoid_decay(param, rate, min_value: float = 0., max_value: float = 1., name: Optional[str] = None, ...
from test_framework.test_framework import ComparisonTestFramework from test_framework.util import * from test_framework.mininode import CTransaction, NetworkThread from test_framework.blocktools import create_coinbase, create_block from test_framework.comptool import TestInstance, TestManager from test_framework.script...
import unittest, time, sys sys.path.extend(['.','..','py']) import h2o_browse as h2b import h2o, h2o_hosts, h2o_util, h2o_log class Basic(unittest.TestCase): def tearDown(self): h2o.check_sandbox_for_errors() @classmethod def setUpClass(cls): localhost = h2o.decide_if_localhost() i...