content stringlengths 4 20k |
|---|
#!/usr/bin/python
"""Test of structural navigation by heading."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
#sequence.append(WaitForDocLoad())
sequence.append(PauseAction(5000))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Control>Home"))
sequence.app... |
"""
WSGI config for dummy project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` se... |
from spack import *
class Fasttree(Package):
"""FastTree infers approximately-maximum-likelihood phylogenetic
trees from alignments of nucleotide or protein sequences.
FastTree can handle alignments with up to a million of sequences
in a reasonable amount of time and memory."""
homepage ... |
# python
# This file is generated by a program (mib2py).
import CISCO_CIPTG_MIB
OIDMAP = {
'1.3.6.1.4.1.9.9.73': CISCO_CIPTG_MIB.ciscoCipTgMIB,
'1.3.6.1.4.1.9.9.73.1': CISCO_CIPTG_MIB.cipTgObjects,
'1.3.6.1.4.1.9.9.73.1.1': CISCO_CIPTG_MIB.cipTgLlc,
'1.3.6.1.4.1.9.9.73.1.2': CISCO_CIPTG_MIB.cipTgIp,
'1.3.6.1.4.1.9.9... |
"""Invenio Search Engine config parameters."""
SEARCH_ALLOWED_KEYWORDS = []
"""A list of allowed keywords for the query parser."""
#
# ELASTIC configuration
#
SEARCH_ELASTIC_HOSTS = None # default localhost
"""List of hosts for Elasticsearch client.
Elasticsearch
<https://elasticsearch-py.readthedocs.io/en/mas... |
#!/usr/bin/python
#
import xmlrpclib
class SMConnect:
"""
SM connection mixin.
"""
def __init__(self, host, user, password):
"""
Constructor.
"""
self.client = xmlrpclib.Server("http://%s/rpc/api" % host, verbose=0)
self.token = self.client.auth.login(user, pa... |
"""
"""
from __future__ import division, print_function
import sys, os, pdb
import numpy as np
import nibabel as nib
def plot_mosaic(img_data, transpose=False):
""" Return a mosaic plot for each slice of
the 3rd dimension of img_data
Parameters:
----------
img_data = 3D array
Returns... |
from slicc.ast.DeclAST import DeclAST
from slicc.symbols.Type import Type
class TypeDeclAST(DeclAST):
def __init__(self, slicc, type_ast, pairs, field_asts):
super(TypeDeclAST, self).__init__(slicc, pairs)
self.type_ast = type_ast
self.field_asts = field_asts
def __repr__(self):
... |
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from compose.cli import colors
from compose.cli.formatter import ConsoleWarningFormatter
from tests import unittest
MESSAGE = 'this is the message'
def make_log_record(level, message=None):
return logging.LogRecord('... |
import os
try:
from pyvcloud.vcloudair import VCA
HAS_PYVCLOUD = True
except ImportError:
HAS_PYVCLOUD = False
from ansible.module_utils.basic import AnsibleModule
SERVICE_MAP = {'vca': 'ondemand', 'vchs': 'subscription', 'vcd': 'vcd'}
LOGIN_HOST = {'vca': 'vca.vmware.com', 'vchs': 'vchs.vmware.com'}
DE... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
class ModuleDocFragment(object):
# Windows shell documentation fragment
# FIXME: set_module_language don't belong here but must be set so they don't fail when someone
# get_option('set_module_language') on this plugi... |
from zope.interface import implements
from twisted.trial.itrial import IReporter
from twisted.plugin import IPlugin
class _Reporter(object):
implements(IPlugin, IReporter)
def __init__(self, name, module, description, longOpt, shortOpt, klass):
self.name = name
self.module = module
se... |
# -*- coding: utf-8 -*-
"""
Tests parsers ability to read and parse non-local files
and hence require a network connection to be read.
"""
import logging
import numpy as np
import pytest
from pandas.compat import BytesIO, StringIO
import pandas.util._test_decorators as td
from pandas import DataFrame
import pandas.... |
from __future__ import absolute_import
import fnmatch
import logging
from io import BytesIO, StringIO
from ...utils import Tokenizer
from .file_system import FileSystem
from ...exceptions import FileSystemNotSupported
log = logging.getLogger(__name__)
boto = None
try:
import boto
except ImportError:
pass
... |
from __future__ import absolute_import
from zope.interface import implementer
from autobahn.wamp2.interfaces import *
from autobahn.wamp2.types import *
from autobahn.wamp2.error import ApplicationError, ProtocolError
from twisted.internet.defer import Deferred, inlineCallbacks
import random
def newid():
retu... |
"""Collection of DIRAC useful file related modules.
.. warning::
By default on Error they return None.
"""
#pylint: skip-file
## getGlobbedFiles gives "RuntimeError: maximum recursion depth exceeded" in pylint
import os
import hashlib
import random
import glob
import sys
import re
import errno
__RCSID__ = "$Id$"... |
import logging
from oslo_config import cfg
class LoggingErrorNotificationHandler(logging.Handler):
def __init__(self, *args, **kwargs):
# NOTE(dhellmann): Avoid a cyclical import by doing this one
# at runtime.
import oslo_messaging
logging.Handler.__init__(self, *args, **kwargs)
... |
"""Tests for text utls."""
from __future__ import print_function, absolute_import
from datetime import datetime
from invenio.testsuite import make_test_suite, run_test_suite, InvenioTestCase
class DateTests(InvenioTestCase):
"""Test the datefilter functions."""
def test_older_date(self):
"""Test ... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import atexit
import errno
import os
import shutil
import stat
import tempfile
import threading
import uuid
from collections import defaultdict
from pants.util.struti... |
"""Testing utilities."""
import os
import re
import threading
import functools
from tempfile import NamedTemporaryFile
from numpy import testing
import numpy as np
from ._warnings import expected_warnings
import warnings
from .. import data, io, img_as_uint, img_as_float, img_as_int, img_as_ubyte
SKIP_RE = re.com... |
import account_budget
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from gnuradio import gr, uhd
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
import sys
def add_freq_option(parser):
"""
Hackery that has the -f / --freq option set both tx_freq and rx_freq
"""
def freq_callback(option, opt_str, value, par... |
import os
from ansible.utils import template
from ansible import utils
from ansible import errors
from ansible.runner.return_data import ReturnData
class ActionModule(object):
TRANSFERS_FILES = False
def __init__(self, runner):
self.runner = runner
def run(self, conn, tmp, module_name, module_ar... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import time
import json
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
... |
import mock
from nova.pci import utils as pci_utils
from nova import test
from nova.tests.unit import matchers
from nova.virt.libvirt import config
from nova.virt.libvirt import designer
class DesignerTestCase(test.NoDBTestCase):
def test_set_vif_bandwidth_config_no_extra_specs(self):
# Test whether tes... |
# The default socket timeout, used by httplib to indicate that no timeout was
# specified by the user
from socket import _GLOBAL_DEFAULT_TIMEOUT
import time
from ..exceptions import TimeoutStateError
# A sentinel value to indicate that no timeout was specified by the user in
# urllib3
_Default = object()
def current... |
from xml.dom import minidom
from django.conf import settings
from django.contrib.sites.models import Site
from django.test import TestCase
from models import City
class GeoFeedTest(TestCase):
urls = 'django.contrib.gis.tests.geoapp.urls'
def setUp(self):
Site(id=settings.SITE_ID, domain="example.co... |
from fifo import FifoClient
fifo = FifoClient('redis://localhost:6379/0')
# queue up a single task
task_id = fifo.queue_task('example.tasks.multiply', (6, 7),
max_wait=2, result_timeout=30)
# wait for result for at most 5s
result = fifo.wait(task_id, timeout=5)
print(task_id, result['body']... |
import zipfile, os, codecs, datetime
class ZipUtil(object):
def zip_dir(cls, dir, zip_path=None, ignore_dirs=[], include_dirs=[]):
if not zip_path:
zip_path = "./%s.zip" % os.path.basename(dir)
print "zip_path: ", zip_path
if os.path.exists(zip_path):
os.unlink(zi... |
import json
from django.contrib.postgres import forms, lookups
from django.contrib.postgres.fields.array import ArrayField
from django.core import exceptions
from django.db.models import Field, TextField, Transform
from django.utils import six
from django.utils.translation import ugettext_lazy as _
__all__ = ['HStore... |
import hashlib
import unittest
from test import test_support
def hexstr(s):
import string
h = string.hexdigits
r = ''
for c in s:
i = ord(c)
r = r + h[(i >> 4) & 0xF] + h[i & 0xF]
return r
class HashLibTestCase(unittest.TestCase):
supported_hash_names = ( 'md5', 'MD5', 'sha1'... |
from opaque_keys.edx.locator import DefinitionLocator
import copy
class DefinitionLazyLoader(object):
"""
A placeholder to put into an xblock in place of its definition which
when accessed knows how to get its content. Only useful if the containing
object doesn't force access during init but waits unt... |
# basictimerapp - a really simple timer application.
# This should be run using the command line:
# pythonwin /app demos\basictimerapp.py
import win32ui
import win32api
import win32con
import sys
from pywin.framework import app, cmdline, dlgappcore, cmdline
import timer
import time
import string
class TimerAppDialog(d... |
import unittest
from datetime import datetime
from conans.client.recorder.upload_recoder import UploadRecorder
class UploadRecorderTest(unittest.TestCase):
def setUp(self):
self.recorder = UploadRecorder()
def empty_test(self):
info = self.recorder.get_info()
expected_result = {'err... |
"""
Support for the Microsoft Cognitive Services text-to-speech service.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/tts.microsoft/
"""
import logging
from http.client import HTTPException
import voluptuous as vol
from homeassistant.components.tts ... |
import time
from psycopg2 import OperationalError
from openerp import SUPERUSER_ID
from openerp.osv import fields, osv
import openerp.addons.decimal_precision as dp
from openerp.tools.translate import _
import openerp
PROCUREMENT_PRIORITIES = [('0', 'Not urgent'), ('1', 'Normal'), ('2', 'Urgent'), ('3', 'Very Urgent'... |
import argparse
import json
parser = argparse.ArgumentParser(description="Diff between two runs of performance tests.")
parser.add_argument("file1", help="the first output json from runner")
parser.add_argument("file2", help="the second output json from runner")
args = parser.parse_args()
def load_data(filename):
... |
"""
A module to provide convenient file format identification through a combination of filename extension
and file based *magic* numbers.
To manage a collection of FormatSpecifications for loading::
import iris.io.format_picker as fp
import matplotlib.pyplot as plt
fagent = fp.FormatAgent()
png_spec ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.template.defaultfilters import iriencode, urlencode
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class IriencodeTests(SimpleTestCase):
"""
Ensure iriencode keeps safe... |
from yowsup.structs import ProtocolEntity, ProtocolTreeNode
from yowsup.layers.protocol_notifications.protocolentities import NotificationProtocolEntity
class GroupsNotificationProtocolEntity(NotificationProtocolEntity):
'''
<notification notify="WhatsApp" id="{{id}}" t="1420402514" participant="{{participant... |
import json
import unittest
from airflow.providers.amazon.aws.hooks.cloud_formation import AWSCloudFormationHook
try:
from moto import mock_cloudformation
from moto.ec2.models import NetworkInterface as some_model
except ImportError:
mock_cloudformation = None
@unittest.skipIf(mock_cloudformation is Non... |
import signal
import sys
import time
import Ice
Ice.loadSlice('Hello.ice')
import Demo
class HelloI(Demo.Hello):
def sayHello(self, delay, current):
if delay != 0:
time.sleep(delay / 1000.0)
print("Hello World!")
def shutdown(self, current):
current.adapter.getCommunicato... |
import os
import traceback
from hashlib import md5
from jinja2 import Environment
UPSTART_TEMPLATE = """
start on {{ start_on }}
stop on {{ stop_on }}
{% if description -%}
description {{ description }}
{% endif -%}
{% if envs -%}
{% for env in envs %}
env {{ env }}
{% endfor %}
{% endif -%}
{% if prestart_script ... |
# -*- coding: utf-8 -*-
"""
Created on 01 October 2017
@author: Ashiv Dhondea
"""
import AstroFunctions as AstFn
import AstroConstants as AstCnst
import GeometryFunctions as GF
import RadarSystem as RS
import TimeHandlingFunctions as THF
import math
import numpy as np
import datetime as dt
import pyt... |
#!/usr/bin/env python
#
# GrovePi Example for using the Grove Water Sensor (http://www.seeedstudio.com/wiki/Grove_-_Water_Sensor)
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question about this example? Ask on ... |
#!/usr/bin/env python
# This is a visualizer which pulls microbenchmark results from the MySQL
# databases and visualizes them. Four graphs will be generated per workload,
# latency graphs on single node and multiple nodes, and throughput graphs
# on single node and multiple nodes.
#
# Run it without any arguments to ... |
from django.utils.translation import ugettext_lazy as _
import horizon
class Settings(horizon.Dashboard):
name = _("Settings")
slug = "settings"
panels = ('user', 'password', )
default_panel = 'user'
def nav(self, context):
dash = context['request'].horizon.get('dashboard', None)
... |
from colander import Invalid
from flask import request
from apikit import jsonify
from aleph.core import app, login_manager
from aleph.views.ui import ui # noqa
from aleph.assets import assets # noqa
from aleph.model import User
from aleph.views.data_api import blueprint as data_api
from aleph.views.search_api import ... |
import mock
from twisted.trial import unittest
from twisted.spread import pb
from twisted.internet import defer, reactor
from buildbot.clients import sendchange
class Sender(unittest.TestCase):
def setUp(self):
# patch out some PB components and make up some mocks
self.patch(pb, 'PBClientFactory',... |
__version__ = (0, 1, 0)
import keyconf
class Layer(keyconf.Configuration):
"""Base class for a layer. The class is derived from
keyconf.Configuration, to support the .configure() method seamlessly."""
def __init__(self):
"""Sets the layer to has-changed."""
keyconf.Configu... |
# -*- coding: utf-8 -*-
import os
import tensorflow as tf
FLAGS = tf.app.flags.FLAGS
class PhotoRecognizer(object):
'''
基于google于2015年在ILSVRC比赛上发表的incept-v3模型进行迁移学习,完成其它图像识别任务
'''
def __init__(self, n_classes, data_processor, reuse=None):
self.__n_classes = n_classes
self.__data_proc... |
import logging
from flask_restful import marshal
from analyser.common.config import loadTargetState
from core.interface import targetStateFields, RecordingDeviceStatus
logger = logging.getLogger('analyser.targetstate')
REACH_TARGET_STATE = 'RTS'
class TargetStateController(object):
def __init__(self, targetSt... |
"""SCons.Tool.qt
Tool-specific initialization for Qt.
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 The SCons Foundation
#
# Permission is h... |
from __future__ import unicode_literals, division, absolute_import
import collections
import datetime
import io
import re
import sys
from git import Repo
class MDChangeSet(object):
"""Represets a markdown changeset for a single version."""
CATEGORIES = [
('### Added\n', ['add', 'added', 'feature']),... |
import gdb
from linux import utils
list_head = utils.CachedType("struct list_head")
def list_check(head):
nb = 0
if (head.type == list_head.get_type().pointer()):
head = head.dereference()
elif (head.type != list_head.get_type()):
raise gdb.GdbError('argument must be of type (struct list... |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_, assert_allclose
import scipy.special.orthogonal as orth
from scipy.special._testutils import FuncData
def test_eval_chebyt():
n = np.arange(0, 10000, 7)
x = 2*np.random.rand() - 1
v1 = ... |
class Migration(object):
"""
The base class for all migrations.
Migration files will import this from django.db.migrations.Migration
and subclass it as a class called Migration. It will have one or more
of the following attributes:
- operations: A list of Operation instances, probably from dj... |
import sys
import gdb
import os
import os.path
pythondir = '/home/build/work/GCC-4-7-build/install-native/share/gcc-arm-none-eabi'
libdir = '/home/build/work/GCC-4-7-build/install-native/arm-none-eabi/lib/armv7e-m/softfp'
# This file might be loaded when there is no current objfile. This
# can happen if the user loa... |
# -*- coding: utf-8 -*-
import unittest, doctest
# These tests check that error handling in the Pyrex code is
# complete.
# It is likely that if there are errors, instead of failing the code
# will simply crash.
import sys, gc, os.path
from lxml import etree
this_dir = os.path.dirname(__file__)
if this_dir not in s... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: mso_schema_template_l3out
short_description: Manage l3outs i... |
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import inspect
from . import base
# Add custom behaviour to some class:
#class Device(base.BaseDevice):
# def my_method(self):
# ...
class RR(base.BaseRR):
@property
def label(self):
return '%s.%s' ... |
import sys
import time
import eventlet
eventlet.monkey_patch()
from oslo.config import cfg
from neutron.agent.linux import ovs_lib
from neutron.agent.linux import utils
from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config
from neutron.com... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
DOCUMENTATION = r'''
---
module: aci_aaa_user
short_description: Manage AAA users (aaa:User)
... |
import urllib
from weboob.capabilities.bill import ICapBill, SubscriptionNotFound, BillNotFound, Subscription, Bill
from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.value import ValueBackendPassword
from .browser import AmeliProBrowser
__all__ = ['AmeliProBackend']
class AmeliProBackend(... |
import FreeCAD, DraftGeomUtils, Part, Draft
from DraftTools import translate
p = Draft.precision()
if open.__module__ == '__builtin__':
pythonopen = open
def findVert(aVertex,aList):
"finds aVertex in aList, returns index"
for i in range(len(aList)):
if ( round(aVertex.X,p) == round(aList[i].X,p)... |
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import unittest
import os
from bitcoin.core import COutPoint, CTxIn, CTxOut, CTransaction, CheckTransaction, CheckTransactionError, lx, x, b2x, ValidationError
from bitcoin.core.scripteval import VerifyScript, SCRIPT_VERIFY... |
#!/usr/bin python
# -*- coding: utf-8 -*-
"""
Backuping database script with insert sorting
"""
import psycopg2
import ConfigParser
import os
import sys
import sql_reserved_words
import decimal
import datetime
import subprocess
import codecs
from shutil import move
NONE_TYPE = type(None)
DEFAULT_OUTPUT_FILE_NAME = 'd... |
#!/usr/bin/env python
import os
import platform
import sys
try:
import multiprocessing.synchronize
gyp_parallel_support = True
except ImportError:
gyp_parallel_support = False
CC = os.environ.get('CC', 'cc')
script_dir = os.path.dirname(__file__)
uv_root = os.path.normpath(script_dir)
output_dir = os.path.joi... |
# -*- coding: utf-8 -*-
# pylint: disable-msg=E1101, E0102, E0202
"""
Created on Tue May 05 10:37:17 2015
Small test to try the abductive approach with the dataset from the Mobiguide
project at the BMI lab.
@author: T. Teijeiro
"""
import construe.utils.plotting.plotter as plotter
import construe.acquisition.record_... |
import time
from openerp.osv import osv
from openerp.report import report_sxw
from common_report_header import common_report_header
class journal_print(report_sxw.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context=None):
if context is None:
context = {}
super(... |
"""Argmax matcher implementation.
This class takes a similarity matrix and matches columns to rows based on the
maximum value per column. One can specify matched_thresholds and
to prevent columns from matching to rows (generally resulting in a negative
training example) and unmatched_theshold to ignore the match (gene... |
from unittest import TestCase
import sys
import os.path
import pexpect
DATADIR = os.path.join(os.path.dirname(__file__), 'data')
KEYA_VDO = os.path.join(DATADIR, 'samplea.vdo')
KEYB_VDO = os.path.join(DATADIR, 'sampleb.vdo')
class TestSendEvents(TestCase):
def setUp(self):
cmd = 'vncev -rfbport 5933 -r... |
"""Wrappers for bucketization operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.ops import math_ops
def bucketize(input_tensor, boundaries, name=None):
"""Bucketizes input_tensor by given boundaries.
See bucketize_o... |
from hachoir_core.tools import humanDurationNanosec
from hachoir_core.i18n import _
from math import floor
from time import time
class BenchmarkError(Exception):
"""
Error during benchmark, use str(err) to format it as string.
"""
def __init__(self, message):
Exception.__init__(self,
... |
'''Unit tests for grit.py'''
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import unittest
import StringIO
from grit import util
import grit.grit_runner
class OptionArgsUnittest(unittest.TestCase):
def setUp(self):
self.buf = StringIO.StringIO... |
"""
=============================================
Whitening evoked data with a noise covariance
=============================================
Evoked data are loaded and then whitened using a given noise covariance
matrix. It's an excellent quality check to see if baseline signals match
the assumption of Gaussian white... |
'''
Copyright 2016, EMC, Inc.
Author(s):
George Paulos
'''
import fit_path # NOQA: unused import
import os
import sys
import subprocess
import fit_common
# Select test group here using @attr
from nose.plugins.attrib import attr
@attr(all=True, regression=True, smoke=True)
class rackhd20_api_lookups(fit_common.unit... |
from omeroweb.webgateway.tests.seleniumbase import SeleniumTestBase, Utils
from omero.gateway.scripts import dbhelpers
from random import random
import sys
class WebClientTestBase (SeleniumTestBase):
def login (self, u, p):
sel = self.selenium
if self.selenium.is_element_present('link=L... |
#!/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... |
import re
component_re = re.compile(r'(\d+ | [a-z]+ | \.| -)', re.VERBOSE)
replace = {'pre':'c', 'preview':'c','-':'final-','_':'final-','rc':'c','dev':'@','saas':'','~':''}.get
def _parse_version_parts(s):
for part in component_re.split(s):
part = replace(part,part)
if not part or part=='.':
... |
"""Automatically adapted for numpy Sep 19, 2005 by convertcode.py
"""
from __future__ import division, absolute_import, print_function
__all__ = ['iscomplexobj', 'isrealobj', 'imag', 'iscomplex',
'isreal', 'nan_to_num', 'real', 'real_if_close',
'typename', 'asfarray', 'mintypecode', 'asscalar',
... |
import gbl
import re
import sys
if len(sys.argv)!=2:
print "Invalid number of arguments"
sys.exit(0)
dimacsfile=sys.argv[1].strip()
f = open(dimacsfile, 'r')
data=f.read()
lines=data.split('\n')
commentLine = re.compile('c.*') #Regular expression to detect comment lines
statLine = re.compile('p\s*cnf\s*(\d*)\s*(\d*... |
from nltk.tokenize.nist import NISTTokenizer
from pimlico.core.modules.map import skip_invalid
from pimlico.core.modules.map.multiproc import multiprocessing_executor_factory
@skip_invalid
def process_document(worker, archive, filename, doc):
# Run tokenization
# This tokenizer doesn't split sentences, so lin... |
import json
from unittest2 import skipIf
from django.test.utils import override_settings
from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from myuw.test.api import missing_url, get_user, get_user_pass
FDAO_SWS = 'restclients.dao_implementation.sws.Fil... |
from ansible.compat.tests import unittest
from oneview_module_loader import OneViewModuleBase
from ansible.modules.remote_management.oneview.oneview_logical_interconnect_group_facts import LogicalInterconnectGroupFactsModule
from hpe_test_utils import FactsParamsTestCase
ERROR_MSG = 'Fake message error'
PARAMS_GET_A... |
import copy
from coala_utils.decorators import (
enforce_signature, generate_ordering, generate_repr)
from coalib.results.TextPosition import TextPosition
@generate_repr("start", "end")
@generate_ordering("start", "end")
class TextRange:
@enforce_signature
def __init__(self, start: TextPosition, end: (T... |
import optparse
import mock
from glance.cmd import cache_manage
from glance.common import exception
import glance.common.utils
import glance.image_cache.client
from glance.tests import utils as test_utils
class TestGlanceCmdManage(test_utils.BaseTestCase):
@mock.patch.object(glance.image_cache.client.CacheClie... |
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon.utils import memoized
from openstack_dashboard import api
from openstack_dashboard.dashboards.admin.networks.ports \
import forms as ports_for... |
"""Generates test runner factory and tests for performance tests."""
import json
import fnmatch
import logging
import os
import shutil
from pylib import android_commands
from pylib import constants
from pylib import forwarder
from pylib.device import device_list
from pylib.perf import test_runner
from pylib.utils imp... |
from __future__ import unicode_literals
import webnotes
from webnotes import msgprint
sql = webnotes.conn.sql
class DocType:
def __init__(self,d,dl):
self.doc, self.doclist = d,dl
def get_message(self, arg):
fn = arg.lower().replace(' ', '_') + '_message'
v = sql("select value from tabSingles where field=%s... |
from nova.scheduler import filters
from nova.scheduler.filters import utils
class TypeAffinityFilter(filters.BaseHostFilter):
"""TypeAffinityFilter doesn't allow more than one VM type per host.
Note: this works best with ram_weight_multiplier
(spread) set to 1 (default).
"""
def host_passes(self... |
"""Support for EnOcean light sources."""
import math
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from homeassistant.const import CONF_ID, CONF_NAME
import homeassistant.helpers.config_validation as cv
from ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleError
from ansible.module_utils.six.moves.urllib.error import HTTPError, URLError
from ansible.module_utils._text import to_text, to_native
from ansible.module_utils.urls import open_url, Connectio... |
from ansible.errors import AnsibleError
import ansible.utils as utils
from re import compile as re_compile, IGNORECASE
# shortcut format
NUM = "(0?x?[0-9a-f]+)"
SHORTCUT = re_compile(
"^(" + # Group 0
NUM + # Group 1: Start
"-)?" +
NUM + # Group 2: End
"(/" + # Group 3... |
#!/usr/bin/env python
'''
search a set of log files for a condition
'''
import sys, time, os
from pymavlink import mavutil
from optparse import OptionParser
parser = OptionParser("mavsearch.py [options]")
parser.add_option("--condition", default=None, help="conditional check on log")
parser.add_option("--types", de... |
from .sub_resource import SubResource
class VirtualNetworkPeering(SubResource):
"""Peerings in a virtual network resource.
:param id: Resource ID.
:type id: str
:param allow_virtual_network_access: Whether the VMs in the linked virtual
network space would be able to access all the VMs in local V... |
puts(green("installing MidoNet api on %s" % env.host_string))
zk = []
for zkhost in metadata.roles['zookeeper']:
zk.append("{'ip' => '%s', 'port' => '2181'}" % metadata.servers[zkhost]['ip'])
args = {}
args['zk_servers'] = "[%s]" % ",".join(zk)
args['keystone_auth'] = "false"
args['v... |
"""
Miscellaneous utility functions that are used by multiple modules.
@group Python source types: is_module_file, is_package_dir, is_pyname,
py_src_filename
@group Text processing: wordwrap, decode_with_backslashreplace,
plaintext_to_html
"""
__docformat__ = 'epytext en'
import os, os.path, re
#############... |
#
# Dummy importer
#
# requirements
#
# read the planetlab database and update the local registry database accordingly
# so we update the following collections
# . authorities (from pl sites)
# . node (from pl nodes)
# . users+keys (from pl persons and attached ... |
from Screens.Screen import Screen
from Screens.ParentalControlSetup import ProtectedScreen
from Components.Sources.List import List
from Components.ActionMap import NumberActionMap
from Components.Sources.StaticText import StaticText
from Components.config import configfile
from Components.PluginComponent import plugin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.