code
stringlengths
1
199k
"""Checks import position rule""" A = 1 from sys import x # [wrong-import-position]
""" This class convert dictionaries to XML. This is usually an easy mapping, because key-value mappings go easily to XML (the other way is more problematic). A potential issue usually is how to handle attributes.... See the options below! Examples: { 'book' = { 'chapter' = [ 'text chap 1'...
"""VIF drivers for libvirt.""" import copy from oslo.config import cfg from nova import exception from nova.network import linux_net from nova.network import model as network_model from nova.openstack.common import log as logging from nova import utils from nova.virt.libvirt import config as vconfig from nova.virt.libv...
"""Tests for training routines.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python import keras from tensorflow.python.framework import test_util from tensorflow.python.keras import backend as K from tensorflow.python...
input = """ 1 2 2 1 3 4 1 3 2 1 2 4 1 4 0 0 1 5 2 1 6 7 1 6 2 1 5 7 1 7 0 0 1 8 2 1 9 10 1 9 2 1 8 10 1 10 0 0 1 11 2 1 12 13 1 12 2 1 11 13 1 13 0 0 5 15 4 4 2 8 11 2 5 1 3 3 2 1 14 1 0 15 0 8 d 6 not_c 12 not_e 14 ok 5 c 3 not_a 9 not_d 2 a 11 e 0 B+ 0 B- 1 0 1 """ output = """ {a, c, d, e, ok} {a, c, d, not_e, ok} {...
import os import tempfile import unittest import build_file import repository class BuildFileTest(unittest.TestCase): def test_find_all_include_defs_when_no_includes(self): self.assertEqual([], build_file.from_content("").find_all_include_defs()) def test_find_all_include_defs_when_they_exist(self): ...
from maskrcnn_benchmark import _C from apex import amp nms = amp.float_function(_C.nms)
import getopt import json import logging import os import os.path import sys import time import yaml from datetime import datetime from pathlib import Path from shutil import copyfile from zapv2 import ZAPv2 from zap_common import * config_dict = {} config_msg = {} out_of_scope_dict = {} min_level = 0 ignore_scan_rules...
from xmlrpc.server import DocXMLRPCServer import http.client import sys from test import support threading = support.import_module('threading') import unittest def make_request_and_skipIf(condition, reason): # If we skip the test, we have to make a request because # the server created in setUp blocks expecting ...
import numpy as np from numpy.testing import (assert_array_almost_equal, assert_almost_equal, assert_array_equal, assert_allclose) from nose.tools import assert_equal, assert_true, assert_raises import os.path as op import warnings from scipy.signal import resample as sp_resample from mne.fil...
from contextlib import closing import html from io import StringIO import pytest from sklearn import config_context from sklearn.linear_model import LogisticRegression from sklearn.neural_network import MLPClassifier from sklearn.impute import SimpleImputer from sklearn.decomposition import PCA from sklearn.decompositi...
import xml.etree.ElementTree as ET from qepy.auxiliary import * from numpy import array from lattice import * HatoeV = 27.2107 class PwXML(): """ Class to read data from a Quantum espresso XML file """ _eig_xml = 'eigenval.xml' def __init__(self,prefix,path='.'): """ Initlize the structur...
from amonone.core.collector.runner import runner from amonone.web.apps.api.models import api_model system_info = runner.system() process_info = runner.processes() api_model.store_system_entries(system_info) api_model.store_process_entries(process_info)
from django.apps import AppConfig class BlogConfig(AppConfig): name = 'blog' verbose_name = "博客应用"
"""Initial database schema Revision ID: 1371a0c98ad Revises: None Create Date: 2015-05-20 11:17:56.582791 """ revision = '1371a0c98ad' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust! ### pass ### end Alembic commands ...
u""" .. module:: offer_utilities """ from django import template register = template.Library() # pylint: disable=invalid-name @register.filter(name='can_edit_offer') def can_edit_offer(userprofile, offer): u"""Return whether the user can edit an offer based on an ID.""" if userprofile is None: return F...
import datetime import os from peewee import * from peewee import print_ from playhouse.migrate import * from playhouse.test_utils import count_queries from playhouse.tests.base import database_initializer from playhouse.tests.base import PeeweeTestCase from playhouse.tests.base import skip_if try: from psycopg2cff...
""" *************************************************************************** QgisAlgorithmTests.py --------------------- Date : January 2019 Copyright : (C) 2019 by Nyall Dawson Email : nyall dot dawson at gmail dot com ***********************************...
import string import md5 from sys import argv def MDPrint(str): outstr = '' for i in str: o = ord(i) outstr = (outstr + string.hexdigits[(o >> 4) & 0xF] + string.hexdigits[o & 0xF]) print outstr, from time import time def makestr(start, end): result = ...
""" WMSHistory corrector for the group and ingroup shares """ __RCSID__ = "$Id$" import datetime import time as nativetime from DIRAC.WorkloadManagementSystem.private.correctors.BaseCorrector import BaseCorrector from DIRAC.Core.Utilities import Time from DIRAC.AccountingSystem.Client.ReportsClient import ReportsClient...
""" A lightweight Traits like module. This is designed to provide a lightweight, simple, pure Python version of many of the capabilities of enthought.traits. This includes: * Validation * Type specification with defaults * Static and dynamic notification * Basic predefined types * An API that is similar to enthought.t...
DOCUMENTATION = ''' --- module: apt short_description: Manages apt-packages description: - Manages I(apt) packages (such as for Debian/Ubuntu). version_added: "0.0.2" options: name: description: - A package name, like C(foo), or package specifier with version, like C(foo=1.0). Name wildcards (fnmatch) lik...
{ 'name': "Spain - SII EDI Suministro de Libros", 'version': '1.0', 'category': 'Accounting/Localizations/EDI', 'description': """ This module sends the taxes information (mostly VAT) of the vendor bills and customer invoices to the SII. It is called Procedimiento G417 - IVA. Ll...
""" URLs for course_info API """ from django.conf import settings from django.conf.urls import patterns, url from .views import CourseHandoutsList, CourseUpdatesList urlpatterns = patterns( 'mobile_api.course_info.views', url( r'^{}/handouts$'.format(settings.COURSE_ID_PATTERN), CourseHandoutsLi...
from weboob.tools.test import BackendTest from weboob.capabilities.video import BaseVideo class YoupornTest(BackendTest): BACKEND = 'youporn' def test_search(self): self.assertTrue(len(self.backend.search_videos('ass to mouth', nsfw=False)) == 0) l = list(self.backend.search_videos('ass to mouth...
from Products.Archetypes.public import BaseSchema from plone.app.folder.folder import ATFolderSchema BikaSchema = BaseSchema.copy() BikaSchema['id'].widget.visible = False BikaSchema['description'].widget.visible = False BikaSchema['description'].schemata = 'default' BikaSchema['description'].default_content_type = 'te...
import logging import os import tempfile import urllib import werkzeug.urls import werkzeug.exceptions from openerp.modules.registry import RegistryManager try: import openerp.addons.web.common.http as openerpweb except ImportError: import web.common.http as openerpweb # noqa from openid import oidutil from ...
from __future__ import unicode_literals, division, absolute_import, print_function import os import sys from .._posix import get_shell_env from .getent import get_user_login_shell def get_env(shell=None, for_subprocess=False): """ Fetches the environmental variables for the current user. This is necessary s...
import botocore.exceptions import kappa.event_source.base import logging LOG = logging.getLogger(__name__) class KinesisEventSource(kappa.event_source.base.EventSource): def __init__(self, context, config): super(KinesisEventSource, self).__init__(context, config) self._lambda = kappa.awsclient.crea...
import os import tvm from tvm import te from tvm import rpc from vta import get_bitstream_path, download_bitstream, program_fpga, reconfig_runtime host = os.environ.get("VTA_RPC_HOST", "pynq") port = int(os.environ.get("VTA_RPC_PORT", "9091")) def program_rpc_bitstream(path=None): """Program the FPGA on the RPC ser...
"""Model classes and utility functions for handling Quotes, Votes and Voters in the Overheard application. """ import datetime import hashlib from google.appengine.ext import db from google.appengine.api import memcache from google.appengine.api import users PAGE_SIZE = 20 DAY_SCALE = 4 class Quote(db.Model): """Stor...
from org.myrobotlab.opencv import OpenCVFilterLKOpticalTrack opencv = Runtime.createAndStart("opencv","OpenCV") opencv.addListener("publishOpenCVData", "python", "input") lkfilter = opencv.getFilter("LKOpticalTrack") if (lkfilter == None): lkfilter = OpenCVFilterLKOpticalTrack() opencv.addFilter(lkfilter) lkfilter....
"""The tests for the Group Light platform.""" from homeassistant.components.group import DOMAIN import homeassistant.components.group.light as group from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_EFFECT_LIST, ATTR_FLASH, ATTR_HS_COLOR, ATTR_M...
import ldap import ldap.modlist from keystone import config from keystone import exception from keystone import identity from keystone import tests from keystone.tests import test_ldap_livetest CONF = config.CONF def create_object(dn, attrs): conn = ldap.initialize(CONF.ldap.url) conn.simple_bind_s(CONF.ldap.us...
""" Test continuity along a boundary with hanging nodes due to a mesh refinement. """ from __future__ import absolute_import import os.path as op import numpy as nm from sfepy.base.testing import TestCommon from sfepy.base.base import assert_, Struct def eval_fun(ts, coors, mode, **kwargs): val = nm.sin(nm.sum(coor...
from __future__ import unicode_literals import webnotes, os from webnotes.modules import scrub, get_module_path, scrub_dt_dn in_import = False def import_files(module, dt=None, dn=None, force=False): if type(module) is list: for m in module: return import_file(m[0], m[1], m[2], force) else: return import_file(...
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*- """ read audio stream from audio file """ import os import struct import xbmcvfs class UnknownFormat(Exception):pass class FormatError(Exception):pass class AudioFile(object): f = None audioStart = 0 def AudioFile(self): self...
import sys import urllib import simplejson googleGeocodeUrl = 'http://maps.googleapis.com/maps/api/geocode/json?' def make_geoRequest(query, from_sensor=False): query = query.encode('utf-8') params = { 'address': query, 'sensor': "true" if from_sensor else "false" } url = googleGeocodeUr...
""" *==LICENSE==* CyanWorlds.com Engine - MMOG client, server and tools Copyright (C) 2011 Cyan Worlds, Inc. 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 yo...
DASHBOARD = 'admin' ADD_INSTALLED_APPS = [ 'openstack_dashboard.dashboards.admin', ] ADD_ANGULAR_MODULES = [ 'horizon.dashboard.admin', ] AUTO_DISCOVER_STATIC_FILES = True ADD_SCSS_FILES = [ 'dashboard/admin/admin.scss' ]
"""This plugin adds reporting functionality.""" from grr.gui.plugins import forms from grr.lib.aff4_objects import reports class ReportNameRenderer(forms.StringTypeFormRenderer): """Renderer for listing the available reports.""" type_descriptor = reports.ReportName default = "ClientListReport" layout_template =...
"""Model definitions for simple speech recognition. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import tensorflow as tf def _next_power_of_two(x): """Calculates the smallest enclosing power of two for an input. Args: x: Positive fl...
"""Tests for arbitrary expression evaluator.""" import numpy as np from tensorflow.python.debug.cli import evaluator from tensorflow.python.debug.lib import debug_data from tensorflow.python.framework import test_util from tensorflow.python.platform import test class ParseDebugTensorNameTest(test_util.TensorFlowTestCas...
"""Test configs for sparse_to_dense.""" import numpy as np import tensorflow.compat.v1 as tf from tensorflow.lite.testing.zip_test_utils import create_scalar_data from tensorflow.lite.testing.zip_test_utils import create_tensor_data from tensorflow.lite.testing.zip_test_utils import make_zip_of_tests from tensorflow.li...
"""Support for functionality to have conversations with Home Assistant.""" import logging import re import voluptuous as vol from homeassistant import core from homeassistant.components import http, websocket_api from homeassistant.components.http.data_validator import RequestDataValidator from homeassistant.const impo...
import sys import time import shpUtils t1 = time.time() shapefile = shpUtils.loadShapefile( 'states/st99_d00_shp-90/st99_d00.shp') features = shapefile['features'] t2 = time.time() print '%0.3f seconds load time' %( t2 - t1 ) print '%d features' % len(features) for i in xrange(len(features)): feature = features[i] in...
"""metric_keys python module. Importing from tensorflow.python.estimator is unsupported and will soon break! """ from tensorflow_estimator.python.estimator.canned import metric_keys _HAS_DYNAMIC_ATTRIBUTES = True metric_keys.__all__ = [s for s in dir(metric_keys) if not s.startswith('__')] from tensorflow_estimator.pyt...
""" Test for Nest sensors platform for the Smart Device Management API. These tests fake out the subscriber/devicemanager, and are not using a real pubsub subscriber. """ from google_nest_sdm.device import Device from google_nest_sdm.event import EventMessage from homeassistant.helpers import device_registry as dr, ent...
from oslo_log import log as logging from sqlalchemy import Column from sqlalchemy import MetaData, String, Table LOG = logging.getLogger(__name__) def upgrade(migrate_engine): """Add source volume id column to volumes.""" meta = MetaData() meta.bind = migrate_engine volumes = Table('volumes', meta, auto...
from numba import cuda, float32 from math import cos, sin, tan, exp, log, log10, log2, pow import numpy as np from numba.cuda.testing import CUDATestCase, skip_on_cudasim import unittest @skip_on_cudasim('Fastmath and PTX inspection not available on cudasim') class TestFastMathOption(CUDATestCase): def test_kernel(...
from __future__ import absolute_import, unicode_literals import json from django.core.urlresolvers import reverse from django.forms import widgets from django.contrib.contenttypes.models import ContentType from django.utils.functional import cached_property from django.utils.translation import ugettext_lazy as _ from d...
""" Writing Plugins --------------- nose supports plugins for test collection, selection, observation and reporting. There are two basic rules for plugins: * Plugin classes should subclass :class:`nose.plugins.Plugin`. * Plugins may implement any of the methods described in the class :doc:`IPluginInterface <interface...
from django.core.exceptions import ValidationError from django.forms import EmailField from django.test import SimpleTestCase from . import FormFieldAssertionsMixin class EmailFieldTest(FormFieldAssertionsMixin, SimpleTestCase): def test_emailfield_1(self): f = EmailField() self.assertWidgetRendersT...
"""Patch an orderfile. Starting with a list of symbols in a binary and an orderfile (ordered list of symbols), matches the symbols in the orderfile and augments each symbol with the symbols residing at the same address (due to having identical code). Note: It is possible to have. - Several symbols mapping to the same o...
"""An FTP client class and some helper functions. Based on RFC 959: File Transfer Protocol (FTP), by J. Postel and J. Reynolds Example: >>> from ftplib import FTP >>> ftp = FTP('ftp.python.org') # connect to host, default port >>> ftp.login() # default, i.e.: user anonymous, passwd anonymous@ '230 Guest login ok, acces...
"""Tests prime functions.""" import unittest import rsa.prime class PrimeTest(unittest.TestCase): def test_is_prime(self): """Test some common primes.""" # Test some trivial numbers self.assertFalse(rsa.prime.is_prime(-1)) self.assertFalse(rsa.prime.is_prime(0)) self.assertFa...
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2013-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...
from random import choice from django import forms from django.conf import settings from django.contrib.auth.models import User from django.template.defaultfilters import slugify from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ from django.utils.safestring impo...
"""The tests for the sun automation.""" from datetime import datetime import unittest from unittest.mock import patch from homeassistant.core import callback from homeassistant.setup import setup_component from homeassistant.components import sun import homeassistant.components.automation as automation import homeassis...
from selenium import webdriver from selenium.common.exceptions import * from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0 from selenium.webdriver.common.action_chains import ActionChains as action from common import Global_Locators from cspages.cspage import CloudStackPage from common.shar...
import GithubObject import NamedUser class IssueComment(GithubObject.GithubObject): @property def body(self): self._completeIfNotSet(self._body) return self._NoneIfNotSet(self._body) @property def created_at(self): self._completeIfNotSet(self._created_at) return self._Non...
""" Django settings for ssbc project. Generated by 'django-admin startproject' using Django 1.8.1. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ import os BASE_DIR ...
from __future__ import unicode_literals import unittest import frappe from frappe.contacts.address_and_contact import filter_dynamic_link_doctypes class TestSearch(unittest.TestCase): #Search for the word "clie", part of the word "client" (customer) in french. def test_contact_search_in_foreign_language(self): frap...
""" This file contains tasks that are designed to perform background operations on the running state of a course. At present, these tasks all operate on StudentModule objects in one way or another, so they share a visitor architecture. Each task defines an "update function" that takes a module_descriptor, a particular...
'''OpenGL extension EXT.texture This module customises the behaviour of the OpenGL.raw.GL.EXT.texture to provide a more Python-friendly API Overview (from the spec) The original intention of this extension was simply to support various numeric resolutions of color components in texture images. While it accomplishes...
"""A sensor for incoming calls using a USB modem that supports caller ID.""" import logging import voluptuous as vol from homeassistant.const import (STATE_IDLE, EVENT_HOMEASSISTANT_STOP, CONF_NAME, CONF_DEVICE) from home...
""" compat ====== Cross-compatible functions for Python 2 and 3. Key items to import for 2/3 compatible code: * iterators: range(), map(), zip(), filter(), reduce() * lists: lrange(), lmap(), lzip(), lfilter() * unicode: u() [u"" is a syntax error in Python 3.0-3.2] * longs: long (int in Python 3) * callable * iterable...
"""Tests for the SWIG-wrapped quantize training rewriting.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from tensorflow.python.client import session from tensorflow.python.framework import constant_op from tensorflow.python.framework import im...
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 'RestService' db.create_table('restservice_restservice', ( ('id', self.gf('django.db.models.fields.AutoField...
import logging from django.forms.widgets import Textarea from django.template import loader, Context from django.templatetags.static import static from django.utils import six from django.utils import translation from django.contrib.gis.gdal import OGRException from django.contrib.gis.geos import GEOSGeometry, GEOSExce...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import unittest import test_base import utils class ModuleTests(test_base.ProcessGenerator, unittest.TestCase): def setUp(self): self.binary = os.path.join(test_base.ARGS.build, ...
import copy import unittest import numpy as np import bson from hyperopt.pyll import scope uniform = scope.uniform normal = scope.normal one_of = scope.one_of from hyperopt.base import JOB_STATE_NEW from hyperopt.base import TRIAL_KEYS from hyperopt.base import TRIAL_MISC_KEYS from hyperopt.base import InvalidTrial fro...
""" Easy Install ------------ A tool for doing automatic download/extract/build of distutils-based Python packages. For detailed documentation, see the accompanying EasyInstall.txt file, or visit the `EasyInstall home page`__. __ https://setuptools.readthedocs.io/en/latest/easy_install.html """ from glob import glob f...
from pyramid.settings import asbool def parse_array(types, value): return [cast(types, v) for v in value.split(';') if v.strip()] def parse_object(types, value): items = (part.split(':', 1) for part in value.split(',') if value.strip()) return {k.strip(): cast(types, v) for k, v in items} def parse_string(t...
from __future__ import unicode_literals import frappe import json from frappe import _ from frappe.model.mapper import get_mapped_doc from frappe.utils import flt, cstr from frappe.email.doctype.email_group.email_group import add_subscribers def get_course(program): '''Return list of courses for a particular program ...
from __future__ import print_function from openturns import * TESTPREAMBLE() RandomGenerator.SetSeed(0) try: distribution = FrankCopula(1.5) size = 1000 sample = distribution.getSample(size) factory = FrankCopulaFactory() estimatedDistribution = factory.build(sample) print("distribution=", repr(...
import os, pprint, sys, time, traceback sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common'))) import driver, scenario_common, utils, vcoptparse op = vcoptparse.OptParser() op["num_rows"] = vcoptparse.IntFlag("--num-rows", 50000) scenario_common.prepare_option_parser_mode_fl...
import unittest from ...compatibility import StringIO from ...chart import Chart class TestInitialisation(unittest.TestCase): """ Test initialisation of the Chart class and call a method. """ def setUp(self): self.fh = StringIO() self.chart = Chart() self.chart._set_filehandle(se...
"""Forms needed for authentication.""" from django import forms from django.contrib.auth import authenticate, login class LoginForm(forms.Form): """Django-backed login form for normal authentication.""" username = forms.CharField(label="Username", max_length=30, widget=forms.TextI...
from platformio.platforms.base import BasePlatform class TitivaPlatform(BasePlatform): """ Texas Instruments TM4C12x MCUs offer the industrys most popular ARM Cortex-M4 core with scalable memory and package options, unparalleled connectivity peripherals, advanced application functions, industry-leading ...
""" Unit tests for the NLTK modules. These tests are intented to ensure that changes that we make to NLTK's code don't accidentally introduce bugs. Each module in this package tests a specific aspect of NLTK. Modules are typically named for the module or class that they test (e.g., L{nltk.test.tree} performs tests on...
""" Base and utility classes for pandas objects. """ from pandas import compat import numpy as np from pandas.core import common as com import pandas.core.nanops as nanops import pandas.lib as lib from pandas.util.decorators import Appender, cache_readonly, deprecate_kwarg from pandas.core.common import AbstractMethodE...
from . import AWSObject, Ref, GetAtt from .validators import boolean, integer, network_port class CacheCluster(AWSObject): resource_type = "AWS::ElastiCache::CacheCluster" props = { 'AutoMinorVersionUpgrade': (boolean, False), 'AZMode': (basestring, False), 'CacheNodeType': (basestring, ...
import unittest from django.core.checks import Error, Warning from django.core.checks.model_checks import _check_lazy_references from django.db import connection, connections, models from django.db.models.functions import Abs, Lower, Round from django.db.models.signals import post_init from django.test import SimpleTes...
"""Test resurrection of mined transactions when the blockchain is re-organized.""" from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * class MempoolCoinbaseTest(BitcoinTestFramework): def __init__(self): super().__init__() self.num_nodes = 1 self....
from __future__ import division, print_function, absolute_import import numpy as np from scipy._lib.six import callable, xrange from scipy._lib._numpy_compat import suppress_warnings from collections import namedtuple __all__ = ['binned_statistic', 'binned_statistic_2d', 'binned_statistic_dd'] Bin...
"""pyduino - A python library to interface with the firmata arduino firmware. Copyright (C) 2007 Joe Turner <orphansandoligarchs@gmail.com> 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 versi...
import base64 import logging import werkzeug from openerp.addons.web import http from openerp.exceptions import AccessError, UserError from openerp.http import request from openerp.tools.translate import _ _logger = logging.getLogger(__name__) class website_slides(http.Controller): _slides_per_page = 12 _slides...
""" WWW: http://4suite.com/4DOM e-mail: support@4suite.com Copyright (c) 2000 Fourthought Inc, USA. All Rights Reserved. See http://4suite.com/COPYRIGHT for license and copyright information """ import string from xml.dom import Node from xml.dom.html.HTMLElement import HTMLElement class HTMLMenuElement(HTM...
"""Implements basics of Capa, including class CapaModule.""" import cgi import copy import datetime import hashlib import json import logging import os import traceback import struct import sys try: import dogstats_wrapper as dog_stats_api except ImportError: # pylint: disable=invalid-name dog_stats_api = N...
from twisted.internet.defer import inlineCallbacks from twisted.logger import Logger from autobahn.twisted.util import sleep from autobahn.twisted.wamp import ApplicationSession from autobahn.wamp.exception import ApplicationError class AppSession(ApplicationSession): log = Logger() @inlineCallbacks def onJ...
from ..base import SEMLikeCommandLine class SlicerCommandLine(SEMLikeCommandLine): pass
from unittest import TestCase import mock from six import StringIO from grab.error import warn class GrabErrorTestCase(TestCase): def test_warn(self): out = StringIO() with mock.patch('sys.stderr', out): warn('abc') self.assertTrue('GrabDeprecationWarning: abc' in out.getvalue())
import os import sys def is_active(): return True def get_name(): return "OSX" def can_build(): if (sys.platform == "darwin" or os.environ.has_key("OSXCROSS_ROOT")): return True return False def get_opts(): return [ ('force_64_bits','Force 64 bits binary','no'), ('osxcross_sdk','OSXCross SDK version','...
""" Base classes for writing management commands (named commands which can be executed through ``django-admin.py`` or ``manage.py``). """ import os import sys from optparse import make_option, OptionParser import django from django.core.exceptions import ImproperlyConfigured from django.core.management.color import col...
from .qhavedate import QHaveDate __all__ = ['QHaveDate']
import sys, os, re import helpers, options, client, server, firewall, hostwatch import compat.ssubprocess as ssubprocess from helpers import * def parse_subnets(subnets_str): subnets = [] for s in subnets_str: m = re.match(r'(\d+)(?:\.(\d+)\.(\d+)\.(\d+))?(?:/(\d+))?$', s) if not m: ...
"""Chromium presubmit script for src/net. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details on the presubmit API built into gcl. """ def GetPreferredTryMasters(project, change): # Changes in crypto often need a corresponding OpenSSL edit. return { 'tryserver.chromium':...
""" sphinx.util.json ~~~~~~~~~~~~~~~~ Minimal JSON module that generates small dumps. This is not fully JSON compliant but enough for the searchindex. And the generated files are smaller than the simplejson ones. Uses the basestring encode function from simplejson. :copyright: 2007-2008 by A...
from toolset.test_types.abstract_test_type import AbstractTestType from toolset.test_types.verifications import verify_query_cases class TestType(AbstractTestType): def __init__(self, config): self.update_url = "" kwargs = { 'name': 'update', 'accept_header': self.accept('jso...