content string |
|---|
import unittest
from unittest import mock
import botocore.exceptions
import pytest
from parameterized import parameterized
from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.batch_client import AwsBatchClientHook
# Use dummy AWS credentials
AWS_REGION = "eu-west-1"
AWS_ACCESS_KEY... |
from telemetry.page import action_runner as action_runner_module
from telemetry.page import test_expectations
class TestNotSupportedOnPlatformError(Exception):
"""PageTest Exception raised when a required feature is unavailable.
The feature required to run the test could be part of the platform,
hardware confi... |
from django import forms
from lib.l10n_utils.dotlang import _, _lazy
from bedrock.mozorg.forms import (DateInput, EmailInput, HoneyPotWidget,
NumberInput, TelInput, TimeInput, URLInput)
SPEAKER_REQUEST_FILE_SIZE_LIMIT = 5242880 # 5MB
class SpeakerRequestForm(forms.Form):
# e... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'PaidCourseRegistrationAnnotation'
db.create_table('shoppingcart_paidcourseregistrationannota... |
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = 'j. F Y H:i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y H:i'
FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org... |
from __future__ import absolute_import, division, print_function
import logging
# concurrent.futures is optional
try:
from concurrent.futures import ThreadPoolExecutor
except ImportError:
ThreadPoolExecutor = None
log = logging.getLogger(__name__)
class Emitter(object):
threading = False
threading... |
from __future__ import (absolute_import, division)
__metaclass__ = type
from collections import defaultdict
# for testing
from ansible.compat.tests import unittest
from ansible.module_utils.facts import collector
from ansible.module_utils.facts import default_collectors
class TestFindCollectorsForPlatform(unittes... |
import base64
import sys
import github.GithubObject
import github.Repository
atLeastPython3 = sys.hexversion >= 0x03000000
class ContentFile(github.GithubObject.CompletableGithubObject):
"""
This class represents ContentFiles as returned for example by http://developer.github.com/v3/todo
"""
@prop... |
"""Make the format of a vcproj really pretty.
This script normalize and sort an xml. It also fetches all the properties
inside linked vsprops and include them explicitly in the vcproj.
It outputs the resulting xml to stdout.
"""
__author__ = 'nsylvain (Nicolas Sylvain)'
import os
import sys
from xml.dom.m... |
# -*- coding: utf-8 -*-
import re
from module.network.RequestFactory import getURL
from module.plugins.Hoster import Hoster
def getInfo(urls):
ids = ""
names = ""
p = re.compile(RapidshareCom.__pattern__)
for url in urls:
r = p.search(url)
if r.group("name"):
ids += ","... |
# -*- coding: utf-8 -*-
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):
def forwards(self, orm):
# Adding M2M table for field authors on 'Book'
m2m_table_name = db.shorte... |
from __future__ import absolute_import
import datetime
import os
import sys
import socket
from socket import error as SocketError, timeout as SocketTimeout
import warnings
from .packages import six
try: # Python 3
from http.client import HTTPConnection as _HTTPConnection
from http.client import HTTPException ... |
import socket
import sys
from redis.connection import (Connection, SYM_STAR, SYM_DOLLAR, SYM_EMPTY,
SYM_CRLF, b)
from redis._compat import imap
from base import Benchmark
class StringJoiningConnection(Connection):
def send_packed_command(self, command):
"Send an already packe... |
# -*- coding: utf-8 -*-
from sqlalchemy.exc import IntegrityError
from flask import g, Response, redirect, flash
from flask.ext.lastuser import signal_user_session_refreshed
from coaster.views import get_next_url
from baseframe import csrf
from .. import app, lastuser
from ..signals import signal_login, signal_logout... |
"""
Test cases for twisted.hook module.
"""
from twisted.python import hook
from twisted.trial import unittest
class BaseClass:
"""
dummy class to help in testing.
"""
def __init__(self):
"""
dummy initializer
"""
self.calledBasePre = 0
self.calledBasePost = 0
... |
MODEL_PARAMS = {
# Type of model that the rest of these parameters apply to.
'model': "HTMPrediction",
# Version that specifies the format of the config.
'version': 1,
# Intermediate variables used to compute fields in modelParams and also
# referenced from the control section.
'aggregatio... |
"""Configure GDB using the ELinOS environment."""
import os
import glob
import gdb
def warn(msg):
print "warning: %s" % msg
def get_elinos_environment():
"""Return the ELinOS environment.
If the ELinOS environment is properly set up, return a dictionary
which contains:
* The path to the ELin... |
class DirectConnectClientException(Exception):
pass
class DirectConnectServerException(Exception):
pass |
from ansible.compat.tests.mock import patch
from ansible.modules.source_control import gitlab_deploy_key
from ansible.module_utils._text import to_bytes
from ansible.module_utils import basic
import pytest
import json
from units.modules.utils import set_module_args
fake_server_state = [
{
"id": 1,
... |
import contextlib
import sys
import unittest
import warnings
import pkg_resources
try:
import mock
_mock_error = None
except ImportError as e:
_mock_error = e
def _check_mock_available():
if _mock_error is not None:
raise RuntimeError(
'mock is not available: Reason: {}'.format(_m... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import unittest
from unittest import skipUnless
from django.conf import settings
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.geoip import HAS_GEOIP
from django.utils import six
if HAS_GEOIP:
from . import GeoIP, G... |
#!/usr/bin/env python
"""
test
"""
INTERP = 128
TXGAIN = 30
CONSTANT = 0.10
from gnuradio import gr, gr_unittest
import usrp_options
from optparse import OptionParser
from gnuradio.eng_option import eng_option
from pick_bitrate import pick_tx_bitrate
def main():
gr.enable_realtime_scheduling()
tb = gr.top_b... |
from __future__ import unicode_literals
import os
import unittest
import warnings
from django.test import SimpleTestCase
from django.test.utils import reset_warning_registry
from django.utils import six
from django.utils.deprecation import RenameMethodsBase
from django.utils.encoding import force_text
class RenameM... |
"""
SQLite3 backend for the sqlite3 module in the standard library.
"""
import decimal
import re
import warnings
from sqlite3 import dbapi2 as Database
import pytz
from django.core.exceptions import ImproperlyConfigured
from django.db import utils
from django.db.backends import utils as backend_utils
from django.db.b... |
"""
Credentials utilities
"""
from PySide import QtCore, QtGui
WEAK_PASSWORDS = ("123456", "qweasd", "qwerty", "password")
USERNAME_REGEX = r"^[a-z][a-z\d_\-\.]+[a-z\d]$"
USERNAME_VALIDATOR = QtGui.QRegExpValidator(QtCore.QRegExp(USERNAME_REGEX))
def username_checks(username):
# translation helper
_tr = QtC... |
Latin2_HungarianCharToOrderMap = (
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10
253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20
252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30
2... |
'''
Created on 28 okt 2011
@author: jev
'''
from tradingWithPython import estimateBeta, Spread, returns, Portfolio, readBiggerScreener
from tradingWithPython.lib import yahooFinance
from pandas import DataFrame, Series
import numpy as np
import matplotlib.pyplot as plt
import os
symbols = ['SPY','... |
"""Utilities to remove unneeded nodes from a GraphDefs."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
from google.protobuf import text_format
from tensorflow.core.framework import attr_value_pb2
from tensorflow.core.framework import graph_... |
from django.contrib import messages
from django import http
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from datacash.facade import Facade
from oscar.apps.checkout import views, exceptions
from oscar.apps.payment.forms import BankcardForm
from oscar.apps.payment... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import platform
import io
import os
def read_utf8_file(path, encoding='utf-8'):
if not os.access(path, os.R_OK):
return None
with io.open(path, 'r', encoding=encoding) as fd:
content = fd.read(... |
"""
Base class for Scrapy spiders
See documentation in docs/topics/spiders.rst
"""
from scrapy import log
from scrapy.http import Request
from scrapy.utils.trackref import object_ref
from scrapy.utils.url import url_is_from_spider
from scrapy.utils.deprecate import create_deprecated_class
class Spider(object_ref):
... |
#!/usr/bin/env python
'''
these tables are generated from the STM32 datasheets for the
STM32F103x8
'''
# additional build information for ChibiOS
build = {
"CHIBIOS_STARTUP_MK" : "os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f1xx.mk",
"CHIBIOS_PLATFORM_MK" : "os/hal/ports/STM32/STM32F1xx/platform.mk... |
HAS_PURESTORAGE = True
try:
from purestorage import purestorage
except ImportError:
HAS_PURESTORAGE = False
from functools import wraps
from os import environ
from os import path
import platform
VERSION = 1.0
USER_AGENT_BASE = 'Ansible'
def get_system(module):
"""Return System Object or Fail"""
user... |
from odoo import models, fields, api
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
payment_mode_id = fields.Many2one(
comodel_name='account.payment.mode', string="Payment Mode",
ondelete='restrict',
readonly=True, states={'draft': [('readonly', False)]})
bank_ac... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleActionFail
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, MagicMock, Mock
from ansible.plugins.action.raw import ActionModule
from ansible.playbook.task impo... |
import ast
import ConfigParser
import glob
import grp
import importlib
import multiprocessing
import os
import sys
from drop_privileges import drop_privileges
from jobhandler import JobCtl
from pwd import getpwnam
class SchedCtl(object):
def __init__(self, sched, config, logging):
self.sched = sched
... |
from decimal import Decimal
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.captcha.virtkeyboard import VirtKeyboardError
from weboob.capabilities.bank import Recipient, AccountNotFound, Transfer
from weboob.tools.browser import BasePage, BrokenPageError
from weboob.tools.me... |
import os
import socket
import atexit
import re
import functools
from setuptools.extern.six.moves import urllib, http_client, map, filter
from pkg_resources import ResolutionError, ExtractionError
try:
import ssl
except ImportError:
ssl = None
__all__ = [
'VerifyingHTTPSHandler', 'find_ca_bundle', 'is_a... |
# -*- coding: utf-8 -*-
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):
def forwards(self, orm):
# Adding model 'TagKeyphrase'
db.create_table(u'auxiliary_tagkeyphrase', ... |
"""Mixin classes to help make good tests."""
import atexit
import collections
import os
import random
import shutil
import sys
import tempfile
import textwrap
from coverage.backunittest import TestCase
from coverage.backward import StringIO, to_bytes
class Tee(object):
"""A file-like that writes to all the file... |
"""Inception Resnet v2 Faster R-CNN implementation.
See "Inception-v4, Inception-ResNet and the Impact of Residual Connections on
Learning" by Szegedy et al. (https://arxiv.org/abs/1602.07261)
as well as
"Speed/accuracy trade-offs for modern convolutional object detectors" by
Huang et al. (https://arxiv.org/abs/1611.1... |
"""
maf - a waf extension for automation of parameterized computational experiments
"""
# NOTE: coding ISO8859-1 is necessary for attaching maflib at the end of this
# file.
import os
import os.path
import shutil
import subprocess
import sys
import tarfile
import waflib.Context
import waflib.Logs
TAR_NAME = 'maflib.... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import pygame, sys
from pygame.locals import *
# Przygotowanie zmiennych opisujących okno gry oraz obiekty gry i ich właściwości (paletki, piłeczka)
# Inicjacja modułu i obiektów Pygame'a
# inicjacja modułu pygame
pygame.init()
# liczba klatek na sekundę
FPS = 30
# obi... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, MagicMock
from ansible.executor.task_result import TaskResult
class TestTaskResult(unittest.TestCase):
def test_task_result_basic(self):
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ansible module to add authorized_keys for ssh logins.
(c) 2012, Brad Olson <<EMAIL>>
This file is part of Ansible
Ansible 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 Founda... |
from __future__ import absolute_import
from bokeh.io import save
from bokeh.models import Plot, Range1d, LinearAxis, Circle, Column, ColumnDataSource
import pytest
pytestmark = pytest.mark.integration
HEIGHT = 600
WIDTH = 600
@pytest.mark.screenshot
def test_the_default_titles_settings_and_ensure_outside_any_axes(... |
"""
Tests for twisted.python.modules, abstract access to imported or importable
objects.
"""
import sys
import itertools
import zipfile
import compileall
import twisted
from twisted.trial.unittest import TestCase
from twisted.python import modules
from twisted.python.filepath import FilePath
from twisted.python.refl... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutTuples(Koan):
def test_creating_a_tuple(self):
count_of_three = (1, 2, 5)
self.assertEqual(__, count_of_three[2])
def test_tuples_are_immutable_so_item_assignment_is_not_possible(self):
count_of_three ... |
import threading
class FtpCoord:
shutdown = None
lock = None
stats = {}
def __init__(self):
self.shutdown = False
self.lock = threading.Lock()
def kill(self):
print("raising shutdown")
self.shutdown = True
def need_to_stop(self):
return self.shutdown
... |
__author__ = 'xiaoxiaol'
__author__ = 'xiaoxiaol'
# run standardize swc to make sure swc files have one single root, and sorted, and has the valide type id ( 1~4)
import matplotlib.pyplot as plt
import seaborn as sb
import os
import os.path as path
import numpy as np
import pandas as pd
import platform
import sys
imp... |
"""
=======================================
Clustering text documents using k-means
=======================================
This is an example showing how the scikit-learn can be used to cluster
documents by topics using a bag-of-words approach. This example uses
a scipy.sparse matrix to store the features instead of ... |
import sys
import pickle
import os
import getopt
from time import ctime
import numpy as np
usage = '''
USAGE: python xlsearch_train.py -l [path to xlsearch library]
-p [parameter file]
-o [output file]'''
(pairs, args) = getopt.getopt(sys.argv[1:], 'l:p:... |
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class ToughTextureUploadCasesPage(page_module.Page):
def __init__(self, url, page_set):
super(
ToughTextureUploadCasesPage,
self).__init__(
url=url,
page_set=page_set)
def RunSmo... |
from sirano.action import Action
class RTPPayloadAction(Action):
"""Anonymize the RTP payload content field"""
name = "raw-payload"
def __init__(self, app):
super(RTPPayloadAction, self).__init__(app)
def anonymize(self, value):
value_len = len(value)
text = "ANONYMIZED BY S... |
"""This example gets custom targeting values for the given predefined custom
targeting key.
To create custom targeting values, run
create_custom_targeting_keys_and_values.py. To determine which custom
targeting keys exist, run get_all_custom_targeting_keys_and_values.py."""
__author__ = ('Nicholas Chen',
... |
from openerp.osv import osv
from openerp.tools.translate import _
class crm_phonecall2meeting(osv.osv_memory):
""" Phonecall to Meeting """
_name = 'crm.phonecall2meeting'
_description = 'Phonecall To Meeting'
def action_cancel(self, cr, uid, ids, context=None):
"""
Closes Phonecall t... |
import re
import pyauto_functional # Must be imported before pyauto
import pyauto
import test_utils
class SearchEnginesTest(pyauto.PyUITest):
"""TestCase for Search Engines."""
_localhost_prefix = 'http://localhost:1000/'
def _GetSearchEngineWithKeyword(self, keyword):
"""Get search engine info and retu... |
from __future__ import unicode_literals
import os
from django.contrib.staticfiles import finders
from django.core.management.base import LabelCommand
from django.utils.encoding import force_text
class Command(LabelCommand):
help = "Finds the absolute paths for the given static file(s)."
label = 'static file... |
"""Process http://www.otsys.com/clue/ DB for use with python."""
import collections
import os
import sqlite3
import sys
# Add parent directory to path.
sys.path.append(os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
'src'))
from data import crossword
from data import data
from puzz... |
# helper module for test_runner.Test_TextTestRunner.test_warnings
"""
This module has a number of tests that raise different kinds of warnings.
When the tests are run, the warnings are caught and their messages are printed
to stdout. This module also accepts an arg that is then passed to
unittest.main to affect the b... |
__all__ = [ 'Client', 'Listener', 'Pipe' ]
from queue import Queue
families = [None]
class Listener(object):
def __init__(self, address=None, family=None, backlog=1):
self._backlog_queue = Queue(backlog)
def accept(self):
return Connection(*self._backlog_queue.get())
def close(self):... |
import re
xpath_tokenizer_re = re.compile(
"("
"'[^']*'|\"[^\"]*\"|"
"::|"
"//?|"
"\.\.|"
"\(\)|"
"[/.*:\[\]\(\)@=])|"
"((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|"
"\s+"
)
def xpath_tokenizer(pattern, namespaces=None):
for token in xpath_tokenizer_re.findall(pattern):
tag =... |
#!/usr/bin/env python
'''Add an Item to Pocket'''
__author__ = 'Felipe Borges'
import sys
sys.path.append("..")
import getopt
import pocket
USAGE = '''Usage: save_to_pocket [options] url
This script adds an Item to Pocket.
Options:
-h --help: print this help
--consumer_key : the Pocket API consumer ... |
from code128 import get_code
from code39 import create_c39
from EANBarCode import EanBarCode
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
def make_barcode(code, code_type='ean13', rotate=None, height=50, xw=1):
if code:
if code_type.lower()=='ean13':
... |
# Display a process of packets and processed time.
# It helps us to investigate networking or network device.
#
# options
# tx: show only tx chart
# rx: show only rx chart
# dev=: show only thing related to specified device
# debug: work with debug mode. It shows buffer status.
import os
import sys
sys.path.append(os... |
import sys
import time
from django.conf import settings
from django.db.backends.base.creation import BaseDatabaseCreation
from django.db.utils import DatabaseError
from django.utils.functional import cached_property
from django.utils.six.moves import input
TEST_DATABASE_PREFIX = 'test_'
PASSWORD = 'Im_a_lumberjack'
... |
"""Repeatedly execute bank transfers.
WARNING: This file does not create a new client instance per worker process.
Your client library needs a mutex in shared memory around the networking code.
See RAM-39.
This is a stress test for RAMCloud.
Run this program with --help for usage."""
import os
import sys
import ran... |
from thrift.protocol import TBinaryProtocol
from thrift.transport import TTransport
def serialize(thrift_object,
protocol_factory=TBinaryProtocol.TBinaryProtocolFactory()):
transport = TTransport.TMemoryBuffer()
protocol = protocol_factory.getProtocol(transport)
thrift_object.write(protocol)... |
from datetime import date
from oslo_log import log as logging
from trove.common import cfg
from trove.common.i18n import _
from trove.common import stream_codecs
from trove.common import utils
from trove.guestagent.common import operating_system
from trove.guestagent.module.drivers import module_driver
LOG = loggin... |
"""Tricks that depend on a certain DNS provider.
Tricks that require inheritence by nameserver.py must go here, otherwise,
see providers.py for externally available functions.
"""
__author__ = '<EMAIL> (Thomas Stromberg)'
class NameServerProvider(object):
"""Inherited by nameserver."""
# myresolver.info
d... |
import sys
import os
import getpass
import hashlib
def passprompt():
pprompt = lambda: (getpass.getpass("Passphrase: "), getpass.getpass("Retype passphrase: "))
p1, p2 = pprompt()
while p1 != p2:
print("No match, please try again", file=sys.stderr)
p1, p2 = pprompt()
return p1
if len(s... |
import logging
import traceback
from netman import regex
import re
class SubShell(object):
debug = False
def __init__(self, ssh, enter, exit_cmd, validate=None):
self.ssh = ssh
self.enter = enter
self.exit = exit_cmd
self.validate = validate or (lambda x: None)
def __ent... |
from openerp import SUPERUSER_ID
from openerp.osv import osv
from openerp.tools.translate import _
class mail_mail(osv.Model):
""" Update of mail_mail class, to add the signin URL to notifications. """
_inherit = 'mail.mail'
def _get_partner_access_link(self, cr, uid, mail, partner=None, context=None):
... |
"""
Verifies simple actions when using an explicit build target of 'all'.
"""
import glob
import os
import TestGyp
test = TestGyp.TestGyp(workdir='workarea_all')
test.run_gyp('actions.gyp', chdir='src')
test.relocate('src', 'relocate/src')
# Some gyp files use an action that mentions an output but never
# writes i... |
from oslo.config import cfg
from openstack_dashboard.openstack.common import jsonutils
from openstack_dashboard.openstack.common import log as logging
CONF = cfg.CONF
def notify(_context, message):
"""Notifies the recipient of the desired event given the model.
Log notifications using openstack's default ... |
# encoding: utf-8
from __future__ import unicode_literals
import re
import json
import xml.etree.ElementTree
from .common import InfoExtractor
from ..compat import (
compat_parse_qs,
compat_str,
compat_urllib_parse,
compat_urllib_parse_urlparse,
compat_urllib_request,
compat_urlparse,
comp... |
"""
Optional fixer to transform set() calls to set literals.
"""
from lib2to3 import fixer_base, pytree
from lib2to3.fixer_util import token, syms
class FixSetLiteral(fixer_base.BaseFix):
BM_compatible = True
explicit = True
PATTERN = """power< 'set' trailer< '('
(atom=atom< '[' ... |
from gofer import NAME, Singleton
from gofer.config import Config, Graph
from gofer.config import REQUIRED, OPTIONAL, ANY, BOOL, NUMBER
#
# [management]
# enabled
# The manager is (enabled|disabled).
# host
# Host (name or IP) the manager listens on.
# port
# The port number the manager listens on... |
from openerp.osv import fields, orm
class ProjectProject(orm.Model):
_inherit = 'project.project'
_columns = {
'use_analytic_account': fields.selection(
[('no', 'No'), ('yes', 'Optional'), ('req', 'Required')],
'Use Analytic Account'),
}
_defaults = {
'use_a... |
from __future__ import unicode_literals
import logging
from django.conf import settings
from django.contrib.gis import gdal
from django.contrib.gis.geos import GEOSException, GEOSGeometry
from django.forms.widgets import Widget
from django.template import loader
from django.utils import six, translation
logger = log... |
"""
Check that all of the certs on SQS endpoints validate.
"""
import unittest
from tests.integration import ServiceCertVerificationTest
import boto.s3
class S3CertVerificationTest(unittest.TestCase, ServiceCertVerificationTest):
s3 = True
regions = boto.s3.regions()
def sample_service_call(self, conn)... |
"""A simple load tester for WebSocket clients.
A client program sends a message formatted as "<time> <count> <message>" to
this handler. This handler starts sending total <count> WebSocket messages
containing <message> every <time> seconds. <time> can be a floating point
value. <count> must be an integer value.
"""
... |
"""Testing the TFP Hypothesis strategies.
(As opposed to using them to test other things).
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import hypothesis as hp
from hypothesis import strategies as hps
import nu... |
"""Invenio Bibliographic Tasklet BibTask.
This is a particular BibTask that execute tasklets, which can be any
function dropped into ``<package>.tasklets`` where ``<package>`` is defined
in ``PACKAGES``.
"""
from __future__ import print_function
import sys
from invenio.version import __version__
from invenio.legacy... |
from os import listdir, path
from types import GeneratorType
import six
from pyinfra import logger, pseudo_inventory
from pyinfra.api.inventory import Inventory
from pyinfra_cli.util import exec_file
# Hosts in an inventory can be just the hostname or a tuple (hostname, data)
ALLOWED_HOST_TYPES = tuple(
six.stri... |
from enigma import eDVBFrontendParametersSatellite, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable, eDVBFrontendParameters, eDVBResourceManager, eTimer
class Tuner:
def __init__(self, frontend, ignore_rotor=False):
self.frontend = frontend
self.ignore_rotor = ignore_rotor
# transponder = (freque... |
# -*- coding: utf-8 -*-
"""
flask.sessions
~~~~~~~~~~~~~~
Implements cookie based sessions based on itsdangerous.
:copyright: (c) 2012 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import uuid
import hashlib
from base64 import b64encode, b64decode
from datetime import dateti... |
class SourceAttribute(object):
"""
Provide information about attributes for an index field.
A maximum of 20 source attributes can be configured for
each index field.
:ivar default: Optional default value if the source attribute
is not specified in a document.
:ivar name: The na... |
KOI8R_CharToOrderMap = (
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10
253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20
252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30
253,14... |
import os
import testtools
from jenkins_jobs.cli import entry
from tests.base import LoggingFixture
from tests.base import mock
class CmdTestsBase(LoggingFixture, testtools.TestCase):
fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
def setUp(self):
super(CmdTestsBase, self).setU... |
"Base for c programs/libraries"
import os
import TaskGen, Build, Utils, Task
from Logs import debug
import ccroot
from TaskGen import feature, before, extension, after
g_cc_flag_vars = [
'CCDEPS', 'FRAMEWORK', 'FRAMEWORKPATH',
'STATICLIB', 'LIB', 'LIBPATH', 'LINKFLAGS', 'RPATH',
'CCFLAGS', 'CPPPATH', 'CPPFLAGS', 'CCD... |
Enum DEFINITIONS IMPLICIT TAGS ::=
BEGIN
-- EXPORTS P1, P2;
-- F.2.3.1
-- Use an enumerated type to model the values of a variable
-- with three or more states.
-- Assign values starting with zero if their only
-- constraint is distinctness.
-- EXAMPLE
DayOfTheWeek ::= ENUMERATED {sunday(0), monday(1), tuesday(2),
... |
import datetime
from unittest import mock
from oslo_config import cfg
from oslo_utils import uuidutils
from magnum.api.controllers.v1 import federation as api_federation
from magnum.conductor import api as rpcapi
import magnum.conf
from magnum import objects
from magnum.tests import base
from magnum.tests.unit.api im... |
# -*- coding: utf-8 -*-
import time
import pika
import json
import logging
import hashlib
class ExamplePublisher(object):
"""This is an example publisher that will handle unexpected interactions
with RabbitMQ such as channel and connection closures.
If RabbitMQ closes the connection, it will reopen it. ... |
from .core import (SERVICES, LANGUAGE_INDEX, SERVICE_INDEX, SERVICE_CONFIDENCE,
MATCHING_CONFIDENCE, create_list_tasks, consume_task, create_download_tasks,
group_by_video, key_subtitles)
from .language import language_set, language_list, LANGUAGES
import logging
__all__ = ['list_subtitles', 'download_subtitl... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import cv2
from time import clock
from numpy import pi, sin, cos
import common
class VideoSynthBase(object):
def __init__(self, size=None, noise=0.0, bg = None, **params):
self.bg = None
self.frame_size = (640, 480)
... |
#!/usr/bin/python
from PyQt4.QtCore import *
from PyQt4.QtSql import *
from PyQt4.QtGui import *
from blur.Stone import *
from blur.Classes import *
from blur.Classesui import *
import blur.email, blur.jabber
import sys, time, re, os
from math import ceil
import traceback
try:
import popen2
except: pass
app = QAppl... |
from datasketch import MinHashLSHForest, MinHash
data1 = ['minhash', 'is', 'a', 'probabilistic', 'data', 'structure', 'for',
'estimating', 'the', 'similarity', 'between', 'datasets']
data2 = ['minhash', 'is', 'a', 'probability', 'data', 'structure', 'for',
'estimating', 'the', 'similarity', 'between', ... |
"""Base translators for translating Grow content."""
import copy
import json
import logging
import os
import threading
import progressbar
import texttable
import yaml
from protorpc import message_types
from protorpc import messages
from protorpc import protojson
from grow.common import progressbar_non
from grow.common... |
from unittest import TestCase
from zoom.www.entities.application_state import ApplicationState
class TestApplicationState(TestCase):
def setUp(self):
self.state = ApplicationState(application_name="1",
configuration_path="2",
appl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.