content stringlengths 4 20k |
|---|
import Gaffer
import GafferUI
import GafferScene
import GafferSceneUI
##########################################################################
# Metadata
##########################################################################
Gaffer.Metadata.registerNodeDescription(
GafferScene.SubTree,
"""A node for extracti... |
from __future__ import unicode_literals
from django import http
from django.apps import apps
from django.conf import settings
from django.contrib.redirects.models import Redirect
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import ImproperlyConfigured
from django.utils.deprec... |
"""Utilities for testing pymongo
"""
import os
import struct
import sys
import threading
from nose.plugins.skip import SkipTest
from pymongo import MongoClient, MongoReplicaSetClient
from pymongo.errors import AutoReconnect
from pymongo.pool import NO_REQUEST, NO_SOCKET_YET, SocketInfo
from test import host, port, ve... |
import time
import numpy as np
from kid_readout.interactive import *
from kid_readout.equipment import hardware
from kid_readout.measurement import acquire
from kid_readout.roach import analog, hardware_tools, attenuator, r2heterodyne
ifboard = analog.HeterodyneMarkII()
setup = hardware.Hardware(ifboard)
ri = hard... |
"""
Provides a function to report all internal modules for using freezing tools
pytest
"""
def pytest_namespace():
return {'freeze_includes': freeze_includes}
def freeze_includes():
"""
Returns a list of module names used by py.test that should be
included by cx_freeze.
"""
import py
impo... |
# -*- coding: utf-8 -*-
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default... |
#! /usr/bin/env python
"""
Visual Studio 2010 Build Script
$Id: Build.py 309 2011-09-21 05:44:28Z soothe $
"""
import os
import sys
import getopt
import subprocess
# Setup some path stuff
try:
if environ['VISUALSTUDIO_BIN']:
VSBINDIR = environ['VISUALSTUDIO_BIN']
except NameError:
# Use default val... |
""" Generic Python Character Mapping Codec.
Use this codec directly rather than through the automatic
conversion mechanisms supplied by unicode() and .encode().
Written by Marc-Andre Lemburg (<EMAIL>).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import codecs
### Codec APIs
class Codec(c... |
"""
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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.
CVXPY is distributed i... |
import json
from mock import patch
import jenkins
from tests.jobs.base import JenkinsJobsTestBase
class JenkinsCreateJobTest(JenkinsJobsTestBase):
@patch.object(jenkins.Jenkins, 'jenkins_open')
def test_simple(self, jenkins_mock):
jenkins_mock.side_effect = [
jenkins.NotFoundException(),... |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... |
from __future__ import absolute_import
from fife import fifechan
from fife.extensions.pychan.attrs import BoolAttr
from .basictextwidget import BasicTextWidget
class Label(BasicTextWidget):
"""
A basic label - displaying a string.
Also allows text wrapping and onMouse hover callbacks.
New Attributes
========... |
"""
Basic wheel tests.
"""
import os
import pkg_resources
import json
import sys
from pkg_resources import resource_filename
import wheel.util
import wheel.tool
from wheel import egg2wheel
from wheel.install import WheelFile
from zipfile import ZipFile
from shutil import rmtree
test_distributions = ("complex-dist"... |
import numpy
import hashlib
def dr_rms(y):
n = y.shape
return numpy.sqrt(2.0 * numpy.sum(y**2.0, 0) / float(n[0]))
def u_rms(y):
n = y.shape
return numpy.sqrt(numpy.sum(y**2.0, 0) / float(n[0]))
def decibel_u(y, ref):
return 20.0 * numpy.log10(y / ref)
def decibel_p(y, ref):
return 10.0 ... |
"""Utility functions for working with the Google Chart API.
Not intended for end users, use the methods in __init__ instead."""
import cgi
import string
import urllib
# TODO: Find a better representation
LONG_NAMES = dict(
client_id='chc',
size='chs',
chart_type='cht',
axis_type='chxt',
axis_label='chxl',... |
import os
import platform
from twisted.internet import defer
from .. import data, helper
from p2pool.util import pack
P2P_PREFIX = 'fcd9b7dd'.decode('hex')
P2P_PORT = 1336
ADDRESS_VERSION = 24
RPC_PORT = 1337
RPC_CHECK = defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
'doubloons address' in (y... |
# (C) 2005-2011 Frank-Rene Schaefer
# ABSOLUTELY NO WARRANTY
###############################################################################
from quex.engine.state_machine.core import StateMachine, State
import quex.engine.state_machine.index as index
def do(StateMachineList, CommonTerminalStateF=True, CloneF=True):... |
"""
Unit Tests for testing the cells weight algorithms.
Cells with higher weights should be given priority for new builds.
"""
import datetime
from oslo_utils import timeutils
from nova.cells import state
from nova.cells import weights
from nova import test
class FakeCellState(state.CellState):
def __init__(s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.che... |
from __future__ import absolute_import
from sentry.api.base import DocSection
from sentry.api.bases.organization import OrganizationReleasesBaseEndpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.api.serializers import serialize
from sentry.models import Release, ReleaseCommit
class Organizat... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 22 22:03:23 2017
@author: alek
"""
import sys
sys.path.append('../../')
from pyDist import Nodes
import logging
import sys
from pyDist.TaskManager import TaskManager
#change these up for use in other cases
taskManager = TaskManager()
#taskManager... |
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from fileserver.UserWorker import GetUserFromPostRequest, \
GetRecipientsFromPostRequest, GetUploadedFileFromPostRequest, \
GetFileListByUser, GetFilesCountByUser, GetFileResponseFromPostRequest, \
ChangePasswordFromP... |
"""
Simple restricted Boltzmann Machine model.
"""
import logging
from neon.backends.backend import Block
from neon.models.model import Model
from neon.util.compat import range
logger = logging.getLogger(__name__)
class RBM(Model):
"""
Restricted Boltzmann Machine with binary visible and binary hidden uni... |
from sympy import symbols, Integer
from sympy.physics.quantum.dagger import Dagger
from sympy.physics.quantum.commutator import Commutator as Comm
from sympy.physics.quantum.operator import Operator
a, b, c = symbols('a,b,c')
A, B, C, D = symbols('A,B,C,D', commutative=False)
def test_commutator():
c = Comm(A,... |
"""Add a new SSH key."""
# :license: MIT, see LICENSE for more details.
from os import path
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
@click.command()
@click.argument('label')
@click.option('--in-file', '-f',
type=click.Path(exists=True),
... |
import json
import re
from django.contrib.auth.decorators import user_passes_test
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from cripts.config.config import CRIPTsConfig
from cripts.config.forms import ConfigGeneralForm, ConfigLDAPFo... |
from django.conf.urls import patterns, url
from contacts import views
urlpatterns = patterns('',
# The home view ('/contacts/')
url(r'^$', views.index, name='index'),
# Used to start OAuth2 flow ('/contacts/connect/')
url(r'^connect/$', views.connect, name='connect'),
# Used as redirect target in ... |
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: CPM test
# Description: gnuradio flow graph
# Generated: Thu Feb 19 23:16:23 2009
##################################################
from gnuradio import gr
from gnuradio import trellis, digital, filter, bloc... |
from kano.logging import logger
from kano.utils import get_user_unsudoed
import os
KDESKRC_SYSTEM = "/usr/share/kano-desktop/kdesk/.kdeskrc"
KDESKRC_HOME_TEMPLATE = "/home/{user}/.kdeskrc"
PARAM_NAME_TEMPLATE = "Background.File-{size}"
SIZE_SUFFIX_MAP = {
"medium": "-1024.png",
"4-3": "-4-3.png",
"16-9": ... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.nxos import get_config, load_config, run_commands
from ansible.module_utils.nxos import nxos_argument_spec, check_args
from ansible.module_utils.basic im... |
from boto.s3.key import Key
class Object(Key):
def __init__(self, bucket, name=None):
super(Object, self).__init__(bucket, name=name)
self.distribution = bucket.distribution
def __repr__(self):
return '<Object: %s/%s>' % (self.distribution.config.origin, self.name)
def url(self, ... |
"""TimeShifter class for shifting ModelResults."""
import collections
import copy
from nupic.frameworks.opf.opfutils import InferenceElement, ModelResult
class InferenceShifter(object):
"""Shifts time for ModelResult objects."""
def __init__(self):
self._inferenceBuffer = None
def shift(self, modelResul... |
"""
sentry.plugins.bases.issue
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django import forms
from django.conf import settings
from django.utils.html import format_h... |
# Created by John Travers, Robert Hetland, 2007
""" Test functions for rbf module """
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (assert_, assert_array_almost_equal,
assert_almost_equal, run_module_suite)
from numpy import l... |
try:
import pyrax
HAS_PYRAX = True
except ImportError:
HAS_PYRAX = False
def cloud_queue(module, state, name):
for arg in (state, name):
if not arg:
module.fail_json(msg='%s is required for rax_queue' % arg)
changed = False
queues = []
instance = {}
cq = pyrax.que... |
'''
Copyright (C) 2014 Codility Limited. <https://codility.com>
This file is part of Candidate User Interface (CUI).
CUI is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version... |
"""Library of dtypes (Tensor element types)."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.core.framework import types_pb2
class DType(object):
"""Represents the type of the elements in a `Tensor`.
The followin... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from collections import defaultdict, namedtuple
from pants.goal.goal import Goal
class ProducerInfo(namedtuple('ProducerInfo', ['product_type', 'task_type', 'goal']... |
"""
Operations on existing wheel files, including basic installation.
"""
# XXX see patched pip to install
import sys
import warnings
import os.path
import re
import zipfile
import hashlib
import csv
import shutil
try:
_big_number = sys.maxsize
except NameError:
_big_number = sys.maxint
from wheel.decorato... |
import xml.dom.minidom
## Create a element of XML
#
# @param Name
# @param String
# @param NodeList
# @param AttributeList
#
# @revel Element
#
def CreateXmlElement(Name, String, NodeList, AttributeList):
Doc = xml.dom.minidom.Document()
Element = Doc.createElement(Name)
if String != '' and String != None:... |
"""
Relating an object to itself, many-to-one
To define a many-to-one relationship between a model and itself, use
``ForeignKey('self', ...)``.
In this example, a ``Category`` is related to itself. That is, each
``Category`` has a parent ``Category``.
Set ``related_name`` to designate what the reverse relationship i... |
import math
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
from pydub import AudioSegment
from main_const import *
class ExportSession():
def __init__(self, main, gui, player):
self.main = main
self.gui = gui
self.pl... |
"""A temp file that automatically gets pushed and deleted from a device."""
# pylint: disable=W0622
import posixpath
import random
import threading
from devil.android import device_errors
from devil.utils import cmd_helper
class DeviceTempFile(object):
def __init__(self, adb, suffix='', prefix='temp_file', dir='... |
"""Result class definitions."""
from pymongo.errors import InvalidOperation
class _WriteResult(object):
"""Base class for write result classes."""
def __init__(self, acknowledged):
self.__acknowledged = acknowledged
def _raise_if_unacknowledged(self, property_name):
"""Raise an exceptio... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
def main():
module = AnsibleModule(
argument_spec = dict()
)
facter_path = module.get_bin_path('facter', opt_dirs=['/opt/puppetlabs/bin'])
cmd = [facter_... |
import os
import inspect
from lib import BaseTest
changesRemove = lambda _, s: s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "changes"), "")
class EditRepo1Test(BaseTest):
"""
edit repo: change comment
"""
fixtureCmds = [
"aptly repo create repo1",
]
runCmd... |
"""
A module containing specialized collection classes.
"""
class HomogeneousList(list):
"""
A subclass of list that contains only elements of a given type or
types. If an item that is not of the specified type is added to
the list, a `TypeError` is raised.
"""
def __init__(self, types, value... |
from pathlib import Path
import gc
from collections import defaultdict
from contextlib import contextmanager
from typing import Iterable, Union
from database.lightning import LightningInterface
class SetWithCallback(set):
"""A set implementation that triggers callbacks on `add` or `update`.
It has an impo... |
#! ../env/bin/python
# -*- coding: utf-8 -*-
import pytest
create_user = True
@pytest.mark.usefixtures("testapp")
class TestURLs:
def test_home(self, testapp):
""" Tests if the home page loads """
rv = testapp.get('/')
assert rv.status_code == 200
def test_login(self, testapp):
... |
from __future__ import unicode_literals
from django.contrib.localflavor.be.forms import (BEPostalCodeField,
BEPhoneNumberField, BERegionSelect, BEProvinceSelect)
from django.test import SimpleTestCase
class BELocalFlavorTests(SimpleTestCase):
def test_BEPostalCodeField(self):
error_format = ['Enter ... |
from .imports import *
from .layer_optimizer import *
import copy
class Callback:
def on_train_begin(self): pass
def on_batch_begin(self): pass
def on_epoch_end(self, metrics): pass
def on_batch_end(self, metrics): pass
def on_train_end(self): pass
class LossRecorder(Callback):
def __init__(se... |
import numbers
from . import Image, ImageColor
from ._util import isStringType
"""
A simple 2D drawing interface for PIL images.
<p>
Application code should use the <b>Draw</b> factory, instead of
directly.
"""
class ImageDraw(object):
def __init__(self, im, mode=None):
"""
Create a drawing ins... |
from types import FunctionType
from contextlib import contextmanager
from functools import wraps
from astropy.table import QTable
__all__ = ['BaseTimeSeries', 'autocheck_required_columns']
COLUMN_RELATED_METHODS = ['add_column',
'add_columns',
'keep_columns',
... |
#!/usr/bin/env python
from __future__ import print_function
import re
import os
import os.path
import optparse
import sys
import pysam
import subprocess
# global regular expressions
readKeyRe = re.compile('(.*)[\s\/][1-2](.*)')
readNumRe = re.compile('.*[\s\/]([1-2]).*')
# sort bam file with pysam.sort function
# ... |
"""Class representing audio/* type MIME documents."""
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
__all__ = ['MIMEAudio']
import sndhdr
from io import BytesIO
from future.backports.email import encoders
from future.backports.email.mime.nonmultipart i... |
import enum
import os
import shutil
import subprocess
import sys
import pytest
from assets.scripts.build_gallery import execute_shell_command
from great_expectations.data_context.util import file_relative_path
class BackendDependencies(enum.Enum):
BIGQUERY = "BIGQUERY"
MYSQL = "MYSQL"
MSSQL = "MSSQL"
... |
"""
Implementation of "Instructor" service
"""
import logging
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey, UsageKey
from courseware.models import StudentModule
from instructor.views.tools import get_student_from_identifier
from django.core.exceptions import ObjectDoesNotExist
im... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import re
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='User',... |
data = (
'A', # 0x00
'a', # 0x01
'A', # 0x02
'a', # 0x03
'E', # 0x04
'e', # 0x05
'E', # 0x06
'e', # 0x07
'I', # 0x08
'i', # 0x09
'I', # 0x0a
'i', # 0x0b
'O', # 0x0c
'o', # 0x0d
'O', # 0x0e
'o', # 0x0f
'R', # 0x10
'r', # 0x11
'R', # 0x12
'r', # 0x13
'U', # 0... |
import sys
import time
from django.db.backends.creation import BaseDatabaseCreation
from django.utils.six.moves import input
TEST_DATABASE_PREFIX = 'test_'
PASSWORD = 'Im_a_lumberjack'
class DatabaseCreation(BaseDatabaseCreation):
# This dictionary maps Field objects to their associated Oracle column
# types,... |
import argparse
from datetime import datetime
config = {
1: {
# md5: b28da1f2a5d889594a0e77e0853bcf29
# sha256: 34bd23cbb9cf301ba444e1696694527ffc59edaba2bbbe25c4ac28a90df6f52a
# sample: https://malwr.com/analysis/OTE2NzIwODkxMWUzNDBlNzhmNGZlMmFjY2ExOWEyZjQ/
'seed': 62,
'shift': 7,
'mod': 8,
... |
from __future__ import unicode_literals
import os
import django
from django.test import TestCase
from job.test import utils as job_test_utils
from product.models import FileAncestryLink
from product.test import utils as product_test_utils
from storage.messages.delete_files import create_delete_files_messages, Delete... |
"""Tests NCF."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import mock
import numpy as np
import tensorflow as tf
from absl import flags
from absl.testing import flagsaver
from official.recommendation import constants as rconst
from offi... |
from hyperspyui.plugins.plugin import Plugin
import numpy as np
import hyperspy.api as hs
from hyperspy.drawing import utils
from functools import partial
class VirtualBfDf(Plugin):
name = "Virtual BF/DF"
def __init__(self, *args, **kwargs):
super(VirtualBfDf, self).__init__(*args, **kwargs)
... |
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
import uuid
from .. import models
class QueryKeysOperations(object):
"""QueryKeysOperations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param... |
import unittest
import numpy
import six
import chainer
from chainer import cuda
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
if cuda.available:
cuda.init()
class TestAccuracy(unittest.TestCase):
def setUp(self):
... |
import os
from setuptools import find_packages, setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def requirements(fname):
return [line.strip()
for line in open(os.path.join(os.path.dirname(__file__), fname))]
setup(
name="revscoring",
version="0... |
"""
Verifies use of include_dirs when using the default build target.
"""
import TestGyp
test = TestGyp.TestGyp()
if test.format == 'scons':
test.skip_test('TODO: http://code.google.com/p/gyp/issues/detail?id=176\n')
test.run_gyp('includes.gyp', chdir='src')
test.relocate('src', 'relocate/src')
test.build('incl... |
"""This example gets all predefined custom targeting keys. The statement
retrieves up to the maximum page size limit of 500. To create custom
targeting keys, run create_custom_targeting_keys_and_values.py."""
__author__ = '<EMAIL> (Jeff Sham)'
# Locate the client library. If module was installed via "setup.py" script... |
"""
create errno-specific classes for IO or os calls.
"""
import sys, os, errno
class Error(EnvironmentError):
def __repr__(self):
return "%s.%s %r: %s " %(self.__class__.__module__,
self.__class__.__name__,
self.__class__.__doc__,
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.shell.sh import ShellModule as ShModule
class ShellModule(ShModule):
# How to end lines in a python script one-liner
_SHELL_EMBEDDED_PY_EOL = '\\\n'
def env_prefix(self, **kwargs):
return... |
'''
XML parser. One function for each top-level element in the schema.
Most functions just declare a new object and add it to the module.
For typedefs, eventcopies, xidtypes, and other aliases though,
we do not create a new type object, we just record the existing one under a new name.
'''
from os.path import join
f... |
# coding=utf-8
"""
BDD lettuce framework runner
TODO: Support other params (like tags) as well.
Supports only 2 params now: folder to search "features" for or file and "-s scenario_index"
"""
import inspect
import optparse
import os
import _bdd_utils
__author__ = 'Ilya.Kazakevich'
from lettuce.exceptions import Reason... |
"""
The ActionChains implementation,
"""
from selenium.webdriver.remote.command import Command
from selenium.webdriver.common.keys import Keys
class ActionChains(object):
"""
ActionChains are a way to automate low level interactions such as
mouse movements, mouse button actions, key press, and context men... |
import os
from invenio.ext.registry import ModuleAutoDiscoverySubRegistry
from flask.ext.registry import PkgResourcesDirDiscoveryRegistry, \
ModuleAutoDiscoveryRegistry, RegistryProxy
from invenio.utils.datastructures import LazyDict
format_elements = RegistryProxy(
'format_elements',
ModuleAutoDiscoveryS... |
import sys
from datetime import datetime, timezone
import logging
from . import parts
logger = logging.getLogger(__name__)
sep = " :"
unit_map = {
"mt": " (meters)",
"km": " (kilometers)",
"mi": " (miles)",
"kf": " (kilo-ft)",
}
tracetype = {
"ST": "[standard trace]",
"RT": "[reverse trace... |
__test__ = {"API_TESTS": r"""
>>> from datetime import datetime
>>> from django.conf import settings
>>> ORIGINAL_TIME_ZONE = settings.TIME_ZONE
>>> settings.TIME_ZONE = "UTC"
>>> from timezones import forms, decorators
>>> from timezones.utils import localtime_for_timezone, adjust_datetime_to_timezone
>>> localtime... |
import unittest
from phonopy.structure.atoms import PhonopyAtoms
class TestCell(unittest.TestCase):
def setUp(self):
symbols = ['Si'] * 2 + ['O'] * 4
lattice = [[4.65, 0, 0],
[0, 4.75, 0],
[0, 0, 3.25]]
points = [[0.0, 0.0, 0.0],
[0... |
import os
import pytz
import talib as ta
import pandas as pd
from pandas.tseries.offsets import DateOffset
from pytradelib.settings import DATA_DIR, ZIPLINE_CACHE_DIR
from pytradelib.utils import (
percent_change,
within_percent_of_value,
crossed,
)
class CSVStore(object):
_symbols = []
_csv_file... |
import json
from .base import MyTestCase
class APIEventsTestCase(MyTestCase):
def test_01_crud_events(self):
# list empty events
with self.app.test_request_context('/event',
method='GET',
headers={'Authorizatio... |
import collections
from nova.compute import task_states
from nova.compute import vm_states
from nova import context
from nova import exception
from nova.objects import instance
from nova.objects import pci_device
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nov... |
"""Unit tests for pycsw.opensearch"""
import pytest
from pycsw import opensearch
pytestmark = pytest.mark.unit
@pytest.mark.parametrize("bbox, expected", [
([10, 30, -10, -30], True),
([10.0, 30.0, -10.0, -30.0], True),
(["10", "30", "-10", "-30"], True),
([-180, 30, -10, -30], True),
([180, 30... |
from ryu.app.ofctl import api as ryu_api
from ryu.lib import dpid as dpid_lib
from ryu.lib.packet import arp
from ryu.lib.packet import ethernet
from ryu.lib.packet import packet
from ryu.lib.packet import vlan
from neutron.common import log
from neutron.openstack.common.gettextutils import _LI
from neutron.openstack.... |
#!/usr/bin/env python3
# coding=utf-8
"""
Used by ``make readme`` to generate github readme from rst docs.
Pipeline: routine(`include`, `out_file`)
* `include` - include files and inline 'heredocs'
* concatenate - flatten documents
* sanitize - modify content... |
# urllib2 work-alike interface
# ...from urllib2...
from urllib2 import \
URLError, \
HTTPError
# ...and from mechanize
from _auth import \
HTTPProxyPasswordMgr, \
HTTPSClientCertMgr
from _debug import \
HTTPResponseDebugProcessor, \
HTTPRedirectDebugProcessor
# crap ATM
## from _gzip impo... |
import Bio
from Bio import SeqIO, SeqFeature
from Bio.SeqRecord import SeqRecord
from Bio.Blast import NCBIXML
from Bio.Blast import NCBIStandalone
import sys
import os
import site
import argparse
import string
import numpy
import re
import subprocess
import genbank
import blast
import intergene
loc_reg = re.compil... |
import gtk
import subprocess
import time
import re
import os
from otrverwaltung.GeneratorTask import GeneratorTask
from otrverwaltung.pluginsystem import Plugin
from otrverwaltung import fileoperations
from otrverwaltung import path
from otrverwaltung.constants import Section
from otrverwaltung.actions.cut import Cut
... |
"""USB echo gadget module.
This gadget has pairs of IN/OUT endpoints that echo packets back to the host.
"""
import math
import struct
import uuid
import gadget
import usb_constants
import usb_descriptors
class EchoGadget(gadget.Gadget):
"""Echo gadget.
"""
def __init__(self):
"""Create an echo gadget.
... |
import dns.exception
import dns.ipv4
import dns.rdata
import dns.tokenizer
class A(dns.rdata.Rdata):
"""A record.
@ivar address: an IPv4 address
@type address: string (in the standard "dotted quad" format)"""
__slots__ = ['address']
def __init__(self, rdclass, rdtype, address):
super(A, ... |
# coding: utf-8
"""
Module with tests for ansi filters
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import unicode_literals
from ...tests.base import TestsBase
from ..ansi import strip_ansi, ansi2html, ansi2latex
class TestAnsi(TestsBase):... |
import clr, sys
from action import *
from System import *
from mathUtils import MathUtils
clr.AddReference('ZyGames.Framework');
clr.AddReference('ZyGames.Framework.Common');
clr.AddReference('ZyGames.Framework.Game');
clr.AddReference('ZyGames.Doudizhu.Bll');
clr.AddReference('ZyGames.Doudizhu.Model');
clr.A... |
from django.conf.urls import url
from oscar.core.application import Application
from oscar.core.loading import get_class
from oscar.apps.promotions.conf import PROMOTION_CLASSES
class PromotionsDashboardApplication(Application):
name = None
default_permissions = ['is_staff', ]
list_view = get_class('das... |
import uuid
from django.core.urlresolvers import reverse
from taiga.base.utils.urls import get_absolute_url
# Set this in settings.PROJECT_MODULES_CONFIGURATORS["github"]
def get_or_generate_config(project):
config = project.modules_config.config
if config and "github" in config:
g_config = project.... |
import os
################## for building word dictionary ##################
max_word_num = 51200 - 2
cutoff_word_fre = 0
################## for training task #########################
# path of training data
train_file = "data/train_data_examples.txt"
# path of testing data, if testing file does not exist,
# test... |
# $Id: __init__.py,v 1.9 2005/03/07 09:34:51 snakeru Exp $
"""
All features of xmpppy library contained within separate modules.
At present there are modules:
simplexml - XML handling routines
protocol - jabber-objects (I.e. JID and different stanzas and sub-stanzas) handling routines.
debug - Jacob Lundquist's debugg... |
import mxnet as mx
from mxnet import gluon
from mxnet.gluon import nn, rnn
class RNNModel(gluon.Block):
"""A model with an encoder, recurrent layer, and a decoder."""
def __init__(self, mode, vocab_size, num_embed, num_hidden,
num_layers, dropout=0.5, tie_weights=False, **kwargs):
sup... |
# -*- coding: utf-8 -*-
from django.db.models.query import QuerySet, ValuesQuerySet, ValuesListQuerySet
from django.db.models.query import ITER_CHUNK_SIZE
from django.db import backend, connection
from django.conf import settings
from django_orm.cache.utils import get_cache_key_for_pk, get_cache
from django_orm.cache... |
"""Usage: %s [options] <IP_address> [image.bin | url]
Valid options:
\t-h | --help: usage statement
\t-d | --dump: create a flash dump
\t-f | --file: use <filename> to store dump contents
\t-u | --user: provide username (default admin)
\t-p | --pass: provide password (default password1)
\t --port: set port for http... |
"""
Support for UPnP Sensors (IGD).
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.upnp/
"""
import logging
from homeassistant.components.upnp import DATA_UPNP, UNITS
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__... |
# -*- coding: utf-8 -*-
from odoo import api, fields, models
from odoo.exceptions import UserError
class BusinessDataTable(models.Model):
_name = 'business.data.table'
_description = u'业务数据表'
model = fields.Many2one('ir.model', u'需要清理的表')
name = fields.Char(u'业务数据表名', required=True)
clean_busine... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.