code stringlengths 1 199k |
|---|
import logging
logging.basicConfig()
logger = logging.getLogger("paddle")
logger.setLevel(logging.INFO)
class TaskMode(object):
"""
TaskMode
"""
TRAIN_MODE = 0
TEST_MODE = 1
INFER_MODE = 2
def __init__(self, mode):
"""
:param mode:
"""
self.mode = mode
def... |
"""Tests for emulated_roku library bindings."""
from unittest.mock import Mock, patch
from homeassistant.components.emulated_roku.binding import (
EmulatedRoku,
EVENT_ROKU_COMMAND,
ATTR_SOURCE_NAME,
ATTR_COMMAND_TYPE,
ATTR_KEY,
ATTR_APP_ID,
ROKU_COMMAND_KEYPRESS,
ROKU_COMMAND_KEYDOWN,
... |
"""Utilities for manipulating the loss collections."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.eager import context
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorfl... |
from Orange.widgets.regression.owmean import OWMean
from Orange.widgets.tests.base import WidgetTest, WidgetLearnerTestMixin
class TestOWMean(WidgetTest, WidgetLearnerTestMixin):
def setUp(self):
self.widget = self.create_widget(OWMean,
stored_settings={"auto_apply":... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('kannel', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='deliveryreport',
name='message_id',
fie... |
import sys
import re
from ..core.parameterization import Parameterized
import numpy as np
import sympy as sym
from ..core.parameterization import Param
from sympy.utilities.lambdify import lambdastr, _imp_namespace, _get_namespace
from sympy.utilities.iterables import numbered_symbols
import scipy
import GPy
def getFro... |
import os
import pynq
import pytest
from .mock_devices import MockDownloadableDevice
from .helpers import create_file, working_directory, create_d_structure
from .helpers import file_contents, MockExtension
BITSTREAM_FILE = "testbitstream.bit"
BITSTREAM_DATA = "A bitstream file"
DTBO_FILE = "testbitstream.dtbo"
DTBO_DA... |
from __future__ import unicode_literals
"""
A series of tests to establish that the command-line management tools work as
advertised - especially with regards to the handling of the DJANGO_SETTINGS_MODULE
and default settings.py files.
"""
import codecs
import os
import re
import shutil
import socket
import subprocess
... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('reviewers', '0016_reviewactionreason'),
]
operations = [
migrations.AlterModelOptions(
name='reviewactionreason',
options={'ordering': ('name',)},
),
] |
from __future__ import absolute_import
import numpy as nm
from sfepy.base.base import output, iter_dict_of_lists, Struct, basestr
from sfepy.base.timing import Timer
import six
def parse_approx_order(approx_order):
"""
Parse the uniform approximation order value (str or int).
"""
ao_msg = 'unsupported a... |
from __future__ import absolute_import
import re
from functools import partial
from inspect import getargspec
from django.conf import settings
from django.template.context import (Context, RequestContext,
ContextPopException)
from django.utils.importlib import import_module
from django.utils.itercompat import is_it... |
class Solution(object):
def closestValue(self, root, target):
"""
:type root: TreeNode
:type target: float
:rtype: int
"""
gap = float("inf")
closest = float("inf")
while root:
if abs(root.val - target) < gap:
gap = abs(root... |
from novaclient.openstack.common import cliutils
from novaclient import utils
@cliutils.arg('server', metavar='<server>', help='Name or ID of server.')
def do_force_delete(cs, args):
"""Force delete a server."""
utils.find_resource(cs.servers, args.server).force_delete()
@cliutils.arg('server', metavar='<server... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('kolibriauth', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='facilitydataset',
name='learner_can_login_with_n... |
import string, sys
class MkMemoIO:
def __init__(self, view, memo, row):
self.view = view
self.memo = memo
self.row = row
self.pos = 0
self.closed = 0
self.softspace = 0
def close(self):
if not self.closed:
self.closed = 1
del self.view, self.memo, self.row, self.pos
def isa... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
_python_ = TestSCons._python_
_exe = TestSCons._exe
test = TestSCons.TestSCons()
test.write('myrpcgen.py', """
import getopt
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'chlmo:', [])
for opt, arg in cmd_opts:
if opt == '-o': ... |
"""Test RPC commands for signing messages with private key."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
)
class SignMessagesWithPrivTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_c... |
import gobject
import gtk
import gst
import pygst
pygst.require("0.10")
from sltv.settings import UI_DIR
class VideoConverterUI:
def __init__(self):
self.interface = gtk.Builder()
self.interface.add_from_file(UI_DIR + "/output_setting.ui")
self.box = self.interface.get_object("setting_box")
... |
MCUREGS = {
'ADCH': '$25',
'ADCL': '$24',
'ADCSR': '$26',
'ADMUX': '$27',
'ACSR': '$28',
'SFIOR': '$50',
'MCUCR': '$55',
'MCUCSR': '$54',
'OSCCAL': '$51',
'SPH': '$5E',
'SPL': '$5D',
'SPMCR': '$57',
'SREG': '$5F',
'EEARH': '$3F',
'EEARL': '$3E',
'EECR': '$3C',
'EEDR': '$3D',
'GICR': '$5B',
'GIFR': '$... |
"""
Command class.
"""
import optparse
import sys
class CommandHelpFormatter(optparse.IndentedHelpFormatter):
"""
I format the description as usual, but add an overview of commands
after it if there are any, formatted like the options.
"""
_commands = None
def addCommand(self, name, description)... |
data = {
'desktop_icons': [
'Agriculture Task',
'Crop',
'Crop Cycle',
'Fertilizer',
'Item',
'Land Unit',
'Disease',
'Plant Analysis',
'Soil Analysis',
'Soil Texture',
'Task',
'Water Analysis',
'Weather'
],
'restricted_roles': [
'Agriculture Manager',
'Agriculture User'
],
'modules': [... |
'''
Genesis Add-on
Copyright (C) 2015 lambda
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 License, or
(at your option) any later version.
This pr... |
'''
Created on 3 Oct 2013
@author: Anna
Basic implementation: runs the allocation routine for the future demand first
(one week at a time for the whole planning horizon) and the PPOS after
Equivalent to M2 in MATLAB functions
'''
import xlwt
import xlrd
from AllocationRoutine import AllocationRoutine
from CoreObject im... |
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2011, Anthon van der Neut <A.van.der.Neut@ruamel.eu>'
import sys
import struct
from calibre.ebooks.djvu.djvubzzdec import BZZDecoder
from calibre.constants import plugin... |
"""
Utilities for writing third_party_auth tests.
Used by Django and non-Django tests; must not have Django deps.
"""
import os.path
from contextlib import contextmanager
from unittest import mock
import django.test
from django.conf import settings
from django.contrib.auth.models import User # lint-amnesty, pylint: di... |
"""The test for the Template sensor platform."""
from homeassistant.setup import setup_component
from tests.common import get_test_home_assistant, assert_setup_component
class TestTemplateSensor:
"""Test the Template sensor."""
hass = None
# pylint: disable=invalid-name
def setup_method(self, method):
... |
"""
The only types of routers in this file should be ``ComposingRouters``.
The routers for the backends should be in the backend-specific router modules.
For example, the ``ComposableRouter`` for ``identity`` belongs in::
keystone.identity.routers
"""
from keystone.common import wsgi
from keystone import controller... |
"""Representation of a deCONZ remote."""
from pydeconz.sensor import Switch
from homeassistant.const import CONF_DEVICE_ID, CONF_EVENT, CONF_ID, CONF_UNIQUE_ID
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.util import slugify
from .const... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class AddAlarm(Choreography):
def __init__(self, temboo_session):
"""
Create a new ins... |
"""
This module is deprecated. Please use `airflow.providers.google.cloud.operators.natural_language`.
"""
import warnings
from airflow.providers.google.cloud.operators.natural_language import (
CloudNaturalLanguageAnalyzeEntitiesOperator, CloudNaturalLanguageAnalyzeEntitySentimentOperator,
CloudNaturalLanguage... |
"""Layers that operate regularization via the addition of noise.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.keras import backend as K
from tensorflow.python.keras.engine.base_layer import Layer
from tensorflo... |
import claripy
from .sim_type import SimTypePointer as Ptr, SimTypeTop as Top
class TypedValue(claripy.BackendObject):
def __init__(self, ty, value):
self.ty = ty
self.value = value
def __repr__(self):
return 'TypedValue(%s, %s)' % (repr(self.ty), repr(self.value))
class TypeBackend(clar... |
from numba import cuda
from numba.cuda.testing import unittest, CUDATestCase
import numpy as np
class TestIterators(CUDATestCase):
def test_enumerate(self):
@cuda.jit
def enumerator(x, error):
count = 0
for i, v in enumerate(x):
if count != i:
... |
import functools
from math import inf
from numbers import Number
import numpy as np
from astropy.units import Quantity
from astropy.utils import isiterable
from astropy.utils.decorators import deprecated
from . import units as cu
__all__ = [] # nothing is publicly scoped
__doctest_skip__ = ["inf_like", "vectorize_if_n... |
import uuid
from django.conf import settings
from django.db.backends.base.operations import BaseDatabaseOperations
from django.utils import timezone
from django.utils.duration import duration_microseconds
from django.utils.encoding import force_str
class DatabaseOperations(BaseDatabaseOperations):
compiler_module =... |
"""Simulate head movements and neural activations
You can do for example:
$ simulate_movement.py --raw test_raw.fif
--pos test_raw_hp.txt
--dipoles dips.txt
--cov simple
--out test_sim_raw.fif
--jobs 2 --o... |
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "_ext")))
extensions = ['configext']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'phpMyAdmin'
copyright = u'2012 - 2016, The phpMyAdmin devel team'
version = '4.6.5.2'
release = versio... |
'''
Megacoin base58 encoding and decoding.
Based on https://megacointalk.org/index.php?topic=1026.0 (public domain)
'''
import hashlib
class SHA256:
new = hashlib.sha256
if str != bytes:
# Python 3.x
def ord(c):
return c
def chr(n):
return bytes( (n,) )
__b58chars = '123456789ABCDEFGHJKL... |
from flask import Blueprint
talks = Blueprint('talks', __name__)
from . import routes |
__author__ = '7sDream'
import json
from .common import *
class Question:
"""问题类,请使用``ZhihuClient.question``方法构造对象."""
@class_common_init(re_question_url)
def __init__(self, url, title=None, followers_num=None,
answer_num=None, session=None):
"""创建问题类实例.
:param str url: 问题url... |
from flask_testing import TestCase
from application.app import app, db
from application.models import User
import os
from setup import basedir
import json
class BaseTestConfig(TestCase):
default_user = {
"email": "default@gmail.com",
"password": "something2"
}
def create_app(self):
a... |
from gluon import current
from s3 import *
from s3layouts import *
try:
from .layouts import *
except ImportError:
pass
import s3menus as default
class S3MainMenu(default.S3MainMenu):
""" Custom Application Main Menu """
# -------------------------------------------------------------------------
@cl... |
from i3pystatus import IntervalModule
import psutil
import getpass
class MakeWatch(IntervalModule):
"""
Watches for make jobs and notifies when they are completed.
requires: psutil
"""
settings = (
("name", "Listen for a job other than 'make' jobs"),
("running_color", "Text color whi... |
"""
***************************************************************************
FixedTableDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***********************************************... |
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):
depends_on = (
("django_nyt", "0001_initial"),
)
def forwards(self, orm):
# Adding model 'ArticleSubscription'
... |
from copy import copy
iNone = -999
iTrue = 1
iFalse = 0
setup = (4, 2, 3, 5, 6, 3, 2, 4, iNone, iNone) + (iTrue,)*4 + (iNone, iNone) + (1,) * 8 + (iNone, iNone, iTrue, iNone, iNone, iNone, iNone, iNone,) + ((0, ) * 8 + (iNone,) * 8) * 4 + (-1,) * 8 + (iNone,) * 8 + (-4, -2, -3, -5, -6, -3, -2, -4) + (iNone,) * ... |
import os
import subprocess
import time
import re
import string
import pexpect
import cgi
import urllib
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
from src.core.setcore import *
definepath=os.getcwd()
port=44444
fileopen=file("%s/config/set_config" % (definepath), "r")
for l... |
from UM.PluginObject import PluginObject
class ProfileWriter(PluginObject):
## Initialises the profile writer.
#
# This currently doesn't do anything since the writer is basically static.
def __init__(self):
super().__init__()
## Writes a profile to the specified file path.
#
# ... |
"""
Exceptions for the course gating feature
"""
class GatingValidationError(Exception):
"""
Exception class for validation errors related to course gating information
"""
pass # lint-amnesty, pylint: disable=unnecessary-pass |
"""Support for Dutch Smart Meter Requirements.
Also known as: Smartmeter or P1 port.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.dsmr/
Technical overview:
DSMR is a standard to which Dutch smartmeters must comply. It specifies that
the smartmete... |
from geomesa_pyspark.types import *
from shapely.wkt import loads
from unittest import TestCase, main
class PointUDTTest(TestCase):
udt = Point.__UDT__
def test_udt(self):
self.assertIsInstance(self.udt, PointUDT)
def test_udt_roundtrip(self):
wkt = "POINT (30 10)"
g = loads(wkt)
... |
"""Contains utilities for comparing RELEASE_NOTES between Cloud SDK versions.
"""
import re
import StringIO
from googlecloudsdk.core import config
from googlecloudsdk.core import log
from googlecloudsdk.core.document_renderers import render_document
from googlecloudsdk.core.updater import installers
class ReleaseNotes(... |
"""SignatureDef method name utility functions.
Utility functions for manipulating signature_def.method_names.
"""
from tensorflow.python.lib.io import file_io
from tensorflow.python.platform import tf_logging
from tensorflow.python.saved_model import constants
from tensorflow.python.saved_model import loader_impl as lo... |
from subprocess import (
CalledProcessError,
check_call,
check_output,
Popen,
PIPE,
)
def deactivate_lvm_volume_group(block_device):
'''
Deactivate any volume gruop associated with an LVM physical volume.
:param block_device: str: Full path to LVM physical volume
'''
vg = list_lv... |
"""
========================
CENSURE feature detector
========================
The CENSURE feature detector is a scale-invariant center-surround detector
(CENSURE) that claims to outperform other detectors and is capable of real-time
implementation.
"""
from skimage import data
from skimage import transform as tf
from ... |
f1 = lambda x: lommels1(-1,2.5,x)
f2 = lambda x: lommels1(0,0.5,x)
f3 = lambda x: lommels1(0,6,x)
f4 = lambda x: lommels1(0.5,3,x)
plot([f1,f2,f3,f4], [0,20]) |
"""SCons.Tool.default
Initialization with a default tool list.
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.
"""
__revision__ = "src/engine/SCons/Tool/default.py 2014/07/05 09:42:21 garyo"
import SCons.Tool
def g... |
"""
A port of the Gale-Church Aligner.
Gale & Church (1993), A Program for Aligning Sentences in Bilingual Corpora.
http://aclweb.org/anthology/J93-1004.pdf
"""
from __future__ import division
import math
try:
from scipy.stats import norm
from norm import logsf as norm_logsf
except ImportError:
def erfcc(x)... |
"""
Inventory Management
A module to record inventories of items at a locations (sites),
including Warehouses, Offices, Shelters & Hospitals
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
def index(... |
from pyanaconda.modules.storage.disk_selection.selection import DiskSelectionModule
__all__ = ["DiskSelectionModule"] |
import logging
import time
import datetime
from .HTMLElement import HTMLElement
from .attr_property import attr_property
from .compatibility import *
log = logging.getLogger("Thug")
class HTMLAnchorElement(HTMLElement):
def __init__(self, doc, tag):
HTMLElement.__init__(self, doc, tag)
accessKey =... |
from config_common.rhn_log import log_debug, die
from config_common.file_utils import ostr_to_sym
import handler_base, base64
import sys
class Handler(handler_base.HandlerBase):
def run(self):
log_debug(2)
r = self.repository
files = r.list_files()
if not files:
die(1, "N... |
import binascii
from salts_lib.pyjsparser import PyJsParser
import six
if six.PY3:
basestring = str
long = int
xrange = range
unicode = str
REGEXP_CONVERTER = PyJsParser()
def to_hex(s):
return binascii.hexlify(s.encode('utf8')).decode('utf8') # fucking python 3, I hate it so much
... |
"""Unit tests for the search engine query parsers."""
from invenio.base.wrappers import lazy_import
from invenio.testsuite import make_test_suite, run_test_suite, InvenioTestCase
search_engine_query_parser = lazy_import('invenio.legacy.search_engine.query_parser')
perform_request_search = lazy_import('invenio.legacy.se... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: zypper_repository
author: "Matthias Vogelgesang (@matze)"
versi... |
import re
from six.moves.urllib_parse import urlparse
from cloudinit import settings
from cloudinit import helpers
from cloudinit.sources import DataSourceDigitalOcean
from .. import helpers as test_helpers
httpretty = test_helpers.import_httpretty()
DO_INDEX = """id
hostname
user-data
... |
from odoo import fields, models
from odoo.http import request
class PaymentAcquirer(models.Model):
_inherit = "payment.acquirer"
website_id = fields.Many2one(
"website",
domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]",
ondelete="restrict",
)
def get_ba... |
"""
Single page performance tests for Studio.
"""
from bok_choy.web_app_test import WebAppTest, with_cache
from ..pages.studio.auto_auth import AutoAuthPage
from ..pages.studio.overview import CourseOutlinePage
from nose.plugins.attrib import attr
@attr(har_mode='explicit')
class StudioPagePerformanceTest(WebAppTest):
... |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any
import sys
import argparse
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ValidationError
from django.db.utils import IntegrityError
from django.core import validator... |
from numpy import meshgrid, ndarray, array_equal, allclose, array, sqrt, zeros, asarray, where, ones
from test_utils import LocalTestCase
from thunder.extraction.source import Source, SourceModel
class TestSourceConstruction(LocalTestCase):
def test_source(self):
"""
(SourceConstruction) create
... |
"""
wakatime.languages.php
~~~~~~~~~~~~~~~~~~~~~~
Parse dependencies from PHP code.
:copyright: (c) 2014 Alan Hamlett.
:license: BSD, see LICENSE for more details.
"""
from . import TokenParser
from ..compat import u
class PhpParser(TokenParser):
state = None
parens = 0
def parse(self, t... |
"""
34. Generic relations
Generic relations let an object have a foreign key to any object through a
content-type/object-id field. A ``GenericForeignKey`` field can point to any
object, be it animal, vegetable, or mineral.
The canonical example is tags (although this example implementation is *far*
from complete).
"""
... |
import sys
import os
import unittest
from StringIO import StringIO
import tempfile
import csv
import gc
from test import test_support
class Test_Csv(unittest.TestCase):
"""
Test the underlying C csv parser in ways that are not appropriate
from the high level interface. Further tests of this nature are done
... |
import sys
import socket
from socket import timeout as SocketTimeout
try: # Python 3
from http.client import HTTPConnection as _HTTPConnection, HTTPException
except ImportError:
from httplib import HTTPConnection as _HTTPConnection, HTTPException
class DummyConnection(object):
"Used to detect a failed Conne... |
"""Utilities for probability distributions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib import linalg
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework im... |
import struct
import dns.exception
import dns.rdata
import dns.name
class SRV(dns.rdata.Rdata):
"""SRV record
@ivar priority: the priority
@type priority: int
@ivar weight: the weight
@type weight: int
@ivar port: the port of the service
@type port: int
@ivar target: the target host
... |
class Warehouse:
def __init__(self):
self.objects = []
self.active = []
def addObject(self, moose_object):
self.objects.append(moose_object)
self.active.append(moose_object)
def getActiveObjects(self):
return self.active
def getAllObjects(self):
return sel... |
from __future__ import unicode_literals
from .fields_tests import *
from .widgets_tests import *
from .resources_tests import *
from .instance_loaders_tests import *
from .admin_integration_tests import *
from .base_formats_tests import *
from .tmp_storages_tests import * |
from __future__ import unicode_literals
from django.test import SimpleTestCase
from localflavor.kw.forms import KWCivilIDNumberField
class KWLocalFlavorTests(SimpleTestCase):
def test_KWCivilIDNumberField(self):
error_invalid = ['Enter a valid Kuwaiti Civil ID number']
valid = {
'2820407... |
"""A number of useful helper functions to automate common tasks."""
from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.admin.sites import NotRegistered
from django.utils.encoding import force_text
from reversion.admin import VersionAdmin
def patch_admin(model, admin_site=None):... |
"""Import stub for mock library.
NOTE: copied/adapted from SQLAlchemy master for backwards compatibility;
this should be removable when Alembic targets SQLAlchemy 1.0.0
"""
from __future__ import absolute_import
from ..util.compat import py33
if py33:
from unittest.mock import MagicMock, Mock, call, patch, ... |
from __future__ import unicode_literals
from django_evolution.mutations import ChangeMeta
MUTATIONS = [
ChangeMeta('HostingServiceAccount', 'unique_together', []),
] |
import codecs
import csv
import fnmatch
import inspect
import locale
import os
import openerp.pooler as pooler
import openerp.sql_db as sql_db
import re
import logging
import tarfile
import tempfile
import threading
from babel.messages import extract
from os.path import join
from datetime import datetime
from lxml impo... |
import unittest
import numpy
from htmresearch.algorithms.union_temporal_pooler import UnionTemporalPooler
REAL_DTYPE = numpy.float32
class UnionTemporalPoolerTest(unittest.TestCase):
def setUp(self):
self.unionTemporalPooler = UnionTemporalPooler(inputDimensions=(5, ),
columnDim... |
from cinder.volume.drivers.dothill import dothill_fc
from cinder.volume.drivers.lenovo import lenovo_common
class LenovoFCDriver(dothill_fc.DotHillFCDriver):
"""OpenStack Fibre Channel cinder drivers for Lenovo Storage arrays.
Version history:
1.0 - Inheriting from DotHill cinder drivers.
"""
... |
from __future__ import absolute_import
from sentry.eventtypes import ErrorEvent
from sentry.testutils import TestCase
class ErrorEventTest(TestCase):
def test_to_string_none_value(self):
inst = ErrorEvent({})
result = inst.to_string({'type': 'Error', 'value': None})
assert result == 'Error'
... |
import copy
import betamax
import github3
import os
import unittest
class IntegrationHelper(unittest.TestCase):
def setUp(self):
self.user = os.environ.get('GH_USER', 'foo')
self.password = os.environ.get('GH_PASSWORD', 'bar')
self.token = os.environ.get('GH_AUTH', 'x' * 20)
self.gh ... |
from django.test import SimpleTestCase
from crits.relationships.handlers import forge_relationship, update_relationship_reasons, update_relationship_confidences
from crits.core.user import CRITsUser
from crits.campaigns.campaign import Campaign
from crits.vocabulary.relationships import RelationshipTypes
TUSER_NAME = "... |
""" Generation of sine-Gaussian bursty type things
"""
import pycbc.types
import numpy
def fd_sine_gaussian(amp, quality, central_frequency, fmin, fmax, delta_f):
""" Generate a Fourier domain sine-Gaussian
Parameters
----------
amp: float
Amplitude of the sine-Gaussian
quality: float
... |
from __future__ import unicode_literals
import base64
import binascii
import json
import os
import random
from .common import InfoExtractor
from ..aes import aes_cbc_decrypt
from ..compat import (
compat_b64decode,
compat_ord,
)
from ..utils import (
bytes_to_intlist,
bytes_to_long,
ExtractorError,
... |
"""
Classes for manipulating and querying groups of packages.
"""
from Errors import PackageSackError
import warnings
import re
import fnmatch
import misc
from packages import parsePackages
import rpmUtils.miscutils
from rpmUtils.miscutils import compareEVR
class PackageSackVersion:
def __init__(self):
self... |
from __future__ import division
from future import standard_library
standard_library.install_aliases()
import logging
import re
import fnmatch
import configparser
import math
import os
from urllib.parse import urlparse
import warnings
import boto
from boto.s3.connection import S3Connection
from boto.sts import STSConne... |
"""Test for version 3 of the zero_out op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.examples.adding_an_op import zero_out_op_3
from tensorflow.python.framework import test_util
class ZeroOut3Test(tf.test.TestCa... |
from google.appengine.ext import db
import base64
import cgi
import datetime
import mimetypes
import config
import const
from resources import Resource, ResourceBundle
import utils
PREFACE = '''
<style>
body, table, th, td, input { font-family: arial; font-size: 13px; }
body, form, input { margin: 0; padding: 0; }
.nav... |
"""
mbed SDK
Copyright (c) 2016-2020 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
from south.db import db
from django.db import models
from cms.plugins.snippet.models import *
class Migration:
depends_on = (
("cms", "0001_initial"),
)
def forwards(self, orm):
# Adding model 'Snippet'
db.create_table('snippet_snippet', (
('id', models.AutoField(primary_... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: cloudwatchevent_rule
short_description: Manage CloudWatch Event... |
"""
This page is in the table of contents.
Gcode_small is an export plugin to remove the comments and the redundant z and feed rate parameters from a gcode file.
An export plugin is a script in the export_plugins folder which has the getOutput function, the globalIsReplaceable variable and if it's output is not replace... |
"""SCons.Tool.mslink
Tool-specific initialization for the Microsoft linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
__revision__ = "src/engine/SCons/Tool/mslink.py 3842 2008/12/20 22:59:52 scons"
import ... |
class A():
def method(self):
print(1)
class B(A):
def method(self):
print(2)
b = B()
b.meth<caret>od() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.