content
stringlengths
4
20k
from openerp.tests import common class test_challenge(common.TransactionCase): def setUp(self): super(test_challenge, self).setUp() cr, uid = self.cr, self.uid self.data_obj = self.registry('ir.model.data') self.user_obj = self.registry('res.users') self.challenge_obj = s...
# -*- coding: utf-8 -*- """Tests for MDN importer views.""" from __future__ import unicode_literals import mock from django.contrib.auth.models import Group from django.core.urlresolvers import reverse from mdn.models import FeaturePage, Issue from webplatformcompat.models import Feature from webplatformcompat.tests...
from tqdm import tqdm from tinamit.config import _ from tinamit.mod import OpsSimulGrupo from .mod import CalibradorModSpotPy from .valid import ValidadorMod, vars_datos_interés class SimuladorGeog(object): """ Simulador geográfico. """ def __init__(símismo, mod): """ Parameters ...
import sigrokdecode as srd # Packet IDs (PIDs). # The first 4 bits are the 'packet type' field, the last 4 bits are the # 'check field' (each bit in the check field must be the inverse of the resp. # bit in the 'packet type' field; if not, that's a 'PID error'). # For the 4-bit strings, the left-most '1' or '0' is the...
#! /usr/bin/env python # -*- coding: utf-8 -*- import ldap LDAP_HOST = '10.10.10.10' USER = 'cn=admin,dc=gccmx,dc=cn' PASSWORD = 'yourpass' BASE_DN = 'dc=gccmx,dc=cn' class LDAPTool: def __init__(self,ldap_host=None,base_dn=None,user=None,password=None): if not ldap_host: ldap_host = LDAP_HOST...
from django.core.exceptions import PermissionDenied from django.http import HttpResponseBadRequest, JsonResponse from django.shortcuts import get_object_or_404, render from django.template.loader import render_to_string from django.utils.encoding import force_str from django.views.decorators.http import require_POST fr...
import math from decimal import Decimal from django.db.models import DecimalField from django.db.models.functions import Sqrt from django.test import TestCase from django.test.utils import register_lookup from ..models import DecimalModel, FloatModel, IntegerModel class SqrtTests(TestCase): def test_null(self)...
import test import afip import invoice import config import partner import account import country import report import currency # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: cobbler_system version_added: '2.7' short_description: Manag...
"""handle diagram generation options for class diagram or default diagrams """ from logilab.common.compat import builtins import astroid from astroid.utils import LocalsVisitor from pylint.pyreverse.diagrams import PackageDiagram, ClassDiagram BUILTINS_NAME = builtins.__name__ # diagram generators ################...
"""SCons.Platform.posix Platform-specific initialization for POSIX (Linux, UNIX, etc.) systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001 - 2016 The SCons Foundation # # ...
import Sofa def createScene(node): # a generic implementation of a cheap but clean attachment between a rigid and a deformable using a SubsetMultiMapping # this has been called 'hard-bindings' in Sifakis, E., Shinar, T., Irving, G. and Fedkiw, R. "Hybrid simulation of deformable solids", SCA 2007 node.gravity = [...
#!/usr/bin/env python import argparse import errno import os import subprocess import sys import tempfile from lib.config import PLATFORM, get_target_arch, get_chromedriver_version from lib.util import atom_gyp, execute, get_atom_shell_version, parse_version, \ scoped_cwd from lib.github import G...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import fcntl import gettext import select import os from abc import ABCMeta, abstractmethod, abstractproperty from functools import wraps from six import with_metaclass from ansible import constants as C from ansible.errors impor...
import os import sys _BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) _BINTREES_PATH = os.path.join( _BASE_PATH, os.pardir, os.pardir, 'third_party', 'bintrees') sys.path.insert(0, _BINTREES_PATH) from bintrees import FastRBTree # pylint: disable=F0401 class ExclusiveRangeDict(object): ...
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import re from datetime import date, datetime from decimal import Decimal from django import template from django.conf import settings from django.template import defaultfilters from django.utils.encoding import force_text from django.utils.formats imp...
""" Risk Report =========== +-----------------+----------------------------------------------------+ | key | value | +=================+====================================================+ | trading_days | The number of trading days between ...
import unittest from test import support class Empty: def __repr__(self): return '<Empty>' class Cmp: def __init__(self,arg): self.arg = arg def __repr__(self): return '<Cmp %s>' % self.arg def __eq__(self, other): return self.arg == other class Anyt...
# pylint:disable=no-member from ...protos import cfg_pb2 from ...serializable import Serializable class MemoryDataSort: Unspecified = None Unknown = "unknown" Integer = "integer" PointerArray = "pointer-array" String = "string" UnicodeString = "unicode" SegmentBoundary = "segment-boundary"...
"""InputSpec tests.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.keras.engine import input_spec from tensorflow.python.platform import test class InputSpecTest(test.TestCase): def test_axes_initialization(self): input_s...
"""Tests for slim.nets.overfeat.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.framework.python.ops import variables as variables_lib from tensorflow.contrib.slim.python.slim.nets import overfeat from tensorflow.python.ops impor...
from performance import PerformanceService, throughput, latency, compute_aggregate_throughput from end_to_end_latency import EndToEndLatencyService from producer_performance import ProducerPerformanceService from consumer_performance import ConsumerPerformanceService
import base64 import io import json import zlib from requests.structures import CaseInsensitiveDict from .compat import HTTPResponse, pickle def _b64_encode_bytes(b): return base64.b64encode(b).decode("ascii") def _b64_encode_str(s): return _b64_encode_bytes(s.encode("utf8")) def _b64_decode_bytes(b): ...
import cgi import datetime import urllib import urlparse from django.conf import settings from django.template import defaultfilters from django.utils.html import strip_tags from jingo import register import jinja2 from .urlresolvers import reverse # Yanking filters from Django. register.filter(strip_tags) registe...
from openerp.tools.translate import _ from openerp.osv import osv, orm class account_invoice(orm.Model): _inherit = "account.invoice" def action_cancel(self, cr, uid, ids, context=None): invoices = self.read(cr, uid, ids, ['move_id', 'payment_ids']) for invoice in invoices: if invo...
# DatabaseStorage for django. # 2009 (c) GameKeeper Gambling Ltd, Ivanov E. import StringIO import urlparse from django.conf import settings from django.core.files import File from django.core.files.storage import Storage from django.core.exceptions import ImproperlyConfigured try: import pyodbc except ImportErro...
import contextlib import functools import netaddr import six import sys from neutron._i18n import _ from neutron_lib import constants as neutron_constants from oslo_config import cfg from oslo_log import log as logging from nuage_neutron.plugins.common import constants as nuage_constants from nuage_neutron.plugins.co...
""" Tests capa util """ import unittest from . import test_capa_system from capa.util import compare_with_tolerance, sanitize_html class UtilTest(unittest.TestCase): """Tests for util""" def setUp(self): super(UtilTest, self).setUp() self.system = test_capa_system() def test_compare_with...
#!/usr/bin/env python ''' PEXPECT LICENSE This license is approved by the OSI and FSF as GPL-compatible. http://opensource.org/licenses/isc-license.txt Copyright (c) 2012, Noah Spurrier <<EMAIL>> PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY PURPOSE WITH OR WITHOUT F...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json import re from ansible.errors import AnsibleConnectionFailure from ansible.module_utils._text import to_text, to_bytes from ansible.plugins.terminal import TerminalBase class TerminalModule(TerminalBase): termin...
import os, sys import setuptools import pkg_resources from setuptools import setup, Command classifiers = ['Development Status :: 6 - Mature', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', 'Operating...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import os import ssl as ssl_lib import traceback from distutils.version import LooseVersion...
from django import forms class LiveStatusForm(forms.Form): """ This form is used to generate a mk_livestatus query """ table = forms.ChoiceField() columns = forms.MultipleChoiceField() filter1 = forms.ChoiceField(required=False) filter2 = forms.ChoiceField(required=False)
"""Checks Java files for illegal imports.""" import codecs import os import re import results from rules import Rule class JavaChecker(object): """Import checker for Java files. The CheckFile method uses real filesystem paths, but Java imports work in terms of package names. To deal with this, we have an ext...
""" The temp module provides a NamedTemporaryFile that can be re-opened on any platform. Most platforms use the standard Python tempfile.TemporaryFile class, but MS Windows users are given a custom class. This is needed because in Windows NT, the default implementation of NamedTemporaryFile uses the O_TEMPORARY flag, ...
import testtools import time import test_utils import test_mockcontext import random from plugin import (utils, constants, resource_group, subnet, network, security_group ) from cloudify.state impor...
from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import flt, get_datetime, format_datetime class StockOverReturnError(frappe.ValidationError): pass def validate_return(doc): if not doc.meta.get_field("is_return") or not doc.is_return: return validate_return_against(...
from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import formatdate from erpnext.controllers.website_list_for_contact import (get_customers_suppliers, get_party_details) def get_context(context): context.no_cache = 1 context.show_sidebar = True context.doc = frappe.ge...
import os from django.conf import settings CAPTCHA_FONT_PATH = getattr(settings,'CAPTCHA_FONT_PATH', os.path.normpath(os.path.join(os.path.dirname(__file__), '..', 'fonts/etl24-unicode.pil'))) CAPTCHA_FONT_SIZE = getattr(settings,'CAPTCHA_FONT_SIZE', 22) CAPTCHA_LETTER_ROTATION = getattr(settings, 'CAPTCHA_LETTER_ROT...
"""Tests for certificate Django models. """ import json from unittest.mock import patch import ddt import pytest from django.conf import settings from django.core.exceptions import ValidationError from django.core.files.uploadedfile import SimpleUploadedFile from django.test import TestCase from django.test.utils im...
""" Django settings for mysite project. Generated by 'django-admin startproject' using Django 1.10.4. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import os ...
from __future__ import division, print_function from os.path import join, split, dirname import os import sys from distutils.dep_util import newer from distutils.msvccompiler import get_build_version as get_msvc_build_version def needs_mingw_ftime_workaround(): # We need the mingw workaround for _ftime if the msv...
from whoosh.compat import text_type from whoosh.compat import xrange from whoosh.analysis.acore import Token from whoosh.analysis.filters import Filter, LowercaseFilter from whoosh.analysis.tokenizers import Tokenizer, RegexTokenizer # Tokenizer class NgramTokenizer(Tokenizer): """Splits input text into N-grams ...
# -*- coding: utf-8 -*- """ jinja2.debug ~~~~~~~~~~~~ Implements the debug interface for Jinja. This module does some pretty ugly stuff with the Python traceback system in order to achieve tracebacks with correct line numbers, locals and contents. :copyright: (c) 2017 by the Jinja Team. :...
try: from novaclient.v1_1 import client as nova_client try: from neutronclient.neutron import client except ImportError: from quantumclient.quantum import client from keystoneclient.v2_0 import client as ksclient import time except ImportError: print "failed=True msg='novaclient,...
from __future__ import print_function import os import sys import subprocess import params # This module is generated before this script is run BLENDER_COMMAND = "blender" WORK_DIR = "/golem/work" OUTPUT_DIR = "/golem/output" def exec_cmd(cmd): pc = subprocess.Popen(cmd) return pc.wait() def format_blen...
""" This test tests the authmodules/Apache2/privacyidea_apache.py """ from .base import MyTestCase from authmodules.apache2.privacyidea_apache import (OK, UNAUTHORIZED, check_password, ROUNDS, SALT_SIZE) import respo...
#!/usr/bin/env python import argparse import binascii import decimal import io import sys from pycoin import encoding from pycoin.convention import tx_fee, btc_to_satoshi, satoshi_to_btc from pycoin.services import blockchain_info from pycoin.tx import Tx, UnsignedTx, TxOut, SecretExponentSolver def mai...
"""A single place for constructing and exposing the main parser """ import os import sys from pip import __version__ from pip._internal.cli import cmdoptions from pip._internal.cli.parser import ( ConfigOptionParser, UpdatingDefaultsHelpFormatter, ) from pip._internal.commands import ( commands_dict, get_simi...
import oslo_config.cfg from nova.conductor import api as conductor_api def API(*args, **kwargs): use_local = kwargs.pop('use_local', False) if oslo_config.cfg.CONF.conductor.use_local or use_local: api = conductor_api.LocalAPI else: api = conductor_api.API return api(*args, **kwargs) ...
"""A custom list that manages index/position information for contained elements. :author: Jason Kirtland ``orderinglist`` is a helper for mutable ordered relationships. It will intercept list operations performed on a :func:`.relationship`-managed collection and automatically synchronize changes in list position ont...
# -*- coding: utf-8 -*- # __ # /__) _ _ _ _ _/ _ # / ( (- (/ (/ (- _) / _) # / """ requests HTTP library ~~~~~~~~~~~~~~~~~~~~~ Requests is an HTTP library, written in Python, for human beings. Basic GET usage: >>> import requests >>> r = requests.get('http://python.org') >>> r.sta...
from __future__ import division from __future__ import print_function import time import tensorflow as tf import numpy as np from sklearn.model_selection import train_test_split from keras.layers import Dense, Dropout, Flatten from keras.layers import Conv2D, MaxPooling2D from keras.layers.core import Dropout from la...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: bigip_iapp_template short_description: Manages TCL iApp tem...
import pytest import search_journalctl def canned_search_journalctl(get_log_output=None): """Create a search_journalctl object with canned get_log_output method""" module = search_journalctl if get_log_output: module.get_log_output = get_log_output return module DEFAULT_TIMESTAMP = 149634136...
# coding: utf-8 from __future__ import unicode_literals import re from .adobepass import AdobePassIE from ..compat import compat_str from ..utils import ( xpath_text, int_or_none, determine_ext, parse_duration, xpath_attr, update_url_query, ExtractorError, strip_or_none, ) class Turn...
""" Check that all of the certs on all service endpoints validate. """ import unittest from tests.integration import ServiceCertVerificationTest import boto.ec2.cloudwatch class CloudWatchCertVerificationTest(unittest.TestCase, ServiceCertVerificationTest): cloudwatch = True regions = boto.ec2.cloudwatch.re...
from airflow.contrib.hooks.wasb_hook import WasbHook from airflow.models import BaseOperator from airflow.utils.decorators import apply_defaults class WasbDeleteBlobOperator(BaseOperator): """ Deletes blob(s) on Azure Blob Storage. :param container_name: Name of the container. (templated) :type conta...
__author__ = 'yurib' import random def n_point(f,m,n=1): """ :param f: parent 1 :param m: parent 2 :param n: points to performs corssover :return: 2 children (each with the first segment selected from a different parent) """ assert n <= min(len(f), len(m)) - 1 f_splits = [0] + sorted(...
import sys import unittest from test import test_support from test.test_support import run_unittest, have_unicode import math L = [ ('0', 0), ('1', 1), ('9', 9), ('10', 10), ('99', 99), ('100', 100), ('314', 314), (' 314', 314), ('314 ', 314), ...
import pandas import scipy.optimize def graphinit(): import matplotlib.pyplot as plt fontsize=25 plt.rcParams['figure.autolayout'] = False plt.rcParams['figure.figsize'] = 12, 7 plt.rcParams['axes.labelsize'] = 25 plt.rcParams['axes.titlesize'] = 25 plt.rcParams['font.size'] = 25 plt.r...
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 import json from django.conf import settings from django.core.management import BaseCommand from django.utils import timezone from django.utils.dateparse import parse_datetime from django.utils.translation import ugettext_lazy from odk_logger.models ...
""" brain-dead simple parser for ini-style files. (C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed """ __version__ = "0.2.dev2" __all__ = ['IniConfig', 'ParseError'] COMMENTCHARS = "#;" class ParseError(Exception): def __init__(self, path, lineno, msg): Exception.__init__(self, path, lineno, msg) ...
#!/usr/bin/env python """Installs geordi""" import os import sys from distutils.core import setup def long_description(): """Get the long description from the README""" return open(os.path.join(sys.path[0], 'README.rst')).read() setup( author='Brodie Rao', author_email='<EMAIL>', classifiers=[ ...
from win32com import storagecon from win32com.shell import shell, shellcon # nuitka-skip-unless-imports: win32com print("OK.")
""" Simple example: .. UIExample:: 50 b = ui.Button(text="Push me") Example with interaction: .. UIExample:: 50 from flexx import app, ui, react class Example(ui.Widget): def init(self): self.b1 = ui.Button(text="I've been clicked 0 times") class...
from PyQt4.QtCore import * from PyQt4.QtGui import * from qrtextedit import ScanQRTextEdit import re from decimal import Decimal from electrum import bitcoin import util RE_ADDRESS = '[1-9A-HJ-NP-Za-km-z]{26,}' RE_ALIAS = '(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>' frozen_style = "QWidget { background-color:none; bor...
# -*- coding: utf-8 -*- from formalchemy.tests import * def test_renderer_names(): """ Check that the input name take care of multiple primary keys:: >>> fs = FieldSet(primary1) >>> print fs.field.render() <input id="PrimaryKeys-1_22-field" maxlength="10" name="PrimaryKeys-1_22-field" ...
# -*- coding: utf-8 -*- import sys sys.path[0:0] = [""] import unittest from mongoengine import * from mongoengine.connection import get_db __all__ = ("GeoFieldTest", ) class GeoFieldTest(unittest.TestCase): def setUp(self): connect(db='mongoenginetest') self.db = get_db() def _test_for_e...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import sys import copy import json from ansible import constants as C from ansible.plugins.action.network import ActionModule as ActionNetworkModule from ansible.module_utils.network.asa.asa import asa_provider_spec from ansible.m...
# -*- coding: utf-8 -*- """ *************************************************************************** i_in_spotvgt.py --------------- Date : April 2016 Copyright : (C) 2016 by Médéric Ribreux Email : medspx at medspx dot fr *******************************...
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2019 Fortinet, 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 Lic...
"""This module contains a object that represents Tests for Telegram Venue""" import sys if sys.version_info[0:2] == (2, 6): import unittest2 as unittest else: import unittest sys.path.append('.') import telegram from tests.base import BaseTest class VenueTest(BaseTest, unittest.TestCase): """This obje...
""" Tests for database migrations. There are "opportunistic" tests which allows testing against all 3 databases (sqlite in memory, mysql, pg) in a properly configured unit test environment. For the opportunistic testing you need to set up db's named 'openstack_citest' with user 'openstack_citest' and password 'opensta...
import pygame from OpenGL.GL import * from OpenGL.GLU import * import DevIL pygame.init() screen = pygame.display.set_mode((800, 600), pygame.OPENGL | pygame.DOUBLEBUF) pygame.display.set_caption('Devil Test') glDisable(GL_DEPTH_TEST) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluOrtho2D(0, 800, 0, 600) glMatrixMod...
#!/usr/bin/env python import os import sys import uuid from datetime import time, date, datetime, timedelta from random import randint import git from progress.bar import Bar hello_world_c = """#include <iostream> int main() { std::cout << "Hello World!"; }""" default_file_name = 'main.cpp' class RockStar: ...
import os import ConfigParser class InvalidConfig(Exception): pass class Config(dict): def __init__(self): super(Config, self).__init__() def from_file(self, file_name): if not os.path.isfile(file_name): raise InvalidConfig('File %s not found' % file_name) conf = Con...
import json from ansible.module_utils._text import to_text from ansible.module_utils.basic import env_fallback from ansible.module_utils.network.common.utils import to_list, ComplexList from ansible.module_utils.connection import Connection, ConnectionError, exec_command from ansible.module_utils.network.common.config...
from __future__ import unicode_literals import pickle import time from datetime import datetime from django.conf import settings from django.template import Context, engines from django.template.response import ( ContentNotRenderedError, SimpleTemplateResponse, TemplateResponse, ) from django.test import ( Re...
#!/usr/bin/env python """ 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 ...
import copy from django.core.exceptions import FieldError from django.db.models.constants import LOOKUP_SEP from django.db.models.fields import FieldDoesNotExist class SQLEvaluator(object): def __init__(self, expression, query, allow_joins=True, reuse=None): self.expression = expression self.opts...
from allauth.account.signals import email_confirmed, user_logged_in, user_signed_up from allauth.socialaccount.signals import pre_social_login from allauth.socialaccount.signals import social_account_removed from django.core.exceptions import ObjectDoesNotExist from django.db import transaction from django.db.models.si...
import time from lib.ast import (Ast_Branch, Ast_Comment, Ast_Goto, Ast_Loop, Ast_IfGoto, Ast_Ifelse, Ast_AndIf) from lib.utils import BRANCH_NEXT, BRANCH_NEXT_JUMP, debug__ from lib.exceptions import ExcIfelse def get_ast_ifgoto(ctx, paths, curr_loop_idx, inst): nxt = ctx.gph.link_out[inst.address] ...
""" controls.py - support classes for LDAP controls See http://www.python-ldap.org/ for details. \$Id: controls.py,v 1.7 2009/07/26 11:09:58 stroeder Exp $ Description: The ldap.controls module provides LDAPControl classes. Each class provides support for a certain control. """ from ldap import __version__ __all__...
import logging from cStringIO import StringIO from thrift.transport.TTransport import * from desktop.lib.rest.http_client import HttpClient from desktop.lib.rest.resource import Resource LOG = logging.getLogger(__name__) class THttpClient(TTransportBase): """ HTTP transport mode for Thrift. HTTPS and Kerb...
from functools import partial from tempest import config from tempest.lib.common.utils import data_utils as lib_data_utils CONF = config.CONF PING_IPV4_COMMAND = 'ping -c 3 ' PING_IPV6_COMMAND = 'ping6 -c 3 ' PING_PACKET_LOSS_REGEX = '(\d{1,3})\.?\d*\% packet loss' class DataUtils(object): def __getattr__(self...
from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import tabs from openstack_dashboard import api from openstack_dashboard.dashboards.project.loadbalancers import tables class PoolsTab(tabs.TableTab): table_classes = (tables.PoolsTable,) name = _("Pools") ...
""" Performes various tests for module ldapurl """ import ldapurl from ldapurl import * print '\nTesting function isLDAPUrl():' is_ldap_url_tests = { # Examples from RFC2255 'ldap:///o=University%20of%20Michigan,c=US':1, 'ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US':1, 'ldap://ldap.itd.umich.e...
import abc from neutron.api import extensions from neutron.api.v2 import attributes as attr from neutron.api.v2 import resource_helper from neutron.common import exceptions as qexception from neutron.plugins.common import constants from neutron.services.service_base import ServicePluginBase import six supported_tunne...
""" To view this example, first start a Bokeh server: bokeh serve --allow-websocket-origin=localhost:8000 And then load the example into the Bokeh server by running the script: python widget.py in this directory. Finally, start a simple web server by running: python -m SimpleHTTPServer (python 2) or ...
import sys from proton import * class CallbackAdapter: def __init__(self, messenger): self.messenger = messenger self.messenger.blocking = False self.messenger.outgoing_window = 1024 self.messenger.incoming_window = 1024 # for application use self.message = Message(...
import os import sys import pytest import numpy as np import pyarrow as pa def test_tensor_attrs(): data = np.random.randn(10, 4) tensor = pa.Tensor.from_numpy(data) assert tensor.ndim == 2 assert tensor.size == 40 assert tensor.shape == data.shape assert tensor.strides == data.strides ...
from __future__ import unicode_literals import os import sys import base64 import codecs from cherrymusicserver import log from time import time PERFORMANCE_TEST = True def timed(func): """decorator to time function execution and log result on DEBUG""" def wrapper(*args, **kwargs): starttime = time(...
''' This scan writes a patterns of bits in the pixel registers and reads them back. The occuring errors are counted and a Shmoo plot is produced and printed on a .pdf The supply voltage and the .bit file loaded can be changed from here. Global registers are checked as well and a second Shmoo plot is printed in t...
"""Utility functions for Windows builds. These functions are executed via gyp-win-tool when using the ninja generator. """ import os import shutil import subprocess import sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) def main(args): executor = WinTool() exit_code = executor.Dispatch(args) if exi...
import unittest from iptest import IronPythonTestCase, is_cli, run_test from iptest.type_util import myset, myfrozenset #--GLOBALS--------------------------------------------------------------------- s1 = [2, 4, 5] s2 = [4, 7, 9, 10] s3 = [2, 4, 5, 6] class SetTest(IronPythonTestCase): def test_equality(self): ...
import boto from boto.configservice.exceptions import NoSuchConfigurationRecorderException from tests.compat import unittest class TestConfigService(unittest.TestCase): def setUp(self): self.configservice = boto.connect_configservice() def test_describe_configuration_recorders(self): response...
""" Parsing for Tor hidden service descriptors as described in Tor's `rend-spec <https://gitweb.torproject.org/torspec.git/tree/rend-spec.txt>`_. Unlike other descriptor types these describe a hidden service rather than a relay. They're created by the service, and can only be fetched via relays with the HSDir flag. T...
from openerp.osv import osv from openerp.tools.translate import _ class purchase_line_invoice(osv.osv_memory): """ To create invoice for purchase order line""" _name = 'purchase.order.line_invoice' _description = 'Purchase Order Line Make Invoice' def _make_invoice_by_partner(self, cr, uid, partner...
"""Tests for distutils.dist.""" import os import io import sys import unittest import warnings import textwrap from unittest import mock from distutils.dist import Distribution, fix_help_options from distutils.cmd import Command from test.support import ( captured_stdout, captured_stderr, run_unittest ) from .p...