code stringlengths 1 199k |
|---|
"""
Volume driver for NetApp Data ONTAP FibreChannel storage systems.
"""
from cinder import interface
from cinder.volume import driver
from cinder.volume.drivers.netapp.dataontap import block_cmode
from cinder.volume.drivers.netapp import options as na_opts
from cinder.zonemanager import utils as fczm_utils
@interface... |
from reporting.parsers import IParser
from reporting.collectors import IDataSource
from reporting.utilities import getLogger, get_hostname, init_message
import json
import time, datetime
import httplib, urllib2, urllib
import base64
import hashlib
from reporting.exceptions import InputDataError, RemoteServerError
log =... |
"""
The VMware API VM utility module to build SOAP object specs.
"""
import copy
import functools
from oslo.config import cfg
from oslo.vmware import exceptions as vexc
from nova import exception
from nova.i18n import _
from nova.network import model as network_model
from nova.openstack.common import log as logging
fro... |
from __pyjamas__ import JS
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin
from os import urandom as _urandom
from binascii import hexlify as _hexlify
NV_MAGICCONST = 4 * _exp(-0.5)/_sqrt(2.0)
TWOPI = 2.0*_pi
LOG4 = _lo... |
"""View to accept incoming websocket connection."""
import asyncio
from contextlib import suppress
from functools import partial
import json
import logging
from aiohttp import web, WSMsgType
import async_timeout
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.core import callback
from homeas... |
import re
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from findingaids.fa.urls import EADID_URL_REGEX, TITLE_LETTERS
from findingaids.fa.models import FindingAid
class Command(BaseCommand):
"""Check the specified field in all Finding Aids loaded in the configur... |
"""Module for testing the show machine command."""
import unittest
if __name__ == "__main__":
import utils
utils.import_depends()
from brokertest import TestBrokerCommand
class TestShowMachine(TestBrokerCommand):
def testverifyut3c1n3interfacescsv(self):
command = "show machine --machine ut3c1n3 --f... |
import csv
import signal
import serial
import sys
import os
from time import sleep
def signal_handler(signal, frame):
print('Fin de programme')
ser.write(b's')
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
ser = serial.Serial('/dev/ttyACM0', 115200)
sleep(2)
Data_Location = "/var/www/... |
"""Module for testing the add vlan command."""
import unittest
if __name__ == "__main__":
import utils
utils.import_depends()
from brokertest import TestBrokerCommand
from test_add_vlan import default_vlans
class TestDelVlan(TestBrokerCommand):
def test_100_delete_defaults(self):
for vlan_id in defa... |
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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/L... |
"""Abstract and helper bases for Future implementations."""
import abc
import concurrent.futures
from google.api_core import exceptions
from google.api_core import retry
from google.api_core.future import _helpers
from google.api_core.future import base
class _OperationNotComplete(Exception):
"""Private exception u... |
"""abstract backend class
"""
class Backend():
def __init__(self):
self.inputs = []
self.outputs = []
def version(self):
raise NotImplementedError("Backend:version")
def name(self):
raise NotImplementedError("Backend:name")
def load(self, model_path, inputs=None, outputs=None):
raise NotImpl... |
from __future__ import absolute_import
import os
import nox
LOCAL_DEPS = (
os.path.join('..', 'api_core'),
)
def default(session):
"""Default unit test session.
This is intended to be run **without** an interpreter set, so
that the current ``python`` (on the ``PATH``) or the version of
Python corres... |
"""Tests for saving utility functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
from tensorflow.python import keras
from tensorflow.python import tf2
from tensorflow.python.client import session as session_lib
from tenso... |
import copy
import mock
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_versionedobjects import base as ovo_base
import testtools
from nova import exception
from nova import objects
from nova.objects import fields
from nova.tests.unit.objects import test_objects
fake_instance_uuid = uuids.fake
fake_obj_n... |
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class Referrable(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsReferrable(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = Referrable()
x.Init(buf, n... |
"""Contains the logic for `aq cat --city`."""
from aquilon.aqdb.model import City
from aquilon.worker.broker import BrokerCommand # pylint: disable=W0611
from aquilon.worker.templates.city import PlenaryCity
class CommandCatCity(BrokerCommand):
required_parameters = ["city"]
def render(self, generate, session,... |
import ast
import json
import logging
import os.path
from flask import abort, request, url_for
from jinja2.utils import contextfunction
from pypuppetdb.errors import EmptyResponseError
from requests.exceptions import ConnectionError, HTTPError
log = logging.getLogger(__name__)
@contextfunction
def url_static_offline(co... |
import unittest
from pyvcloud.vcd.org import Org
from pyvcloud.vcd.system import System
from pyvcloud.vcd.test import TestCase
class TestOrg(TestCase):
def test_01_create_org(self):
sys_admin = self.client.get_admin()
system = System(self.client, admin_resource=sys_admin)
org = system.create... |
import copy_reg
import imp
import random
import sys
import unittest
from iptest import run_test
class testclass(object):
pass
class myCustom2:
pass
class CopyRegTest(unittest.TestCase):
@unittest.expectedFailure
def test_constructor_neg(self):
'https://github.com/IronLanguages/main/issues/443'
... |
"""
@package mi.idk.test.test_git
@file mi.idk/test/test_git.py
@author Bill French
@brief test git
"""
__author__ = 'Bill French'
__license__ = 'Apache 2.0'
from os.path import basename, dirname
from os import makedirs,chdir, system
from os import remove
from os.path import exists
import sys
from nose.plugins.attrib i... |
"""
ifmap-python client is an implementation of the TCG IF-MAP 2.0 protocol as a client library.
"""
import sys
__version__ = '0.1'
__build__=""
class Error(Exception):
"""
Base class for exception handling
"""
def __init__(self, msg):
Exception.__init__(self, "Error: '%s'" % msg) |
from distutils.command.build_py import build_py
from distutils.command.sdist import sdist
import os.path
import subprocess
import glob
from setuptools import setup, find_packages
__version__ = '0.1'
try:
REPO_PATH = "."
# noinspection PyUnresolvedReferences
GIT = subprocess.Popen(
# TODO: mbacchi ch... |
import logging
import re
import struct
from collections import OrderedDict, defaultdict
from concurrent.futures import Future
from threading import Event
from typing import List, NamedTuple, Optional, Union
from urllib.parse import urlparse
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad
from reques... |
import pytest
from pages.desktop.home import Home
@pytest.mark.withoutresponses
def test_login(base_url, selenium, user):
"""User can login"""
page = Home(selenium, base_url).open()
assert not page.logged_in
page.login(user['email'], user['password'])
assert page.logged_in
@pytest.mark.skip(
rea... |
import collections
import datetime
import functools
import ipaddress
import os
from king_phisher import serializers
from king_phisher.client import gui_utilities
from king_phisher.client import plugins
from king_phisher.client.widget import extras
from king_phisher.client.widget import managers
from gi.repository impor... |
"""
This script is responsible for generating .gclient-xwalk in the top-level
source directory from DEPS.xwalk.
User-configurable values such as |cache_dir| are fetched from .gclient instead.
"""
import logging
import optparse
import os
import pprint
CROSSWALK_ROOT = os.path.dirname(os.path.abspath(__file__))
GCLIENT_R... |
import json
from rest_framework import generics, serializers, status, decorators
from rest_framework.response import Response
from rest_framework.authentication import SessionAuthentication
from kitsune.customercare.models import TwitterAccount
from kitsune.sumo.api import GenericAPIException, GenericDjangoPermission
c... |
import glob
import os
from telemetry.page import page_test
from telemetry.value import scalar
_JS = 'chrome.gpuBenchmarking.printToSkPicture("{0}");'
class SkpicturePrinter(page_test.PageTest):
def __init__(self, skp_outdir):
super(SkpicturePrinter, self).__init__(
action_name_to_run='RunPageInteractions'... |
import numpy as np
from scipy import amax,shape
class AdamBash(object):
def __init__(self, dfdt, diffusion, ncycle = 0):
#self.delta = delta
self.cflConstant = 0.5
self.ncycle = ncycle
self.dfdt = dfdt
self.diffusion = diffusion
#self.calcMaxVel = maxVel
def integ... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Test User', 'test@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite',
}
}
TIME_ZONE = 'America/Denver'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = True
USE_L10N = True
U... |
from __future__ import unicode_literals
import unittest
from moderation.diff import get_changes_between_models, html_to_list,\
TextChange, get_diff_operations, ImageChange
from django.test.testcases import TestCase
from django.contrib.auth.models import User
from django.db.models import fields
from tests.models imp... |
def find():
first=999;
second=999;
palin=0;
fir=0;
sec=0;
while(second>sec and second>99):
while(second>sec and second>99):
product=first*second;
if(str(product)==str(product)[::-1]):
if(palin<product):
palin=product;
... |
"""Afni preprocessing interfaces
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
>>> os.chdir(datadir)
"""
import os
import os.path as op
... |
"""Migration for the Submitty system."""
import subprocess
def up(config):
"""
Run up migration.
:param config: Object holding configuration details about Submitty
:type config: migrator.config.Config
"""
ps = subprocess.Popen(
('curl', '-sL', 'https://deb.nodesource.com/setup_10.x'),
... |
import os
import sys
import shutil
import platform
import tempfile
import warnings
import threading
import subprocess
import queue
from pathlib import Path
import tables
try:
import multiprocessing as mp
multiprocessing_imported = True
except ImportError:
multiprocessing_imported = False
import numpy as np
... |
from __future__ import division
import numpy as np
import chainer
import chainer.functions as F
from chainer import initializers
import chainer.links as L
from chainercv.links import Conv2DBNActiv
from chainercv.links.model.resnet import ResBlock
from chainercv.links import PickableSequentialChain
from chainercv import... |
from PyQt4.QtGui import *
from subprocess import Popen, PIPE
from Core.Settings import frm_Settings
from os import popen,getpid
from re import search
import threading
import getpass
from time import sleep
global sudo_prompt
sudo_prompt = None
class waiter(threading.Thread):
def run(self):
for i in range(2):... |
__all__ = (
'Publication',
'Subscription',
'Handler',
'Registration',
'Endpoint',
'PublishRequest',
'SubscribeRequest',
'UnsubscribeRequest',
'CallRequest',
'InvocationRequest',
'RegisterRequest',
'UnregisterRequest',
)
class Publication(object):
"""
Object repres... |
from StandardDataSets.scripts import JudgeAssistant
tagLst = []
attrName = ''
attrVal = ''
dataToCheck = ''
class SimpleJudgingObject:
def __init__(self, _tagLst, _attrName, _attrVal, _data):
self.tagList = _tagLst
self.attrName = _attrName
self.attrVal = _attrVal
self.dataToCheck = ... |
from app.api_1_0.api_exception import ApiException
from flask import request
def requires_json(f):
def wrapped(*args, **kwargs):
if not "application/json" in request.headers.get('Content-Type', ''):
raise ApiException(status_code=415)
return f(*args, **kwargs)
return wrapped |
from setuptools import setup
import sys
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = ["multisigcore/test"]
def run_tests(self):
import pytest
errcode = pytest.mai... |
RED = (255, 0, 0)
GREEN = (0, 255, 0)
YELLOW = (255, 255, 0)
ORANGE = (255, 102, 0)
BLACK = (0, 0, 0) |
"""
Database Specific Configuration File
"""
""" Put Generic Database Configurations here """
import os
class DBConfig(object):
""" DB_ON must be True to use the DB! """
DB_ON = True
DB_DRIVER = 'mysql'
DB_ORM = False
""" Put Development Specific Configurations here """
class DevelopmentDBConfig(DBC... |
from flask import Flask, Response
import os
import socket
import time
app = Flask(__name__)
app.debug = os.environ.get("DEBUG", "").lower().startswith('y')
hostname = socket.gethostname()
urandom = os.open("/dev/urandom", os.O_RDONLY)
@app.route("/")
def index():
return "RNG running on {}\n".format(hostname)
@app.r... |
from halide import *
from scipy.misc import imread
import os.path
from datetime import datetime
x, y, c, i, ii, xi, yi = Var("x"), Var("y"), Var("c"), Var("i"), Var("ii"), Var("xi"), Var("yi")
class MyPipeline:
def __init__(self, input):
assert type(input) == Buffer_uint8
self.lut = Func("lut")
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from functools import reduce
from twisted.internet import defer
from twisted.internet import error
from twisted.python import components
from twisted.python import failure
from twisted.python import log
from twi... |
from __future__ import absolute_import
import collections
import threading
class Logs:
"""Thread safe log store"""
MAX_LOG_SIZE_DEFAULT = 500
def __init__(self, max_log_size=MAX_LOG_SIZE_DEFAULT):
self._iter_lock = threading.Lock()
self._log = collections.deque(maxlen=max_log_size)
def _... |
"""
Utility functions to deal with ppm (qemu screendump format) files.
:copyright: Red Hat 2008-2009
"""
from __future__ import division
import os
import struct
import time
import re
import glob
import logging
from functools import reduce
try:
from PIL import Image
from PIL import ImageOps
from PIL import I... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext as _
from guardian.admin import GuardedModelAdmin
from userena.models import UserenaSignup
from userena import settings as userena_settings
from userena.utils import get_profile_model, get_user... |
"""distutils.dir_util
Utility functions for manipulating directories and directory trees."""
__revision__ = "$Id: dir_util.py 43260 2006-03-23 19:07:46Z tim.peters $"
import os, sys
from types import *
from distutils.errors import DistutilsFileError, DistutilsInternalError
from distutils import log
_path_created = {}
d... |
from itertools import combinations
import pytest
from cfme import test_requirements
from cfme.infrastructure.provider import InfraProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.scvmm import SCVMMProvider
from cfme.infrastructure.provider.virtualcenter import VMwa... |
__doc__='''AppEngineDataSource.py
Defines datasource for AppEngine collection. '''
from Products.ZenModel.RRDDataSource import SimpleRRDDataSource
from AccessControl import ClassSecurityInfo, Permissions
from Products.ZenModel.ZenPackPersistence import ZenPackPersistence
from ZenPacks.chudler.GoogleAppEngine.AppEngine... |
import os
import signal
_trackedPids = set()
def autoReapPID(pid):
_trackedPids.add(pid)
# SIGCHLD happend before we added the pid to the set
_tryReap(pid)
def _tryReap(pid):
try:
pid, rv = os.waitpid(pid, os.WNOHANG)
if pid != 0:
_trackedPids.discard(pid)
... |
import sqlalchemy as sa
from buildbot.test.util import migration
from twisted.trial import unittest
class Migration(migration.MigrateTestMixin, unittest.TestCase):
def setUp(self):
return self.setUpMigrateTest()
def tearDown(self):
return self.tearDownMigrateTest()
def create_tables_thd(self... |
import frappe
def execute():
frappe.db.sql(
"""UPDATE `tabPOS Profile` profile
SET profile.`print_format` = 'POS Invoice'
WHERE profile.`print_format` = 'Point of Sale'""") |
from datetime import date, datetime
from datetime import *
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, tools, SUPERUSER_ID, _
from odoo.exceptions import AccessDenied, AccessError, UserError, ValidationError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
import math
c... |
import math, string
import chemfig_mappings as cfm
from common import debug
hydrogen_lefties = "O S Se Te F Cl Br I At".split() # I hope these are all ...
class Atom(object):
'''
wrapper around toolkit atom object, augmented with coordinates
helper class for molecule.Molecule
'''
explicit_characters... |
import StringIO
import optparse
import unittest
from webkitpy.common.host_mock import MockHost
from webkitpy.layout_tests import lint_test_expectations
class FakePort(object):
def __init__(self, host, name, path):
self.host = host
self.name = name
self.path = path
def test_configuration(... |
"""A Mirror object contains the same text as its related tabstop."""
from UltiSnips.text_objects._base import NoneditableTextObject
class Mirror(NoneditableTextObject):
"""See module docstring."""
def __init__(self, parent, tabstop, token):
NoneditableTextObject.__init__(self, parent, token)
sel... |
from .stringlist import StringlistCompleter
class TagCompleter(StringlistCompleter):
"""Complete a tagstring."""
def __init__(self, dbman):
"""
:param dbman: used to look up available tagstrings
:type dbman: :class:`~alot.db.DBManager`
"""
resultlist = dbman.get_all_tags(... |
"""
OOID is "Our opaque ID"
"""
import datetime as dt
import re
import uuid as uu
from socorro.lib.datetimeutil import utc_now, UTC
defaultDepth = 2
oldHardDepth = 4
def create_new_ooid(timestamp=None, depth=None):
"""Create a new Ooid for a given time, to be stored at a given depth timestamp: the year-month-day
... |
"""Url for Gstudio User Dashboard"""
from django.conf.urls.defaults import url
from django.conf.urls.defaults import patterns
urlpatterns = patterns('gstudio.views.userdashboard',
url(r'^$', 'userdashboard',
name='gstudio_userdashboard'),
) |
"""Commands module of Objectapp""" |
from . import crm_lead |
import sys,os
sys.path.append("../src/")
from silpa.modules import transliterator
tx=transliterator.getInstance()
print tx.transliterate(u"இலவச,", "ml_IN").encode("utf-8")
print tx.transliterate(u"இலவச,", "ml_IN").encode("utf-8")
print tx.transliterate(u"-സന്ധ്യ", "ta_IN").encode("utf-8")
print tx.transliterate(u" 8 *"... |
"""
Functions that can are used to modify XBlock fragments for use in the LMS and Studio
"""
import datetime
import json
import logging
import static_replace
from django.conf import settings
from django.utils.timezone import UTC
from edxmako.shortcuts import render_to_string
from xblock.exceptions import InvalidScopeEr... |
from registration.forms import RegistrationFormUniqueEmail
from django import forms
from django.db import transaction
from django.contrib.auth.models import User
from django_comments.models import Comment
from django.contrib.sites.models import Site as DjangoSite
from django.utils.translation import ugettext_lazy as _
... |
from __future__ import unicode_literals
from django.core.cache import cache
from django.db import models, migrations
CLEAR_CONTACT_SQL = """
TRUNCATE contacts_contact;
"""
def remove_cache_and_lock_keys(apps, schema_editor):
try:
# clear redis cache and locks to allow the next task to fetch all the contacts... |
"""
Middleware to serve assets.
"""
import datetime
import logging
from django.http import (
HttpResponse,
HttpResponseBadRequest,
HttpResponseForbidden,
HttpResponseNotFound,
HttpResponseNotModified,
HttpResponsePermanentRedirect
)
from django.utils.deprecation import MiddlewareMixin
from opaqu... |
from spack import *
class Cubist(MakefilePackage):
"""Cubist is a powerful tool for generating rule-based models that
balance the need for accurate prediction against the requirements of
intelligibility.
Cubist models generally give better results than those
produced by simple techniques such as mul... |
"""
librepo - download a package using client SSL certificate
"""
import librepo
if __name__ == "__main__":
h = librepo.Handle()
h.setopt(librepo.LRO_REPOTYPE, librepo.LR_YUMREPO)
h.setopt(librepo.LRO_URLS, ["https://my-ssl-repo/fedora/20/x86_64/os/"])
# The client certificate .pem file may include just... |
from spack import *
class PerlMailtools(PerlPackage):
"""Perl module for handling mail"""
homepage = "https://metacpan.org/release/MailTools"
url = "https://cpan.metacpan.org/authors/id/M/MA/MARKOV/MailTools-2.21.tar.gz"
version('2.21', sha256='4ad9bd6826b6f03a2727332466b1b7d29890c8d99a32b4b3b0a8d9... |
from casadi import *
"""
This example mainly intended for CasADi presentations. It contains a compact
implementation of a direct single shooting method for DAEs using a minimal
number of CasADi concepts.
It solves the following optimal control problem (OCP) in differential-algebraic
equations (DAE):
minimize integr... |
import sys
def main():
lines = sys.stdin.readlines()
for i, l in enumerate(lines):
if l.startswith('{'):
break
for l in lines[i:]:
print(l.strip("\r\n"))
if __name__ == '__main__':
main() |
from lib.cuckoo.common.abstracts import Signature
class EmailStealer(Signature):
name = "infostealer_mail"
description = "盗取已安装的邮件客户端相关的信息"
severity = 3
categories = ["infostealer"]
authors = ["Accuvant"]
minimum = "1.2"
def run(self):
file_indicators = [
".*\.pst$",
... |
import os
import time
from .common import FileDownloader
from ..utils import (
compat_urllib_request,
compat_urllib_error,
ContentTooShortError,
encodeFilename,
sanitize_open,
format_bytes,
)
class HttpFD(FileDownloader):
def real_download(self, filename, info_dict):
url = info_dict[... |
"""
Python package for feature in MLlib.
"""
from __future__ import absolute_import
import sys
import warnings
import random
import binascii
if sys.version >= '3':
basestring = str
unicode = str
from py4j.protocol import Py4JJavaError
from pyspark import since
from pyspark.rdd import RDD, ignore_unicode_prefix
... |
from pypif.obj.common import *
from pypif.obj.system import * |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... |
version = "1.3.1"
version_info = tuple([int(d) for d in version.split("-")[0].split(".")]) |
def takethis():
fullspeed()
i01.moveHead(14,90)
i01.moveArm("left",13,45,95,10)
i01.moveArm("right",5,90,30,10)
i01.moveHand("left",2,2,2,2,2,60)
i01.moveHand("right",81,66,82,60,105,113)
i01.moveTorso(85,76,90)
sleep(3)
closelefthand()
i01.moveTorso(110,90,90)
sleep(2)
isitaball()
i01.mouth.s... |
"""Test the Nanoleaf config flow."""
from __future__ import annotations
from unittest.mock import AsyncMock, MagicMock, patch
from aionanoleaf import InvalidToken, NanoleafException, Unauthorized, Unavailable
import pytest
from homeassistant import config_entries
from homeassistant.components import ssdp, zeroconf
from... |
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import nose.tools as nt
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
from treeano.sandbox.nodes import interval_relu as irelu
fX = theano.config.floatX
def tes... |
VERSION="0.22.0" |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if us... |
'''
@author: frank
'''
from zstacklib.utils import shell
import os.path
import os
import ConfigParser
import shutil
import string
def build_egg(source):
cmdstr = 'python setup.py bdist_egg'
shell.ShellCmd(cmdstr, workdir=source, pipe=False)()
lsegg = shell.ShellCmd('ls %s/dist' % source)
lsegg()
egg... |
"""Tests for the Bernoulli distribution."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import scipy.special
import tensorflow as tf
def make_bernoulli(batch_shape, dtype=tf.int32):
p = np.random.uniform(size=list(batch_shape))
p = ... |
from ceilometerclient.v2 import meters
from ceilometerclient.v2 import resources
from ceilometerclient.v2 import samples
from ceilometerclient.v2 import statistics
from keystoneclient.v2_0 import tenants
from keystoneclient.v2_0 import users
from openstack_dashboard.test.test_data import utils
def data(TEST):
TEST.... |
import datetime
import threading
import telnetlib
import logging
import time
import socket
import random
import tempfile
import traceback
import sys
import os
import json
from fabric.api import *
from fabric.colors import *
from fabric.contrib.console import *
from gw_cmd import *
from redis_cmd import *
config = None
... |
import wx
import time
from robotide import context
class ProgressObserver(object):
def __init__(self, frame, title, message):
self._progressbar = wx.ProgressDialog(title, message,
maximum=100, parent=frame,
style=wx.... |
from .result import SKIPPED
"""
Pipeline
Test processors are chained together and communicate with each other by
calling previous/next processor in the chain.
----next_test()----> ----next_test()---->
Proc1 Proc2 Proc3
<---result_for()---- <---result_for()----
For... |
"""Constants for the Solar-Log integration."""
from datetime import timedelta
from homeassistant.const import ENERGY_KILO_WATT_HOUR, POWER_WATT
DOMAIN = "solarlog"
"""Default config for solarlog."""
DEFAULT_HOST = "http://solar-log"
DEFAULT_NAME = "solarlog"
"""Fixed constants."""
SCAN_INTERVAL = timedelta(seconds=60)
... |
import numpy as np
from collections import deque
from .envbase import ProxyPlayer
__all__ = ['PreventStuckPlayer', 'LimitLengthPlayer', 'AutoRestartPlayer',
'MapPlayerState']
class PreventStuckPlayer(ProxyPlayer):
""" Prevent the player from getting stuck (repeating a no-op)
by inserting a different act... |
import logging
log = logging.getLogger('gitfs') |
"""
Utilities class provides general-use functions for all modules
"""
import logging
import json
import os
import sys
import zopkio.constants as constants
logger = logging.getLogger(__name__)
def check_dir_with_exception(dirname):
"""
Checks if the directory exists; if not, throw an exception
"""
if not os.pat... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from abc import abstractproperty
from textwrap import dedent
from pants.base.address_lookup_error import AddressLookupError
from pants.base.source_root import SourceRoo... |
"""
@package mi.instrument.um.thsph.thsph.driver
@file marine-integrations/mi/instrument/um/thsph/thsph/driver.py
@author Richard Han
@brief Driver for the thsph
Release notes:
Vent Chemistry Instrument Driver
"""
import re
import time
from mi.core.exceptions import InstrumentException
from mi.core.driver_scheduler im... |
"""
@package mi.dataset.parser.zplsc_c
@file /mi/dataset/parser/zplsc_c.py
@author Rene Gelinas
@brief Parser for the zplsc_c dataset driver
This file contains code for the zplsc_c parser and code to produce data particles.
The ZPLSC sensor, series C, provides acoustic return measurements from the water column.
The rec... |
from django.utils.importlib import import_module
from django.conf import settings
from django.conf.urls import patterns
class IntegrationModuleNotFound(Exception):
pass
class IntegrationNotConfigured(Exception):
pass
integration_cache = {}
class Integration(object):
"""Base Integration class that needs to b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.