content string |
|---|
"""Unit tests for the `iris.plot.points` function."""
from __future__ import (absolute_import, division, print_function)
from six.moves import (filter, input, map, range, zip) # noqa
# Import iris.tests first so that some things can be initialised before
# importing anything else.
import iris.tests as tests
import ... |
import time
from collections import defaultdict
try:
import blessings
except ImportError:
blessings = None
import base
def format_seconds(total):
"""Format number of seconds to MM:SS.DD form."""
minutes, seconds = divmod(total, 60)
return '%2d:%05.2f' % (minutes, seconds)
class NullTerminal(obje... |
from django.db import NotSupportedError
from django.db.models.sql import compiler
class SQLCompiler(compiler.SQLCompiler):
def as_sql(self, with_limits=True, with_col_aliases=False):
"""
Create the SQL for this query. Return the SQL string and list
of parameters. This is overridden from t... |
import os
import logging
import tempfile
from . import constants
LOG_FILE = None
LOGGER = None
LEVELS = {
constants.DEBUG: logging.DEBUG,
constants.INFO: logging.INFO,
constants.WARNING: logging.WARNING,
constants.ERROR: logging.ERROR,
constants.CRITICAL: logging.CRITICAL
}
def init(filename, l... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsPointCloudAttributeByRampRenderer
.. note:: 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 2 of the License, or
(at your option) any ... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
import time
from copy import deepcopy
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.common.utils import remove_default_spec
from... |
from django_jinja import library
from jinja2 import Markup
from taiga.mdrender.service import render
@library.global_function
def mdrender(project, text) -> str:
if text:
return Markup(render(project, text))
return "" |
from __future__ import unicode_literals
import datetime
import decimal
from django.db import models
from django.db.models.constants import LOOKUP_SEP
from django.db.models.deletion import Collector
from django.db.models.related import RelatedObject
from django.forms.forms import pretty_name
from django.utils import f... |
import os
try:
from dnsimple import DNSimple
from dnsimple.dnsimple import DNSimpleException
HAS_DNSIMPLE = True
except ImportError:
HAS_DNSIMPLE = False
def main():
module = AnsibleModule(
argument_spec = dict(
account_email = dict(required=False),
account_api_t... |
import crm_helpdesk
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.cloudstack import (
AnsibleCloudStack,
cs_argument_spec,
cs_required_together
)
class ... |
#!/usr/bin/env python
'''
$Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $
'''
from cStringIO import StringIO
from datetime import datetime, timedelta
from struct import unpack, calcsize
from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo
from pytz.tzinfo import memorized_datetime, memorized_timede... |
from __future__ import unicode_literals
from django.conf import global_settings, settings
from .. import Tags, Warning, register
@register(Tags.compatibility)
def check_duplicate_template_settings(app_configs, **kwargs):
if settings.TEMPLATES:
values = [
'TEMPLATE_DIRS',
'ALLOWED... |
__all__ = [
'Charset',
'add_alias',
'add_charset',
'add_codec',
]
import codecs
import email.base64mime
import email.quoprimime
from email import errors
from email.encoders import encode_7or8bit
# Flags for types of header encodings
QP = 1 # Quoted-Printable
BASE64 = 2 # Base64
S... |
from datetime import date, datetime, time
from django.forms import SplitDateTimeWidget
from .base import WidgetTest
class SplitDateTimeWidgetTest(WidgetTest):
widget = SplitDateTimeWidget()
def test_render_empty(self):
self.check_html(self.widget, 'date', '', html=(
'<input type="text" ... |
import datetime
import isodate
from pulp.server.db.connection import get_collection
def migrate(*args, **kwargs):
"""
Add last_updated and last_override_config to the importer collection.
"""
updated_key = 'last_updated'
config_key = 'last_override_config'
collection = get_collection('repo_i... |
import datetime
from django.test import TestCase
from django.utils import timezone
from oscar.test import factories
from oscar.apps.offer import models
class TestActiveOfferManager(TestCase):
def test_includes_offers_in_date_range(self):
# Create offer that is available but with the wrong status
... |
"""
Utility functions for generating "lorem ipsum" Latin text.
"""
from __future__ import unicode_literals
import random
COMMON_P = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco ... |
import ephem
from tkinter import Tk, Canvas, PhotoImage, mainloop, LEFT
import math
import argparse
import sys, os
from datetime import datetime, timezone
ICONDIR = os.path.expanduser("~/Docs/Preso/mars/pix/")
earth = { "name": "Earth", "obj": ephem.Sun(), "color": "#08f",
"path": [], "xypath": [],
... |
import time
from datetime import datetime
from django.test import TestCase
from django.utils import timezone
from oidc_provider.lib.utils.common import get_issuer
from oidc_provider.lib.utils.token import create_id_token
from oidc_provider.tests.app.utils import create_fake_user
class Request(object):
"""
M... |
"""Some common SessionRunHook classes.
@@
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import numpy as np
import six
from tensorflow.contrib.framework.python.ops import variables as contrib_variables
from tensorflow.contrib.l... |
import zstackwoodpecker.header.checker as checker_header
import zstackwoodpecker.operations.volume_operations as vol_ops
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.zstack_test.zstack_test_snapshot as zstack_sp_header
import zstackwoodpecker.header... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (C) 2013-2015 Muthiah Annamalai
#
# This file is part of 'open-tamil' package tests
#
# setup the paths
import codecs
import re
from opentamiltests import *
from tamil.utils.santhirules import joinWords
from tamil.regexp import make_pattern
class SantheeRules(unitt... |
class HealthVaultStatus(object):
"""Status codes that HealthVault can return.
`See also <http://msdn.microsoft.com/en-us/library/hh567902.aspx>`_
"""
OK = 0 # The request was successful.
FAILED = 1 # Generic failure due to unknown causes or internal error.
BAD_HTTP = 2 # Http protocol prob... |
from django.http import Http404
from django.shortcuts import render, redirect
from django.utils import six
from django.utils.translation import ugettext as _
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from avatar.forms import PrimaryAvatarForm, DeleteAvatarForm, Uplo... |
import subprocess
import tempfile
import os
def img_to_str(tesseract_path, image):
"""Reads text in an image with tesseract-ocr
:param tesseract_path: path to the tesseract executable
:type tesseracth_path: str
:param image: path to the input image
:type image: str
"""
if not os.path.isfi... |
import gcc
import gccutils
import sys
want_raii_info = False
logging = False
show_cfg = False
def log(msg, indent=0):
global logging
if logging:
sys.stderr.write('%s%s\n' % (' ' * indent, msg))
sys.stderr.flush()
def is_cleanup_type(return_type):
if not isinstance(return_type, gcc.Point... |
"""Provides utility functions used with command line samples."""
# This module is used for version 2 of the Google Data APIs.
import sys
import getpass
import urllib
import gdata.gauth
__author__ = '<EMAIL> (Jeff Scudder)'
CLIENT_LOGIN = 1
AUTHSUB = 2
OAUTH = 3
HMAC = 1
RSA = 2
def get_param(name, prompt='', se... |
#
# qNEW.py : The q-NEW signature algorithm.
#
# Part of the Python Cryptography Toolkit
#
# Distribute and use freely; there are no restrictions on further
# dissemination and usage except those imposed by the laws of your
# country of residence. This software is provided "as is" without
# warranty of fitness fo... |
# Test VfsFat class and its finaliser
try:
import uerrno, uos
uos.VfsFat
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
class RAMBlockDevice:
def __init__(self, blocks, sec_size=512):
self.sec_size = sec_size
self.data = bytearray(blocks * self.sec_size)
... |
"""
Rule that checks for a family with a particular tag.
"""
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext... |
import l10n_in_hr_payroll
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
# -*- coding: utf-8 -*-
# code for console Encoding difference. Dont' mind on it
import sys
import imp
imp.reload(sys)
try:
sys.setdefaultencoding('UTF8')
except Exception as E:
pass
import testValue
from popbill import TaxinvoiceService, PopbillException
taxinvoiceService = TaxinvoiceService(testValue.Link... |
#!/usr/bin/env python
import subprocess, sys
#API - virtdc command line init tool
#==============================================================================
# Variables
#==============================================================================
# Some descriptive variables
#name = "virtdc"
#ve... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
'''
Lookup plugin to grab metadata from a consul key value store.
============================================================
Plugin will lookup metadata for a playbook from the key value store in a
consul cluster. Values can be ... |
from os import listdir, mkdir
import cPickle
from imp import load_source
api = load_source('api', 'modules\\api.py')
from api import *
class World(object):
#initialize
def __init__(self):
super(World, self).__init__()
self.world="Default"
self.dimension="DIM1"
self.playername="Default"
self.world_blocks={}... |
def main(request, response):
"""Handler that causes multiple redirections.
The request has two mandatory and one optional query parameters:
page_origin - The page origin, used for redirection and to set TAO. This is a mandatory parameter.
cross_origin - The cross origin used to make this a cross-origin ... |
from openerp import models, fields
class ResPartnerNuts(models.Model):
_name = 'res.partner.nuts'
_order = "parent_left"
_parent_order = "name"
_parent_store = True
_description = "NUTS Item"
# NUTS fields
level = fields.Integer(required=True)
code = fields.Char(required=True)
nam... |
""" A Python code editor.
"""
#------------------------------------------------------------------------------
# Imports:
#------------------------------------------------------------------------------
from os.path import exists, basename
from enthought.pyface.workbench.api import TraitsUIEditor
from enthought.trait... |
######################################################################
# This file should be kept compatible with Python 2.3, see PEP 291. #
######################################################################
"""
Generic dylib path manipulation
"""
import re
__all__ = ['dylib_info']
DYLIB_RE = re.comp... |
import sys
sys.path.insert(0, "..")
import logging
from opcua import Client
from opcua import uaprotocol as ua
class SubHandler(object):
"""
Client to subscription. It will receive events from server
"""
def datachange_notification(self, node, val, data):
print("Python: New data change even... |
from bisect import bisect_left
import operator
import java.lang.Character
# XXX - this is intended as a stopgap measure until 2.5.1, which will have a Java implementation
# requires java 6 for `normalize` function
# only has one version of the database
# does not normalized ideographs
_codepoints = {}
_eaw = {}
_name... |
from setuptools import setup, find_packages
import os.path
# Package data
# ------------
_name = 'edrn.rdf'
_version = '1.3.8'
_description = 'EDRN RDF Server'
_author = 'Sean Kelly'
_authorEmail = '<EMAIL>'
_maintainer = 'Sean Kelly'
_maintainerEmail = '<EMAIL>'
_license ... |
import copy
import os
import logging
import pickle
try:
import sigopt as sgo
except ImportError:
sgo = None
from ray.tune.suggest.suggestion import SuggestionAlgorithm
logger = logging.getLogger(__name__)
class SigOptSearch(SuggestionAlgorithm):
"""A wrapper around SigOpt to provide trial suggestions.
... |
"""
=================================================
SVM-Anova: SVM with univariate feature selection
=================================================
This example shows how to perform univariate feature before running a SVC
(support vector classifier) to improve the classification scores.
"""
print(__doc__)
import... |
import unittest
from coalib.bearlib.spacing.SpacingHelper import SpacingHelper
from coalib.settings.Section import Section
class SpacingHelperTest(unittest.TestCase):
def setUp(self):
self.uut = SpacingHelper()
def test_needed_settings(self):
self.assertEqual(list(self.uut.get_optional_sett... |
import re
import sys
from formatter import AbstractFormatter, DumbWriter
from color import Coloring
from command import PagedCommand, MirrorSafeCommand
class Help(PagedCommand, MirrorSafeCommand):
common = False
helpSummary = "Display detailed help on a command"
helpUsage = """
%prog [--all|command]
"""
helpD... |
import time
from openerp.osv import osv
from openerp.report import report_sxw
from common_report_header import common_report_header
class journal_print(report_sxw.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context=None):
if context is None:
context = {}
super(... |
from dtk.ui.draw import draw_text
from dtk.ui.constant import DEFAULT_FONT_SIZE
from preview_bg import PreViewWin
from mplayer.player import LDMP
from mplayer.player import length_to_time
from constant import PREVIEW_PV_WIDTH, PREVIEW_PV_HEIGHT
import gtk
import cairo
import pango
class PreView(object):
def __i... |
"""
vis.py
======
Ctypes based module to access libbsd's strvis & strunvis functions.
The `vis` function is the equivalent of strvis.
The `unvis` function is the equivalent of strunvis.
All functions accept unicode string as input and return a unicode string.
Constants:
----------
* to select alternate encoding for... |
from __future__ import unicode_literals
import os.path
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse_urlparse,
)
from ..utils import (
ExtractorError,
)
class MySpassIE(InfoExtractor):
_VALID_URL = r'http://www\.myspass\.de/.*'
_TEST = {
'url': 'http://www.myspa... |
from __future__ import absolute_import, unicode_literals
from django.http import HttpResponseBadRequest
from django.shortcuts import render_to_response
from django.template import TemplateDoesNotExist
from django.template.engine import Engine
from django.utils.safestring import mark_safe
try:
from django.template... |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <<EMAIL>>'
__docformat__ = 'restructuredtext en'
import sys
from xml.sax.saxutils import escape
from lxml import etree
from calibre import guess_... |
from __future__ import unicode_literals
import boto
from boto.exception import S3ResponseError
from boto.s3.lifecycle import Lifecycle, Transition, Expiration, Rule
import sure # noqa
from moto import mock_s3
@mock_s3
def test_lifecycle_create():
conn = boto.s3.connect_to_region("us-west-1")
bucket = conn... |
œœdef kthlargest(arr1, arr2, k):
if len(arr1) == 0:
return arr2[k]
elif len(arr2) == 0:
return arr1[k]
mida1 = len(arr1)/2
mida2 = len(arr2)/2
if mida1+mida2<k:
if arr1[mida1]>arr2[mida2]:
return kthlargest(arr1, arr2[mida2+1:], k-mida2-1)
else:
... |
from neutron.agent.common import config
from oslo_config import cfg
from networking_nec._i18n import _
agent_opts = [
cfg.IntOpt('polling_interval', default=2,
help=_("The number of seconds the agent will wait between "
"polling for local device changes.")),
]
cfg.CONF.regist... |
__author__ = 'Neil Butcher'
from PyQt4 import QtCore, QtGui
from model_population import PopulationModel
from Rota_System.UI.widget_addDel_list import AddDelListWidget
from widget_person import PersonWidget
class PopulationWidget(QtGui.QWidget):
commandIssued = QtCore.pyqtSignal(QtGui.QUndoCommand)
criticalC... |
import sqlalchemy as sa
from .exceptions import ImproperlyConfigured
def coercion_listener(mapper, class_):
"""
Auto assigns coercing listener for all class properties which are of coerce
capable type.
"""
for prop in mapper.iterate_properties:
try:
listener = prop.columns[0].... |
{
'name': 'Google Analytics',
'version': '1.0',
'category': 'Tools',
'complexity': "easy",
'description': """
Google Analytics.
=================
Collects web application usage with Google Analytics.
""",
'author': 'OpenERP SA',
'website': 'https://www.odoo.com/page/website-builder',
... |
"""
lockfile.py - Platform-independent advisory file locks.
Requires Python 2.5 unless you apply 2.4.diff
Locking is done on a per-thread basis instead of a per-process basis.
Usage:
>>> lock = LockFile('somefile')
>>> try:
... lock.acquire()
... except AlreadyLocked:
... print 'somefile', 'is locked already... |
#!/usr/bin/env python
# Try to determine how much RAM is currently being used per program.
# Note per _program_, not per process. So for example this script
# will report RAM used by all httpd process together. In detail it reports:
# sum(private RAM for program processes) + sum(Shared RAM for program processes)
# The... |
import math, pygame
from pygame.locals import *
#############################################
## Standard colors (RGB)
BLACK = (20, 20, 40)
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
#############################################
## Customize plot here
def function_to_print(x):
... |
from sys import argv, stdout, stderr, exit
from subprocess import call, PIPE
from os import path, chdir
import optparse
import time
def run():
parser = optparse.OptionParser()
parser.add_option("-d", "--directory", type="str", dest="directory", default=".",
help="Specify the directory th... |
"""MAR (Mozilla ARchive) parser
Author: Robert Xiao
Creation date: July 10, 2007
"""
from hachoir_core.endian import BIG_ENDIAN
from hachoir_core.field import (RootSeekableFieldSet, FieldSet,
String, CString, UInt32, RawBytes)
from hachoir_core.text_handler import displayHandler, filesizeHandler
from hachoir_cor... |
try:
unicode
except NameError:
raise ImportError
from pybench import Test
class ConcatUnicode(Test):
version = 2.0
operations = 10 * 5
rounds = 60000
def test(self):
# Make sure the strings are *not* interned
s = unicode(u''.join(map(str,range(100))))
t = unicode(u''... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author igor
# Created by iFantastic on 16-6-3
import re
import tarfile
from functools import reduce
import numpy as np
import nltk
from keras.preprocessing.sequence import pad_sequences
from keras.layers.embeddings import Embedding
from keras.layers.core import Dense, M... |
from numpy.testing import assert_array_equal, assert_raises, run_module_suite
from skimage import data
from skimage.transform import pyramids
image = data.astronaut()
image_gray = image[..., 0]
def test_pyramid_reduce_rgb():
rows, cols, dim = image.shape
out = pyramids.pyramid_reduce(image, downscale=2)
... |
from django import forms
from .models import Company, SpecialOffer
EXPEDITED_CHOICES = (
(0, 'No, we do not offer any expedited shipping options.'),
(1, 'Yes we offer an expedited process for a fee.')
)
class AddCompanyForm(forms.ModelForm):
class Meta:
model = Company
fields = ['name'... |
import sys
from PyQt4 import QtGui, QtCore, QtNetwork
from PyQt4.QtCore import SLOT, SIGNAL
CAPTCHA_URL = 'http://www.titulky.com/captcha/captcha.php'
MAX_CAPTCHA_LEN = 8
class CaptchaDialog(QtGui.QDialog):
# Signal is emmited if captcha code is sucessfuly re-typed
codeRead = QtCore.pyqtSignal()
def... |
"""Tests for PCI request."""
from nova import exception
from nova.pci import request
from nova import test
_fake_alias1 = """{
"name": "QuicAssist",
"capability_type": "pci",
"product_id": "4443",
"vendor_id": "8086",
"device_type": "type-PCI... |
import time
import numpy
import os
import pmt
from gnuradio import gr, gr_unittest
from gnuradio import blocks
class test_multiply_matrix_ff (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
self.multiplier = None
def tearDown (self):
self.tb = None
self.mult... |
# getAllSubjectsCX
import re
import xmlrpclib
import cx_Oracle
Kim_Nguyen_G5 = '192.168.0.1'
Kim_Nguyen_iMac = '192.168.0.1'
Kim_Nguyen_MacBook = '192.168.0.1'
Plone1 = '192.168.0.1'
Plone3 = '192.168.0.1'
def getAllSubjectsCX (self, usexml):
request = self.REQUEST
RESPONSE = request.RESPONSE
remote_ad... |
# NamedType specification for constructed types
import sys
from pyasn1.type import tagmap
from pyasn1 import error
class NamedType:
isOptional = 0
isDefaulted = 0
def __init__(self, name, t):
self.__name = name; self.__type = t
def __repr__(self): return '%s(%s, %s)' % (
self.__class__.... |
import time
from distutils.version import LooseVersion
try:
import boto.ec2
from boto.exception import BotoServerError
from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping
HAS_BOTO = True
except ImportError:
HAS_BOTO = False
def get_volume(module, ec2):
name = module.p... |
from oslo_log import log as logging
from sqlalchemy.exc import OperationalError
from sqlalchemy.schema import Index
from sqlalchemy.schema import MetaData
from trove.db.sqlalchemy.migrate_repo.schema import Table
logger = logging.getLogger('trove.db.sqlalchemy.migrate_repo.schema')
def upgrade(migrate_engine):
... |
from func.minion.modules import func_module
from func.minion.modules.netapp.common import *
class Options(func_module.FuncModule):
# Update these if need be.
version = "0.0.1"
api_version = "0.0.1"
description = "Interface to the 'options' command"
def get(self, filer, filter=''):
"""
... |
"""
Stream object that redirects writes to a logger instance.
"""
import logging
class StreamToLogger(object):
"""
Fake file-like stream object that redirects writes to a logger instance.
Credits to:
http://www.electricmonk.nl/log/2011/08/14/\
redirect-stdout-and-stderr-to-a-logger-in-python/... |
# -*- coding: utf-8 -*-
from . import TaggerStorageAdapter
import unittest
import os
import codecs
class TaggerStorageAdapterTestCase(unittest.TestCase):
taggerStorage = TaggerStorageAdapter()
currentDirectory = "%s" % (os.path.dirname(os.path.realpath(__file__)), )
testTextsDirectory = "%s/../../../../d... |
"""
mbed SDK
Copyright (c) 2011-2013 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 wr... |
"""Base test cases for all neutron tests.
"""
import contextlib
import gc
import logging as std_logging
import os
import os.path
import random
import traceback
import weakref
import eventlet.timeout
import fixtures
import mock
from oslo_concurrency.fixture import lockutils
from oslo_config import cfg
from oslo_messag... |
import WebIDL
def WebIDLTest(parser, harness):
parser.parse("""
enum TestEnum {
"",
"foo",
"bar"
};
interface TestEnumInterface {
TestEnum doFoo(boolean arg);
readonly attribute TestEnum foo;
};
""")
results = parser.finish... |
# encoding: utf-8
"""Utilities for working with data structures like lists, dicts and tuples.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the f... |
'''OpenGL extension ATI.text_fragment_shader
This module customises the behaviour of the
OpenGL.raw.GL.ATI.text_fragment_shader to provide a more
Python-friendly API
Overview (from the spec)
The ATI_fragment_shader extension exposes a powerful fragment
processing model that provides a very general means of expr... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2016 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... |
#-*-coding:utf-8-*-
"""
Copyright (c) 2012 wgx731 <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merg... |
"""Tests for TransformedDistribution."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from scipy import stats
from tensorflow.contrib import distributions
from tensorflow.contrib import linalg
from tensorflow.contrib.distributions.pyt... |
# -*- coding: utf-8 -*-
"""
werkzeug.testsuite.compat
~~~~~~~~~~~~~~~~~~~~~~~~~
Ensure that old stuff does not break on update.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import unittest
import warnings
from werkzeug.testsuite import WerkzeugTestCase
... |
from mirte.core import Module
from six.moves import range
import logging
import threading
try:
import prctl
except ImportError:
prctl = None
class ThreadPool(Module):
class Worker(threading.Thread):
def __init__(self, pool, l):
self._name = None
threading.Thread.__init... |
class ErrorIndication:
"""SNMPv3 error-indication values"""
def __init__(self, descr=None):
self.__value = self.__descr = self.__class__.__name__[0].lower() + self.__class__.__name__[1:]
if descr:
self.__descr = descr
def __eq__(self, other):
return self.__value == other... |
# -*- coding: utf8 -*-
# This will create a dist directory containing the executable file, all the data
# directories. All Libraries will be bundled in executable file.
#
# Run the build process by entering 'pygame2exe.py' or
# 'python pygame2exe.py' in a console prompt.
#
# To build exe, python, pygame, and py2exe ha... |
from nova.api.openstack import extensions
class Createserverext(extensions.ExtensionDescriptor):
"""Extended support to the Create Server v1.1 API."""
name = "Createserverext"
alias = "os-create-server-ext"
namespace = ("http://docs.openstack.org/compute/ext/"
"createserverext/api/v1... |
"""The tests for the input_boolean component."""
# pylint: disable=protected-access
import unittest
import logging
from tests.common import get_test_home_assistant
from homeassistant.bootstrap import setup_component
from homeassistant.components.input_boolean import (
DOMAIN, is_on, toggle, turn_off, turn_on)
fro... |
"""
Test for tvb.simulator.noise module
.. moduleauthor:: Paula Sanz Leon <<EMAIL>>
"""
if __name__ == "__main__":
from tvb.tests.library import setup_test_console_env
setup_test_console_env()
import unittest
from tvb.tests.library.base_testcase import BaseTestCase
from tvb.simulator import noise
from ... |
from gramps.gen.plug._pluginreg import newplugin, STABLE, IMPORT
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
MODULE_VERSION="5.2"
#------------------------------------------------------------------------
#
# Comma _Separated Values Spreadsheet (CSV)
#
#-----------------------... |
# -*- coding: utf-8 -*-
"""
.. _tut-brainstorm-elekta-phantom:
==========================================
Brainstorm Elekta phantom dataset tutorial
==========================================
Here we compute the evoked from raw for the Brainstorm Elekta phantom
tutorial dataset. For comparison, see :footcite:`TadelEt... |
#!/usr/bin/env python
'''
Copyright (c) 2013-2015, Joshua Pitts
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this li... |
import numpy as np
import itertools
from collections import defaultdict
import numpy as np
import networkx as nx
def is_op(thing):
try:
return thing._is_sigops_operator
except AttributeError:
return False
class Operator(object):
"""Base class for operator instances understood by nengo.... |
from __future__ import print_function
import find_mxnet
import mxnet as mx
import importlib
import argparse
import sys
parser = argparse.ArgumentParser(description='network visualization')
parser.add_argument('--network', type=str, default='vgg16_ssd_300',
choices = ['vgg16_ssd_300', 'vgg16_ssd_512... |
import xbmc
from common import *
try:
#import apt
import apt
from aptdaemon import client
from aptdaemon import errors
except:
log('python apt import error')
class AptdeamonHandler:
def __init__(self):
self.aptclient = client.AptClient()
def _check_versions(self, package):
... |
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
def check_browser(browser):
driver = webdriver.Remote(
command_executor='http://selenium-hub:4444/wd/hub',
desired_capabilities=getattr(DesiredCapabilities, browser)
)
driver.get("http://google.c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.