code
stringlengths
1
199k
{ 'name': 'Account Cut-off Base', 'version': '0.1', 'category': 'Accounting & Finance', 'license': 'AGPL-3', 'summary': 'Base module for Account Cut-offs', 'description': """ This module contains objets, fields and menu entries that are used by other cut-off modules. So you need to install other...
import os, sys usage = "usage: %s [infile [outfile]]" % os.path.basename(sys.argv[0]) if len(sys.argv) < 1: print (usage) else: stext = "<insert_a_suppression_name_here>" rtext = "memcheck problem #" input = sys.stdin output = sys.stdout hit = 0 if len(sys.argv) > 1: input = open(sys...
"""Unit tests for the :class:`iris.coord_systems.VerticalPerspective` class.""" import iris.tests as tests # isort:skip import cartopy.crs as ccrs from iris.coord_systems import GeogCS, VerticalPerspective class Test(tests.IrisTest): def setUp(self): self.latitude_of_projection_origin = 0.0 self.lo...
""" Test lldb data formatter subsystem. """ from __future__ import print_function import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase class ObjCDataFormatterNSError(ObjCDataFormatter...
from oslo_config import cfg from oslo_utils import importutils from cinder import test import cinder.volume.drivers.fujitsu.eternus_dx_common as eternus_dx_common CONF = cfg.CONF FUJITSU_FC_MODULE = ('cinder.volume.drivers.fujitsu.' 'eternus_dx_fc.FJDXFCDriver') FUJITSU_ISCSI_MODULE = ('cinder.volu...
"""Utilities for image bundling tool.""" import logging import os import subprocess import time import urllib2 METADATA_URL_PREFIX = 'http://169.254.169.254/computeMetadata/' METADATA_V1_URL_PREFIX = METADATA_URL_PREFIX + 'v1/' class MakeFileSystemException(Exception): """Error occurred in file system creation.""" cl...
''' Usage: advogato.py <name> <diary entry file> ''' from twisted.web.xmlrpc import Proxy from twisted.internet import reactor from getpass import getpass import sys class AddDiary: def __init__(self, name, password): self.name = name self.password = password self.proxy = Proxy('http://advog...
from openflow.optin_manager.sfa.rspecs.elements.element import Element class PLTag(Element): fields = [ 'tagname', 'value', ]
"""This example creates a campaign in a given advertiser. To create an advertiser, run create_advertiser.py. The LoadFromStorage method is pulling credentials and properties from a "googleads.yaml" file. By default, it looks for this file in your home directory. For more information, see the "Caching authentication inf...
import hashlib import mock from neutron.common import constants from neutron.common import exceptions from neutron.plugins.vmware.common import utils from neutron.plugins.vmware.nsxlib import switch as switchlib from neutron.tests.unit import test_api_v2 from neutron.tests.unit.vmware.nsxlib import base _uuid = test_ap...
"""This code example gets all first party audience segments. To create first party audience segments, run create_audience_segments.py. """ from googleads import dfp def main(client): # Initialize client object. client = dfp.DfpClient.LoadFromStorage() # Initialize appropriate service. audience_segment_service =...
import os import re import subprocess from mock import Mock, MagicMock, patch import pexpect from trove.common import exception from trove.common import utils from trove.guestagent import pkg from trove.tests.unittests import trove_testtools """ Unit tests for the classes and functions in pkg.py. """ class PkgDEBInstal...
""" sphinx.environment.managers.indexentries ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Index entries manager for sphinx.environment. :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re import bisect import unicodedata import string fr...
"""Tests for contrib.losses.python.losses.loss_ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf class AbsoluteDifferenceLossTest(tf.test.TestCase): def setUp(self): self._predictions = tf.constant([4, 8,...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('osf', '0238_abstractprovider_allow_updates'), ] operations = [ migrations.AddIndex( model_name='schemaresponse', index=models.Ind...
import json import logging import django from django.conf import settings from django.utils import html from django.utils.translation import ugettext_lazy as _ from django.views.decorators.debug import sensitive_variables # noqa from oslo_utils import strutils import six from horizon import exceptions from horizon imp...
""" Statistics for astronomy """ import numpy as np from scipy.stats.distributions import rv_continuous def bivariate_normal(mu=[0, 0], sigma_1=1, sigma_2=1, alpha=0, size=None, return_cov=False): """Sample points from a 2D normal distribution Parameters ---------- mu : array-like (...
import copy import datetime import decimal import math import warnings from itertools import tee from django.db import connection from django.db.models.query_utils import QueryWrapper from django.conf import settings from django import forms from django.core import exceptions, validators from django.utils.datastructure...
from __future__ import print_function import numpy as nm try: import matplotlib.pyplot as plt import matplotlib as mpl except (ImportError, RuntimeError): plt = mpl = None #print 'matplotlib import failed!' from sfepy.base.base import output, pause def spy(mtx, eps=None, color='b', **kwargs): """ ...
""" =========================================== Sparse coding with a precomputed dictionary =========================================== Transform a signal as a sparse combination of Ricker wavelets. This example visually compares different sparse coding methods using the :class:`sklearn.decomposition.SparseCoder` estim...
""" CSS Testing :copyright: (C) 2014 by Openlabs Technologies & Consulting (P) Limited :license: BSD, see LICENSE for more details. """ from os.path import join from cssutils import CSSParser import unittest import trytond.tests.test_tryton dir = 'static/css/' class CSSTest(unittest.TestCase): """ T...
"""Vendor core functionality used from xarray. This code has been reproduced with modification under the terms of the Apache License, Version 2.0 (notice included below). Copyright 2014-2019, xarray Developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
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 'ImageAttachment' db.create_table('upload_imageattachment', ( ('id', self.gf('django.db.models.fields.AutoFi...
from .plot import plot_lines
"""This file contains code for use with "Think Stats" and "Think Bayes", both by Allen B. Downey, available from greenteapress.com Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function, division """This file contains class definitions for: Hist:...
"""Problema unic.""" from __future__ import print_function def gaseste_unic(istoric): """unic""" result = istoric.pop() for numar in istoric: result = result ^ numar return result if __name__ == "__main__": assert gaseste_unic([1, 2, 3, 2, 1]) == 3 assert gaseste_unic([1, 1, 1, 2, 2]) ==...
"""Support to pretty-print lists, tuples, & dictionaries recursively. Very simple, but useful, especially in debugging data structures. Classes ------- PrettyPrinter() Handle pretty-printing operations onto a stream using a configured set of formatting parameters. Functions --------- pformat() Format a Pyth...
from .openssl import OpenSSL def _equals_bytes(a, b): if len(a) != len(b): return False result = 0 for x, y in zip(a, b): result |= x ^ y return result == 0 def _equals_str(a, b): if len(a) != len(b): return False result = 0 for x, y in zip(a, b): result |= or...
from __future__ import absolute_import import nsq import unittest class WriterUnitTest(unittest.TestCase): def setUp(self): super(WriterUnitTest, self).setUp() def test_constructor(self): name = 'test' reconnect_interval = 10.0 writer = nsq.Writer(nsqd_tcp_addresses=['127.0.0.1:4...
"""Plugin for filesystem tasks.""" from __future__ import unicode_literals, division, absolute_import import os import logging from path import Path from flexget import plugin from flexget.entry import Entry from flexget.event import event from flexget.config_schema import one_or_more log = logging.getLogger('listdir')...
import participantCollection participantCollection = participantCollection.ParticipantCollection() numberStillIn = participantCollection.sizeOfParticipantsWhoAreStillIn() initialNumber = participantCollection.size() print "There are currently **" + str(numberStillIn) + " out of " + str(initialNumber) +"** original part...
import unittest from mini_project7 import Puzzle class TestFunctions(unittest.TestCase): def setUp(self): pass def test_lower_row_invariant(self): state = Puzzle(4, 4, [[4, 2, 3, 7], [8, 5, 6, 10], [9, 1, 0, 11], [12, 13, 14, 15]]) self.assertTrue(state.lower_row_invariant(2, 2)) ...
""" *************************************************************************** rgb2pct.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ********************************************************...
"""Implement upgrade recipes."""
__author__ = "Cyril Jaquier" __copyright__ = "Copyright (c) 2004 Cyril Jaquier" __license__ = "GPL" import re from abc import abstractmethod from .strptime import reGroupDictStrptime, timeRE from ..helpers import getLogger logSys = getLogger(__name__) class DateTemplate(object): """A template which searches for and re...
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile from plone.app.layout.viewlets.common import ViewletBase from zope.component import getMultiAdapter class SpaceIconViewlet(ViewletBase): render = ViewPageTemplateFile('space_icon.pt') def update(self): portal_state = getMultiAdapter...
"""A module that is accepted by Python but rejected by tokenize. The problem is the trailing line continuation at the end of the line, which produces a TokenError.""" ""\
{ 'name': 'Gengo Translator', 'category': 'Website/Website', 'summary': 'Translate website in one-click', 'description': """ This module allows to send website content to Gengo translation service in a single click. Gengo then gives back the translated terms in the destination language. """, 'de...
""" Serializers and ModelSerializers are similar to Forms and ModelForms. Unlike forms, they are not constrained to dealing with HTML output, and form encoded input. Serialization in REST framework is a two-phase process: 1. Serializers marshal between complex types like model instances, and python primitives. 2. The p...
from sympy import (symbols, product, factorial, rf, sqrt, cos, Function, Product, Rational) a, k, n = symbols('a,k,n', integer=True) def test_simple_products(): assert product(2, (k, a, n)) == 2**(n-a+1) assert product(k, (k, 1, n)) == factorial(n) assert product(k**3, (k, 1, n)) == facto...
from spack import * class UtilMacros(AutotoolsPackage): """This is a set of autoconf macros used by the configure.ac scripts in other Xorg modular packages, and is needed to generate new versions of their configure scripts with autoconf.""" homepage = "http://cgit.freedesktop.org/xorg/util/macros/" ...
"""Fixer that changes raw_input(...) into input(...).""" from .. import fixer_base from ..fixer_util import Name class FixRawInput(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< name='raw_input' trailer< '(' [any] ')' > any* > """ def transform(self, node, results...
"""Python 2<->3 compatibility module""" import sys def print_(template, *args, **kwargs): template = str(template) if args: template = template % args elif kwargs: template = template % kwargs sys.stdout.writelines(template) if sys.version_info < (3, 0): basestring = basestring f...
"""Shared helper functions for RuntimeConfig API classes.""" def config_name_from_full_name(full_name): """Extract the config name from a full resource name. >>> config_name_from_full_name('projects/my-proj/configs/my-config') "my-config" :type full_name: str :param full_name: The full r...
"""Tests for Keras metrics functions.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import json from absl.testing import parameterized import numpy as np from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes f...
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 GetTag(Choreography): def __init__(self, temboo_session): """ Create a new insta...
from __future__ import print_function import os import shutil import sys assert sys.argv[1] == '-frontend' primaryFile = sys.argv[sys.argv.index('-primary-file') + 1] if (os.path.basename(primaryFile) == 'bad.swift' or os.path.basename(primaryFile) == 'crash.swift'): print("Handled", os.path.basename(primar...
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 Badges(Choreography): def __init__(self, temboo_session): """ Create a new insta...
import six import sys from optparse import make_option, NO_DEFAULT from django.core.management.base import BaseCommand, CommandError from django.conf import settings from django_extensions.management.modelviz import generate_dot try: import pygraphviz HAS_PYGRAPHVIZ = True except ImportError: HAS_PYGRAPHVIZ...
import json from tempfile import mkdtemp from os.path import join, basename from shutil import rmtree from distutils.dir_util import copy_tree from twisted.trial import unittest from twisted.internet.defer import inlineCallbacks from slyd.projectspec import create_project_resource from slyd.projectspec import convert_t...
""" Created on Sat Aug 24 15:08:01 2013 @author: steve """ import numpy as np import mdptoolbox from .utils import SMALLNUM, P_forest, R_forest, P_small, R_small, P_sparse from .utils import P_forest_sparse, R_forest_sparse def test_ValueIterationGS_small(): sdp = mdptoolbox.mdp.ValueIterationGS(P_small, R_small, 0...
try: from urllib.parse import urljoin except ImportError: from urlparse import urljoin try: import cPickle as pickle except ImportError: import pickle try: from pip._vendor.requests.packages.urllib3.response import HTTPResponse except ImportError: from pip._vendor.urllib3.response import HTTPRes...
from __future__ import print_function, division from qsrlib_qsrs.qsr_rcc_abstractclass import QSR_RCC_Abstractclass class QSR_RCC8(QSR_RCC_Abstractclass): """Symmetrical RCC5 relations. Values of the abstract properties * **_unique_id** = "rcc8" * **_all_possible_relations** = ("dc", "ec", "po",...
import sys import glob import re import argparse def check_version_format(version): """Check format of version number""" pattern = '^[0-9]+[\.][0-9]+[\.][0-9]+(\-.+)*$' return re.match(pattern, version) is not None BIO_FORMATS_ARTIFACT = ( r"(<groupId>%s</groupId>\n" ".*<artifactId>pom-bio-formats</...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: puppet short_description: Runs puppet description: - Runs I(puppet) agent or apply in a reliable manner version_added: "2.0" options: tim...
from __future__ import unicode_literals from frappe import _ def get_data(): return [ { "module_name": "Item", "_doctype": "Item", "color": "#f39c12", "icon": "octicon octicon-package", "type": "link", "link": "List/Item" }, { "module_name": "Customer", "_doctype": "Customer", "color":...
import logging from importlib import import_module from django.apps import AppConfig from django.conf import settings from django.db.models import signals from geonode.tasks.tasks import send_queued_notifications E = getattr(settings, 'NOTIFICATION_ENABLED', False) M = getattr(settings, 'NOTIFICATIONS_MODULE', None) no...
from lib.cuckoo.common.abstracts import Signature class NetworkIRC(Signature): name = "network_irc" description = "Connects to an IRC server, possibly part of a botnet" severity = 3 categories = ["irc"] authors = ["nex"] minimum = "0.6" def run(self): if "irc" in self.results["networ...
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh.""" from import_shims.warn import warn_deprecated_import warn_deprecated_import('course_action_state.tests.test_rerun_manager', 'common.djangoapps.course_action_state.tests.test_rerun_manager') from common.djangoapps.course_action_state.test...
"""Add db_worker_unseen table to keep track of unseen items on the database side. """ SQL = [ """ CREATE TABLE txlog.db_worker_unseen ( id INTEGER NOT NULL, worker_id TEXT NOT NULL, created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT \ timezone('UTC'::text, now()) ) """,...
import logging from flask import current_app as app from superdesk.errors import SuperdeskApiError import superdesk from .ldap import ADAuth, add_default_values, get_user_query logger = logging.getLogger(__name__) class ImportUserProfileFromADCommand(superdesk.Command): """ Responsible for importing a user prof...
from spack import * class RTriebeard(RPackage): """triebeard: 'Radix' Trees in 'Rcpp'""" homepage = "https://github.com/Ironholds/triebeard/" url = "https://cloud.r-project.org/src/contrib/triebeard_0.3.0.tar.gz" list_url = "https://cloud.r-project.org/src/contrib/Archive/triebeard" version('0....
from spack import * class PyEpydoc(PythonPackage): """Epydoc is a tool for generating API documentation documentation for Python modules, based on their docstrings.""" pypi = "epydoc/epydoc-3.0.1.tar.gz" version('3.0.1', sha256='c81469b853fab06ec42b39e35dd7cccbe9938dfddef324683d89c1e5176e48f2')
from __future__ import unicode_literals import hashlib import math import random import time import uuid from .common import InfoExtractor from ..compat import compat_urllib_parse from ..utils import ExtractorError class IqiyiIE(InfoExtractor): IE_NAME = 'iqiyi' IE_DESC = '爱奇艺' _VALID_URL = r'http://(?:[^.]...
"""Support for WeMo switches.""" import asyncio import logging from datetime import datetime, timedelta import requests import async_timeout from homeassistant.components.switch import SwitchDevice from homeassistant.exceptions import PlatformNotReady from homeassistant.util import convert from homeassistant.const impo...
import pygame from Axon.Component import component class BasicSprite(pygame.sprite.Sprite, component): Inboxes=["translation", "imaging","inbox", "control"] allsprites = [] def __init__(self, imagepath, name, pos = None,border=40): pygame.sprite.Sprite.__init__(self) component.__init__(self)...
"""Generates the appropriate JSON data for LB interop test scenarios.""" import json import os import yaml all_scenarios = [] def server_sec(transport_sec): if transport_sec == 'google_default_credentials': return 'alts', 'alts', 'tls' return transport_sec, transport_sec, transport_sec def generate_no_b...
"""oslo.i18n integration module. See http://docs.openstack.org/developer/oslo.i18n/usage.html """ import oslo_i18n _translators = oslo_i18n.TranslatorFactory(domain='murano') _ = _translators.primary _LI = _translators.log_info _LW = _translators.log_warning _LE = _translators.log_error _LC = _translators.log_critical
import pytest import aiohttp from aiohttp import web @pytest.mark.run_loop async def test_client_ws_async_for(loop, create_server): items = ['q1', 'q2', 'q3'] async def handler(request): ws = web.WebSocketResponse() await ws.prepare(request) for i in items: ws.send_str(i) ...
"""Test Agent DVR integration.""" from unittest.mock import AsyncMock, patch from agent import AgentError from homeassistant.components.agent_dvr.const import DOMAIN from homeassistant.config_entries import ConfigEntryState from homeassistant.core import HomeAssistant from . import CONF_DATA, create_entry from tests.co...
''' Copyright 2017 Dell Inc. or its subsidiaries. All Rights Reserved. Author(s): George Paulos This script tests minimum payload base case of the RackHD API 2.0 OS bootstrap workflows using NFS mount or local repo method. This routine runs OS bootstrap jobs simultaneously on multiple nodes. For 12 tests to run, 12 nod...
import logging from calico.felix.actor import Actor, actor_message from calico.felix.futils import IPV4, IPV6 from calico.felix.ipsets import Ipset, FELIX_PFX _log = logging.getLogger(__name__) ALL_POOLS_SET_NAME = FELIX_PFX + "all-ipam-pools" MASQ_POOLS_SET_NAME = FELIX_PFX + "masq-ipam-pools" MASQ_RULE_FRAGMENT = ("P...
from oslo_config import cfg from ironic.common.i18n import _ opts = [ cfg.StrOpt('manager_url', help=_('URL where OneView is available.')), cfg.StrOpt('username', help=_('OneView username to be used.')), cfg.StrOpt('password', secret=True, help=_('...
""" 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...
''' FFmpeg video abstraction ======================== .. versionadded:: 1.0.8 This abstraction requires ffmpeg python extensions. We have made a special extension that is used for the android platform but can also be used on x86 platforms. The project is available at:: http://github.com/tito/ffmpeg-android The exte...
def test(): for i in xrange(int(5e3)): t = [] for j in xrange(int(1e4)): #t[j] = 'x' t.append('x') t = ''.join(t) test()
"""GDB commands for working with frame-filters.""" import sys import gdb import copy from gdb.FrameIterator import FrameIterator from gdb.FrameDecorator import FrameDecorator import gdb.frames import itertools class SetFilterPrefixCmd(gdb.Command): """Prefix command for 'set' frame-filter related operations.""" ...
""" This parser uses the --preprocess option of wesnoth so a working wesnoth executable must be available at runtime if the WML to parse contains preprocessing directives. Pure WML can be parsed as is. For example: wml = "" [unit] id=elve name=Elve [abilities] [damage] ...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'metadata_version': '1.1'} DOCUMENTATION = ''' --- module: fortios_firewall_ssl_server short_description: Configure SSL ...
import datetime from south.db import db from south.v2 import DataMigration from django.db import models from django.contrib.auth.models import User from account.models import Account class Migration(DataMigration): def forwards(self, orm): # we need to associate each user to an account object for us...
"""Support for ZHA covers.""" from __future__ import annotations import asyncio import functools import logging from zigpy.zcl.foundation import Status from homeassistant.components.cover import ( ATTR_CURRENT_POSITION, ATTR_POSITION, DEVICE_CLASS_DAMPER, DEVICE_CLASS_SHADE, DOMAIN, CoverEntity,...
import unittest import amulet class TestDeploy(unittest.TestCase): """ Deployment and smoke test for Apache Bigtop Mahout. """ @classmethod def setUpClass(cls): cls.d = amulet.Deployment(series='xenial') cls.d.add('mahout') cls.d.add('client', charm='hadoop-client') c...
""" Unit Tests for nova.cert.rpcapi """ from nova.cert import rpcapi as cert_rpcapi from nova import context from nova import flags from nova.openstack.common import rpc from nova import test FLAGS = flags.FLAGS class CertRpcAPITestCase(test.TestCase): def setUp(self): super(CertRpcAPITestCase, self).setUp(...
"""Implementation of Unix-like rm command for cloud storage providers.""" from __future__ import absolute_import import time from gslib.cloud_api import BucketNotFoundException from gslib.cloud_api import NotEmptyException from gslib.cloud_api import NotFoundException from gslib.cloud_api import ServiceException from g...
''' Interact with Trello API as a CLI or Sopel IRC bot module ''' import argparse from datetime import date from email.mime.text import MIMEText import json import os import re import smtplib import sys try: import sopel.module # pylint: disable=import-error except ImportError: pass try: from urllib import ...
import grpc from grpc.framework.common import cardinality from grpc.framework.interfaces.face import utilities as face_utilities import google.cloud.proto.logging.v2.logging_metrics_pb2 as google_dot_cloud_dot_proto_dot_logging_dot_v2_dot_logging__metrics__pb2 import google.protobuf.empty_pb2 as google_dot_protobuf_dot...
''' Test idlelib.debugger. Coverage: 19% ''' from idlelib import debugger from test.support import requires requires('gui') import unittest from tkinter import Tk class NameSpaceTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.root = Tk() cls.root.withdraw() @classmethod de...
'''Test RGBA load using the platform decoder (QuickTime, Quartz, GDI+ or Gdk). You should see the rgba.png image on a checkboard background. ''' __docformat__ = 'restructuredtext' __version__ = '$Id: $' import unittest import base_load import sys if sys.platform == 'linux2': from pyglet.image.codecs.gdkpixbuf2 impo...
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'committer', 'version': '1.0'} DOCUMENTATION = ''' --- module: docker_image short_description: Manage docker images. version_added: "1.5" description: - Build, load or pull an image, making the image available for cr...
import mock from nova import test from nova.virt.hyperv import vmutils class VMUtilsTestCase(test.NoDBTestCase): """Unit tests for the Hyper-V VMUtils class.""" _FAKE_VM_NAME = 'fake_vm' _FAKE_MEMORY_MB = 2 _FAKE_VM_PATH = "fake_vm_path" def setUp(self): self._vmutils = vmutils.VMUtils() ...
from sqlalchemy import Column, Integer, MetaData, String, Table meta = MetaData() fixed_ips = Table( "fixed_ips", meta, Column( "id", Integer(), primary_key=True, nullable=False)) fixed_ips_addressV6 = Column( "addressV6", String( length=255, convert_u...
""" Copyright (c) 2004-Present Pivotal Software, Inc. This program and the accompanying materials are made available under the terms of the under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.or...
"""Test inter-conversion of different polynomial classes. This tests the convert and cast methods of all the polynomial classes. """ import operator as op from numbers import Number import pytest import numpy as np from numpy.polynomial import ( Polynomial, Legendre, Chebyshev, Laguerre, Hermite, HermiteE) from num...
from django.conf.global_settings import PASSWORD_HASHERS from django.contrib.auth import get_user_model from django.contrib.auth.hashers import get_hasher from django.contrib.auth.models import ( AbstractUser, Group, Permission, User, UserManager, ) from django.contrib.contenttypes.models import ContentType from dj...
from eventEngine import * EMPTY_STRING = '' EMPTY_UNICODE = u'' EMPTY_INT = 0 EMPTY_FLOAT = 0.0 DIRECTION_NONE = u'无方向' DIRECTION_LONG = u'多' DIRECTION_SHORT = u'空' DIRECTION_UNKNOWN = u'未知' DIRECTION_NET = u'净' OFFSET_NONE = u'无开平' OFFSET_OPEN = u'开仓' OFFSET_CLOSE = u'平仓' OFFSET_UNKNOWN = u'未知' STATUS_NOTTRADED = u'未成...
""" Internal subroutines for e.g. aborting execution with an error message, or performing indenting on multiline output. """ import sys import textwrap def abort(msg): """ Abort execution, print ``msg`` to stderr and exit with error status (1.) This function currently makes use of `sys.exit`_, which raises ...
import unittest, time, sys, random, math, getpass sys.path.extend(['.','..','../..','py']) import h2o, h2o_cmd, h2o_import as h2i, h2o_util, h2o_browse as h2b, h2o_print as h2p import h2o_summ DO_TRY_SCIPY = False if getpass.getuser()=='kevin' or getpass.getuser()=='jenkins': DO_TRY_SCIPY = True DO_MEDIAN = True MA...
from supybot.test import * import copy import pickle import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils msgs = [] rawmsgs = [] class IrcMsgTestCase(SupyTestCase): def testLen(self): for msg in msgs: if msg.prefix: strmsg = str(msg) self.failIf(l...
""""Implementation of Spatial Transformer networks core components.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import abc from itertools import chain import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin from sonnet.pyth...
import string import conditions def parse_expression(exp): if isinstance(exp, list): functionsymbol = exp[0] return PrimitiveNumericExpression(functionsymbol, [conditions.parse_term(arg) for arg in exp[1:]]) elif exp.replace(".","").isdigit(): re...