content
string
import mock from neutron.callbacks import events from neutron.callbacks import exceptions from neutron.callbacks import manager from neutron.callbacks import resources from neutron.tests import base def callback_1(*args, **kwargs): callback_1.counter += 1 callback_id_1 = manager._get_id(callback_1) def callbac...
from __future__ import absolute_import, division, print_function __metaclass__ = type ################################################################################ # Documentation ################################################################################ ANSIBLE_METADATA = {'metadata_version': '1.1', 'statu...
""" Brook.io external inventory script ================================== Generates inventory that Ansible can understand by making API requests to Brook.io via the libbrook library. Hence, such dependency must be installed in the system to run this script. The default configuration file is named 'brook.ini' and is l...
import json from django.utils.http import urlencode from allauth.socialaccount.providers.oauth.client import OAuth from allauth.socialaccount.providers.oauth.views import ( OAuthAdapter, OAuthLoginView, OAuthCallbackView) from .provider import FlickrProvider class FlickrAPI(OAuth): api_url = 'https...
from django.db.models.signals import class_prepared, post_delete, post_save from django.utils.functional import cached_property from ormcache.queryset import CachedQuerySet class CachedManagerMixin(object): @cached_property def __cache_enabled(self): return getattr(self.model, "cache_enabled", False...
""" Utility Class for threaded agents (e.g. TransformationAgent) Mostly for logging """ import time from DIRAC import gLogger __RCSID__ = "$Id$" AGENT_NAME = '' class TransformationAgentsUtilities(object): """ logging utilities for threaded TS agents """ def __init__(self): """ c'tor """ sel...
import re class URLMonitor: ''' The URL monitor maintains a set of (client, url) tuples that correspond to requests which the server is expecting over SSL. It also keeps track of secure favicon urls. ''' # Start the arms race, and end up here... javascriptTrickery = [re.compile("http://....
#! python3 # -*- coding: utf-8 -*- import os import xbmcaddon import xbmcgui import datetime import resources.lib.httplib2 as httplib2 import urllib import json addon = xbmcaddon.Addon() dialog = xbmcgui.Dialog() http = httplib2.Http() class Habitica(xbmcgui.Window): def __init__(self): self.background = xbmcgui.C...
from __future__ import print_function, division from neuralnilm import Net, RealApplianceSource, BLSTMLayer, SubsampleLayer, DimshuffleLayer from lasagne.nonlinearities import sigmoid, rectify from lasagne.objectives import crossentropy from lasagne.init import Uniform, Normal from lasagne.layers import LSTMLayer, Dens...
from django.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property from .base import Database try: import pytz except ImportError: pytz = None class DatabaseFeatures(BaseDatabaseFeatures): empty_fetchmany_value = () update_can_self_select = False ...
import subprocess from path import Path class KubernetesInstaller(): """ This class contains the logic needed to install kuberentes binary files. """ def __init__(self, arch, version, master, output_dir): """ Gather the required variables for the install. """ # The kubernetes charm ne...
""" Classes to represent the default SQL aggregate functions """ import copy import warnings from django.db.models.fields import FloatField, IntegerField from django.db.models.lookups import RegisterLookupMixin from django.utils.deprecation import RemovedInDjango110Warning from django.utils.functional import cached_pr...
''' This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code ''' CSI = '\033[' OSC = '\033]' BEL = '\007' def code_to_chars(code): return CSI + str(code) + 'm' def set_title(title): return OSC + '2;' + title + BEL def clear_screen(mode=2...
from __future__ import (absolute_import, division, print_function) import abc import collections import json import os import traceback try: from hpOneView.oneview_client import OneViewClient HAS_HPE_ONEVIEW = True except ImportError: HAS_HPE_ONEVIEW = False from ansible.module_utils import six from ansi...
import sys from config_common import handler_base, cfg_exceptions from config_common.rhn_log import log_debug, die class Handler(handler_base.HandlerBase): _usage_options = "[options] file" _options_table = [ handler_base.HandlerBase._option_class( '-c', '--channel', action="append", ...
from oslo_config import cfg from oslo_service import wsgi from neutron._i18n import _ socket_opts = [ cfg.IntOpt('backlog', default=4096, help=_("Number of backlog requests to configure " "the socket with")), cfg.IntOpt('retry_until_window', d...
import os def generate(env, gcc_cross_prefix=None, gcc_strict=True, gcc_stop_on_warning=None): if gcc_stop_on_warning == None: gcc_stop_on_warning = env['stop_on_warning'] ### compiler flags if gcc_strict: env.AppendUnique(CCFLAGS = ['-pedantic', '-Wall', '-W', '-Wundef', '-Wno-long-long']) ...
from django.core.urlresolvers import reverse from django import http from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test class HypervisorViewTest(test.BaseAdminViewTests): @test.create_stubs({api.nova: ('hypervisor_list', ...
# -*- coding: utf-8 -*- from config.config import ARTICLE_PER_PAGE from exception import Unauthorized from helper.model_control import get_board, get_article_page from helper.permission import is_anybody, can_write from helper.resource import YuzukiResource from helper.template import render_template class Board(Yuzu...
import defaults ####################### # message definitions # ####################### # define usage message usage="""\ usage: cdshelf <command> [<command> ...] [--config <parameter>=<value> [<parameter>=<value>]] The following commands are currently supported: help print help message pretend_image pret...
"""Grading tests""" import unittest from xmodule import graders from xmodule.graders import Score, aggregate_scores class GradesheetTest(unittest.TestCase): '''Tests the aggregate_scores method''' def test_weighted_grading(self): scores = [] Score.__sub__ = lambda me, other: (me.earned - oth...
""" Tests for epoll wrapper. """ import os import socket import errno import time import select import tempfile import unittest from test import test_support if not hasattr(select, "epoll"): raise test_support.TestSkipped("test works only on Linux 2.6") try: select.epoll() except IOError, e: if e.errno ==...
#!/usr/bin/env python '''Test that font.Text vertical alignment works. Four labels will be aligned top, center, baseline and bottom. ''' __docformat__ = 'restructuredtext' __version__ = '$Id: $' import unittest from pyglet import gl from pyglet import font from . import base_text class TEST_VALIGN(base_text.Text...
# Partition import salome salome.salome_init() import GEOM from salome.geom import geomBuilder geompy = geomBuilder.New(salome.myStudy) gg = salome.ImportComponentGUI("GEOM") # create a vertex and a vector p0 = geompy.MakeVertex( 0., 0., 0.) p200 = geompy.MakeVertex(200., 200., 200.) pz = geompy.MakeVertex( ...
import numpy as np from scipy.sparse import csr_matrix from sklearn import datasets from sklearn.metrics.cluster.unsupervised import silhouette_score from sklearn.metrics import pairwise_distances from sklearn.utils.testing import assert_false, assert_almost_equal from sklearn.utils.testing import assert_raises_regexp...
"""Utilities for indicating abandonment of computation.""" class Abandoned(Exception): """Indicates that some computation is being abandoned. Abandoning a computation is different than returning a value or raising an exception indicating some operational or programming defect. """
#!/usr/bin/env python import sys import random import heapq DISTRIBUTION = [ 341, 444, 551, 656, 765, 906, 1130, 1588, 3313, 84399 ] EVENTS_PER_MS = 5754. / 431997259 # do a simulation MAX_TIME = 60 * 60 * 24 * 1000 if __name__ == '__main__': scale_factor = int(sys.argv[1]) exp_lambda = (EVENTS_PER_MS * sc...
import unittest import fib class Testing(unittest.TestCase): def test_testing(self): self.assertEqual(1,1, "Of course it does!") class Fib_(unittest.TestCase): def setUp(self): self.fib = fib.fib2 def basecase_num_1(self): self.assertEqual(self.fib(1), 0, "fib num 1 is not c...
""" A tiny app that checks for a status message. """ from django.conf import settings from django.core.cache import cache import json import logging import os log = logging.getLogger(__name__) def get_site_status_msg(course_id): """ Look for a file settings.STATUS_MESSAGE_PATH. If found, read it, parse...
{ 'name': 'Forum', 'category': 'Website', 'summary': 'Forum, FAQ, Q&A', 'version': '1.0', 'description': """ Ask questions, get answers, no distractions """, 'author': 'OpenERP SA', 'website': 'https://www.odoo.com/page/community-builder', 'depends': [ 'auth_signup', ...
"""Tests for tensorflow.ops.session_ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python....
# -*- coding: utf-8 -*- import arrow import forecastio from geopy.geocoders import Nominatim from hbconfig import Config from urllib import parse from ..open_api.airkoreaPy import AirKorea from ..slack.resource import MsgResource from ..slack.slackbot import SlackerAdapter from ..slack.template import MsgTemplate f...
import json import urllib.request from urllib.error import HTTPError from retry import retry from django.contrib.gis.geos import GEOSGeometry from storage.shapefile import convert_geom_to_multipolygon class OsniLayer: @retry(HTTPError, tries=2, delay=30) def get_data_from_url(self, url): with urllib.r...
# -*- coding: utf-8 -*- import json from django.contrib.auth import get_permission_codename from django.contrib.sites.models import Site from django.http import HttpResponse from django.shortcuts import render from django.utils.encoding import smart_str from cms.constants import PUBLISHER_STATE_PENDING, PUBLISHER_STA...
import datetime import logging logger = logging.getLogger(__name__) from gi.repository import Gtk, GLib, Gio from .gs_calendar_widget import PersianCalendarWidget, GeorgianCalendarWidget from .gs_day_widget import PersianDayWidget, GeorgianDayWidget from .gs_events_handler import EventsHandler from .gs_indicator impor...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.training.python.training import sampling_ops from tensorflow.python.framework import dtypes as dtypes_lib from tensorflow.python.framework import random_seed from tensorflow.python.ops i...
from django.forms import models as model_forms from django.core.exceptions import ImproperlyConfigured from django.http import HttpResponseRedirect from django.utils.encoding import force_text from django.views.generic.base import TemplateResponseMixin, ContextMixin, View from django.views.generic.detail import (Single...
""" KMeans class """ import numpy as np import sklearn.cluster as cluster #from . import out #from .inval import * from pysptools.classification.out import Output from pysptools.classification.inval import * class KMeans(object): """ KMeans clustering algorithm adapted to hyperspectral imaging """ ...
""" Weigh cells by memory needed in a way that spreads instances. """ from nova.cells import weights import nova.conf CONF = nova.conf.CONF class RamByInstanceTypeWeigher(weights.BaseCellWeigher): """Weigh cells by instance_type requested.""" def weight_multiplier(self): return CONF.cells.ram_weig...
"""curses The main package for curses support for Python. Normally used by importing the package, and perhaps a particular module inside it. import curses from curses import textpad curses.initscr() ... """ __revision__ = "$Id$" from _curses import * from curses.wrapper import wrapper import os as _os...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from units.compat.mock import patch from ansible.modules.network.netvisor import pn_role from units.modules.utils import set_module_args from .nvos_module import TestNvosModule class TestRoleModule(TestNvosModule): module = ...
import pytest from iotile.core.utilities.schema_verify import BytesVerifier, DictionaryVerifier, ListVerifier, StringVerifier, IntVerifier, BooleanVerifier, LiteralVerifier, OptionsVerifier from iotile.core.exceptions import ValidationError @pytest.fixture def verifier1(): ver = DictionaryVerifier('test verifier'...
from ansible.modules.storage.netapp.netapp_e_auditlog import AuditLog from units.modules.utils import AnsibleFailJson, ModuleTestCase, set_module_args __metaclass__ = type from units.compat import mock class AuditLogTests(ModuleTestCase): REQUIRED_PARAMS = {'api_username': 'rw', 'api_passw...
"""Module containing base test results classes.""" class ResultType(object): """Class enumerating test types.""" PASS = 'PASS' SKIP = 'SKIP' FAIL = 'FAIL' CRASH = 'CRASH' TIMEOUT = 'TIMEOUT' UNKNOWN = 'UNKNOWN' @staticmethod def GetTypes(): """Get a list of all test types.""" return [ResultT...
""" Tests for the SignatureValidator class. """ import ddt from django.test import TestCase from django.test.client import RequestFactory from mock import patch from lti_provider.models import LtiConsumer from lti_provider.signature_validator import SignatureValidator def get_lti_consumer(): """ Helper meth...
"""ICU dependency tester. This probably works only on Linux. The exit code is 0 if everything is fine, 1 for errors, 2 for only warnings. Sample invocation: ~/svn.icu/trunk/src/source/test/depstest$ ./depstest.py ~/svn.icu/trunk/dbg """ __author__ = "Markus W. Scherer" import glob import os.path import subproces...
def get_message(params, operation): message = 'Handling requested operation...' if operation == 'new-metadata': message = 'Opening New Metadata UI' elif operation == 'compile-metadata': if 'paths' in params and len(params['paths']) == 1: what = params['paths'][0] if '...
# -*- coding: utf-8 -*- #------------------------------------------------------------ # pelisalacarta - XBMC Plugin # Conector para thevideo.me # http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/ #------------------------------------------------------------ import re from core import httptools from core import l...
from requests.auth import HTTPBasicAuth from requests_oauthlib import OAuth2 from mangopaysdk.tools import enums from mangopaysdk.configuration import Configuration class AuthenticationHelper: # Root/parent MangoPayApi instance that holds the OAuthToken and Configuration instance _root = None def __init...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import time from ansible.module_utils.network.aireos.aireos import run_commands from ansibl...
import numpy as np import _example class Example(_example.Example): title = 'Hello Program' def __init__(self, **kwargs): super().__init__(**kwargs) self.prog = self.ctx.program( vertex_shader=''' #version 330 in vec2 in_vert; vo...
#!/usr/bin/env python """Setup script for cf-predict.""" import setuptools from cf_predict import __project__, __version__ try: README = open("README.rst").read() CHANGES = open("CHANGES.rst").read() except IOError: DESCRIPTION = "<placeholder>" else: DESCRIPTION = README + '\n' + CHANGES setuptool...
""" A 2-dimensional vector class >>> v1 = Vector2d(3, 4) >>> x, y = v1 >>> x, y (3.0, 4.0) >>> v1 Vector2d(3.0, 4.0) >>> v1_clone = eval(repr(v1)) >>> v1 == v1_clone True >>> print(v1) (3.0, 4.0) >>> octets = bytes(v1) >>> octets b'\\x00\\x00\\x00\\x00\\x00\\x00\...
"""Tests for open_spiel.python.algorithms.double_oracle.""" from absl.testing import absltest import numpy as np from open_spiel.python.algorithms import double_oracle import pyspiel class DoubleOracleTest(absltest.TestCase): def test_rock_paper_scissors(self): game = pyspiel.load_matrix_game("matrix_rps") ...
from QuantLib import * swaptionVols = [ # maturity, length, volatility (Period(1, Years), Period(5, Years), 0.1148), (Period(2, Years), Period(4, Years), 0.1108), (Period(3, Years), Period(3, Years), 0.1070), (Period(4, Years), Pe...
"""Component to integrate the Home Assistant cloud.""" import logging import voluptuous as vol from homeassistant.auth.const import GROUP_ID_ADMIN from homeassistant.components.alexa import smart_home as alexa_sh from homeassistant.components.google_assistant import const as ga_c from homeassistant.const import ( ...
import sys import wx #import wx.lib.agw.ultimatelistctrl as ULC from ObjectListView import ObjectListView, ColumnDefn import wx.lib.mixins.gridlabelrenderer as glr from src.wizard.controller.frmVirtualList import VirtualList from src.wizard.controller.frmVirtualGrid import VirtualGrid, GridBase #from lib.ObjectListView...
#!/usr/bin/env python from __future__ import print_function, division, absolute_import import json import os from bokeh.io import curdoc from bokeh.layouts import column, row from toolz import valmap from tornado import gen from distributed.core import rpc from distributed.bokeh.worker_monitor import (worker_table...
import google_login # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
""" Test the internal RIFF reader. """ import os import unittest from pyglet.media.sources.riff import WaveSource test_data_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'data', 'media')) class RiffTest(unittest.TestCase): def test_pcm_16_11025_1ch(self): file_name = os.path...
#!/usr/bin/env python # # x08c.c # # 3-d plot demo. from Numeric import * import math #import pl import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) XPTS = 35 # Data points in x YPTS = 46 # Data points in y opt = [1, 2, 3, 3] alt ...
#!/usr/bin/python # -*- coding: utf-8 -*- from EmeraldAI.Logic.Singleton import Singleton from EmeraldAI.Logic.NLP.SentenceResolver import SentenceResolver from EmeraldAI.Entities.ContextParameter import ContextParameter from EmeraldAI.Entities.User import User from EmeraldAI.Config.Config import Config from EmeraldAI....
"""Provides an interface like pexpect.spawn interface using subprocess.Popen """ import os import threading import subprocess import sys import time import signal import shlex try: from queue import Queue, Empty # Python 3 except ImportError: from Queue import Queue, Empty # Python 2 from .spawnbase import ...
"""Support for mocking the utils module""" from cmdlib.testsupport.util import patchModule # pylint: disable=C0103 def patchUtils(module_under_test): """Patches the L{ganeti.utils} module for tests. This function is meant to be used as a decorator for test methods. @type module_under_test: string @param m...
# -*- coding: utf-8 -*- """ Site upload test. These tests write to the wiki. """ # # (C) Pywikibot team, 2014 # # Distributed under the terms of the MIT license. # from __future__ import unicode_literals __version__ = '$Id: 4d1b1ea2f42aee542722240c9618cc72b4f1bcbb $' import os import pywikibot from tests import _...
import urllib.parse from typing import Sequence from typing import Tuple from mitmproxy.net import check def parse(url): """ URL-parsing function that checks that - port is an integer 0-65535 - host is a valid IDNA-encoded hostname with no null-bytes - path is valid AS...
# hack to return special attributes from _sys import * from javascript import JSObject has_local_storage=__BRYTHON__.has_local_storage has_session_storage = __BRYTHON__.has_session_storage has_json=__BRYTHON__.has_json brython_debug_mode = __BRYTHON__.debug argv = ['__main__'] base_exec_prefix = __BRYTHON__.brython_...
"""Tests for functions.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys # TODO: #6568 Remove this hack that makes dlopen() not crash. if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): import ctypes sys.setdlo...
from enum import Enum, auto from inspect import getsourcefile import os import sys from unittest.mock import Mock import pytest from collections import deque current_path = os.path.abspath(getsourcefile(lambda: 0)) current_dir = os.path.dirname(current_path) root_dir = os.path.join(current_dir, os.pardir, os.pardir) ...
__author__ = 'hiroki' import theano import theano.tensor as T import numpy as np from nn_utils import sigmoid class Layer(object): def __init__(self, rand, input=None, n_input=784, n_output=10, activation=None, W=None, b=None): self.input = input if W is None: W_values = np.asarray(...
"""distutils.command.build Implements the Distutils 'build' command.""" __revision__ = "$Id$" import sys, os from distutils.util import get_platform from distutils.core import Command from distutils.errors import DistutilsOptionError def show_compilers(): from distutils.ccompiler import show_compilers show...
""" A sub-package for efficiently dealing with polynomials. Within the documentation for this sub-package, a "finite power series," i.e., a polynomial (also referred to simply as a "series") is represented by a 1-D numpy array of the polynomial's coefficients, ordered from lowest order term to highest. For example, a...
""" Test authorization functions """ from django.contrib.auth.models import AnonymousUser from django.test import TestCase from .mixins import CourseApiFactoryMixin from ..permissions import can_view_courses_for_username class ViewCoursesForUsernameTestCase(CourseApiFactoryMixin, TestCase): """ Verify func...
from wptserve.handlers import HTTPException import urllib def main(request, response): if request.method != "GET": raise HTTPException(400, message="Method was not GET") if not "id" in request.GET: raise HTTPException(400, message="No id") id = request.GET['id'] if "read" in request....
""" Tests for the bdist_wheel tag options (--python-tag, --universal, and --plat-name) """ import sys import shutil import pytest import py.path import tempfile import subprocess SETUP_PY = """\ from setuptools import setup, Extension setup( name="Test", version="1.0", author_email="<EMAIL>", py_modu...
#!/usr/bin/env python ''' Open the ./OSPF_DATA/ospf_single_interface.txt and extract the interface, IP address, area, type, cost, hello timer, and dead timer. Use regular expressions to accomplish your extraction. Your output should look similar to the following: Int: GigabitEthernet0/1 IP: 172.16.13.150/29 ...
# -*- coding: UTF-8 -*- #!/usr/bin/env python from __future__ import unicode_literals # odfpy_gen_example.py # http://mashupguide.net/1.0/html/ch17s04.xhtml """ Description: This program used odfpy to generate a simple ODF text document odfpy: http://opendocumentfellowship.com/projects/odfpy documentation for o...
from __future__ import absolute_import, division, print_function __metaclass__ = type ################################################################################ # Documentation ################################################################################ ANSIBLE_METADATA = {'metadata_version': '1.1', 'statu...
""" Serialize data to/from JSON """ import datetime import decimal from StringIO import StringIO from django.core.serializers.python import Serializer as PythonSerializer from django.core.serializers.python import Deserializer as PythonDeserializer from django.utils import datetime_safe from django.utils i...
import datetime import os import platform import random import shutil import socket import sys import time from ansible.errors import AnsibleOptionsError from ansible.cli import CLI from ansible.plugins import module_loader from ansible.utils.cmd_functions import run_cmd ##############################################...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import traceback try: import ovirtsdk4.types as otypes except ImportError: pass from datetime import datetime from ansible.module_utils.basic import AnsibleModule from a...
""" Unit tests for instructor dashboard Based on (and depends on) unit tests for courseware. Notes for running by hand: ./manage.py lms --settings test test lms/djangoapps/instructor """ from django.test.utils import override_settings # Need access to internal func to put users in the right group from django.contr...
import unittest from cpp_util import ( Classname, CloseNamespace, GenerateIfndefName, OpenNamespace) class CppUtilTest(unittest.TestCase): def testClassname(self): self.assertEquals('Permissions', Classname('permissions')) self.assertEquals('UpdateAllTheThings', Classname('updateAllTheThings')) ...
"""Base classes for all estimators.""" # License: BSD 3 clause import copy import inspect import warnings import numpy as np from scipy import sparse from .externals import six class ChangedBehaviorWarning(UserWarning): pass ############################################################################## def cl...
""" This endpoint is used to create, modify, list and delete Machine Resolvers. Machine Resolvers fetch machine information from remote machine stores like a hosts file or an Active Directory. The code of this module is tested in tests/test_api_machineresolver.py """ from flask import (Blueprint, re...
from hachoir.stream import InputIOStream from hachoir.parser import guessParser from hachoir.metadata import extractMetadata from flask import json import logging logger = logging.getLogger(__name__) def get_meta(filestream): metadata = {} try: filestream.seek(0) stream = InputIOStream(file...
"""SCons.Tool.gnulink Tool-specific initialization for the gnu linker. 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. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons F...
"""Contains functions to define flags and params. Calling a DEFINE_* function will add a ParamSpec namedtuple to the param_spec dict. The DEFINE_* arguments match those in absl. Calling define_flags() creates a command-line flag for every ParamSpec defined by a DEFINE_* functions. The reason we don't use absl flags d...
import json import os import base64 from ansible.callbacks import vvv from ansible import utils from ansible import errors from ansible import constants HAVE_ZMQ=False try: import zmq HAVE_ZMQ=True except ImportError: pass class Connection(object): ''' ZeroMQ accelerated connection ''' def __ini...
""" Support for ZoneMinder Sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.zoneminder/ """ import logging import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import STATE_UNKNOWN ...
from django.conf import settings from django.db import models from django.utils.translation import gettext as _ from openpds.core.models import Profile class Context(models.Model): datastore_owner = models.ForeignKey(Profile, blank = False, null = False, related_name="datastore_owner_context") context_...
from ggrc import utils from unittest import TestCase class TestUtilsFunctions(TestCase): def test_mapping_rules(self): """ Test that all mappings go both ways """ mappings = utils.get_mapping_rules() verificationErrors = [] for object_name, object_mappings in mappings.items(): for mapping in...
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import ( compat_parse_qs, compat_str, compat_urllib_parse_urlparse, ) from ..utils import ( determine_ext, int_or_none, try_get, qualities, ) class SixPlayIE(InfoExtractor): ...
"""Generates default implementations of operator<< for enum types.""" import codecs import os import re import string import sys _ENUM_START_RE = re.compile(r'\benum\b\s+(\S+)\s+\{') _ENUM_VALUE_RE = re.compile(r'([A-Za-z0-9_]+)(.*)') _ENUM_END_RE = re.compile(r'^\s*\};$') _ENUMS = {} _NAMESPACES = {} def Confused(...
import os import sys import time import logging import datetime import numpy as np from data import * from time import clock from parameters import * from collections import defaultdict spike_generators = {} # dict name_part : spikegenerator spike_detectors = {} # dict name_part : spikedetector multimeters = {} ...
# DEPRECATED """ Copyright 2011 Software Freedom Conservancy. 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 ag...
""" DSS keys. """ import os from hashlib import sha1 from Crypto.PublicKey import DSA from paramiko import util from paramiko.common import zero_byte from paramiko.py3compat import long from paramiko.ssh_exception import SSHException from paramiko.message import Message from paramiko.ber import BER, BERException fro...
""" @author: Andrew Case @license: GNU General Public License 2.0 @contact: <EMAIL> @organization: """ import volatility.obj as obj import volatility.plugins.mac.common as common import volatility.plugins.mac.list_zones as list_zones import volatility.plugins.mac.pslist as pslist class mac_dead_procs...
""" ================================================= Orthogonal distance regression (:mod:`scipy.odr`) ================================================= .. currentmodule:: scipy.odr Package Content =============== .. autosummary:: :toctree: generated/ Data -- The data to fit. RealData -- Dat...
import unittest from socket import error as SocketError import mock from ryu.app.ws_topology import WebSocketTopology class Test_ws_topology(unittest.TestCase): def test_when_sock_error(self): args = { 'wsgi': mock.Mock(), } app = WebSocketTopology(**args) rpc_clien...