code
stringlengths
1
199k
""" Stubouts, mocks and fixtures for the test suite """ from nova.compute import task_states from nova.compute import vm_states from nova import db from nova import utils def stub_out_db_instance_api(stubs): """Stubs out the db API for creating Instances.""" INSTANCE_TYPES = { 'm1.tiny': dict(memory_mb=...
from ..utils import appid, have_appserver, on_production_server from .creation import DatabaseCreation from django.db.backends.util import format_number from djangotoolbox.db.base import NonrelDatabaseFeatures, \ NonrelDatabaseOperations, NonrelDatabaseWrapper, NonrelDatabaseClient, \ NonrelDatabaseValidation, ...
"""Psyco profiler (Python part). The implementation of the non-time-critical parts of the profiler. See profile() and full() in core.py for the easy interface. """ import _psyco from support import * import math, time, types, atexit now = time.time try: import thread except ImportError: import dummy_thread as t...
from os.path import abspath, join, dirname from preggy import expect import mock import tornado.web from tests.base import PythonTestCase import thumbor.loaders.strict_https_loader as loader from thumbor.context import Context from thumbor.config import Config from thumbor.loaders import LoaderResult def fixture_for(fi...
"""Invenio Web Page Functions""" __revision__ = "$Id$" from invenio.config import \ CFG_WEBSTYLE_CDSPAGEBOXLEFTBOTTOM, \ CFG_WEBSTYLE_CDSPAGEBOXLEFTTOP, \ CFG_WEBSTYLE_CDSPAGEBOXRIGHTBOTTOM, \ CFG_WEBSTYLE_CDSPAGEBOXRIGHTTOP, \ CFG_SITE_LANG, \ CFG_SITE_URL, \ CFG_SITE_SECURE_URL from...
"""Tests for TCP connection handling, including proper and timely close.""" import socket import sys import time import errno import six import cherrypy from cherrypy._cpcompat import HTTPConnection, HTTPSConnection, NotConnected from cherrypy._cpcompat import ( BadStatusLine, ntob, tonative, urlopen, )...
__version__ = '1.0-dev'
""" Tests that check that we ignore the appropriate files when importing courses. """ import unittest from mock import Mock from xmodule.modulestore.xml_importer import StaticContentImporter from opaque_keys.edx.locator import CourseLocator from xmodule.tests import DATA_DIR class IgnoredFilesTestCase(unittest.TestCase...
'''OpenGL extension EXT.depth_bounds_test This module customises the behaviour of the OpenGL.raw.GL.EXT.depth_bounds_test to provide a more Python-friendly API Overview (from the spec) This extension adds a new per-fragment test that is, logically, after the scissor test and before the alpha test. The depth bounds ...
"""Support for Ecovacs Ecovacs Vaccums.""" import logging from homeassistant.components.vacuum import ( SUPPORT_BATTERY, SUPPORT_CLEAN_SPOT, SUPPORT_FAN_SPEED, SUPPORT_LOCATE, SUPPORT_RETURN_HOME, SUPPORT_SEND_COMMAND, SUPPORT_STATUS, SUPPORT_STOP, SUPPORT_TURN_OFF, SUPPORT_TURN_ON, VacuumDevice) from homea...
""" Covenant Add-on 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 (at your option) any later version. This program is distributed in the h...
import codecs import time from six.moves.urllib.parse import urlencode, urlsplit, parse_qs from django.conf import settings from django.core.cache import cache from graphite.http_pool import http from graphite.intervals import Interval, IntervalSet from graphite.logger import log from graphite.node import LeafNode, Bra...
__all__ = [ 'Provider', 'ContainerState' ] class Type(object): @classmethod def tostring(cls, value): """Return the string representation of the state object attribute :param str value: the state object to turn into string :return: the uppercase string that represents the state o...
import hashlib import hmac import mock from six import StringIO import unittest from swift.cli import form_signature class TestFormSignature(unittest.TestCase): def test_prints_signature(self): the_time = 1406143563.020043 key = 'secret squirrel' expires = 3600 path = '/v1/a/c/o' ...
"""Support for tracking the proximity of a device.""" import logging import voluptuous as vol from homeassistant.const import ( CONF_DEVICES, CONF_UNIT_OF_MEASUREMENT, CONF_ZONE) import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity from homeassistant.helpers.event imp...
""" Allows Dynamic Theme Loading. """ import io import os import threading import django from django.conf import settings from django.core.exceptions import SuspiciousFileOperation from django.template.engine import Engine from django.template.loaders.base import Loader as tLoaderCls from django.utils._os import safe_j...
"""Utility functions for storage. """ import logging from ganeti import constants from ganeti import errors from ganeti.utils import io as utils_io from ganeti.utils import process as utils_process def GetDiskTemplatesOfStorageTypes(*storage_types): """Given the storage type, returns a list of disk templates based on...
import test.support import os import os.path import sys import textwrap import zipfile import zipimport import doctest import inspect import linecache import unittest from test.support.script_helper import (spawn_python, kill_python, assert_python_ok, make_script, make_zip_script...
import unittest import rdflib import re from rdflib.py3compat import b TRIPLE = (rdflib.URIRef("http://example.com/s"), rdflib.RDFS.label, rdflib.Literal("example 1")) class TestTrig(unittest.TestCase): def testEmpty(self): g=rdflib.Graph() s=g.serialize(format='trig') se...
import cv2 from PIL import Image,ImageFont,ImageDraw DEBUG = True def opencv(filename,num): img = cv2.imread(filename,1) font = cv2.FONT_HERSHEY_PLAIN width,height,channel = img.shape cv2.putText(img,str(num),(int(width*5/6),int(height/4)),font,3,(0,0,255),2,cv2.LINE_AA) cv2.imwrite("result_opencv.p...
from cStringIO import StringIO import unittest from testtools import PlaceHolder import subunit from subunit.run import SubunitTestRunner def test_suite(): loader = subunit.tests.TestUtil.TestLoader() result = loader.loadTestsFromName(__name__) return result class TimeCollectingTestResult(unittest.TestResul...
import pefile from ctypes import (c_char, c_short, c_ubyte, c_uint, c_ushort, sizeof, Structure, Union) class SymAddr(Structure): _fields_ = [ ("zeroes", c_uint), ("offset", c_uint) ] class SymUnion(Union): _fields_ = [ ("name", c_char * 8), ("addr", SymAddr) ] cl...
"""Delegate test execution to another environment.""" from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import re import sys import tempfile from . import types as t from .io import ( make_dirs, ) from .executor import ( SUPPORTED_PYTHON_VERSIONS, HTTPTESTER_H...
{ 'name': 'Contracts Management: hr_expense link', 'version': '1.1', 'category': 'Hidden', 'description': """ This module is for modifying account analytic view to show some data related to the hr_expense module. ===========================================================================================...
''' Created on Aug 4, 2012 @author: cmoore ''' from apps.utils import test_utils from apps.managers.challenge_mgr import challenge_mgr from django.test.testcases import TransactionTestCase from apps.widgets.bonus_points.models import BonusPoint from django.core.urlresolvers import reverse class BonusPointTest(Transacti...
from misago.markup import checksums, signature_flavour def set_user_signature(request, user, signature): user.signature = signature if signature: user.signature_parsed = signature_flavour(request, user, signature) user.signature_checksum = make_signature_checksum( user.signature_pars...
"""Test of models for embargo app""" import json from django.test import TestCase from django.db.utils import IntegrityError from opaque_keys.edx.locator import CourseLocator from embargo.models import ( EmbargoedCourse, EmbargoedState, IPFilter, RestrictedCourse, Country, CountryAccessRule, CourseAccessRuleHis...
import frappe from frappe.templates.pages.style_settings import default_properties def execute(): style_settings = frappe.get_doc("Style Settings", "Style Settings") if not style_settings.apply_style: style_settings.update(default_properties) style_settings.apply_style = 1 style_settings.save()
from django.contrib.syndication.feeds import Feed from models import Wiki class LatestEntries(Feed): title = u'Aprendendo Django no Planeta Terra' link = 'http://aprendendodjango.com/' description = u'Capítulos do livro eletrônico "Aprendendo Django no Planeta Terra"' def items(self): return Wik...
"""Platform for water_heater integration.""" from __future__ import annotations from pymelcloud import DEVICE_TYPE_ATW, AtwDevice from pymelcloud.atw_device import ( PROPERTY_OPERATION_MODE, PROPERTY_TARGET_TANK_TEMPERATURE, ) from pymelcloud.device import PROPERTY_POWER from homeassistant.components.water_heat...
class UpdatePathInfo(object): """ Rewrite request.path_info so that it contains the full URL requested. The full URL is composed of the WSGIScriptAlias that is passed in the SCRIPT_NAME header. '/releases.json' becomes '/api/v1/releases.json', '/<consumer_id>/<repo_id>/api/v1/releases.json' becomes ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'core'} DOCUMENTATION = ''' --- module: ec2_vpc_net short_description: Configure AWS virtual private...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from collections import defaultdict from six import iteritems from ansible.compat.tests import unittest from ansible.compat.tests.mock import patch, MagicMock from ansible.inventory import Inventory from ansible.playbook.play import...
from openerp import models, fields class ResCompany(models.Model): _inherit = 'res.company' bvr_background_on_merge = fields.Boolean( 'Insert BVR Background with invoice ?' )
""" Course Group Configurations page. """ from bok_choy.promise import EmptyPromise from .course_page import CoursePage from .utils import confirm_prompt class GroupConfigurationsPage(CoursePage): """ Course Group Configurations page. """ url_path = "group_configurations" def is_browser_on_page(self...
"""Provides the Toon DataUpdateCoordinator.""" import logging import secrets from typing import Optional from toonapi import Status, Toon, ToonError from homeassistant.components.webhook import ( async_register as webhook_register, async_unregister as webhook_unregister, ) from homeassistant.config_entries impo...
"""Auto-generated file, do not edit by hand. MP metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_MP = PhoneMetadata(id='MP', country_code=1, international_prefix='011', general_desc=PhoneNumberDesc(national_number_pattern='[5689]\\d{9}', possible_number_pattern='\\...
import webob.exc from nova.api.openstack.compute.schemas.v3 import services from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova.api import validation from nova import compute from nova import exception from nova.i18n import _ from nova import servicegroup ALIAS = "os-services" author...
u""" ================================== Input and output (:mod:`scipy.io`) ================================== .. currentmodule:: scipy.io SciPy has many modules, classes, and functions available to read data from and write data to a variety of file formats. .. seealso:: `NumPy IO routines <https://www.numpy.org/devdocs...
import datetime from unittest import skipUnless import ddt import pytz from django.conf import settings from mock import patch, DEFAULT, Mock from openedx.core.djangoapps.schedules.management.commands import SendEmailBaseCommand from openedx.core.djangoapps.site_configuration.tests.factories import SiteFactory, SiteCon...
""" Script to run a simple sentence classification experiment with HTM temporal memory The goal is to classify two class of sentences: "The animal eats vegetable" (e.g. The rabbit eats carrot) and "The vegetable eats animal" (e.g. The carrot eats rabbit) """ import time import csv import argparse from htmresearch.frame...
from openerp import models, fields, api, exceptions, _ from datetime import datetime from dateutil.relativedelta import relativedelta import logging NUMBER_OF_UNUSED_MONTHS_BEFORE_EXPIRY = 36 logger = logging.getLogger(__name__) class AccountBankingMandate(models.Model): """SEPA Direct Debit Mandate""" _inherit...
"""Auto-generated file, do not edit by hand. GP metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_GP = PhoneMetadata(id='GP', country_code=None, international_prefix=None, general_desc=PhoneNumberDesc(national_number_pattern='1\\d', possible_number_pattern='\\d{2}')...
""" Script to abandon stale changes from the review server. Fetches a list of open changes that have not been updated since a given age in months or years (default 6 months), and then abandons them. Assumes that the user's credentials are in the .netrc file. Supports either basic or digest authentication. Example to a...
from __future__ import absolute_import, division, print_function, \ with_statement import time import socket import logging import struct import errno import random import binascii import traceback from shadowsocks import encrypt, eventloop, lru_cache, common, shell from shadowsocks.common import pre_parse_header, ...
"""Operations for linear algebra.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops from tensorflow.pyth...
from os.path import join def configuration(parent_package='',top_path=None): from scipy._build_utils.system_info import get_info from numpy.distutils.misc_util import Configuration from scipy._build_utils import (get_g77_abi_wrappers, uses_blas64, blas_ilp64_pre_build_hoo...
import struct import sys from binascii import hexlify from enum import IntEnum import ipaddress def expect_the_same_class(self, other): if not isinstance(other, self.__class__): raise TypeError("Expected the same class. Got {} and {}".format(type(self), type(other))) class MessageInfo(object): def __ini...
""" SleekXMPP: The Sleek XMPP Library Copyright (C) 2013 Nathanael C. Fritz, Lance J.T. Stout This file is part of SleekXMPP. See the file LICENSE for copying permission. """ import logging from sleekxmpp import Iq, Message from sleekxmpp.plugins import BasePlugin from sleekxmpp.xmlstream.handler import...
import json try: from urllib2 import urlopen except ImportError: from urllib.request import urlopen from pycoin.serialize import h2b from pycoin.tx import Spendable class ChainProvider(object): def __init__(self, key_id, netcode="BTC"): NETWORK_PATHS = { "BTC" : "bitcoin", "X...
from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider class BattleNetAccount(ProviderAccount): def to_str(self): battletag = self.account.extra_data.get("battletag") return battletag or super(BattleNetAccount, self...
from __future__ import absolute_import, unicode_literals import beets.library from beets.util import confit __version__ = '1.3.15' __author__ = 'Adrian Sampson <adrian@radbox.org>' Library = beets.library.Library config = confit.LazyConfig('beets', __name__)
''' Structural Plasticity example ----------------------- This example shows a simple network of two populations where structural plasticity is used. The network has 1000 neurons, 80% excitatory and 20% inhibitory. The simulation starts without any connectivity. A set of homeostatic rules are defined, according to whic...
from sqlutils import sqlite, executeSQL, sql_esc from Errors import PkgTagsError import sqlutils import sys import misc def catchSqliteException(func): """This decorator converts sqlite exceptions into PkgTagsError""" def newFunc(*args, **kwargs): try: return func(*args, **kwargs) ex...
"""AWS plugin for integration tests.""" from __future__ import absolute_import, print_function import os from lib.util import ( ApplicationError, display, is_shippable, ) from lib.cloud import ( CloudProvider, CloudEnvironment, ) from lib.core_ci import ( AnsibleCoreCI, ) class AwsCloudProvider(...
import datetime from django.test.client import Client from django.core.urlresolvers import reverse from django.conf import settings from django.test import TestCase from django.core import exceptions from askbot.tests import utils from askbot.tests.utils import with_settings from askbot.conf import settings as askbot_s...
import warnings from . import _construct __all__ = [ # noqa: F822 'block_diag', 'bmat', 'bsr_matrix', 'check_random_state', 'coo_matrix', 'csc_matrix', 'csr_hstack', 'csr_matrix', 'dia_matrix', 'diags', 'eye', 'get_index_dtype', 'hstack', 'identity', 'isscala...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'metadata_version': '1.1'} DOCUMENTATION = ''' --- module: fortios_system_replacemsg_icap short_description: Replacement...
"""A warpper between Invenio and elasticsearch. invenio.ext.elasticsearch.es_query ---------------------------------- A warpper between Invenio and elasticsearch. usage: >>> from es_query import process_es_query, process_es_results >>> es = ElasticSearch(app) >>> es.query_handler(process_es_query) >>> e...
from odoo import api, fields, models from odoo import tools from odoo.addons.crm.models import crm_stage class CrmLeadReportAssign(models.Model): """ CRM Lead Report """ _name = "crm.lead.report.assign" _auto = False _description = "CRM Lead Report" partner_assigned_id = fields.Many2one('res.partner...
"""Base classes for Digital Evidence Containers (DECs)""" from io import RawIOBase from lf.dec.consts import SEEK_SET, SEEK_CUR, SEEK_END __docformat__ = "restructuredtext en" __all__ = [ "Container", "SingleStreamContainer", "StreamInfo", "IStream", "ManagedIStream", "IStreamWrapper" ] class Container(): "...
"""Test Z-Wave switches.""" from homeassistant.components.zwave import switch from tests.async_mock import patch from tests.mock.zwave import MockEntityValues, MockNode, MockValue, value_changed def test_get_device_detects_switch(mock_openzwave): """Test get_device returns a Z-Wave switch.""" node = MockNode() ...
"""A parser for HTML and XHTML.""" import re import warnings import _markupbase from html import unescape __all__ = ['HTMLParser'] interesting_normal = re.compile('[&<]') incomplete = re.compile('&[a-zA-Z#]') entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]') charref = re.compile('&#(?:[0-9]+|[xX][0-9a-fA-...
""" Ansible module to manage A10 Networks slb server objects (c) 2014, Mischa Peters <mpeters@a10networks.com>, 2016, Eric Chou <ericc@a10networks.com> This file is part of Ansible Ansible is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Fr...
import sys from pybindgen import FileCodeSink from pybindgen.gccxmlparser import ModuleParser def my_module_gen(): libName = 'libPy' + sys.argv[2] className = sys.argv[2] + '.hh' includeFile = sys.argv[1] + '/' + className module_parser = ModuleParser( libName, '::') module_parser.parse([includeFile...
import sys with open(sys.argv[1], 'w') as f: print('EXPORTS', file=f) print(' somedllfunc', file=f)
import os.path import re import bjam from b2.build import type, toolset, generators, scanner, feature from b2.exceptions import AlreadyDefined from b2.tools import builtin from b2.util import regex from b2.build.toolset import flags from b2.manager import get_manager from b2.util import utility __debug = None def debug...
s = f'foo{ 42 }bar'
from neutron.common import constants as const from neutron.extensions import portbindings from neutron.plugins.ml2 import driver_api as api class TestMechanismDriver(api.MechanismDriver): """Test mechanism driver for testing mechanism driver api.""" def initialize(self): self.bound_ports = set() def...
from __future__ import unicode_literals from django.db import models from django.db.models import signals from django.dispatch import receiver from django.test import TestCase from django.test.utils import isolate_apps from django.utils import six from .models import Author, Book, Car, Person class BaseSignalTest(TestC...
import os import sys import fcntl from errno import EWOULDBLOCK, EEXIST import fcntl class LockfileLockedException(Exception): """thrown ONLY when pid file is locked.""" pass class Lockfile: """class that provides simple access to a PID-style lockfile. methods: __init__(lockfile), acquire(), and release...
"""Support for the Hitron CODA-4582U, provided by Rogers.""" from collections import namedtuple import logging import requests import voluptuous as vol from homeassistant.components.device_tracker import ( DOMAIN, PLATFORM_SCHEMA, DeviceScanner, ) from homeassistant.const import ( CONF_HOST, CONF_PA...
""" NTLM authenticating pool, contributed by erikcederstran Issue #10, see: http://code.google.com/p/urllib3/issues/detail?id=10 """ from __future__ import absolute_import import warnings from logging import getLogger from ntlm import ntlm from .. import HTTPSConnectionPool from ..packages.six.moves.http_client import ...
"""Generic Unit tests for the GDAL provider. .. note:: 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 2 of the License, or (at your option) any later version. """ __author__ = 'Nyall D...
from __future__ import print_function import argparse import glob import itertools import os import sys from . import Command from .server import main from odoo.modules.module import get_module_root, MANIFEST_NAMES from odoo.service.db import _create_empty_database, DatabaseExists class Start(Command): """Quick sta...
from urllib.parse import urljoin from django.contrib.staticfiles import storage from django.contrib.staticfiles.templatetags.staticfiles import static from django.template import Context, Template from django.test import SimpleTestCase, override_settings from django.utils.deprecation import RemovedInDjango30Warning cla...
"""Private interfaces implemented by data sets used in Face-layer tests.""" import abc from grpc.framework.face import interfaces as face_interfaces # pylint: disable=unused-import from grpc_test.framework.face.testing import interfaces class UnaryUnaryTestMethodImplementation(interfaces.Method): """A controllable i...
""" Utility for parsing an AMQP XML spec file and generating a Python module skeleton. This is a fairly ugly program, but it's only intended to be run once. 2007-11-10 Barry Pederson <bp@barryp.org> """ import sys import textwrap from xml.etree import ElementTree def _textlist(self, _addtail=False): '''Returns a li...
import os import shutil import tempfile from nova import exception from nova import flags class MiniDNS(object): """ Trivial DNS driver. This will read/write to a local, flat file and have no effect on your actual DNS system. This class is strictly for testing purposes, and should keep you out of de...
import vtk from vtk.test import Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() ren1 = vtk.vtkRenderer() ren2 = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.SetMultiSamples(0) renWin.AddRenderer(ren1) renWin.AddRenderer(ren2) iren = vtk.vtkRenderWindowInteractor() iren.SetRe...
from . import im_livechat from . import website from . import res_config_settings
"""dummy Movie class if all else fails """ class Movie: def __init__(self, filename, surface=None): self.filename=filename self.surface = surface self.process = None self.loops=0 self.playing = False self.paused = False self._backend = "DUMMY" self.wi...
import os import optparse import sys import m5 from m5.objects import * m5.util.addToPath('../common') parser = optparse.OptionParser() parser.add_option("-d", "--detailed", action="store_true") parser.add_option("-t", "--timing", action="store_true") parser.add_option("-m", "--maxtick", type="int") parser.add_option("...
"""Core event interfaces.""" from . import event, exc from .pool import Pool from .engine import Connectable, Engine, Dialect from .sql.base import SchemaEventTarget class DDLEvents(event.Events): """ Define event listeners for schema objects, that is, :class:`.SchemaItem` and other :class:`.SchemaEventTarg...
"""QGIS Unit tests for QgsStringStatisticalSummary. .. note:: 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 2 of the License, or (at your option) any later version. """ __author__ = '...
import sys from os import path sys.path.append(path.join(path.dirname(__file__), "_ext")) sys.path.insert(0, path.dirname(path.dirname(__file__))) extensions = [ 'scrapydocs', 'sphinx.ext.autodoc' ] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'Scrapy' copyright = u'200...
import os import sys import time import shutil from lib.util.mysqlBaseTestCase import mysqlBaseTestCase server_requirements = [[]] servers = [] server_manager = None test_executor = None backup_path = None class basicTest(mysqlBaseTestCase): def setUp(self): master_server = servers[0] # assumption that this...
import binwalk binwalk.scan()
"""Convenience wrapper for starting an appengine tool.""" import os import re import sys if not hasattr(sys, 'version_info'): sys.stderr.write('Very old versions of Python are not supported. Please ' 'use version 2.5 or greater.\n') sys.exit(1) version_tuple = tuple(sys.version_info[:2]) if versi...
from __future__ import unicode_literals import webnotes @webnotes.whitelist() def get_items(price_list, sales_or_purchase, item=None, item_group=None): condition = "" args = {"price_list": price_list} if sales_or_purchase == "Sales": condition = "i.is_sales_item='Yes'" else: condition = "i.is_purchase_item='Yes...
import os, sys, json, re, datetime require = json.loads(sys.argv[5]) if len(sys.argv) > 5 else {} stack=re.match("^([^-]+)(?:-([0-9]+))?$", os.getenv("STACK", "cedar-14")) require["heroku-sys/"+stack.group(1)] = "^{}.0.0".format(stack.group(2) or "1") require["heroku/installer-plugin"] = "^1.2.0" manifest = { "type...
""" Intermediate module for working with XML-related virsh functions/methods. The intention of this module is to hide the details of working with XML from test module code. Helper methods are all high-level and not condusive to direct use in error-testing. However, access to a virsh instance is available. All classes...
from __future__ import absolute_import, division, print_function, unicode_literals from guessit.test.guessittest import * class TestHashes(TestGuessit): def test_hashes(self): hashes = ( ('hash_mpc', '1MB', u'8542ad406c15c8bd'), # TODO: Check if this value is valid ('has...
""" Nose test runner module. This script is a front-end to "nosetests" which installs SQLAlchemy's testing plugin into the local environment. The script is intended to be used by third-party dialects and extensions that run within SQLAlchemy's testing framework. The runner can be invoked via:: python -m sqlalche...
import argparse import os import sys import unittest try: # py2 from StringIO import StringIO except ImportError: # py3 from io import StringIO from swift_build_support.arguments import ( action as argaction, type as argtype, ) class ArgumentsTypeTestCase(unittest.TestCase): def test_bool(se...
import traceback from django.http import HttpResponseServerError from django.template import Context, loader def server_error(request, template_name='500.html'): template = loader.get_template(template_name) context = Context({ 'stacktrace' : traceback.format_exc() }) return HttpResponseServerError( templat...
""" To run this, you'll need to have installed. * scikit-learn Does two benchmarks First, we fix a training set, increase the number of samples to classify and plot number of classified samples as a function of time. In the second benchmark, we increase the number of dimensions of the training set, classify a sample ...
"""AuthHandler plugin for gsutil's boto to support LOAS based auth.""" import getpass import json import os import re import subprocess import time import urllib2 from boto.auth_handler import AuthHandler from boto.auth_handler import NotReadyToAuthenticate CMD = ['stubby', '--proto2', 'call', 'blade:sso', 'CorpLogin.E...
from . import * BinaryOperator.R_only = False Sum.SQL_function = "SUM" Average.SQL_function = "AVG" StandardDeviation.SQL_function = "STDDEV" Minimum.SQL_function = "MIN" Maximum.SQL_function = "MAX" Count.SQL_function = "COUNT" can_be_SQL = Method("can_be_SQL") @can_be_SQL.implementation(Number) def Number_can_be_SQL(...
''' Redis Store =========== Store implementation using Redis. You must have redis-py installed. Usage example:: from kivy.storage.redisstore import RedisStore params = dict(host='localhost', port=6379, db=14) store = RedisStore(params) All the key-value pairs will be stored with a prefix 'store' by default....