content
stringlengths
4
20k
# -*- coding: utf-8 -*- """Scheduling Block Instance List API resource.""" import logging from http import HTTPStatus from random import choice from flask import Blueprint, request from .utils import add_scheduling_block, get_root_url, missing_db_response from ..db.client import ConfigDb BP = Blueprint("scheduling-...
from copy import copy from django.core.exceptions import ImproperlyConfigured from django.utils.importlib import import_module from django.http import HttpRequest # Cache of actual callables. _standard_context_processors = None # We need the CSRF processor no matter what the user has in their settings, # because other...
from ...flash.flash import Flash from ...coresight.coresight_target import CoreSightTarget from ...core.memory_map import (FlashRegion, RamRegion, MemoryMap) from ...debug.svd.loader import SVDFile # Chip erase takes a really long time. CHIP_ERASE_WEIGHT = 15.0 class DBGMCU: CR = 0xE0042004 CR_VALUE = 0x7 # D...
from shinken_test import * #time.time = original_time_time #time.sleep = original_time_sleep from shinken.objects.timeperiod import Timeperiod class TestMaintPeriod(ShinkenTest): def setUp(self): self.setup_with_file('etc/shinken_maintenance_period.cfg') def test_check_defined_maintenance_period(sel...
# -*- coding: utf-8 -*- """ requests.async ~~~~~~~~~~~~~~ This module contains an asynchronous replica of ``requests.api``, powered by gevent. All API methods return a ``Request`` instance (as opposed to ``Response``). A list of requests can be sent with ``map()``. """ try: import gevent from gevent import m...
# -*- coding: utf-8 -*- from pygame import * from gloss import * from sound import * from tools import * class Intro(): def __init__(self, mainp): self.game = mainp self.logo_fade = 0 self.logo_fade_out = 0 self.logo_fading_out = False self.fadeout_amount = 0.0 sel...
import boto from boto.sqs.message import MHMessage from boto.utils import get_ts from socket import gethostname import os, mimetypes, time class ServiceMessage(MHMessage): def for_key(self, key, params=None, bucket_name=None): if params: self.update(params) if key.path: t =...
from __future__ import absolute_import, division, print_function, \ with_statement import sys import os import signal import select import time import argparse from subprocess import Popen, PIPE python = ['python'] default_url = 'http://localhost/' parser = argparse.ArgumentParser(description='test Shadowsocks'...
""" USAGE: %(program)s WIKI_XML_DUMP OUTPUT_PREFIX [VOCABULARY_SIZE] Convert articles from a Wikipedia dump to (sparse) vectors. The input is a bz2-compressed dump of Wikipedia articles, in XML format. This actually creates three files: * `OUTPUT_PREFIX_wordids.txt`: mapping between words and their integer ids * `OU...
import json import os import socket import threading import time import traceback from .base import (Protocol, BaseProtocolPart, RefTestExecutor, RefTestImplementation, TestharnessExecutor, strip_server) from ..testrunner im...
from __future__ import ( unicode_literals, print_function, absolute_import, division ) from netprofile.common.modules import ModuleBase from sqlalchemy.orm.exc import NoResultFound from pyramid.i18n import TranslationStringFactory _ = TranslationStringFactory('netprofile_ipaddresses') class Module(ModuleBase): ...
"""Support for controlling GPIO pins of a Raspberry Pi.""" import logging from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP _LOGGER = logging.getLogger(__name__) DOMAIN = "rpi_gpio" def setup(hass, config): """Set up the Raspberry PI GPIO component.""" from RPi import GPIO...
from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import (ResolverPlayground, ResolverPlaygroundTestCase) class SonameReinstallTestCase(TestCase): def testSonameReinstall(self): binpkgs = { "app-misc/A-1" : { "RDEPEND": "dev-libs/B", "DEPEND": "dev-libs/B", "REQUIRE...
"""Constants/functions for interpreting results of os.stat() and os.lstat(). Suggested usage: from stat import * """ # Indices for stat struct members in the tuple returned by os.stat() ST_MODE = 0 ST_INO = 1 ST_DEV = 2 ST_NLINK = 3 ST_UID = 4 ST_GID = 5 ST_SIZE = 6 ST_ATIME = 7 ST_MTIME = 8...
import json import logging import base64 import httplib2 import os from django.contrib.auth import authenticate from django.http import HttpResponse, HttpResponseRedirect from django.views.decorators.http import require_POST from django.shortcuts import render_to_response from django.conf import settings from django.c...
from __future__ import unicode_literals import json import re from .common import InfoExtractor from ..utils import ( int_or_none, parse_iso8601, ) class DRBonanzaIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?dr\.dk/bonanza/(?:[^/]+/)+(?:[^/])+?(?:assetId=(?P<id>\d+))?(?:[#&]|$)' _TESTS = [{...
"""Keras Applications: models with automatic loading of pre-trained weights. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.keras._impl.keras.applications.inception_resnet_v2 import InceptionResNetV2 from tensorflow.python.keras._...
#!/usr/bin/python """Service launcher that creates pidfiles and can redirect output to a file.""" import subprocess import sys import os import optparse import signal import pwd import grp import re def stop_service(pidfile): """ Stop a service using a pidfile. Read the first line of a file for an intege...
""" $Id: Base.py,v 1.12.2.19 2011/11/23 17:14:11 customdesigned Exp $ This file is part of the pydns project. Homepage: http://pydns.sourceforge.net This code is covered by the standard Python License. See LICENSE for details. Base functionality. Request and Response classes, that sort of thing. """ import soc...
from openerp.osv import fields, osv class l10n_fr_report(osv.osv): _name = 'l10n.fr.report' _description = 'Report for l10n_fr' _columns = { 'code': fields.char('Code', size=64), 'name': fields.char('Name'), 'line_ids': fields.one2many('l10n.fr.line', 'report_id', 'Lines', copy=True...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'core'} # ============================================================== import os import tempf...
import copy import sys import traceback from oslo.config import cfg import six from ceilometer.openstack.common.gettextutils import _ # noqa from ceilometer.openstack.common import importutils from ceilometer.openstack.common import jsonutils from ceilometer.openstack.common import local from ceilometer.openstack.co...
from django.utils.encoding import smart_unicode from django.db.models.fields import BLANK_CHOICE_DASH class BoundRelatedObject(object): def __init__(self, related_object, field_mapping, original): self.relation = related_object self.field_mappings = field_mapping[related_object.name] def templ...
import struct SHA_BLOCKSIZE = 64 SHA_DIGESTSIZE = 32 def new_shaobject(): return { 'digest': [0]*8, 'count_lo': 0, 'count_hi': 0, 'data': [0]* SHA_BLOCKSIZE, 'local': 0, 'digestsize': 0 } ROR = lambda x, y: (((x & 0xffffffff) >> (y & 31)) | (x << (32 - (y & 31...
from ducktape.utils.util import wait_until from ducktape.tests.test import Test from ducktape.mark.resource import cluster from kafkatest.services.verifiable_producer import VerifiableProducer from kafkatest.services.zookeeper import ZookeeperService from kafkatest.services.kafka import KafkaService from kafkatest.ser...
import json import jsonschema from jsonschema import ValidationError from redash import query_runner from redash.models import DataSource def validate_configuration(query_runner_type, configuration_json): query_runner_class = query_runner.query_runners.get(query_runner_type, None) if query_runner_class is No...
import math import time t1 = time.time() prime = [] def primeSieve(n): global prime n = (n+1)//2 p = [True]*(n) i = 1 prime.append(2) while i < n: if p[i]: t = 2*i+1 prime.append(t) p[i] = False j = 2*i*i+2*i while j < n: ...
# Backward compatible module for RandomArray __all__ = ['ArgumentError','F','beta','binomial','chi_square', 'exponential', 'gamma', 'get_seed', 'mean_var_test', 'multinomial', 'multivariate_normal', 'negative_binomial', 'noncentral_F', 'noncentral_chi_square', 'normal', 'permutation', ...
from operator import add import copy from dpark.serialize import load_func, dump_func class AccumulatorParam: def __init__(self, zero, addInPlace): self.zero = zero self.addInPlace = addInPlace def __getstate__(self): return dump_func(self.addInPlace), self.zero def __setstate__(...
"""A setup module for the GRPC Python package.""" import os import os.path import sys from distutils import core as _core import setuptools # Ensure we're in the proper directory whether or not we're being used by pip. os.chdir(os.path.dirname(os.path.abspath(__file__))) # Break import-style to ensure we can actual...
#!/usr/bin/env python3.4 # -*- coding: utf-8 -*- # Debe ejcutarse como root o el escaneo no mostrará resultados. # La bilioteca markup.py [1] se encuentra instalada en /usr/lib/python2.7/ # conmo un archivo del mismo nombre, ya que la instalación mediante pip # fallaba. [1] http://markup.sourceforge.net/ import codec...
""" This module attempts to make it easy to create VTK-Python unittests. The module uses unittest for the test interface. For more documentation on what unittests are and how to use them, please read these: http://www.python.org/doc/current/lib/module-unittest.html http://www.diveintopython.org/roman_divein.h...
#!/usr/bin/python # # a python script used to generate the "default-skin.h' header file # from a given skin directory # # usage: # progname skin-directory-path > default-skin.h # import sys, os, string, re header = """\ /* automatically generated, do not touch */ """ footer = """\ static const FileEntry _file_...
"""Tests for Softplus and SoftplusGrad.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.framework import constant_op from tensorflow.python.ops import gradient_checker from tensorflow.python.ops import nn_ops im...
#!/usr/bin/env python import six try: import unittest2 as unittest except ImportError: import unittest from csvkit.utilities.csvsql import CSVSQL from tests.utils import stdin_as_string class TestCSVSQL(unittest.TestCase): def test_create_table(self): args = ['--table', 'foo', 'examples/testfixe...
from __future__ import absolute_import, division, print_function, unicode_literals class TransformerException(Exception): def __init__(self, transformer, message): # Call the base class constructor with the parameters it needs Exception.__init__(self, message) self.transformer = transfor...
import pinutils; info = { 'name' : "STM32 F4 Discovery", 'link' : [ "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1199/PF252419" ], 'default_console' : "EV_SERIAL2", # FIXME: This was S2 because of pin conflict. Not sure if it's really an issue? 'variables' : 5450, 'binary_name' : 'espruino_%v_stm32f4...
import gdb from linux import utils task_type = utils.CachedType("struct task_struct") def task_lists(): task_ptr_type = task_type.get_type().pointer() init_task = gdb.parse_and_eval("init_task").address t = g = init_task while True: while True: yield t t = utils.co...
from mininode import * from blockstore import BlockStore, TxStore from util import p2p_port ''' This is a tool for comparing two or more bitcoinds to each other using a script provided. To use, create a class that implements get_tests(), and pass it in as the test generator to TestManager. get_tests() should be a py...
import unittest, time, sys, random sys.path.extend(['.','..','../..','py']) import h2o, h2o_cmd, h2o_glm, h2o_browse as h2b, h2o_import as h2i class Basic(unittest.TestCase): def tearDown(self): h2o.check_sandbox_for_errors() @classmethod def setUpClass(cls): # assume we're at 0xdata with ...
import logging from collections import defaultdict from datetime import datetime import dateutil.parser from sqlalchemy import func, or_ from werkzeug.exceptions import Forbidden, NotFound from newspipe.bootstrap import db logger = logging.getLogger(__name__) class AbstractController: _db_cls = None # referen...
import logging import os import numpy as np from scipy import stats from itertools import combinations # Local from enrichm.genome import Genome, AnnotationParser ############################################################################### class Compare: def __init__(self): # Result types self...
""" Core Linear Algebra Tools ========================= =============== ========================================================== Linear algebra basics ========================================================================== norm Vector or matrix norm inv Inverse of a square matrix solve ...
#!/usr/bin/env python # # A script to generate TUF repository files. # # A modification of generate.py from the Python implementation: # https://github.com/theupdateframework/tuf/blob/v0.9.9/tests/repository_data/generate.py import shutil import datetime import optparse import stat from tuf.repository_tool import * i...
from curio import run, spawn from curio.socket import * async def echo_server(address): sock = socket(AF_INET, SOCK_STREAM) sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) sock.bind(address) sock.listen(5) print('Server listening at', address) async with sock: while True: clien...
from openerp import models, fields, api, exceptions, _ import openerp.addons.decimal_precision as dp class WizProductionProductLine(models.TransientModel): _name = 'wiz.production.product.line' product_id = fields.Many2one('product.product', 'Product', required=True) product_qty = fields.Float( '...
from __future__ import unicode_literals from moto.core import BaseBackend from .utils import get_random_message_id class Message(object): def __init__(self, message_id, source, subject, body, destination): self.id = message_id self.source = source self.subject = subject self.body =...
""" Spoof source address ++++++++++++++++++++ Send a SNMP GET request * with SNMPv2c, community 'public' * over IPv4/UDP * to an Agent at 104.236.166.95:161 * from a non-local, spoofed IP 1.2.3.4 (root and Python 3.3+ required) * for an OID in tuple form This script performs similar to the following Net-SNMP command:...
#!/usr/bin/python3 import sys import json import matplotlib.pyplot as plt import matplotlib.dates as mdates from matplotlib.ticker import FixedLocator import datetime import numpy as np import optparse def extract_string(text,tag): textspli = text.split(); for t in textspli: if tag in t: textspli2 = t....
import pyb # for randomness import xmlrpc """ A component can have following decorators : - componentFactory : indicates the name of the component - validate method : called when the component is valid - invalidate method : called when the component is invalid - BindField : called when a field is bound (used when a...
import tensorflow as tf import numpy as np from functools import reduce VGG_MEAN = [103.939, 116.779, 123.68] class Vgg19: """ A trainable version VGG19. """ def __init__(self, vgg19_npy_path=None, trainable=True, dropout=0.5): if vgg19_npy_path is not None: self.data_dict = np....
import cStringIO from openerp import tools from openerp.osv import osv, fields from openerp.tools.translate import _ class base_update_translations(osv.osv_memory): def _get_languages(self, cr, uid, context): lang_obj = self.pool.get('res.lang') ids = lang_obj.search(cr, uid, ['&', ('active', '=',...
from test import test_support import time import unittest class TimeTestCase(unittest.TestCase): def setUp(self): self.t = time.time() def test_missing_module_attribute(self): self.assertEqual(time.clock.__module__, 'time') self.assertEqual(time.time.__module__, 'time') def test...
import os import re HAVE_REDIS=False try: import redis # https://github.com/andymccurdy/redis-py/ HAVE_REDIS=True except ImportError: pass from ansible.errors import AnsibleError from ansible.plugins.lookup import LookupBase # ============================================================== # REDISG...
from openerp.osv import fields, osv from openerp import SUPERUSER_ID class res_users(osv.osv): _name = 'res.users' _inherit = 'res.users' def _is_share(self, cr, uid, ids, name, args, context=None): res = {} for user in self.browse(cr, uid, ids, context=context): res[user.id] =...
from django.conf.urls import include, url from django.contrib import admin admin.autodiscover() from django.conf import settings urlpatterns = [ url(r'^login/$', 'django.contrib.auth.views.login'), url(r'^logout/$', 'django.contrib.auth.views.logout_then_login'), url(r'^resetpassword/done/$', 'django.con...
from collections import Counter, OrderedDict from itertools import chain from operator import attrgetter from django.db import IntegrityError, connections, transaction from django.db.models import signals, sql from django.utils import six class ProtectedError(IntegrityError): def __init__(self, msg, protected_ob...
import os import shutil import sys import tempfile from hashlib import md5 from PyQt4.QtCore import QUrl, QObject, QMutex from picard import config, log from picard.coverart.utils import translate_caa_type from picard.script import ScriptParser from picard.util import ( encode_filename, replace_win32_incompat,...
import subprocess from testtools.matchers import EndsWith import integration_tests class StageTestCase(integration_tests.TestCase): def test_conflicts(self): project_dir = 'conflicts' exception = self.assertRaises( subprocess.CalledProcessError, self.run_snapcraft, 'stag...
""" This module is used to integrate child process termination into a reactor event loop. This is a challenging feature to provide because most platforms indicate process termination via SIGCHLD and do not provide a way to wait for that signal and arbitrary I/O events at the same time. The naive implementation involv...
"""Unit tests for BitmapArray Encoder.""" CL_VERBOSITY = 0 import tempfile import unittest2 as unittest import numpy from nupic.encoders.sparse_pass_through_encoder import SparsePassThroughEncoder from nupic.encoders.sparse_pass_through_encoder_capnp import ( SparsePassThroughEncoderProto ) class SparsePassThr...
from unittest import TestCase import simplejson as json class JSONTestObject: pass class RecursiveJSONEncoder(json.JSONEncoder): recurse = False def default(self, o): if o is JSONTestObject: if self.recurse: return [JSONTestObject] else: re...
"""gypsh output module gypsh is a GYP shell. It's not really a generator per se. All it does is fire up an interactive Python session with a few local variables set to the variables passed to the generator. Like gypd, it's intended as a debugging aid, to facilitate the exploration of .gyp structures after being pro...
from telemetry.value import failure from telemetry.value import skip # TODO(eakuefner): Get rid of this as part of crbug.com/525688 def DefaultKeyFunc(value): """Keys values in a standard way for grouping in merging and summary. Merging and summarization can be parameterized by a function that groups values in...
""" ============================================================ Visualize channel over epochs as images in sensor topography ============================================================ This will produce what is sometimes called event related potential / field (ERP/ERF) images. One sensor topography plot is produced...
try: from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver from libcloud.common.google import GoogleBaseError, QuotaExceededError, \ ResourceExistsError, ResourceNotFoundError _ = Provider.GCE HAS_LIBCLOUD = True except ImportError: HAS_LIBCLOU...
''' Run this script from the root of the repository to update all translations from transifex. It will do the following automatically: - fetch all translations using the tx tool - post-process them into valid and committable format - remove invalid control characters - remove location tags (makes diffs less noisy)...
from __future__ import print_function import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator from astropy.io import fits from astropy.time import Time from PyAstronomy import pyasl from scipy import ndimage import pandas as pd import gaussfitter as gf import BF_functions as bff...
from django.contrib.contenttypes.models import ContentType from django.db.models import get_apps, get_models, signals from django.utils.encoding import smart_unicode def update_contenttypes(app, created_models, verbosity=2, **kwargs): """ Creates content types for models in the given app, removing any model ...
from i18n import _ import mdiff, parsers, error, revlog, util, dicthelpers import array, struct class manifestdict(dict): def __init__(self, mapping=None, flags=None): if mapping is None: mapping = {} if flags is None: flags = {} dict.__init__(self, mapping) ...
# coding: utf8 from __future__ import unicode_literals from ..punctuation import TOKENIZER_PREFIXES, TOKENIZER_SUFFIXES, TOKENIZER_INFIXES from ..char_classes import ALPHA, merge_chars, split_chars, _currency, _units _units = ( _units + "s bit Gbps Mbps mbps Kbps kbps ƒ ppi px " "Hz kHz MHz GHz mAh " "ra...
import cv2 import numpy as np from collections import deque import gym from gym import spaces class NoopResetEnv(gym.Wrapper): def __init__(self, env=None, noop_max=30): """Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0. """ super(...
from boto.emr.emrobject import EmrObject from boto.resultset import ResultSet class RunJobFlowResponse(EmrObject): Fields = set(['JobFlowId']) class Arg(EmrObject): def __init__(self, connection=None): self.value = None def endElement(self, name, value, connection): self.value = value c...
""" views that return data useful only to other machines (but not JSON) """ import logging from django.conf import settings from django.core.exceptions import PermissionDenied from ..auth import decorators as authz, auth_service from ..auth.localdb_auth import auth_key as localdb_auth_key from ..models import Experi...
from django.core.urlresolvers import reverse from django import http from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test INDEX_URL = reverse('horizon:project:images:index') class SnapshotsViewTests(test.TestCase): def test_create_snapshot_get(se...
# -*- coding: utf-8 -*- from openerp import models, fields, api, osv # We just create a new model class Unit(models.Model): _name = 'test.unit' _columns = { 'name': osv.fields.char('Name', required=True), 'state': osv.fields.selection([('a', 'A'), ('b', 'B')], ...
""" Verifies that targets have independent INTERMEDIATE_DIRs. """ import TestGyp test = TestGyp.TestGyp() test.run_gyp('test.gyp', chdir='src') test.build('test.gyp', 'target1', chdir='src') # Check stuff exists. intermediate_file1 = test.read('src/outfile.txt') test.must_contain(intermediate_file1, 'target1') sha...
import sqlalchemy as sa from sqlalchemy import orm from neutron.db import agents_db from neutron.db import l3_db from neutron.db import model_base from neutron.db import models_v2 class HostingDevice(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant): """Represents an appliance hosting Neutron router(s). ...
try: from decimal import Decimal, ROUND_HALF_UP except: from django.utils._decimal import Decimal, ROUND_HALF_UP from django.core.exceptions import ImproperlyConfigured from django.db.models import Q from satchmo.configuration import config_value from satchmo.contact.models import Contact from satchmo.l10n.mod...
"""Migrate control_sections to relationships Revision ID: b0c3361797a Revises: 32e064034091 Create Date: 2015-05-20 10:35:39.561584 """ from alembic import op # revision identifiers, used by Alembic. revision = 'b0c3361797a' down_revision = '32e064034091' def upgrade(): sql = """ REPLACE INTO relationships ( ...
""" Javascript test tasks """ from pavelib import assets from pavelib.utils.test import utils as test_utils from pavelib.utils.test.suites.suite import TestSuite from pavelib.utils.envs import Env __test__ = False # do not collect class JsTestSuite(TestSuite): """ A class for running JavaScript tests. "...
"""Access Ansible Core CI remote services.""" from __future__ import absolute_import, print_function import json import os import traceback import uuid import errno import time from lib.http import ( HttpClient, HttpResponse, HttpError, ) from lib.util import ( ApplicationError, run_command, ...
# # distutils/version.py # # Implements multiple version numbering conventions for the # Python Module Distribution Utilities. # # $Id: version.py,v 1.7 2002/11/14 02:25:42 akuchling Exp $ # """Provides classes to represent module version numbers (one class for each style of version numbering). There are currently tw...
#!/usr/bin/env python from __future__ import print_function import argparse import os import sys import subprocess from catkin.test_results import ensure_junit_result_exist, remove_junit_result def main(argv=sys.argv[1:]): parser = argparse.ArgumentParser(description='Runs the test command passed as an argumen...
#!/usr/bin/env python # _*_ coding:utf-8 _*-_ ############################ # File Name: graph.py # Created Time: 2016-09-02 14:29:41 ############################ import rrdtool import time #定义图表上方大标题 title="Server network traffic flow(" + time.strftime('%Y-%m-%d', time.localtime(time.time())) + ")" # 重点解释"--x-grid",...
from webkitpy.common.system import logutils from webkitpy.tool.steps.abstractstep import AbstractStep from webkitpy.tool.steps.options import Options _log = logutils.get_logger(__file__) class ApplyWatchList(AbstractStep): @classmethod def options(cls): return AbstractStep.options() + [ ...
import xml.etree.ElementTree as ET from modules.supportingfunctions import text_to_bool_force def set_value_if_xmlnode_exists(configdict, key, Node, xpath): """Set a config value only if the value is in the xml""" if isinstance(Node, ET.Element): node_found = Node.find(xpath) else: node_fo...
import sys if sys.version_info[0] >= 3: # Python 3 import tkinter as tk from tkinter import ttk from tkinter import messagebox as msgbox else: import Tkinter as tk import ttk import tkMessageBox as msgbox class TextObserver: def onSendMessage(self, msg): pass def onStartTyping(self): pass def onStopTypin...
"""Unit tests for WebMessage.""" __revision__ = \ "$Id$" import unittest from invenio import webmessage_mailutils from invenio.testutils import make_test_suite, run_test_suite class TestQuotingMessage(unittest.TestCase): """Test for quoting messages.""" def test_simple_quoting_per_block(self): ...
from logging import getLogger from abstract_step import AbstractStep logger = getLogger('uap_logger') class IdentifyAdapters(AbstractStep): ''' Uses AdapterRemoval to identify adapter sequences from paired read data. AdapterRemoval (ver. 2.1.7) This program searches for and removes remnant adapter s...
#!/usr/bin/env python import os import shutil import glob import time import sys import subprocess from optparse import OptionParser, make_option SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) PARAMETERS = None ADB_CMD = "adb" def doCMD(cmd): # Do not need handle timeout in this short script, let tool...
from __future__ import unicode_literals from .common import InfoExtractor from .internetvideoarchive import InternetVideoArchiveIE class RottenTomatoesIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/[^/]+/trailers/(?P<id>\d+)' _TEST = { 'url': 'http://www.rottentomatoes.co...
from __future__ import print_function, division from pyglet.gl import * from sympy.core import S from sympy.core.compatibility import xrange def get_model_matrix(array_type=c_float, glGetMethod=glGetFloatv): """ Returns the current modelview matrix. """ m = (array_type*16)() glGetMethod(GL_MODELV...
"""Momentum for TensorFlow.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import ops from tensorflow.python.ops import math_ops from tensorflow.python.training import optimizer from tensorflow.python.training import trai...
"""Test that the wallet resends transactions periodically.""" import time from test_framework.blocktools import create_block, create_coinbase from test_framework.messages import ToHex from test_framework.p2p import P2PTxInvStore from test_framework.test_framework import BitcoinTestFramework from test_framework.util im...
from opus_core.choices import Choices from opus_core.sampling_toolbox import sample_choice from numpy import concatenate from numpy import reshape from numpy import sum class random_choices(Choices): def run(self, probability, resources=None): """ Compute choices according to given probability. ...
# -*- coding: latin-1 -*- """Heap queue algorithm (a.k.a. priority queue). Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for all k, counting elements from 0. For the sake of comparison, non-existing elements are considered to be infinite. The interesting property of a heap is that a[0] is always ...
"""The goal of PyMouse is to have a cross-platform way to control the mouse. PyMouse should work on Windows, Mac and any Unix that has xlib. See http://github.com/pepijndevos/PyMouse for more information. """ from threading import Thread class PyMouseMeta(object): def press(self, x, y, button = 1): """P...
""" This module contains the game rules. """ import json import config def form_to_band(requestform): """ This function takes in a HTTP request and returns a band object. """ print(requestform) bandname = requestform['bandname'] capspec = requestform['capspec'] capskill = requestform...
from django.test import TestCase class PublicTest(TestCase): def test_index(self): response = self.client.get('/') self.assertEqual(response.status_code, 200) def test_about(self): response = self.client.get('/about/') self.assertEqual(response.status_code, 200) def test...