content stringlengths 4 20k |
|---|
"""Verifies that test shuffling works."""
__author__ = '<EMAIL> (Zhanyong Wan)'
import os
import gtest_test_utils
# Command to run the gtest_shuffle_test_ program.
COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_shuffle_test_')
# The environment variables for test sharding.
TOTAL_SHARDS_ENV_VAR = 'GTEST_TOT... |
#####################################################################
# File: ReqManagerHandler.py
########################################################################
"""
:mod: ReqManagerHandler
.. module: ReqManagerHandler
:synopsis: Implementation of the RequestDB service in the DISET framework
"""
__RCSID__... |
import mock
from oslo_utils import units
from nova import test
from nova.virt.hyperv import constants
from nova.virt.hyperv import vhdutils
from nova.virt.hyperv import vmutils
class VHDUtilsBaseTestCase(test.NoDBTestCase):
"Base Class unit test classes of Hyper-V VHD Utils classes."
_FAKE_VHD_PATH = "C:\\f... |
data = (
'Xu ', # 0x00
'Ji ', # 0x01
'Mu ', # 0x02
'Chen ', # 0x03
'Xiao ', # 0x04
'Zha ', # 0x05
'Ting ', # 0x06
'Zhen ', # 0x07
'Pei ', # 0x08
'Mei ', # 0x09
'Ling ', # 0x0a
'Qi ', # 0x0b
'Chou ', # 0x0c
'Huo ', # 0x0d
'Sha ', # 0x0e
'Fei ', # 0x0f
'Weng ', # 0x10
'Z... |
import functools
from oslo_config import cfg
from oslo_log import log as logging
from sqlalchemy.orm import exc
from neutron.api.v2 import attributes
from neutron.common import constants
from neutron.common import exceptions as n_exc
from neutron.common import utils
from neutron.db import common_db_mixin
from neutron... |
"""
Quick conversion command module.
"""
from optparse import make_option
import sys
from django.core.management.base import BaseCommand
from django.core.management.color import no_style
from django.conf import settings
from django.db import models
from django.core import management
from django.core.exceptions import... |
from gladecheck import GladeTest
class CheckMnemonics(GladeTest):
def checkGlade(self, glade_tree):
"""Check for widgets with keyboard accelerators but no mnemonic"""
# Look for labels with use-underline=True and no mnemonic-widget
for label in glade_tree.xpath(".//object[@class='GtkLabel'... |
import os
import sys
try:
from setuptools import setup
except:
from distutils.core import setup
def get_static_files(path):
return [os.path.join(dirpath.replace("luigi/", ""), ext)
for (dirpath, dirnames, filenames) in os.walk(path)
for ext in ["*.html", "*.js", "*.css", "*.png"]... |
"""
Choicelists for `lino_xl.lib.humanlinks`.
"""
from __future__ import unicode_literals
from __future__ import print_function
from django.utils.translation import gettext_lazy as _
from django.utils.translation import pgettext_lazy as pgettext
from django.utils.text import format_lazy
from lino_xl.lib.contacts.ro... |
from __future__ import absolute_import
import pytest
from itertools import islice
from kafka import (
KafkaClient,
SimpleProducer,
)
from tests.pgshovel.fixtures import (
cluster,
create_temporary_database,
)
from tests.pgshovel.streams.fixtures import (
DEFAULT_PUBLISHER,
begin,
transacti... |
from django import forms
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.utils.translation import ugettext, ugettext_lazy as _
class FlatpageForm(forms.ModelForm):
url = forms.RegexField(
label=_("URL"),
max_length=100,
regex=r'^[-\w/\.~]+$... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
try:
import tower_cli
import tower_cli.utils.exceptions as exc
from tower_cli.conf import settings
from ansi... |
"""Unit tests for the indexing engine."""
__revision__ = "$Id$"
from invenio.testutils import InvenioTestCase
from invenio import bibindex_engine_stemmer
from invenio.testutils import make_test_suite, run_test_suite
class TestStemmer(InvenioTestCase):
"""Test stemmer."""
def test_stemmer_none(self):
... |
"""The match_hostname() function from Python 3.3.3, essential when using SSL."""
import re
__version__ = '3.4.0.2'
class CertificateError(ValueError):
pass
def _dnsname_match(dn, hostname, max_wildcards=1):
"""Matching according to RFC 6125, section 6.4.3
http://tools.ietf.org/html/rfc6125#section-6.4... |
#!/usr/bin/env python
import unittest
from test import support
from test.test_urllib2 import sanepathname2url
import os
import socket
import sys
import urllib.error
import urllib.request
def _retry_thrice(func, exc, *args, **kwargs):
for i in range(3):
try:
return func(*args, **kwargs)
... |
"""Standard functions for creating slots.
A slot is a `Variable` created with the same shape as a primary variable or
`Tensor`. A slot is always scoped in the namespace of the primary object and
typically has the same device and type.
Slots are typically used as accumulators to track values associated with
the primar... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
RasterCalculator.py
---------------------
Date : May 2014
Copyright : (C) 2014 by Victor Olaya
Email : volayaf at gmail dot com
*************************... |
# -*- coding: utf-8 -*-
"""
jinja2._compat
~~~~~~~~~~~~~~
Some py2/py3 compatibility support based on a stripped down
version of six so we don't have to depend on a specific version
of it.
:copyright: Copyright 2013 by the Jinja team, see AUTHORS.
:license: BSD, see LICENSE for details.
""... |
from connect import Connect
from device import Device
from account import Account
from user import User
from data import Data
from rule import Rule
from component import Component
from utils import prettyprint, update_properties
import json
import os
import sys
# load Configuration file and store values as class attr... |
from hachoir_metadata.timezone import UTC
from datetime import date, datetime
# Year in 1850..2030
MIN_YEAR = 1850
MAX_YEAR = 2030
class Filter:
def __init__(self, valid_types, min=None, max=None):
self.types = valid_types
self.min = min
self.max = max
def __call__(self, value):
... |
"""this module contains exceptions used in the astroid library
"""
__doctype__ = "restructuredtext en"
class AstroidError(Exception):
"""base exception class for all astroid related exceptions"""
class AstroidBuildingException(AstroidError):
"""exception class when we are unable to build an astroid represen... |
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **Ftp Client for Retrieving ftp data.**
Contact : <EMAIL>
.. 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 Found... |
from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from guardian.compat import get_user_model
from guardian.shortcuts import assign_perm, remove_perm
class CustomPKModelTest(TestCase):
"""
Tests agains custom model with primary ... |
"""
Copyright (c) 2003-2005 Gustavo Niemeyer <<EMAIL>>
This module offers extensions to the standard python 2.3+
datetime module.
"""
from dateutil.tz import tzfile
from tarfile import TarFile
import os
__author__ = "Gustavo Niemeyer <<EMAIL>>"
__license__ = "PSF License"
__all__ = ["setcachesize", "gettz", "rebuil... |
""" Python wrapper for wkhtmltopdf library, for rendering images from html files.
[ doc: https://wkhtmltopdf.org/docs.html ]
* Currently supporting only Linux distributions!
This script designed to be run on devices without display.
Uses xvfb (X virtual framebuffer) for that functionality.
... |
"""
Widgets for various HTML5 input types.
"""
from .core import Input
__all__ = (
'ColorInput', 'DateInput', 'DateTimeInput', 'DateTimeLocalInput',
'EmailInput', 'MonthInput', 'NumberInput', 'RangeInput', 'SearchInput',
'TelInput', 'TimeInput', 'URLInput', 'WeekInput',
)
class SearchInput(Input):
"... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'finalize.ui'
#
# by: PyQt4 UI code generator 4.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
... |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.jsrouting
~~~~~~~~~~~~~~~~~~~~~~~~~~
Addon module that allows to create a JavaScript function from a map
that generates rules.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
... |
from __future__ import print_function
import argparse
import base64
import json
import subprocess
import sys
import urllib
import urllib2
class ReviewBoard(object):
def __init__(self, host, user, password):
self._host = host
self.user = user
self._password = password
def api_url(self, api_path):
... |
"""Test of the GRPC-backed ForeLink and RearLink."""
import threading
import unittest
from grpc._adapter import _proto_scenarios
from grpc._adapter import _test_links
from grpc._adapter import fore
from grpc._adapter import rear
from grpc.framework.base import interfaces
from grpc.framework.foundation import logging_... |
from django.core.management.base import BaseCommand, CommandError
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.core.servers.basehttp import get_internal_wsgi_application
#from django.utils import autoreload
from trunserv import autoreload
from twisted.application import internet, serv... |
from unittest import mock
import ddt
from cinder.tests.unit import test
from cinder.tests.unit.volume.drivers.netapp.dataontap.performance \
import fakes as fake
from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api
from cinder.volume.drivers.netapp.dataontap.performance import perf_base
fro... |
"""
Regression tests for proper working of ForeignKey(null=True). Tests these bugs:
* #7512: including a nullable foreign key reference in Meta ordering has un
xpected results
"""
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
... |
from decimal import Decimal as D
from django.test import TestCase
import mock
from oscar.apps.shipping import methods
from oscar.apps.basket.models import Basket
class TestFreeShipppingForEmptyBasket(TestCase):
def setUp(self):
self.method = methods.Free()
self.basket = Basket()
self.ch... |
module_value1 = 5000
module_value2 = 3000
def calledRepeatedly():
# Force frame and eliminate forward propagation (currently).
module_value1
local_value = module_value1
s = module_value1
t = module_value2
# construct_begin
t = s + t
# construct_end
return s, t, local_value
import iterto... |
"""Driver for ADS WS1 weather stations.
Thanks to Steve (sesykes71) for the testing that made this driver possible.
Thanks to Jay Nugent (WB8TKL) and KRK6 for weather-2.kr6k-V2.1
http://server1.nuge.com/~weather/
"""
from __future__ import with_statement
import serial
import syslog
import time
import weewx.driver... |
# -*- coding: utf-8 -*-
"""
jinja2.testsuite
~~~~~~~~~~~~~~~~
All the unittests of Jinja2. These tests can be executed by
either running run-tests.py using multiple Python versions at
the same time.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
i... |
from django.apps import apps
from django.conf import settings
from django.conf.urls import (
include,
url,
)
from django.conf.urls.static import static
from django.contrib import admin
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import TemplateView
from drf_auto_endpoint.route... |
"""Capa's specialized use of codejail.safe_exec."""
from codejail.safe_exec import safe_exec as codejail_safe_exec
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import json_safe, SafeExecException
from . import lazymod
from dogapi import dog_stats_api
import hashlib
#... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
class Attribute:
def __init__(self, isa=None, private=False, default=None, required=False, listof=None):
self.isa = isa
self.private = private
self.default = default
self.required = required
... |
from . import model |
"""
These classes are light wrappers around Django's database API that provide
convenience functionality and permalink functions for the databrowse app.
"""
from django.db import models
from django.utils import formats
from django.utils.text import capfirst
from django.utils.encoding import smart_unicode, smart_str, i... |
from . import encode
from . import number_types as N
class Table(object):
"""Table wraps a byte slice and provides read access to its data.
The variable `Pos` indicates the root of the FlatBuffers object therein."""
__slots__ = ("Bytes", "Pos")
def __init__(self, buf, pos):
N.enforce_number... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.compat.tests.mock import patch
from ansible.modules.network.eos import eos_config
from .eos_module import TestEosModule, load_fixture, set_module_args
class TestEosConfigModule(TestEosModule):
modul... |
from django.core.management.base import copy_helper, CommandError, LabelCommand
from django.utils.importlib import import_module
import os
import re
from random import choice
class Command(LabelCommand):
help = "Creates a Django project directory structure for the given project name in the current directory."
... |
r"""Invenio module for OAI-PMH metadata harvesting between repositories.
Harvesting is simple
====================
.. code-block:: shell
youroverlay oaiharvester harvest -u http://export.arxiv.org/oai2 \
-i oai:arXiv.org:1507.07286 > my_record.xml
This will harvest the repository for a specific record ... |
#!/usr/bin/env python
"""
Install wagtailsettings using setuptools
"""
from wagtailsettings import __version__
with open('README.rst', 'r') as f:
readme = f.read()
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setupt... |
from setuptools import setup, find_packages
setup(
name='stevedore-examples',
version='1.0',
description='Demonstration package for stevedore',
author='Doug Hellmann',
author_email='<EMAIL>',
url='http://git.openstack.org/cgit/openstack/stevedore',
classifiers=['Development Status :: 3 ... |
import hashlib
from boto.glacier.utils import chunk_hashes, tree_hash, bytes_to_hex
# This import is provided for backwards compatibility. This function is
# now in boto.glacier.utils, but any existing code can still import
# this directly from this module.
from boto.glacier.utils import compute_hashes_from_fileobj
... |
import sys
#emotions:
#happy
#calm
#sad
#loss
#interested - clasping hands together?
#horny
#shocked - maybe hands in front of face, with a gap in between her fingers to see through?
#excited
#stunned - eyes closed, I think.
#angry
#clothes = shoes, socks, jumper, tie, skirt, shirt, bra, panties
#11 total stages
#ap... |
# coding=utf-8
"""
Collect stats from puppet agent's last_run_summary.yaml
#### Dependencies
* yaml
"""
try:
import yaml
except ImportError:
yaml = None
import diamond.collector
class PuppetAgentCollector(diamond.collector.Collector):
def get_default_config_help(self):
config_help = super(... |
"""
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... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests import unittest
from ansible.errors import AnsibleParserError
from ansible.parsing.yaml.objects import AnsibleMapping
from ansible.playbook.task_include import TaskInclude
from test.mock.loader import Dic... |
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib import comments
from django.utils import six
from django.utils.deprecation import RenameMethodsBase, RemovedInDjango18Warning
fr... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
from units.modules.utils import set_module_args as _set_module_args
def set_module_args(args):
if 'provider' not in args:... |
import pytest
@pytest.mark.django_db
def test_course_create_view(admin_client, client, user):
from django.core.urlresolvers import reverse_lazy
from core.models import Course
response = admin_client.get(reverse_lazy('administration.new_course'))
assert response.status_code == 405
name = 'Test cou... |
import string
import gtk
import gettext
t = gettext.translation('rhn-client-tools', fallback=True)
_ = t.ugettext
# wrap a long line...
def wrap_line(line, max_line_size = 100):
if len(line) < max_line_size:
return line
ret = []
l = ""
for w in string.split(line):
if not len(l):
... |
# stdlib
import os
from inspect import getsourcefile
from os.path import abspath
# project
from checks import AgentCheck
from hashlib import md5
from aerospike.constants import ERROR_CODES
from aerospike.constants import HASH_KEY
from aerospike import interface
from aerospike import log
from aerospike import citrusle... |
from __future__ import absolute_import, division, print_function
import string
import re
from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
from pkg_resources.extern.pyparsing import ZeroOrMore, Word, Optional, Regex, Combine
from pkg_resources.extern.pyparsing import L... |
from collections import defaultdict
from sympy import Symbol
from sympy.core.compatibility import range
from sympy.ntheory import n_order, is_primitive_root, is_quad_residue, \
legendre_symbol, jacobi_symbol, totient, primerange, sqrt_mod, \
primitive_root, quadratic_residues, is_nthpow_residue, nthroot_mod, \... |
"""This module is deprecated. Please use `airflow.sensors.weekday_sensor`."""
import warnings
# pylint: disable=unused-import
from airflow.sensors.weekday_sensor import DayOfWeekSensor # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.sensors.weekday_sensor`.",
DeprecationWarning,
st... |
from __future__ import absolute_import
import contextlib
import logging
import logging.handlers
import os
try:
import threading
except ImportError:
import dummy_threading as threading
from pip.compat import WINDOWS
from pip.utils import ensure_dir
try:
from pip._vendor import colorama
# Lots of differen... |
from __future__ import print_function
import errno
import gc
import os
import pprint
import socket
import sys
import traceback
import eventlet
import eventlet.backdoor
import greenlet
from oslo.config import cfg
from nova.openstack.common._i18n import _LI
from nova.openstack.common import log as logging
help_for_ba... |
"""
A simple wrapper for protoc.
- Adds includes in generated headers.
- Handles building with system protobuf as an option.
"""
import optparse
import os.path
import shutil
import subprocess
import sys
import tempfile
PROTOC_INCLUDE_POINT = '// @@protoc_insertion_point(includes)\n'
def ModifyHeader(header_file, ex... |
from .. import exc as sa_exc
from ..util import ScopedRegistry, ThreadLocalRegistry, warn
from . import class_mapper, exc as orm_exc
from .session import Session
__all__ = ['scoped_session']
class scoped_session(object):
"""Provides scoped management of :class:`.Session` objects.
See :ref:`unitofwork_conte... |
from __future__ import print_function
import time, sys, signal, atexit
from upm import pyupm_ims
def main():
# Create an instance of the I2C Moisture Sensor
# I2C bus 0, default address = 0x20
ims = pyupm_ims.IMS(0)
print ('I2C moisture sensor example...')
while (1):
try:
print... |
from __future__ import absolute_import
from keystoneclient.v2_0 import client as keystone_client
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
class FakeConnection(object):
pass
class ClientConnectionTests(test.TestCase):
def setUp(self):
super(ClientConn... |
"""The debug module contains utilities and functions for better
debugging Gunicorn."""
import sys
import linecache
import re
import inspect
__all__ = ['spew', 'unspew']
_token_spliter = re.compile('\W+')
class Spew(object):
"""
"""
def __init__(self, trace_names=None, show_values=True):
self.tr... |
# -*- coding: utf-8 -*-
import itertools
import unittest2
from lxml import etree as ET, html
from lxml.html import builder as h
from openerp.tests import common
def attrs(**kwargs):
return dict(('data-oe-%s' % key, str(value)) for key, value in kwargs.iteritems())
class TestViewSaving(common.TransactionCase):
... |
# -*- coding: utf-8 -*-
"""
This file is part of Radar.
Radar 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 3 of the License, or
(at your option) any later version.
Radar is distributed ... |
"""Classes to represent tokens and positions within them."""
__author__ = ('<EMAIL> (Robert Walker)',
'<EMAIL> (Andy Perelson)')
class TokenType(object):
"""Token types common to all languages."""
NORMAL = 'normal'
WHITESPACE = 'whitespace'
BLANK_LINE = 'blank line'
class Token(object):
"""... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Check that all auxilary files created by LaTeX are properly cleaned by scons -c.
"""
import os
import TestSCons
test = TestSCons.TestSCons()
latex = test.where_is('latex')
if not latex:
test.skip_test("Could not find tex or latex; skipping test(... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['deprecated'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.netcfg import NetworkConfig, dumps
from ansible.module_utils.iosxr import get_config, load_confi... |
# Wrapper for loading templates from eggs via pkg_resources.resource_string.
try:
from pkg_resources import resource_string
except ImportError:
resource_string = None
from django.template import TemplateDoesNotExist
from django.template.loader import BaseLoader
from django.conf import settings
class Loader(B... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson
from ansible.module_utils import basic
from ansible.modules.network.check_point import cp_mgmt_tag
OBJECT = {
"name": "My New ... |
"""
Model for handling display of open files.
"""
#pylint: disable=C0103
from __future__ import unicode_literals
import json
from collections import OrderedDict
from PyQt4 import QtGui, QtCore
from aston.resources import resfile
from aston.qtgui.Fields import aston_fields, aston_groups
from aston.database.File import ... |
"""A keyring based Storage.
A Storage for Credentials that uses the keyring module.
"""
__author__ = '<EMAIL> (Joe Gregorio)'
import keyring
import threading
from client import Storage as BaseStorage
from client import Credentials
class Storage(BaseStorage):
"""Store and retrieve a single credential to and from... |
"""
:module: watchdog.utils.dirsnapshot
:synopsis: Directory snapshots and comparison.
:author: <EMAIL> (Yesudeep Mangalapilly)
.. ADMONITION:: Where are the moved events? They "disappeared"
This implementation does not take partition boundaries
into consideration. It will only work when the directory... |
"""WebDriver element location functionality."""
class SearchContext(object):
"""Abstract class that provides the core element location functionality."""
def find_element_by_css(self, selector):
"""Find the first element matching a css selector."""
return self._find_element('css selector', sele... |
"""
ui_utils.py
Some UI utility functions
"""
class GUI:
@classmethod
def drawIconButton(cls, enabled, layout, iconName, operator, frame=True):
col = layout.column()
col.enabled = enabled
bt = col.operator(operator,
text='',
icon=iconName,
... |
"""
Test cases for twisted.protocols.stateful
"""
from twisted.trial.unittest import TestCase
from twisted.protocols.test import test_basic
from twisted.protocols.stateful import StatefulProtocol
from struct import pack, unpack, calcsize
class MyInt32StringReceiver(StatefulProtocol):
"""
A stateful Int32Str... |
{
'name': 'Marketing Campaigns',
'version': '1.1',
'depends': ['marketing',
'document',
'email_template',
'decimal_precision'
],
'author': 'OpenERP SA',
'category': 'Marketing',
'description': """
This module provides leads automation throug... |
# coding=utf8
import os
import sys
import time
import unittest
import vk
from vk.utils import HandyList, make_handy, HandyDict
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
# copy to test_props.py and fill it
APP_ID = '4643961' # aka API/Client id
USER_LOGIN = '<EMAIL>' # user email or phone num... |
"""Bar chart related tests"""
from pygal import Bar
def test_simple_bar():
"""Simple bar test"""
bar = Bar()
rng = [-3, -32, -39]
bar.add('test1', rng)
bar.add('test2', map(abs, rng))
bar.x_labels = map(str, rng)
bar.title = "Bar test"
q = bar.render_pyquery()
assert len(q(".axis.... |
import errno
import socket
class QEMUQtestProtocol(object):
def __init__(self, address, server=False):
"""
Create a QEMUQtestProtocol object.
@param address: QEMU address, can be either a unix socket path (string)
or a tuple in the form ( address, port ) for a TCP
... |
import time
from openerp.osv import fields, osv
class account_budget_crossvered_report(osv.osv_memory):
_name = "account.budget.crossvered.report"
_description = "Account Budget crossvered report"
_columns = {
'date_from': fields.date('Start of period', required=True),
'date_to': fields.d... |
from django.db import models
class Author(models.Model):
first_name = models.CharField(max_length=255)
last_name = models.CharField(max_length=255)
dob = models.DateField()
def __init__(self, *args, **kwargs):
super(Author, self).__init__(*args, **kwargs)
# Protect against annotations... |
#!/usr/bin/env python
"""
=====================
Lasso path using LARS
=====================
Computes Lasso Path along the regularization parameter using the LARS
algorithm on the diabetes dataset. Each color represents a different
feature of the coefficient vector, and this is displayed as a function
of the regulariza... |
class CORSRule(object):
"""
CORS rule for a bucket.
:ivar id: A unique identifier for the rule. The ID value can be
up to 255 characters long. The IDs help you find a rule in
the configuration.
:ivar allowed_methods: An HTTP method that you want to allow the
origin to execute... |
# -*- coding: utf-8 -*-
"""
pygments.styles.perldoc
~~~~~~~~~~~~~~~~~~~~~~~
Style similar to the style used in the `perldoc`_ code blocks.
.. _perldoc: http://perldoc.perl.org/
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from... |
try:
import distutils.msvc9compiler
except ImportError:
pass
unpatched = dict()
def patch_for_specialized_compiler():
"""
Patch functions in distutils.msvc9compiler to use the standalone compiler
build for Python (Windows only). Fall back to original behavior when the
standalone compiler is no... |
from __future__ import unicode_literals
from django import forms
from django.forms.util import flatatt
from django.template import loader
from django.utils.datastructures import SortedDict
from django.utils.html import format_html, format_html_join
from django.utils.http import int_to_base36
from django.utils.safestri... |
"""Topological sorting algorithms."""
from ..exc import CircularDependencyError
from .. import util
__all__ = ['sort', 'sort_as_subsets', 'find_cycles']
def sort_as_subsets(tuples, allitems):
edges = util.defaultdict(set)
for parent, child in tuples:
edges[child].add(parent)
todo = set(allitem... |
"""Running tests"""
import sys
import time
from . import result
from .signals import registerResult
__unittest = True
class _WritelnDecorator(object):
"""Used to decorate file-like objects with a handy 'writeln' method"""
def __init__(self,stream):
self.stream = stream
def __ge... |
import os
import random
import stat
import sys
import tempfile
import time
import unittest
from pyspark import SparkConf, SparkContext, TaskContext, BarrierTaskContext
from pyspark.testing.utils import PySparkTestCase
class TaskContextTests(PySparkTestCase):
def setUp(self):
self._old_sys_path = list(sy... |
"""HTML reporter"""
import sys
from cgi import escape
from logilab.common.ureports import HTMLWriter, Section, Table
from pylint.interfaces import IReporter
from pylint.reporters import BaseReporter
class HTMLReporter(BaseReporter):
"""report messages and layouts in HTML"""
__implements__ = IReporter
... |
import unittest
import pytest
from transformers import pipeline
from transformers.testing_utils import is_pipeline_test, is_torch_available, require_torch, slow
from .test_pipelines_common import MonoInputPipelineCommonMixin
if is_torch_available():
from transformers.models.mbart import MBart50TokenizerFast, M... |
import unittest
from telemetry.timeline import inspector_importer
from telemetry.timeline import model
from telemetry.timeline import trace_data
_BACKGROUND_MESSAGE = {
'data': {},
'type': 'BeginFrame',
'thread': '2',
'startTime': 1352783525921.824}
_SAMPLE_MESSAGE = {
'children': [
{'data': {},
'... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
import sys
import os
import platform
import tempfile
class Zone(object):
def __init__(self, module):
self.changed = False
self.msg = []
self.module ... |
"""Tests for Rt - Python interface to Request Tracker :term:`API`"""
__license__ = """ Copyright (C) 2013 CZ.NIC, z.s.p.o.
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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.