code
stringlengths
1
199k
import argparse as ap import shared ACTIONS = dict() def action(key): def wrapper(function): ACTIONS[key] = function return function return wrapper def get_closed_issues(repo, milestone): issues_and_prs = repo.get_issues(milestone=milestone, state="closed") issues_only = [i for i in issu...
from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup(name='portopy', version='0.1', description='Python API for porto', long_description=readme(), url='https://github.com/yandex/porto', author='marchael', author_email='marchael@yandex-team.ru...
"""Run Valgrind on all demos.""" import sys, os, re import platform from instant import get_status_output if "--only-python" in sys.argv: print "Skipping C++ only memory tests" sys.exit() if platform.system() in ['Darwin', 'Windows']: print "No support for Valgrind on this platform." sys.exit(0) cppdemo...
"""Various utility functions used by this plugin""" import subprocess from os import environ, devnull from os.path import expanduser from .constants import PLATFORM from .window_utils import get_pref class NodeNotFoundError(OSError): def __init__(self, original_exception, node_path): msg = "Node.js was not ...
"""Test the Dyson air quality component.""" import json from unittest import mock import asynctest from libpurecool.dyson_pure_cool import DysonPureCool from libpurecool.dyson_pure_state_v2 import DysonEnvironmentalSensorV2State import homeassistant.components.dyson.air_quality as dyson from homeassistant.components im...
"""Unit test for treadmill.runtime. """ import errno import socket import unittest import mock import treadmill import treadmill.rulefile import treadmill.runtime from treadmill import exc class RuntimeTest(unittest.TestCase): """Tests for treadmill.runtime.""" @mock.patch('socket.socket.bind', mock.Mock()) ...
import cPickle import gzip import os, sys, errno import time import math import numpy import numpy.distutils.__config__ import theano from utils.providers import ListDataProvider from frontend.label_normalisation import HTSLabelNormalisation, XMLLabelNormalisation from frontend.silence_remover import SilenceRemover fro...
"""Code snippets used in webdocs. The examples here are written specifically to read well with the accompanying web docs. Do not rewrite them until you make sure the webdocs still read well and the rewritten code supports the concept being described. For example, there are snippets that could be shorter but they are wr...
"""Classes for analyzing and storing the state of Python code blocks.""" from __future__ import unicode_literals import abc import collections import re from grumpy.compiler import expr from grumpy.compiler import util from grumpy.pythonparser import algorithm from grumpy.pythonparser import ast from grumpy.pythonparse...
import os import mock import mox from oslo.config import cfg import stubout import testtools from quantum import context from quantum.db import api as db from quantum.extensions.flavor import (FLAVOR_NETWORK, FLAVOR_ROUTER) from quantum.openstack.common import uuidutils from quantum.plugins.metaplugin.meta_quantum_plug...
import base64 import json from six import string_types from kubernetes_py.models.unversioned.BaseModel import BaseModel from kubernetes_py.models.v1.ObjectMeta import ObjectMeta from kubernetes_py.utils import is_valid_string, is_valid_dict class Secret(BaseModel): """ http://kubernetes.io/docs/api-reference/v1...
import unittest from django import test from common import api from common import util from common import validate from common.test import base class CommonViewTest(base.ViewTestCase): def test_redirect_slash(self): r = self.login_and_get('popular', '/user/popular/overview/') redirected = self.assertRedirects...
from BitTornado.zurllib import urlopen, quote from urlparse import urlparse, urlunparse from socket import gethostbyname from btformats import check_peers from BitTornado.bencode import bdecode from threading import Thread, Lock from cStringIO import StringIO from traceback import print_exc from socket import error, ge...
from oslo.config import cfg from neutron.common import utils METADATA_PROXY_HANDLER_OPTS = [ cfg.StrOpt('admin_user', help=_("Admin user")), cfg.StrOpt('admin_password', help=_("Admin password"), secret=True), cfg.StrOpt('admin_tenant_name', ...
""" Support for ISY994 fans. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/fan.isy994/ """ import logging from typing import Callable from homeassistant.components.fan import (FanEntity, DOMAIN, SPEED_OFF, SPEED_...
"""Platform for the Garadget cover component.""" import logging import requests import voluptuous as vol from homeassistant.components.cover import PLATFORM_SCHEMA, CoverDevice from homeassistant.const import ( CONF_ACCESS_TOKEN, CONF_COVERS, CONF_DEVICE, CONF_NAME, CONF_PASSWORD, CONF_USERNAME,...
import unittest import os import tempfile from yotta.lib.fsutils import rmRf from . import cli Test_Module_JSON = '''{ "name": "git-access-testing", "version": "0.0.2", "description": "Git Access Testing", "author": "autopulated", "homepage": "https://github.com/autopulated/git-access-testing", "licenses": ...
import os import sys import re print "Generate framework fragment related code for leanback" cls = ['Base', 'BaseRow', 'Browse', 'Details', 'Error', 'Headers', 'Playback', 'Rows', 'Search', 'VerticalGrid', 'Branded', 'GuidedStep', 'Onboarding', 'Video'] for w in cls: print "copy {}SupportFragment to {}F...
import six import functools import amqp.exceptions as amqp_exceptions from kombu import Connection from kombu import Exchange from oslo_serialization import jsonutils from kombu import Queue from nailgun.logger import logger from nailgun.settings import settings from nailgun.rpc import utils creds = ( ("userid", "g...
"""Test infrastructure for the NPU cascader"""
if DefLANG in ("RU", "UA"): AnsBase_temp = tuple([line.decode("utf-8") for line in ( "\nВсего входов - %d\nВремя последнего входа - %s\nПоследняя роль - %s", # 0 "\nВремя последнего выхода - %s\nПричина выхода - %s", # 1 "\nНики: %s", # 2 "Нет статистики.", # 3 "«%s» сидит здесь - %s.", # 4 "Ты провёл здес...
""" example1-simpleloop ~~~~~~~~~~~~~~~~~~~ This example shows how to use the loop block backend and frontend. :copyright: 2015 by Lantz Authors, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from lantz.ui.app import start_gui_app from lantz.ui.blocks import Loop, Lo...
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 field 'UserProfile.is_mysqldba_oncall' db.add_column(u'user_profiles', 'is_mysqldba_oncall', self.gf('dj...
from zope.interface import implementer from six import iteritems from twisted.internet.defer import DeferredQueue, inlineCallbacks, maybeDeferred, returnValue from .utils import get_spider_queues from .interfaces import IPoller @implementer(IPoller) class QueuePoller(object): def __init__(self, config): sel...
if __name__ == '__main__': import sys reload(sys) sys.setdefaultencoding('utf-8') import jam.webserver from jam.server import server jam.webserver.run(server)
__author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>" __date__ = "$Mar 30, 2015 08:25:33 EDT$" import collections import json import os import os.path import shutil import tempfile import numpy import h5py import vigra import vigra.impex import nanshe.util.iters import nanshe.util.xnumpy import nanshe.io.xtiff import...
""" .. _tut-overview: Overview of MEG/EEG analysis with MNE-Python ============================================ This tutorial covers the basic EEG/MEG pipeline for event-related analysis: loading data, epoching, averaging, plotting, and estimating cortical activity from sensor data. It introduces the core MNE-Python da...
import copy import mock import unittest from utils.service_discovery.config_stores import get_config_store from utils.service_discovery.consul_config_store import ConsulStore from utils.service_discovery.etcd_config_store import EtcdStore from utils.service_discovery.abstract_config_store import AbstractConfigStore fro...
import os import sys import glob version = (int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4])) def substitute_file(name): subst = '' f = open(name) for l in f: if '#define LIBTORRENT_VERSION_MAJOR' in l and name.endswith('.hpp'): l = '#define LIBTORRENT_VERSION_MAJOR %d\n' % version[0] el...
"""Pause scene""" from __future__ import division, print_function, unicode_literals __docformat__ = 'restructuredtext' from cocos.director import director from cocos.layer import Layer, ColorLayer from cocos.scene import Scene import pyglet from pyglet.gl import * __pause_scene_generator__ = None def get_pause_scene():...
"""Copy Qt frameworks to the target application's frameworks directory. Typical usage: % python copy_qt_frameworks.py --qtdir=/path/to/qtdir/ \ --target=/path/to/target.app/Contents/Frameworks/ """ __author__ = "horo" import optparse import os from copy_file import CopyFiles from util import PrintErrorAndExit f...
import sys import inspect from functools import partial __all__ = ['decorator', 'wraps', 'unwrap', 'ContextDecorator', 'contextmanager'] def decorator(deco): # Any arguments after first become decorator arguments has_args = get_argcounts(deco) != (1, False, False) if has_args: # A decorator with arg...
import numpy as np from pyquante2.dft.functionals import xs,cvwn5 xname = dict(lda=xs,xs=xs,svwn=xs) cname = dict(lda=cvwn5,svwn=cvwn5,xs=None) def get_xc(grid,D,**kwargs): xcname = kwargs.get('xcname','lda') # Does not work on either gradient corrected functionals or spin-polarized functionals yet. xfunc =...
from gpu_tests.gpu_test_expectations import GpuTestExpectations class ContextLostExpectations(GpuTestExpectations): def SetExpectations(self): # Sample Usage: # self.Fail('ContextLost.WebGLContextLostFromGPUProcessExit', # ['mac', 'amd', ('nvidia', 0x1234)], bug=123) # AMD Radeon 6450 self.Fai...
""" This module loads all the classes from the VTK IO library into its namespace. This is a required module.""" import os if os.name == 'posix': from libvtkIOPython import * else: from vtkIOPython import *
""" lantz.drivers.legacy.olympus.ixbx ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When talking about the z-axis of a microscope, use "near" and "far" instead of "up" and "down." "Nearer" always means the objective ends closer to the sample; "farther" means the objective ends farther away. On an inverted microscope, "...
from unicodecsv import DictReader class CSVImporter(object): """ A CSV-backed resource with the datas in it. """ def __init__(self, fh): self.reader = DictReader(fh) self.data = list(self.reader) @property def headers(self): headers = set() for row in self.data: ...
from __future__ import absolute_import, print_function, division import petl as etl table = [['foo', 'bar'], ['a', 1], ['b', None]] etl.select(table, 'bar', lambda v: v > 0) etl.selectgt(table, 'bar', 0) etl.select(table, 'bar', lambda v: v > etl.Comparable(0))
from chainer import cuda from chainer import function from chainer import utils from chainer.utils import type_check import numpy class ClippedReLU(function.Function): """Clipped Rectifier Unit function. Clipped ReLU is written as :math:`ClippedReLU(x, z) = \min(\max(0, x), z)`, where :math:`z(>0)` is a par...
from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): pass def backwards(self, orm): pass models = { } complete_apps = ['website']
""" This module contains practical examples of Docutils client code. Importing this module from client code is not recommended; its contents are subject to change in future Docutils releases. Instead, it is recommended that you copy and paste the parts you need into your own code, modifying as necessary. """ from docu...
from django.contrib.auth.models import Permission from django.contrib.sites.models import Site from django.core.urlresolvers import reverse from cms.api import create_page from cms.constants import PUBLISHER_STATE_DIRTY from cms.models import Page from cms.test_utils.project.extensionapp.models import MyPageExtension, ...
"""A user-defined wrapper around string objects Note: string objects have grown methods in Python 1.6 This module requires Python 1.6 or later. """ from types import StringType, UnicodeType import sys __all__ = ["UserString","MutableString"] class UserString: def __init__(self, seq): if isinstance(seq, Stri...
""" Module containing Axes3D, an object which can plot 3D objects on a 2D matplotlib figure. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import math from matplotlib.externals import six from matplotlib.externals.six.moves import map, xrange, zip, redu...
""" A neural chatbot using sequence to sequence model with attentional decoder. This is based on Google Translate Tensorflow model https://github.com/tensorflow/models/blob/master/tutorials/rnn/translate/ Sequence to sequence model by Cho et al.(2014) Created by Chip Huyen as the starter code for assignment 3, class CS...
"""This module holds the ``Process``es for NER.""" from copy import deepcopy from dataclasses import dataclass from typing import Any, List from boltons.cacheutils import cachedproperty from cltk.core.data_types import Doc, Process from cltk.ner.ner import tag_ner @dataclass class NERProcess(Process): """To be inhe...
from ..base import BaseTaskRunnerBackend class SocketIOBackend(BaseTaskRunnerBackend): def __init__(self): from . import sockets def get_detail_template(self): return 'task_runners/deployment_detail_socketio.html'
"""This module tests only cloud specific events""" import pytest import yaml from cfme.common.vm import VM from cfme.cloud.provider.azure import AzureProvider from utils import testgen from utils.generators import random_vm_name pytestmark = [ pytest.mark.tier(3) ] pytest_generate_tests = testgen.generate([AzurePro...
__tests__ = 'stoqlib.lib.stringutils' import unittest from stoqlib.lib.stringutils import next_value_for, max_value_for class TestStringUtils(unittest.TestCase): def test_next_value_for(self): # Trivial cases self.assertEqual(next_value_for(u''), u'1') self.assertEqual(next_value_for(u'1'), ...
import os import sys import string filenames = os.listdir(os.getcwd()) for file in filenames: if os.path.splitext(file)[1] == ".o" or os.path.splitext(file)[1] == ".elf" : print "objdumparm.exe -D "+file os.system("C:/WindRiver/gnu/4.1.2-vxworks-6.8/x86-win32/bin/objdumparm.exe -D "+file +" > " +file + ".txt") os....
""" *************************************************************************** ConfigDialog.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ***************************************************...
from __future__ import absolute_import from __future__ import print_function from .common import src_tree_iterator DESC = "" def populate_args(extract_args_p): extract_args = extract_args_p.add_argument_group('TREE EDIT OPTIONS') extract_args.add_argument("--orthologs", dest="orthologs", ...
import sys import CORE_DATA import urllib2 import socket import irchat write_to_a_file = False #Only affects psyco write_youtube_to_file = True #True = YTCV4 will load, false = YTCV3 will load try: import psyco except ImportError: print 'Psyco not installed, the program will just run slower' psyco_exists = Fal...
import re from django import template from django.template.loader import get_template from django.template import RequestContext register = template.Library() INSTALLED_ARTIFACTS = dict() def install(artifact_class): INSTALLED_ARTIFACTS[artifact_class.key] = artifact_class def find(data): from fir_artifacts.mod...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'network'} DOCUMENTATION = """ --- module: eos_vrf version_added: "2.4" author: "Ricardo Carrillo Cruz (@rcarrillocruz)" short_description: Manage VRFs on Arista EOS network devices description:...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import base64 import json import os import random import re import stat import tempfile import time from abc import ABCMeta, abstractmethod from ansible import constants as C from ansible.errors import AnsibleError, AnsibleConnectio...
import os from spack import * class Casacore(CMakePackage): """A suite of c++ libraries for radio astronomy data processing.""" homepage = "https://github.com/casacore/casacore" url = "https://github.com/casacore/casacore/archive/v2.4.1.tar.gz" maintainers = ['mpokorny'] version('3.4.0', sha256...
"""Sparse Tensor Representation. See the @{$python/sparse_ops} guide. @@SparseTensor @@SparseTensorValue @@sparse_to_dense @@sparse_tensor_to_dense @@sparse_to_indicator @@sparse_merge @@sparse_concat @@sparse_reorder @@sparse_reshape @@sparse_slice @@sparse_split @@sparse_retain @@sparse_reset_shape @@sparse_fill_empt...
import acos_client.errors as acos_errors import base class Partition(base.BaseV21): def exists(self, name): if name == 'shared': return True try: self._post("system.partition.search", {'name': name}) return True except acos_errors.NotFound: ret...
""" The OpenStack Neat Project ========================== OpenStack Neat is a project intended to provide an extension to OpenStack implementing dynamic consolidation of Virtual Machines (VMs) using live migration. The major objective of dynamic VM consolidation is to improve the utilization of physical resources and r...
"""This code example updates the delivery rate of all line items in an order. To determine which line items exist, run get_all_line_items.py.""" from googleads import dfp ORDER_ID = 'INSERT_ORDER_ID_HERE' def main(client, order_id): # Initialize appropriate service. line_item_service = client.GetService('LineItemSe...
""" Test multiword commands ('platform' in this case). """ import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * class MultiwordCommandsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @no_debug_info_test def test_ambiguous_subcommand(self): self.expec...
import datetime import numbers from contextlib import closing from typing import Any, Iterable, Mapping, Optional, Sequence, Union from airflow.operators.sql import BaseSQLOperator from airflow.providers.google.suite.hooks.sheets import GSheetsHook class SQLToGoogleSheetsOperator(BaseSQLOperator): """ Copy data...
from __future__ import print_function import os import gyp import gyp.common import gyp.msvs_emulation import json generator_supports_multiple_toolsets = True generator_wants_static_library_dependencies_adjusted = False generator_filelist_paths = { } generator_default_variables = { } for dirname in ['INTERMEDIATE_DIR',...
from nose.tools import * from tests.base import ApiTestCase from tests.factories import InstitutionFactory, AuthUserFactory, NodeFactory from framework.auth import Auth from api.base.settings.defaults import API_BASE class TestInstitutionNodeList(ApiTestCase): def setUp(self): super(TestInstitutionNodeList,...
""" JSON KMS activation """ import os import platform import commands import redhat.kms class ActivateCommand(commands.CommandBase): def __init__(self, *args, **kwargs): pass @staticmethod def detect_os(): """ Return the Linux Distribution or other OS name """ transla...
"""This example gets all networks that you have access to with the current login credentials. A networkCode should be left out for this request.""" __author__ = ('Nicholas Chen', 'Joseph DiLallo') from googleads import dfp def main(client): # Initialize appropriate service. network_service = client.Ge...
from __future__ import absolute_import import os from flask.ext.wtf import Form from wtforms import validators from digits import utils from digits.utils import subclass from digits.utils.forms import validate_required_iff @subclass class DatasetForm(Form): """ A form used to create an image processing dataset ...
from __future__ import absolute_import from .analytics import * # NOQA from .base import * # NOQA from .manager import IntegrationManager # NOQA default_manager = IntegrationManager() all = default_manager.all get = default_manager.get exists = default_manager.exists register = default_manager.register unregister = ...
from __future__ import absolute_import from datetime import timedelta from django.utils import timezone from django.test import RequestFactory from exam import fixture from sentry.middleware.user import UserActiveMiddleware from sentry.testutils import TestCase class UserActiveMiddlewareTest(TestCase): middleware =...
from .betweenness import * from .betweenness_subset import * from .closeness import * from .subgraph_alg import * from .current_flow_closeness import * from .current_flow_betweenness import * from .current_flow_betweenness_subset import * from .degree_alg import * from .dispersion import * from .eigenvector import * fr...
from supybot.test import * import supybot.conf as conf import supybot.ircdb as ircdb import supybot.ircmsgs as ircmsgs class ChannelTestCase(ChannelPluginTestCase): plugins = ('Channel', 'User') def setUp(self): super(ChannelTestCase, self).setUp() self.irc.state.channels[self.channel].addUser('...
import datetime import logging import os import re import urllib import urllib2 from HTMLParser import HTMLParseError from urlparse import urlparse from BeautifulSoup import BeautifulSoup, Comment, NavigableString from django.contrib.contenttypes.models import ContentType from django.core.files.base import ContentFile ...
from django.http import HttpResponse from django.test import TestCase from ..pipeline import make_staff class Backend(object): name = None def __init__(self, name, *args, **kwargs): super(Backend, self).__init__(*args, **kwargs) self.name = name class MockSuperUser(object): is_staff = False ...
''' gsconfig is a python library for manipulating a GeoServer instance via the GeoServer RESTConfig API. The project is distributed under a MIT License . ''' __author__ = "David Winslow" __copyright__ = "Copyright 2012-2015 Boundless, Copyright 2010-2012 OpenPlans" __license__ = "MIT" from geoserver.catalog import Cata...
""" Test if BGP community alias is visible in CLI outputs """ import os import sys import json import pytest import functools pytestmark = pytest.mark.bgpd CWD = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(CWD, "../")) from lib import topotest from lib.topogen import Topogen, TopoRouter, ge...
"""QGIS Unit tests for QgsLayoutItemLegend. .. 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__ = '(C) 2017...
try: import polib except ImportError: print("You need to install the python-polib package to read translations") raise from pocketlint.pangocheck import is_markup, markup_match import xml.etree.ElementTree as ET def test_markup(mofile): mo = polib.mofile(mofile) for entry in mo.translated_entries():...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from io import StringIO from units.compat import unittest from ansible import errors from ansible.module_utils.six import text_type, binary_type from ansible.module_utils.common._collections_compat import Sequence, Set, Mapping from...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: nxos_vlan extends_documentation_fragment: nxos version_added: "2.1" short_description: Manages VLAN resources and attributes. description: - Mana...
import dbus from gwibber.microblog import util class GwibberPublic: """ GwibberPublic is the public python class which provides convience methods for using Gwibber. """ def __init__(self): self.bus = dbus.SessionBus() self.accounts = self.getbus("Accounts") self.service = sel...
import unittest import aeneas.globalfunctions as gf class TestCEW(unittest.TestCase): def test_cew_synthesize_multiple(self): handler, output_file_path = gf.tmp_file(suffix=".wav") try: c_quit_after = 0.0 c_backwards = 0 c_text = [ (u"en", u"Dummy ...
"""MySQLdb Cursors This module implements Cursors of various types for MySQLdb. By default, MySQLdb uses the Cursor class. """ import re import sys try: from types import ListType, TupleType, UnicodeType except ImportError: # Python 3 ListType = list TupleType = tuple UnicodeType = str restr = r""" ...
from . import event_event from . import event_registration from . import event_type from . import website from . import website_event_menu from . import website_menu from . import website_visitor
from __future__ import unicode_literals import frappe from frappe.utils import flt, getdate from frappe import _ from erpnext.utilities.transaction_base import delete_events from frappe.model.document import Document class Project(Document): def get_gross_profit(self): pft, per_pft =0, 0 pft = flt(self.project_val...
import copy from rapidsms.connection import Connection from rapidsms.person import Person from datetime import datetime from rapidsms import utils class StatusCodes: '''Enum for representing status types of a message or response.''' NONE = "None" # we don't know. the default OK = "Ok" # is great success! ...
from temboo.Library.Google.Drive.Changes.Get import Get, GetInputSet, GetResultSet, GetChoreographyExecution from temboo.Library.Google.Drive.Changes.List import List, ListInputSet, ListResultSet, ListChoreographyExecution
"""contrib module containing volatile or experimental code.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib import bayesflow from tensorflow.contrib import cloud from tensorflow.contrib import compiler from tensorflow.contrib import...
def pre_listen(task_id, transport, attr_array): new_attrs = [] for (scope, name, value) in attr_array: if scope == transport and name == 'port': value = str(int(value) + 1) new_attr = (scope, name, value) new_attrs.append(new_attr) return new_attrs
"""Support for the Airly air_quality service.""" from homeassistant.components.air_quality import ( ATTR_AQI, ATTR_PM_2_5, ATTR_PM_10, AirQualityEntity, ) from homeassistant.const import CONF_NAME from .const import ( ATTR_API_ADVICE, ATTR_API_CAQI, ATTR_API_CAQI_DESCRIPTION, ATTR_API_CA...
import os import netaddr from oslo.config import cfg from neutron.agent.linux import utils from neutron.common import exceptions OPTS = [ cfg.BoolOpt('ip_lib_force_root', default=False, help=_('Force ip_lib calls to use the root helper')), ] LOOPBACK_DEVNAME = 'lo' VLAN_INTERFACE_DET...
"""Tests for volume name_id.""" from oslo.config import cfg from cinder import context from cinder import db from cinder import test from cinder.tests import utils as testutils CONF = cfg.CONF class NameIDsTestCase(test.TestCase): """Test cases for naming volumes with name_id.""" def setUp(self): super(...
import numpy as np import scipy.ndimage as nd import matplotlib.pyplot as plt eps = np.finfo(np.float).eps def chanvese(I,init_mask,max_its=200,alpha=0.2,thresh=0,color='r',display=False): I = I.astype('float') #-- Create a signed distance map (SDF) from mask phi = mask2phi(init_mask) if display: ...
""" /****************************************************************************** This source file is part of the Avogadro project. Copyright 2013 Kitware, Inc. This source code is released under the New BSD License, (the "License"). Unless required by applicable law or agreed to in writing, software distri...
from io import StringIO from antlr4.Token import Token from antlr4.error.Errors import IllegalStateException class TokenStream(object): pass class BufferedTokenStream(TokenStream): def __init__(self, tokenSource): # The {@link TokenSource} from which tokens for this stream are fetched. self.toke...
import sys, time, string, cStringIO, struct, glob, os; from GoodFET import GoodFET; class GoodFETAVR(GoodFET): AVRAPP=0x32; APP=AVRAPP; AVRVendors={0x1E: "Atmel", 0x00: "Locked", }; #List imported from http://avr.fenceline.de/device_data.html AVRDevices={ 0x90...
from __future__ import print_function import time, sys, signal, atexit from upm import pyupm_lsm303d as sensorObj def main(): # Instantiate a BMP250E instance using default i2c bus and address sensor = sensorObj.LSM303D() ## Exit handlers ## # This function stops python from printing a stacktrace when y...
import unittest import sys import os PROJECT_PATH = os.path.sep.join(os.path.abspath(__file__).split(os.path.sep)[:-2]) ROOT_PATH = os.path.dirname(__file__) if __name__ == '__main__': if 'GAE_SDK' in os.environ: SDK_PATH = os.environ['GAE_SDK'] sys.path.insert(0, SDK_PATH) import dev_appser...
import sys from twisted.internet import reactor from twisted.python import log from autobahn.twisted.websocket import WebSocketClientProtocol, \ WebSocketClientFactory, \ connectWS class EchoClientProtocol(WebSocketClientProtocol): def sendHello(self): self.sendMessage("Hello, world!".encode('utf8')...
import os.path import posixpath PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) FIXTURE_DIRS = [ os.path.join(PROJECT_ROOT, 'fixtures'), ] MANAGERS = ADMINS DATABASES = { 'default': { ...