code
stringlengths
1
199k
from basetest import BaseTest, empty_feed, DummyPackageKit import sys, os, tempfile, imp from io import BytesIO import unittest sys.path.insert(0, '..') from zeroinstall.injector import distro, model, qdom, iface_cache, handler from zeroinstall.support import basedir, windows_args_escape def parse_impls(impls): xml = ...
import json import time import unittest import uuid import os import requests import friend_docs import user_docs import limit_docs def random_db_name(): return "mango_test_" + uuid.uuid4().hex def has_text_service(): return os.path.isfile(os.getcwd() + "/../src/mango_cursor_text.erl") class Database(object): ...
from eliot import log_call, to_file import sys to_file(open("out.log", "w")) @log_call def double(a): if a == 0: import time time.sleep(10) return a * 2 @log_call def main(): double(13) double(0) double(4) main()
""" * Copyright 2008 Google Inc. * * Licensed 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.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, s...
import json import re import sys import importlib_resources from tests import unittest from mongo_connector.namespace_config import ( NamespaceConfig, Namespace, match_replace_regex, namespace_to_regex, RegexSet, wildcards_overlap, ) from mongo_connector import errors class TestNamespaceConfig(u...
"""Copyright 2008 Orbitz WorldWide Licensed 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.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
import unittest import luigi import luigi.util import luigi.notifications luigi.notifications.DEBUG = True class A(luigi.Task): x = luigi.IntParameter(default=3) class B(luigi.util.Derived(A)): y = luigi.IntParameter(default=4) class A2(luigi.Task): x = luigi.IntParameter(default=3) g = luigi.IntParamet...
""" sphinx.websupport ~~~~~~~~~~~~~~~~~ Base Module for web support functions. :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import sys import posixpath from os import path from six.moves import cPickle as pickle from jinja2 import Envir...
import base64 import os import warnings from typing import List, NoReturn, Union from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.webdriver.common.options import ArgOptions class ChromiumOptions(ArgOptions): KEY = "goog:chromeOptions" def __init__(self) -> None: ...
"""Tests for Relu and ReluGrad.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin from tensorflow.python.framework import constant_op from tensorflow.python.framework import...
"""This code example gets all content. This feature is only available to DFP video publishers. 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 information" sect...
import matplotlib.pyplot as plt h = plt.hist(np.random.wald(3, 2, 100000), bins=200, normed=True) plt.show()
''' test depreacted modules (and functions in modules) also test functions w/security implications ''' import os try: import gopherlib except ImportError: pass import string try: import whrandom except ImportError: pass def t1(): 'get rid of warnings about not using deprecated modules' print whr...
import datetime import itertools import unittest from copy import copy from django.db import ( DatabaseError, IntegrityError, OperationalError, connection, ) from django.db.models import Model from django.db.models.fields import ( AutoField, BigIntegerField, BinaryField, BooleanField, CharField, DateTimeFie...
""" Tests of neo.io.nixio_fr """ import numpy as np import unittest from quantities import s from neo.io.nixio_fr import NixIO as NixIOfr import quantities as pq from neo.io.nixio import NixIO from neo.test.iotest.common_io_test import BaseTestIO from neo.core import Block, Segment, AnalogSignal, SpikeTrain, Event try:...
from argparse import ArgumentParser import logging import os import shutil import subprocess import sys import tempfile import warnings import django from django import contrib from django.apps import apps from django.conf import settings from django.db import connection from django.test import TransactionTestCase, Tes...
"""Parallel workflow execution via OAR http://oar.imag.fr """ import os import stat from time import sleep import subprocess import json from .base import (SGELikeBatchManagerBase, logger, iflogger, logging) from nipype.interfaces.base import CommandLine class OARPlugin(SGELikeBatchManagerBase): """Execute using OA...
from __future__ import print_function from __future__ import division from __future__ import absolute_import class Quest(object): """A description of work to do on a Change. Examples include building a binary or running a test. The concept is borrowed from Dungeon Master (go/dungeon-master). In Dungeon Master, Qu...
"""Definitions for the `ThinShell` class.""" import numpy as np from mosfit.constants import FOE, KM_CGS, M_SUN_CGS from mosfit.modules.energetics.energetic import Energetic class ThinShell(Energetic): """Generate `vejecta` from `kinetic_energy` if ejecta in thin shell.""" def process(self, **kwargs): "...
import time from netlib import websockets from .. import language from netlib.exceptions import NetlibException class WebsocketsProtocol: def __init__(self, pathod_handler): self.pathod_handler = pathod_handler def handle_websocket(self, logger): while True: with logger.ctx() as lg: ...
import frappe from frappe.model.naming import append_number_if_name_exists from frappe.utils.dashboard import get_dashboards_with_link def execute(): if not frappe.db.table_exists('Dashboard Chart')\ or not frappe.db.table_exists('Number Card')\ or not frappe.db.table_exists('Dashboard'): return frappe.reload_d...
from django.http import HttpResponse def initialize_ci(request): return HttpResponse('initialize CI job')
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin import os class Sar(Plugin,): """System Activity Reporter """ plugin_name = 'sar' profiles = ('system', 'performance') packages = ('sysstat',) sa_path = '/var/log/sa' option_list = [("all_sar", "gather all system activi...
"""SCons.Tool.ifort Tool-specific initialization for newer versions of the Intel Fortran Compiler for Linux/Windows (and possibly Mac OS X). There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ __revision__ = "src/en...
r""" Buildbot metrics module Keeps track of counts and timings of various internal buildbot activities. Basic architecture: MetricEvent.log(...) || \/ MetricLogObserver || \/ MetricHandler || \/ MetricWatcher """ from __future__ import absolute...
__revision__ = "src/engine/SCons/compat/_scons_itertools.py 4720 2010/03/24 03:14:11 jars" __doc__ = """ Implementations of itertools functions for Python versions that don't have iterators. These implement the functions by creating the entire list, not returning it element-by-element as the real itertools functions do...
import math import logging import sys import time import hashlib import json from wfcommon.formula.base import LastFormula from httplib import HTTPConnection from urllib import urlencode try: from wfrender.datasource.accumulator import AccumulatorDatasource except ImportError, e: from datasource.accumulator imp...
{ 'name': 'Drop Shipping', 'version': '1.0', 'category': 'Warehouse', 'summary': 'Drop Shipping', 'description': """ Manage drop shipping orders =========================== This module adds a pre-configured Drop Shipping operation type as well as a procurement route that allow configuring Drop Shipp...
if __name__ == '__main__': print "ERROR: uhd_modes.py has been deprecated. The new application name is modes_rx."
from spack import * class PyUjson(PythonPackage): """Ultra fast JSON decoder and encoder written in C with Python bindings.""" homepage = "https://github.com/esnme/ultrajson" pypi = "ujson/ujson-1.35.tar.gz" version('4.0.2', sha256='c615a9e9e378a7383b756b7e7a73c38b22aeb8967a8bfbffd4741f7ffd043c4d...
""" ========================================================= SVM-SVC (Support Vector Classification) ========================================================= The classification application of the SVM is used below. The `Iris <http://en.wikipedia.org/wiki/Iris_flower_data_set>`_ dataset has been used for this example ...
import logging from django.conf import settings # noqa from heatclient import client as heat_client from openstack_dashboard.api import base LOG = logging.getLogger(__name__) def format_parameters(params): parameters = {} for count, p in enumerate(params, 1): parameters['Parameters.member.%d.ParameterK...
import json import logging import operator from oslo_utils import units from django.template.defaultfilters import filesizeformat # noqa from django.utils.text import normalize_newlines # noqa from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy from django.views...
""" This is an example dag for using the DingdingOperator. """ from datetime import timedelta from airflow import DAG from airflow.providers.dingding.operators.dingding import DingdingOperator from airflow.utils.dates import days_ago args = { 'owner': 'airflow', 'retries': 3, 'start_date': days_ago(2) } def...
import logging import posixpath import threading from desktop.conf import DEFAULT_USER from desktop.lib.exceptions_renderable import PopupException from desktop.lib.rest.http_client import HttpClient from desktop.lib.rest.resource import Resource from hadoop import cluster from hadoop.yarn.resource_manager_api import g...
from oslo_policy import policy from nova.policies import base BASE_POLICY_NAME = 'os_compute_api:os-agents' POLICY_ROOT = 'os_compute_api:os-agents:%s' agents_policies = [ policy.RuleDefault( name=BASE_POLICY_NAME, check_str=base.RULE_ADMIN_API), policy.RuleDefault( name=POLICY_ROOT % 'd...
"""Switch platform for Hyperion.""" from __future__ import annotations import functools from typing import Any from hyperion import client from hyperion.const import ( KEY_COMPONENT, KEY_COMPONENTID_ALL, KEY_COMPONENTID_BLACKBORDER, KEY_COMPONENTID_BOBLIGHTSERVER, KEY_COMPONENTID_FORWARDER, KEY_...
import fetchers import os import re import sys import traceback import time import logging import json as simplejson logger = logging.getLogger('tst') class colors: OK = '\033[92m' FAIL = '\033[91m' RESET = '\033[0m' acre_host = os.environ["ACRE_HOST_BASE"] acre_port = os.environ["ACRE_PORT"] def drive_apps(man...
""" Types for objects parsed from the configuration. """ from __future__ import absolute_import from __future__ import unicode_literals import os from collections import namedtuple from compose.config.config import V1 from compose.config.errors import ConfigurationError from compose.const import IS_WINDOWS_PLATFORM cla...
"""Tests for Google Cloud Storage client.""" from __future__ import absolute_import from __future__ import division import datetime import errno import logging import os import random import sys import unittest from builtins import object from builtins import range import httplib2 import mock try: from apache_beam.io...
import unittest import weakref import GafferUI import GafferUITest class SplitContainerTest( GafferUITest.TestCase ) : def testConstructor( self ) : c = GafferUI.SplitContainer() self.assertEqual( c.getOrientation(), GafferUI.SplitContainer.Orientation.Vertical ) c = GafferUI.SplitContainer( orientation = Gaffer...
""" Pinterest OAuth2 backend, docs at: https://developers.pinterest.com/docs/api/authentication/ """ from __future__ import unicode_literals import ssl from social.backends.oauth import BaseOAuth2 class PinterestOAuth2(BaseOAuth2): name = 'pinterest' ID_KEY = 'user_id' AUTHORIZATION_URL = 'https://api.p...
import logging import os import unittest from telemetry.core import browser_credentials from telemetry.core import discover from telemetry.page import page_set as page_set_module from telemetry.util import classes from telemetry.wpr import archive_info class PageSetSmokeTest(unittest.TestCase): def setUp(self): #...
"""Translation helper functions.""" import functools import gettext as gettext_module import os import re import sys import warnings from asgiref.local import Local from django.apps import apps from django.conf import settings from django.conf.locale import LANG_INFO from django.core.exceptions import AppRegistryNotRea...
import collections import logging import re import sys import unittest from telemetry.internal.results import artifact_compatibility_wrapper as acw from telemetry.testing import serially_executed_browser_test_case from telemetry.util import screenshot from typ import json_results from gpu_tests import common_browser_ar...
import PythonQt from PythonQt import QtCore, QtGui, QtUiTools from director import applogic as app from director import objectmodel as om from director import propertyset from director import visualization as vis from director.debugVis import DebugData from director.pointpicker import PlacerWidget from director import ...
import os import sys import subprocess from ConfigParser import ConfigParser COMMIT_INFO_FNAME = 'COMMIT_INFO.txt' def pkg_commit_hash(pkg_path): ''' Get short form of commit hash given directory `pkg_path` There should be a file called 'COMMIT_INFO.txt' in `pkg_path`. This is a file in INI file format, wi...
""" github ~~~~~~ Port of the github color scheme. Based upon the pygments-style-railscasts_ of Marcus Fredriksson. .. _pygments-style-railscasts: http://github.com/DrMegahertz/pygments-style-railscasts :copyright: Copyright 2012 Hugo Maia Vieira :license: BSD, see LICENSE for details. """ f...
"""Helpers for listening to events.""" import functools as ft from datetime import timedelta from ..const import ( ATTR_NOW, EVENT_STATE_CHANGED, EVENT_TIME_CHANGED, MATCH_ALL) from ..util import dt as dt_util def track_state_change(hass, entity_ids, action, from_state=None, to_state=None): ...
""" Show how to override basic methods so an artist can contain another artist. In this case, the line contains a Text instance to label it. """ import numpy as np import matplotlib.pyplot as plt import matplotlib.lines as lines import matplotlib.transforms as mtransforms import matplotlib.text as mtext class MyLine(l...
__author__ = 'leviathan' from pylsy import PylsyTable def main(): attributes=["name","age","sex","id","time"] table=PylsyTable(attributes) name=["sun","lsy","luna","leviathan"] table.add_data("name",name) age=[20,21,23,25] table.add_data("age",age) sex=["M","F","F","F"] table.add_data("s...
import process_operations as po import module_tableau_materials def process_entry(processor, txt_file, entry, index): output_list = ["tab_%s %d %s %d %d %d %d %d %d" % entry[0:9]] output_list.extend(processor.process_block(entry[9], entry[0])) output_list.append("\r\n") txt_file.write("".join(output_list)) expo...
import os localDir = os.path.dirname(__file__) import threading import time import cherrypy from cherrypy._cpcompat import copykeys, HTTPConnection, HTTPSConnection from cherrypy.lib import sessions from cherrypy.lib.httputil import response_codes def http_methods_allowed(methods=['GET', 'HEAD']): method = cherrypy...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: ce_vxlan_tunnel version_added: "2.4" short_description: Manages VXLAN tunnel configuration on HUAWEI CloudEngine devices. description: - This mod...
{ 'name': "Sale Matrix", 'summary': "Add variants to Sales Order through a grid entry.", 'description': """ This module allows to fill Sales Order rapidly by choosing product variants quantity through a Grid Entry. """, 'category': 'Sales/Sales', 'version': '1.0', 'depends': ...
"""Convert many unicode characters to ascii characters that are like them. I want to collate names, with the property that a last name starting with O-umlaut will be in with the last name's starting with O. Horrors! So I want that many Latin-1 characters have their umlaute's, etc., stripped. Some of it can be done a...
from openerp.osv import orm, fields class ResCountryState(orm.Model): _inherit = 'res.country.state' _columns = {'better_zip_ids': fields.one2many( 'res.better.zip', 'state_id', 'Cities')}
from django.core.management import BaseCommand, CommandError from mysite.missions.svn import view_helpers class Command(BaseCommand): args = '<username>' help = 'Initialize the Subversion repository for a user' def handle(self, *args, **options): if len(args) != 1: raise CommandError, 'E...
name = "pyodd" version = "1" requires = ["pyfoo"]
import os import itertools from django.conf import settings from django.contrib.staticfiles import finders def static_files_iterator(tested_locations, extension, ignore_patterns=None, additional_settings_list=None): if ignore_patterns is None: ignore_patterns = [] source = (os.path.join(storage.location...
"""Resource definitions for cloud platform apis.""" import enum BASE_URL = 'https://bigtableadmin.googleapis.com/v2/' class Collections(enum.Enum): """Collections for all supported apis.""" OPERATIONS = ( 'operations', '{+name}', { '': 'operations/{operationsId}', }, ...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os from mock import Mock from pants.cache.cache_setup import (CacheFactory, CacheSetup, CacheSpec, CacheSpecFormatError, Emp...
"""Support for IKEA Tradfri switches.""" import logging from homeassistant.components.switch import SwitchDevice from homeassistant.core import callback from . import DOMAIN as TRADFRI_DOMAIN, KEY_API, KEY_GATEWAY from .const import CONF_GATEWAY_ID _LOGGER = logging.getLogger(__name__) IKEA = 'IKEA of Sweden' TRADFRI_S...
""" P1 tests for reset SSH keypair """ from marvin.lib.base import (VirtualMachine, SSHKeyPair, Account, Template, ServiceOffering, ...
''' ''' import os Test.Summary = ''' ''' Test.SkipUnless(Condition.PluginExists('cookie_remap.so')) Test.ContinueOnFail = True Test.testName = "cookie_remap: cookie not exists" ts = Test.MakeATSProcess("ts") server = Test.MakeOriginServer("server", ip='127.0.0.10') request_header = {"headers": "GET /cookiedoesntexist H...
""" Convenient shortcuts to manage or check object permissions. """ from __future__ import unicode_literals from django.contrib.auth.models import Group from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models import ...
from __future__ import with_statement import json from cms.api import add_plugin from cms.constants import PLUGIN_MOVE_ACTION, PLUGIN_COPY_ACTION from cms.models import StaticPlaceholder, Placeholder, CMSPlugin from cms.tests.plugins import PluginsTestBaseCase from cms.utils.compat.dj import force_unicode from cms.util...
from .cli import cli if __name__ == "__main__": cli()
import os import time import logging import shutil import subprocess from autotest.client.shared import error from autotest.client import utils from virttest import virsh, utils_test, utils_misc, data_dir def func_in_thread(vm, timeout): """ Function run in thread to switch domstate. """ def run_virsh_f...
from ..internal.DeadHoster import DeadHoster class NetloadIn(DeadHoster): __name__ = "NetloadIn" __type__ = "hoster" __version__ = "0.55" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?netload\.(in|me)/(?P<PATH>datei|index\.php\?id=10&file_id=)(?P<ID>\w+)' __config__ = [] # @TODO: Rem...
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'metadata_version': '1.0'} DOCUMENTATION = ''' --- module: ce_snmp_target_host version_added: "2.4" short_description: Manages SNMP target host configuration on HUAWEI CloudEngine switches. description: -...
from math import cos, sin, pi, acos, asin, atan, sqrt import FreeCAD, Part from FreeCAD import Base, Console import involute reload(involute) rotate = involute.rotate def makeGear(m, Z, angle, split=True): if FreeCAD.ActiveDocument is None: FreeCAD.newDocument("Gear") doc = FreeCAD.ActiveDocument w ...
"""Tests for RNN cells.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools import numpy as np from tensorflow.contrib.rnn.python.ops import core_rnn_cell_impl from tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl import _linear as linear ...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os import unittest from contextlib import contextmanager from pants.cache.artifact_cache import (NonfatalArtifactCacheError, call_insert, ...
"""Test cases for ternary operators.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.compiler.tests import xla_test from tensorflow.python.framework import dtypes from tensorflow.python.ops import array_ops from tensorflo...
import time import mock import psutil from twitter.common.quantity import Time from apache.thermos.core.helper import TaskRunnerHelper as TRH from gen.apache.thermos.ttypes import ProcessStatus, RunnerHeader, RunnerState USER1 = 'user1' ROOT_UID = 0 UID = 567 PID = 12345 CREATE_TIME = time.time() PROCESS_NAME = 'my_pro...
assert ().count(0) == 0 assert (1, 2, 3).count(2) == 1 assert ("a", "b", "a", "a").count("a") == 3 assert ((2,) * 20).count(2) == 20 try: ().count() assert AssertionError except TypeError: pass
"""Common operations on Posix pathnames. Instead of importing this module directly, import os and refer to this module as os.path. The "os.path" name is an alias for this module on Posix systems; on other systems (e.g. Mac, Windows), os.path provides the same operations in a manner specific to that platform, and is an...
import mock from mock import patch import oslo_messaging as messaging from designate import objects from designate.pool_manager.rpcapi import PoolManagerAPI from designate.tests.test_pool_manager import PoolManagerTestCase class PoolManagerAPITest(PoolManagerTestCase): @patch.object(messaging.RPCClient, 'prepare') ...
class Solution: # @param S, a list of integer # @return a list of lists of integer def subsets(self, S): S.sort() return self._subsets(S, len(S)) def _subsets(self, S, k): if k == 0: return [[]] else: res = [[]] for i in range(len(S)): ...
from os.path import dirname, basename from django.conf import settings from django.core.management import call_command from django.core.management.base import BaseCommand, CommandError from django.db.models import get_apps, get_models, signals from django.utils.importlib import import_module from django.utils.module_lo...
import sys from cv import * def inside(r, q): (rx, ry), (rw, rh) = r (qx, qy), (qw, qh) = q return rx > qx and ry > qy and rx + rw < qx + qw and ry + rh < qy + qh try: img = LoadImage(sys.argv[1]) except: try: f = open(sys.argv[1], "rt") except: print "cannot read " + sys.argv[1]...
""" ================================= Map data to a normal distribution ================================= .. currentmodule:: sklearn.preprocessing This example demonstrates the use of the Box-Cox and Yeo-Johnson transforms through :class:`~PowerTransformer` to map data from various distributions to a normal distributio...
import sys if sys.version_info < (3, 7): from ._width import WidthValidator from ._visible import VisibleValidator from ._valueminus import ValueminusValidator from ._value import ValueValidator from ._type import TypeValidator from ._tracerefminus import TracerefminusValidator from ._tracer...
import functools import mock import pytest class Object: pass @pytest.fixture def object(): return Object() class PartialMethodCaller: def __init__(self, obj, **partial_params): self.obj = obj self.partial_params = partial_params def __getattr__(self, name): return functools.part...
import os import re import subprocess import shlex import pipes import random import select import fcntl import hmac import pwd import gettext import pty from hashlib import sha1 import ansible.constants as C from ansible.callbacks import vvv from ansible import errors from ansible import utils class Connection(object)...
from __future__ import print_function from openturns import * TESTPREAMBLE() try: hermite = HermiteFactory() print("hermite=", hermite) for i in range(10): print("hermite(", i, ")=", hermite.build(i)) roots = hermite.getRoots(10) print("hermite(10) roots=", repr(roots)) nodes, weights = ...
""" Create a DIRAC MoveReplica request to be executed by the RMS """ __RCSID__ = "$Id $" import os from hashlib import md5 import time from DIRAC.Core.Base import Script Script.setUsageMessage( '\n'.join( [ __doc__.split( '\n' )[0], __doc__.split( '\n' )[1], ...
""" Cohorte Top Composer components :author: Thomas Calmant :license: Apache Software License 2.0 .. Copyright 2014 isandlaTech Licensed 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 ...
from __future__ import print_function class DynamicLibrary(object): """This is overwritten and not shown in docs""" ROBOT_LIBRARY_VERSION = 0.1 def __init__(self, arg1, arg2="This is shown in docs"): """This is overwritten and not shown in docs""" def get_keyword_names(self): return ['0'...
import itertools from nova.cells import opts as cells_opts from nova.cells import rpcapi as cells_rpcapi from nova import db from nova import exception from nova.i18n import _LE from nova import objects from nova.objects import base from nova.objects import fields from nova.openstack.common import log as logging LOG = ...
"""Tests for the cost analyzer.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import re from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import meta_graph from tensorflow....
import os, sys import optparse import socket import threading import time from http.server import HTTPServer, BaseHTTPRequestHandler no_reponse_handler_key = 'NoResponse' test_sequence_number_handler_key = 'TestSequenceNumber' test_bad_response_handler_key = 'TestBadResponse' def response_with_code(handler, ret_code): ...
from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.maxDiff = None filename = 'table02.xlsx' test_d...
""" Test for DynamicResizeToolbar """ import logging from AnyQt.QtWidgets import QAction from AnyQt.QtCore import Qt from .. import test from .. import toolbar class ToolBoxTest(test.QAppTestCase): def test_dynamic_toolbar(self): logging.basicConfig(level=logging.DEBUG) w = toolbar.DynamicResizeTool...
from __future__ import division, unicode_literals import sys import os import gzip import argparse import copy import re from math import log, exp from collections import defaultdict from operator import mul from tempfile import NamedTemporaryFile from subprocess import Popen try: from itertools import izip except:...
from olympia.amo.tests import TestCase from olympia.zadmin.models import DownloadSource class TestDownloadSource(TestCase): def test_add(self): created = DownloadSource.objects.create( name='home', type='full', description='This is obviously for the homepage') d = DownloadSou...
import json import logging import re from telemetry.core import camel_case from telemetry.value import list_of_scalar_values from metrics import Metric INTERESTING_METRICS = { 'packetsReceived': { 'units': 'packets', 'description': 'Packets received by the peer connection', }, 'packetsSent':...
""" A simple tool for plotting functions. Each new C{Plot} object opens a new window, containing the plot for a sinlge function. See the documentation for L{Plot} for information about creating new plots. Example plots ============= Plot sin(x) from -10 to 10, with a step of 0.1: >>> Plot(math.sin) Plot cos(x) fr...
""" HTML form utils """ from ..HtmlParser import htmlsax from .. import log, LOG_CHECK class Form(object): """Store HTML form URL and form data.""" def __init__(self, url): """Set URL and empty form data.""" self.url = url self.data = {} def add_value(self, key, value): """Ad...