content string |
|---|
"""Provide functionality to TTS."""
import asyncio
import ctypes
import functools as ft
import hashlib
import io
import logging
import mimetypes
import os
import re
from aiohttp import web
import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.media_player.c... |
import pytest
import mock
from nose.tools import * # noqa:
from api.base.settings.defaults import API_BASE
from tests.base import ApiTestCase
from osf_tests.factories import AuthUserFactory, ProjectFactory
pytestmark = pytest.mark.skip(
'Unskip when throttling no longer fails on travis'
)
class TestDefaultTh... |
import warnings
from braintree.util.http import Http
from braintree.successful_result import SuccessfulResult
from braintree.error_result import ErrorResult
from braintree.resource import Resource
from braintree.apple_pay_card import ApplePayCard
from braintree.android_pay_card import AndroidPayCard
from braintree.cred... |
"""
Discovery-based test loader.
This plugin implements nose2's automatic test module discovery. It
looks for test modules in packages and directories whose names start
with ``test``, then fires the :func:`loadTestsFromModule` hook for each
one to allow other plugins to load the actual tests.
It also fires :func:`han... |
from oslo_config import cfg
from nova.compute import api as compute_api
from nova.tests.functional.v3 import test_servers
from nova.tests.unit.api.openstack import fakes
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions')
class AssistedVolume... |
from hyperspy.drawing.marker import MarkerBase
class VerticalLine(MarkerBase):
"""Vertical line marker that can be added to the signal figure
Parameters
----------
x : array or float
The position of the line. If float, the marker is fixed.
If array, the marker will be updated when na... |
from __future__ import unicode_literals
import frappe
@frappe.whitelist()
def get_items(price_list, sales_or_purchase, item=None):
condition = ""
order_by = ""
args = {"price_list": price_list}
if sales_or_purchase == "Sales":
condition = "i.is_sales_item=1"
else:
condition = "i.is_purchase_item=1"
if item... |
import os
import sys
try:
MODULE = os.path.dirname(os.path.realpath(__file__))
except:
MODULE = ""
sys.path.insert(0, os.path.join(MODULE, "..", "..", "..", ".."))
# Import parser base classes.
from pattern.text import (
Lexicon, Model, Morphology, Context, Parser as _Parser, ngrams, pprint, commandline,... |
import lldb
import os
import shlex
import optparse
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand(
'command script add -f ddp.handle_command ddp')
def handle_command(debugger, command, result, internal_dict):
'''
Displays the Document directories for the current app.
This ... |
__revision__ = "src/engine/SCons/Script/Interactive.py 5134 2010/08/16 23:02:40 bdeegan"
__doc__ = """
SCons interactive mode
"""
# TODO:
#
# This has the potential to grow into something with a really big life
# of its own, which might or might not be a good thing. Nevertheless,
# here are some enhancements that wi... |
# push value
OP_0 = 0x00
OP_FALSE = OP_0
OP_PUSHDATA1 = 0x4c
OP_PUSHDATA2 = 0x4d
OP_PUSHDATA4 = 0x4e
OP_1NEGATE = 0x4f
OP_RESERVED = 0x50
OP_1 = 0x51
OP_TRUE = OP_1
OP_2 = 0x52
OP_3 = 0x53
OP_4 = 0x54
OP_5 = 0x55
OP_6 = 0x56
OP_7 = 0x57
OP_8 = 0x58
OP_9 = 0x59
OP_10 = 0x5a
OP_11 = 0x5b
OP_12 = 0x5c
OP_13 = 0x5d
OP_14 =... |
"""Preprocessing tools useful for building models (deprecated).
This module and all its submodules are deprecated. See
[contrib/learn/README.md](https://www.tensorflow.org/code/tensorflow/contrib/learn/README.md)
for migration instructions.
"""
from __future__ import absolute_import
from __future__ import division
fr... |
def main():
module = AnsibleModule(
argument_spec = dict(
fstype=dict(required=True, aliases=['type']),
dev=dict(required=True, aliases=['device']),
opts=dict(),
force=dict(type='bool', default='no'),
),
supports_check_mode=True,
)
dev... |
# -*- coding: utf-8 -*-
import os
import glob
import argparse
def make_argument_parser():
'''Returns argument parser for this script.
'''
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
description='''
This script adds links to ea... |
"""
Django settings for kpiedemocracy project.
Generated by 'django-admin startproject' using Django 1.8.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Buil... |
import ast
import copy
import json
import uuid
import requests
from oslo_config import cfg
from st2actions.runners import ActionRunner
from st2common import __version__ as st2_version
from st2common import log as logging
from st2common.constants.action import LIVEACTION_STATUS_SUCCEEDED
from st2common.constants.actio... |
import os
import pytest
import numpy as np
from urllib.error import HTTPError
from astropy.time import Time
from astropy import units as u
from astropy.constants import c
from astropy.coordinates.builtin_frames import GCRS, TETE
from astropy.coordinates.earth import EarthLocation
from astropy.coordinates.sky_coordina... |
import unittest2 as unittest
import serial
import firmata
from firmata import io
from firmata.constants import *
FIRMATA_INIT = [chr(i) for i in (
PROTOCOL_VERSION, 0x5, 0x2, # Version 5.2
SYSEX_START, SE_REPORT_FIRMWARE, 0x5, 0x2, 0x54, 0x0, 0x65, 0x0, 0x73, 0x0, 0x74, 0x0, SYSEX_END, # Firmware 'Test'
)]
AR... |
"""
Enforce git-shell to only serve allowed by access control policy.
directory. The client should refer to them without any extra directory
prefix. Repository names are forced to match ALLOW_RE.
"""
import logging
import sys, os, re
from gitosis import access
from gitosis import repository
from gitosis import gitwe... |
from trezorlib import btc
from .common import TrezorTest
class TestMsgVerifymessageSegwit(TrezorTest):
def test_message_long(self):
self.setup_mnemonic_nopin_nopassphrase()
ret = btc.verify_message(
self.client,
"Bitcoin",
"3CwYaeWxhpXXiHue3ciQez1DLaTEAXcKa1",
... |
from itertools import product
from nose.tools import assert_true
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from scipy import linalg
from sklearn import neighbors, manifold
from sklearn.manifold.locally_linear import barycenter_kneighbors_graph
from sklearn.utils.testi... |
from __future__ import print_function
import os
import select
import sys
active = False
def RunPager(globalConfig):
global active
if not os.isatty(0) or not os.isatty(1):
return
pager = _SelectPager(globalConfig)
if pager == '' or pager == 'cat':
return
# This process turns into the pager; a child... |
"""A parser for HTML and XHTML."""
# This file is based on sgmllib.py, but the API is slightly different.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity references and end tags are special)
# and CDAT... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from collections import defaultdict
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import MagicMock, mock_open, patch
from ansible.inventory.manager import InventoryManager
from ansible.module_... |
from core.models import Site
class SiteImporter:
def __init__(self, api):
self.api = api
self.remote_sites = {}
self.local_sites = {}
def run(self):
db_sites = Site.objects.all()
for db_site in db_sites:
self.local_sites[db_site.login_base] = db_site
... |
from sqlalchemy import MetaData, Table, Column, String, Unicode, Integer, \
create_engine
from sqlalchemy.testing import fixtures, AssertsExecutionResults, profiling
from sqlalchemy import testing
from sqlalchemy.testing import eq_
from sqlalchemy.util import u
from sqlalchemy.engine.result import RowProxy
import s... |
# -*- coding: utf-8 -*-
import re,urllib,urlparse,base64
from liveresolver.modules import client,constants
from liveresolver.modules.log_utils import log
def resolve(url):
try:
id = urlparse.parse_qs(urlparse.urlparse(url).query)['c'][0]
try:
referer = urlparse.parse_qs(urlparse.urlp... |
# this function is lifted wholesale from matploblib v1.4.2,
# and modified so that images are stored explicitly under the tests path
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import functools
import gc
import os
import sys
import shutil
im... |
from parser import parse
from strings import *
import os.path
#inspired by code from python cookbook
def ensure_relative_path_exists(newdir):
if os.path.isdir(newdir):
pass
elif os.path.isfile(newdir):
raise OSError("a file with the same name as the desired " \
"di... |
"""Unit tests for the setup script of Connector/Python
"""
import sys
import tests
import imp
import setupinfo
class VersionTests(tests.MySQLConnectorTests):
"""Testing the version of Connector/Python"""
def test_version(self):
"""Test validity of version"""
vs = setupinfo.VERSION
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('custom_attributes', '0002_issuecustomattributesvalues_taskcustomattributesvalues_userstorycustomattributesvalues'),
]
operations = [... |
from ast import literal_eval
import os
import tempfile
import unittest
from compile import Checker
from processor import FileCache, Processor
_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
_SRC_DIR = os.path.join(_SCRIPT_DIR, os.pardir, os.pardir)
_RESOURCES_DIR = os.path.join(_SRC_DIR, "ui", "webui", "res... |
from .Sha256Chain import Sha256Chain
class Bitcoin(Sha256Chain):
def __init__(chain, **kwargs):
chain.name = 'Bitcoin'
chain.code3 = 'BTC'
chain.address_version = '\x00'
chain.script_addr_vers = '\x05'
chain.magic = '\xf9\xbe\xb4\xd9'
Sha256Chain.__init__(chain, **kw... |
from __future__ import unicode_literals
import calendar
import datetime
from django.utils.html import avoid_wrapping
from django.utils.timezone import is_aware, utc
from django.utils.translation import ugettext, ungettext_lazy
TIMESINCE_CHUNKS = (
(60 * 60 * 24 * 365, ungettext_lazy('%d year', '%d years')),
... |
import paddle.fluid as fluid
import numpy as np
import sys
def conv(input,
k_h,
k_w,
c_o,
s_h,
s_w,
relu=False,
padding="VALID",
biased=False,
name=None):
act = None
tmp = input
if relu:
act = "relu"
if padding ==... |
import numpy as np
import unittest
import discretize
from pymatsolver import Solver
TOL = 1e-10
class BasicTensorMeshTests(unittest.TestCase):
def setUp(self):
a = np.array([1, 1, 1])
b = np.array([1, 2])
c = np.array([1, 4])
self.mesh2 = discretize.TensorMesh([a, b], [3, 5])
... |
import re
import cPickle
import os
from cStringIO import StringIO
class UnpickleError(Exception):
pass
GPU_LOCK_NO_SCRIPT = -2
GPU_LOCK_NO_LOCK = -1
def pickle(filename, data):
fo = filename
if type(filename) == str:
fo = open(filename, "w")
cPickle.dump(data, fo, protocol=cPickle.HIGHES... |
"""gypd output module
This module produces gyp input as its output. Output files are given the
.gypd extension to avoid overwriting the .gyp files that they are generated
from. Internal references to .gyp files (such as those found in
"dependencies" sections) are not adjusted to point to .gypd files instead;
unlike ... |
from six.moves.urllib.parse import urlencode
from pywb.warcserver.index.cdxobject import CDXException
from pywb.utils.canonicalize import calc_search_range
from pywb.utils.format import to_bool
#=================================================================
class CDXQuery(object):
def __init__(self, params):
... |
import os
from nikola.plugin_categories import Task
from nikola import utils
class CopyFiles(Task):
"""Copy static files into the output folder."""
name = "copy_files"
def gen_tasks(self):
"""Copy static files into the output folder."""
kw = {
'files_folders': self.site.con... |
import json
from social.tests.backends.oauth import OAuth2Test
class NationBuilderOAuth2Test(OAuth2Test):
backend_path = 'social.backends.nationbuilder.NationBuilderOAuth2'
user_data_url = 'https://foobar.nationbuilder.com/api/v1/people/me'
expected_username = 'foobar'
access_token_body = json.dumps(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import argparse
import signal
import sys
import atexit
import httplib
import urllib3
from threading import Thread
from urlparse import urlparse
from socket import *
from threading import Thread
from time import sleep
#import struct
# Constants
SOCKTIMEOUT =... |
from sys import exit, argv
def main():
""" Convert a MCT dump file to a .eml file (Proxmark3 emulator). """
# Are there enouth arguments?
if len(argv) is not 3:
usage()
# TODO: Check if the dump is comple (has all sectors and no unknown data)
# and if not, create the missing data.
# (0x00 for data, 0... |
"""
Test cases covering workflows and behaviors for the Randomize XModule
"""
import unittest
from datetime import datetime, timedelta
from pytz import UTC
from opaque_keys.edx.locator import BlockUsageLocator
from xblock.fields import ScopeIds
from xmodule.randomize_module import RandomizeModule
from .test_course_mo... |
# -*- coding: utf-8 -*-
from openerp.tests import common
KARMA = {
'ask': 5, 'ans': 10,
'com_own': 5, 'com_all': 10,
'com_conv_all': 50,
'upv': 5, 'dwv': 10,
'edit_own': 10, 'edit_all': 20,
'close_own': 10, 'close_all': 20,
'unlink_own': 10, 'unlink_all': 20,
'post': 100, 'flag': 500, ... |
"""
Invenio utilities to perform a REST like authentication.
"""
from invenio.access_control_config import CFG_WEB_API_KEY_STATUS
from invenio.web_api_key_model import WebAPIKey
def create_new_web_api_key(uid, key_description=None):
"""
Creates a new pair REST API key / secret key for the user. To do that it
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from django.conf.urls import patterns, url
from django.utils.translation import ugettext as _
from wiki.core.plugins import registry
from wiki.core.plugins.base import BasePlugin
from wiki.plugins.images import views... |
#!/usr/bin/env python
# Unicorn sample for auditing network connection and file handling in shellcode.
# Nguyen Tan Cong <<EMAIL>>
from __future__ import print_function
from unicorn import *
from unicorn.x86_const import *
import struct
import uuid
SIZE_REG = 4
SOCKETCALL_MAX_ARGS = 3
SOCKET_TYPES = {
1: "SOCK_S... |
import datetime
import time
import warnings
import numpy as np
from ..base import _BaseRaw, _check_update_montage
from ..meas_info import _empty_info
from ..constants import FIFF
from ...utils import verbose, logger
def _read_header(fid):
"""Read EGI binary header"""
version = np.fromfile(fid, np.int32, 1)... |
"""
Neutron base exception handling.
"""
from oslo_utils import excutils
import six
class NeutronException(Exception):
"""Base Neutron Exception.
To correctly use this class, inherit from it and define
a 'message' property. That message will get printf'd
with the keyword arguments provided to the co... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django_pgjson.fields
class Migration(migrations.Migration):
dependencies = [
('custom_attributes', '0004_create_empty_customattributesvalues_for_existen_object'),
]
operations = [
... |
#! /usr/bin/python3
import struct
import decimal
D = decimal.Decimal
from fractions import Fraction
from . import (util, config, exceptions, bitcoin, util)
"""Burn {} to earn {} during a special period of time.""".format(config.BTC, config.XMN)
ID = 60
def validate (db, source, destination, quantity, block_index,... |
from __future__ import absolute_import
from django.core.management.base import BaseCommand
from django.db.models import Count
from zerver.models import UserActivity, UserProfile, Realm, \
get_realm, get_user_profile_by_email
import datetime
class Command(BaseCommand):
help = """Report rough client activity ... |
#!./uwsgi --https :8443,foobar.crt,foobar.key --http-websockets --gevent 100 --module tests.websocket
import uwsgi
import gevent
from gevent.queue import JoinableQueue
from gevent.socket import wait_read
queue = JoinableQueue()
def application(env, sr):
ws_scheme = 'ws'
if 'HTTPS' in env or env['wsgi.url_sc... |
"""
Tests for discussion API permission logic
"""
import itertools
import ddt
from discussion_api.permissions import (
can_delete,
get_editable_fields,
get_initializable_comment_fields,
get_initializable_thread_fields,
)
from lms.lib.comment_client.comment import Comment
from lms.lib.comment_client.th... |
# TODO: Remove this once the new data model lands.
# This is from http://www.caktusgroup.com/blog/2011/09/20/bulk-inserts-django/
# Bulk insert/update DB operations for the Django ORM. Useful when
# inserting/updating lots of objects where the bottleneck is overhead
# in talking to the database. Instead of doing this
... |
"""Contains the data classes of the Google Webmaster Tools Data API"""
__author__ = '<EMAIL> (Jeff Scudder)'
import atom.core
import atom.data
import gdata.data
import gdata.opensearch.data
WT_TEMPLATE = '{http://schemas.google.com/webmaster/tools/2007/}%s'
class CrawlIssueCrawlType(atom.core.XmlElement):
"""... |
#!/usr/bin/env python
"""
In an earlier exercise we looked at the cities dataset and asked which region in India contains
the most cities. In this exercise, we'd like you to answer a related question regarding regions in
India. What is the average city population for a region in India? Calculate your answer by first ... |
import pytest
from tests.actions.support.mouse import get_center
from tests.actions.support.refine import get_events, filter_dict
from tests.support.asserts import assert_move_to_coordinates
from tests.support.inline import inline
from tests.support.wait import wait
def link_doc(dest):
content = "<a href=\"{}\" ... |
"""The DirichletMultinomial distribution class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.... |
"""
Option Parser sorting module.
This module implements a sorting method for options in a
configuration file.
"""
from operator import itemgetter, attrgetter, methodcaller
class Options:
"""
Collection of options.
"""
def __init__(self):
self.options = []
def insert(self, option):
... |
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import timeutils
from nova import cache_utils
from nova.i18n import _, _LI, _LW
from nova.servicegroup import api
from nova.servicegroup.drivers import base
CONF = cfg.CONF
CONF.import_opt('service_down_time', 'nova.service')
LOG = log... |
from time import time
from datetime import datetime
from google.appengine.ext import db
class WarningLog(db.Model):
date = db.DateTimeProperty(auto_now_add=True)
event = db.StringProperty()
message = db.StringProperty()
attachment_id = db.IntegerProperty()
queue_name = db.StringProperty()
bot... |
import re
def as_string(obj):
if isinstance(obj, basestring):
return '"' + _escape(obj.encode('UTF-8')) + '"'
return str(obj)
_esc_regex = re.compile(r"(\"|\'|\\)")
def _escape(text):
# This escapes any escaped single or double quote or backslash.
x = _esc_regex.sub(r"\\\1", text)
# T... |
"""Tests for filtering postprocessors."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.timeseries.python.timeseries.state_space_models import filtering_postprocessor
from tensorflow.python.framework import constant_op
from tensor... |
"""
10. One-to-one relationships
To define a one-to-one relationship, use ``OneToOneField()``.
In this example, a ``Place`` optionally can be a ``Restaurant``.
"""
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_co... |
# -*- coding: utf-8 -*-
from flask import url_for
from flask_ldap3_login.forms import LDAPLoginForm
from flask_login import current_user
from scout.server.extensions import store
def test_unathorized_login(app, institute_obj, case_obj):
"""Test failed authentication against scout database"""
# GIVEN an init... |
"""
Esperanto-language mappings for language-dependent features of
reStructuredText.
"""
__docformat__ = 'reStructuredText'
directives = {
# language-dependent: fixed
u'atentu': 'attention',
u'zorgu': 'caution',
u'dangxero': 'danger',
u'dan\u011dero': 'danger',
u'eraro': 'error',
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from corehq.apps.smsbillables.models import SmsGatewayFeeCriteria
from corehq.messaging.smsbackends.sislog.models import SQLSislogBackend
from corehq.messaging.smsbackends.yo.models import SQLYoBackend
from corehq.sql_db.o... |
"""
Unit tests for optimization routines from minpack.py.
"""
from numpy.testing import assert_, assert_almost_equal, assert_array_equal, \
assert_array_almost_equal, TestCase, run_module_suite, assert_raises
import numpy as np
from numpy import array, float64
from scipy import optimize
from scipy.optimize.mi... |
from ghidra.framework.model import DomainFile
from ghidra.framework.model import DomainFolder
from ghidra.program.model.address import Address
from ghidra.program.model.lang import LanguageCompilerSpecPair
from ghidra.program.model.listing import Program
from ghidra.util import Msg
from java.lang import IllegalArgumen... |
"""Defines all the tasks the model can learn."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
from base import embeddings
from task_specific.word_level import depparse_module
from task_specific.word_level import depparse_scorer
from task_spec... |
import fixtures
import tempfile
import testscenarios
from oslo_config import cfg
from oslo_log import log as logging
from oslotest import base
from blazar import context
from blazar.db.sqlalchemy import api as db_api
from blazar.db.sqlalchemy import facade_wrapper
cfg.CONF.set_override('use_stderr', False)
logging.... |
"""
API for managing user preferences.
"""
import logging
import analytics
from eventtracking import tracker
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import IntegrityError
from django.utils.translation import ugettext as _
from django.utils.translation impor... |
"""More comprehensive traceback formatting for Python scripts.
To enable this module, do:
import cgitb; cgitb.enable()
at the top of your script. The optional arguments to enable() are:
display - if true, tracebacks are displayed in the web browser
logdir - if set, tracebacks are written to fi... |
"""Commands for interacting with Google Compute Engine HTTP health checks."""
from google.apputils import appcommands
import gflags as flags
from gcutil_lib import command_base
FLAGS = flags.FLAGS
class HttpHealthCheckCommand(command_base.GoogleComputeCommand):
"""Base command for working with the HTTP health ... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import re
from functools import partial
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.eos import get_config, load_config
from ansible.module_uti... |
import uuid
from swift.common.manager import Manager
from swiftclient import client
from test.probe.brain import BrainSplitter
from test.probe.common import ReplProbeTest
def chunker(body):
'''Helper to ensure swiftclient sends a chunked request.'''
yield body
class TestPutIfNoneMatchRepl(ReplProbeTest):
... |
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from splinter.driver.webdriver import (
BaseWebDriver, WebDriverElement as WebDriverElement)
from splinter.driver.webdriver.cookie_manager import CookieManager
from selenium.webdriver.common.keys import Keys... |
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views import generic
from django.shortcuts import render
from formtools.wizard.views import SessionWizardView
from material.frontend import urls as frontend_urls
from . import forms
def index_view(... |
import re
from shinken.objects import Timeperiod, Timeperiods
from shinken.objects import Service, Services
from shinken.objects import Host, Hosts
from shinken.objects import Contact, Contacts
from shinken.comment import Comment
from shinken.downtime import Downtime
from shinken.basemodule import BaseModule
from shi... |
from calyptos.plugins.validator.validatorplugin import ValidatorPlugin
class Storage(ValidatorPlugin):
def validate(self):
self.topology = self.environment['default_attributes']['eucalyptus']['topology']
if 'system-properties' in self.environment['default_attributes']['eucalyptus']:
sel... |
import logging
from nox.lib.core import Component
from nox.netapps.data.pydatacache import PyData_cache, Principal_delete_event
lg = logging.getLogger('nox.netapps.data.datacache')
class DataCache(Component):
def __init__(self, ctxt):
Component.__init__(self, ctxt)
self.cache = PyData_cache(ctxt... |
"""Interface Verify tests
$Id: test_verify.py 110536 2010-04-06 02:59:44Z tseaver $
"""
import doctest
import unittest
from zope.interface import Interface, implements, classImplements, Attribute
from zope.interface.verify import verifyClass, verifyObject
from zope.interface.exceptions import DoesNotImplement, Broken... |
class Context():
def __init__(self, arch, mode, shell_dir, mode_flags, verbose, timeout,
isolates, command_prefix, extra_flags):
self.arch = arch
self.mode = mode
self.shell_dir = shell_dir
self.mode_flags = mode_flags
self.verbose = verbose
self.timeout = timeout
self.isola... |
from __future__ import print_function
from color import Coloring
from command import PagedCommand
class Prune(PagedCommand):
common = True
helpSummary = "Prune (delete) already merged topics"
helpUsage = """
%prog [<project>...]
"""
def Execute(self, opt, args):
all_branches = []
for project in self.... |
import re
from DIRAC import S_OK, S_ERROR
from DIRAC.Core.DISET.RPCClient import RPCClient
from DIRAC.Core.Utilities import DEncode, Time
class UserProfileClient:
def __init__( self, profile, rpcClientFunctor = False ):
if rpcClientFunctor:
self.rpcClientFunctor = rpcClientFunctor
else:
self.rpc... |
import sys
import pytest
import numpy as np
from astropy import table
from astropy.table import Row
from astropy import units as u
from .conftest import MaskedTable
def test_masked_row_with_object_col():
"""
Numpy < 1.8 has a bug in masked array that prevents access a row if there is
a column with objec... |
import os
import shutil
import unittest
from lib.util.mysqlBaseTestCase import mysqlBaseTestCase
server_requirements = [[]]
servers = []
server_manager = None
test_executor = None
# we explicitly use the --no-timestamp option
# here. We will be using a generic / vanilla backup dir
backup_path = None
class basicTest... |
from prune import client
from os.path import expanduser
HOME = expanduser("~")
prune = client.Connect(base_dir = HOME+'/.prune') #Prune data is stored in base_dir
###### Create common HEP environment ######
E1 = prune.envi_add( engine='umbrella', spec='cms.umbrella',
sandbox_mode='parrot', log='u... |
"""Tests for ntttcp_benchmark."""
import os
import unittest
from perfkitbenchmarker import sample
from perfkitbenchmarker import test_util
from perfkitbenchmarker.windows_packages import ntttcp
class NtttcpBenchmarkTestCase(unittest.TestCase, test_util.SamplesTestMixin):
def setUp(self):
self.maxDiff = None
... |
# -*- coding: utf-8 -*-
'''
Scaleway Cloud Module
=====================
.. versionadded:: 2015.8.0
The Scaleway cloud module is used to interact with your Scaleway BareMetal
Servers.
Use of this module only requires the ``api_key`` parameter to be set. Set up
the cloud configuration at ``/etc/salt/cloud.providers`` ... |
import time
from shinken.log import logger
""" TODO: Add some comment about this class for the doc"""
class ContactDowntime:
id = 1
# Just to list the properties we will send as pickle
# so to others daemons, so all but NOT REF
properties = {
# 'activate_me': None,
# 'entry_time': N... |
import pytest
from time2relax import exceptions, utils
def test_encode_uri_component():
assert utils.encode_uri_component('escaped%2F1') == 'escaped%252F1'
assert utils.encode_uri_component('a/b/c') == 'a%2Fb%2Fc'
assert utils.encode_uri_component('az09_$()+-') == 'az09_%24()%2B-'
def test_encode_attac... |
# -*- coding: utf-8 -*-
import __future__
import csv, sys, json, copy, datetime, time
def main(address_filename, street_filename):
timestamp = datetime.datetime.now().strftime('%Y%m%d')
streets = {}
with open(street_filename) as f:
reader = csv.reader(f, delimiter=';')
next(reader)
... |
import os
from hokusai.lib.command import command
from hokusai.lib.config import config
from hokusai.services.ecr import ECR
from hokusai.lib.common import print_green, shout
from hokusai.lib.exceptions import HokusaiError
from hokusai.services.docker import Docker
@command()
def push(tag, local_tag, build, filename,... |
import json
import logging
import os
import shutil
import subprocess
import time
from lib.cuckoo.common.abstracts import Processing
from lib.cuckoo.common.exceptions import CuckooProcessingError
from lib.cuckoo.common.utils import md5_file, sha1_file
try:
import suricatasc
HAVE_SURICATASC = True
except Import... |
"""check the installed Prosilica GigE SDK version number"""
import ctypes, sys
global _libprosilica
_libprosilica = None
ULong = ctypes.c_long # XXX should be unsigned long
def _load_libprosilica():
"""load the prosilica shared library"""
global _libprosilica
if _libprosilica is None:
if sys.pla... |
import collections
import os
import subprocess
import textwrap
from cinder.volume import configuration
from cinder.compute import nova
OrderedDict = collections.OrderedDict
BASEDIR = os.path.split(os.path.realpath(__file__))[0] + "/../../"
if __name__ == "__main__":
os.chdir(BASEDIR)
opt_file = open("cinde... |
#!/usr/bin/env python
"""Bootstrap setuptools installation
To use setuptools in your package's setup.py, include this
file in the same directory and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
To require a specific version of setuptools, set a download
mirror, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.