content stringlengths 4 20k |
|---|
import unittest
import warnings
from scrapy.link import Link
class LinkTest(unittest.TestCase):
def _assert_same_links(self, link1, link2):
self.assertEqual(link1, link2)
self.assertEqual(hash(link1), hash(link2))
def _assert_different_links(self, link1, link2):
self.assertNotEqual(l... |
from openerp import api, models
class SaleOrder(models.Model):
_inherit = 'sale.order.line'
# Copied verbatim from a similar function in sale_sample module.
#
def _get_fields_from_line(self):
"""Internal function to get the fields of the sale order line. Modules
enhancing this one sh... |
from gnuradio import gr
from gnuradio import audio
from gnuradio.eng_option import eng_option
from optparse import OptionParser
class my_top_block(gr.top_block):
def __init__(self):
gr.top_block.__init__(self)
parser = OptionParser(option_class=eng_option)
parser.add_option("-I", "--audio... |
"""Unit tests for projection view."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import os
import numpy as np
import numpy.random as rnd
import pandas as pd
from kwiklib.dataio import Kluste... |
"""Tests for api_init_files.bzl and api_init_files_v1.bzl."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
# The unused imports are needed so that the python and lite modules are
# available in sys.modules
# pylint: disable=unused-import
from ... |
"""Implements a fully blocking kernel client.
Useful for test suites and blocking terminal interfaces.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
from functools import partial
from getpass import getpass
try:
from ... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt import (
check_sdk,
create_connection,
get_dict_of_struct,
o... |
import pytest
from constance import config
from django.contrib.auth.models import Group, Permission
from django.contrib.contenttypes.models import ContentType
from kuma.users.models import User, UserBan
from ..fixture import FixtureLoader
def test_empty_fixtures():
"""A empty specification is OK, does nothing.... |
'''
@author: Dallas Fraser
@date: 2019-08-10
@summary: Tests for the dcolor class and methods
'''
from inducer.dcolor import Dcolor, combine_color_clique, convert_combo,\
add_list
from inducer.helper import make_diamond, make_claw, make_cycle, join
import networkx as nx
import unittest
class TestDcolor(unittest.T... |
from sqlalchemy import Column
from sqlalchemy import MetaData
from sqlalchemy import Table
from sqlalchemy import Text
def upgrade(engine):
meta = MetaData()
meta.bind = engine
# Drop the compute_node_stats table and add a 'stats' column to
# compute_nodes directly. The data itself is transient and ... |
import unittest
import numpy as np
import copy
from op_test import OpTest
def iou(box_a, box_b):
"""Apply intersection-over-union overlap between box_a and box_b
"""
xmin_a = min(box_a[0], box_a[2])
ymin_a = min(box_a[1], box_a[3])
xmax_a = max(box_a[0], box_a[2])
ymax_a = max(box_a[1], box_a[... |
import os
import mock
from oslo_concurrency import processutils
from nova import exception
from nova import test
from nova import utils
from nova.virt import images
class QemuTestCase(test.NoDBTestCase):
def test_qemu_info_with_bad_path(self):
self.assertRaises(exception.InvalidDiskInfo,
... |
"""
Manages the namespace for the application.
This file presents ways an ISV (Independent Software Vendor) might use
namespaces to distribute the guestbook application to different corporate
clients. The original guestbook.py is left unchanged. Our namespace choosing
hook is run when datastore or memcache attempt to ... |
"""
parser.http.searchCharacterParser module (imdb package).
This module provides the HTMLSearchCharacterParser class (and the
search_character_parser instance), used to parse the results of a search
for a given character.
E.g., when searching for the name "Jesse James", the parsed page would be:
http://akas.imdb.... |
from yowsup.structs import ProtocolEntity, ProtocolTreeNode
from yowsup.layers.protocol_notifications.protocolentities import NotificationProtocolEntity
from .notification_groups import GroupsNotificationProtocolEntity
class SubjectGroupsNotificationProtocolEntity(GroupsNotificationProtocolEntity):
'''
<notif... |
#!/usr/bin/python
import socket # Import socket module
from struct import *
class Packet:
'''
Custom packet class.
Attributes created on initialisation:
IP
============
- version
- ihl
- ttl
- protocol
- s_addr
- d_addr
TCP
============
- so... |
from pi import action, atom, bundles, const, domain
import piw
class Toggle(atom.Atom):
def __init__(self,e,d,**kw):
self.__enable = e
atom.Atom.__init__(self,domain=domain.Bool(),protocols='set',policy=atom.default_policy(self.__change),**kw)
self.add_verb2(1,'set([],~a,role(None,[instanc... |
from __future__ import print_function
import sys
import logging
import grp
import pwd
import portage
from portage import os
from portage.progress import ProgressBar
#from portage.emaint.defaults import DEFAULT_OPTIONS
#from portage.util._argparse import ArgumentParser
from portage.util import writemsg_level
from por... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsNetworkContentFetcher
.. 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 later versio... |
from enigma import iPlayableService
from Source import Source
from Components.PerServiceDisplay import PerServiceBase
class FrontendInfo(Source, PerServiceBase):
def __init__(self, service_source = None, frontend_source = None, navcore = None):
self.navcore = None
Source.__init__(self)
if navcore:
PerService... |
# -*- coding: utf-8 -*-
import pytest
import sqlparse
from sqlparse import sql
from sqlparse import tokens as T
from tests.utils import TestCaseBase
class TestGrouping(TestCaseBase):
def test_parenthesis(self):
s = 'select (select (x3) x2) and (y2) bar'
parsed = sqlparse.parse(s)[0]
se... |
import unittest
import datetime
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import connection
from models import CustomPKModel, UniqueTogetherModel, UniqueFieldsModel, UniqueForDateModel, ModelToValidate, Post, FlexibleDatePost
class GetUniqueCheckTests(unittest.... |
from django.db import models
from .machine import CacheMachine
class PickleFieldCache(models.Model):
class Meta:
abstract = True
_cached_fields = []
class CachedForeignKey(models.ForeignKey):
def contribute_to_class(self, cls, name):
super(CachedForeignKey, self).contribute_to_class(cls... |
import re
import ipaddr
from st2common.log import logging
LOG = logging.getLogger(__name__)
__all__ = [
'is_ipv4',
'is_ipv6',
'split_host_port'
]
BRACKET_PATTERN = "^\[.*\]" # IPv6 bracket pattern to specify port
COMPILED_BRACKET_PATTERN = re.compile(BRACKET_PATTERN)
HOST_ONLY_IN_BRACKET = "^\[.*\]$"
... |
{
'name': 'Contracts Management',
'version': '1.1',
'category': 'Sales Management',
'description': """
This module is for modifying account analytic view to show important data to project manager of services companies.
=====================================================================================... |
#!/usr/bin/env python
"""
Simple wklej.org paste script
license: GPLv2
version 0.1.4
thanks ch4os for help
"""
from optparse import OptionParser
import commands
import sys
import xmlrpclib
syntaxes = [
'text', 'apache', 'actionscript', 'actionscript3', 'bash', 'bat', 'bbcode', 'befuge', 'boo', 'brainfuck', 'c-o... |
import unittest
from mantid import UsageService
from unittest.mock import patch
from mantidqt.utils.testing.mocks.mock_qt import MockQWidget
from workbench.plugins.exception_handler import exception_logger
class ExceptionHandlerTest(unittest.TestCase):
@classmethod
def tearDownClass(cls):
UsageServic... |
# ideally, find the maximum total 1:1 overlap between the two sets of intervals
# in reality, use only those overlapping regions which are the maximum overlap for both intervals
# I think it is currently O(n) in the number of intervals on one side since intervals may only overlap two others,
# ... so it is at most doub... |
import os
from django.conf import settings
from django.core.management.base import NoArgsCommand
from ckeditor.views import get_image_files
from ckeditor.utils import get_thumb_filename
from ckeditor.image_processing import get_backend
class Command(NoArgsCommand):
"""
Creates thumbnail files for the CKEdit... |
"""Tests for the experimental input pipeline ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import numpy as np
from tensorflow.contrib.data.python.kernel_tests import dataset_serialization_test_base
from tensorflow.contrib.data.py... |
"""
A provided CSRF implementation which puts CSRF data in a session.
This can be used fairly comfortably with many `request.session` type
objects, including the Werkzeug/Flask session store, Django sessions, and
potentially other similar objects which use a dict-like API for storing
session keys.
The basic concept i... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Blockstack
~~~~~
copyright: (c) 2014-2015 by Halfmoon Labs, Inc.
copyright: (c) 2016 by Blockstack.org
This file is part of Blockstack
Blockstack is free software: you can redistribute it and/or modify
it under the terms of the GNU General... |
__all__ = ['Component', 'ExtensionPoint', 'implements', 'Interface',
'TracError']
def N_(string):
"""No-op translation marker, inlined here to avoid importing from
`trac.util`.
"""
return string
class TracError(Exception):
"""Exception base class for errors in Trac."""
... |
"""
Module for reading, writing and manipulating
Toolbox databases and settings files.
"""
from __future__ import print_function
import os, re, codecs
from xml.etree.ElementTree import ElementTree, TreeBuilder, Element, SubElement
from nltk.compat import StringIO, u, PY3
from nltk.data import PathPointer, Z... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
sanitized_Request,
xpath_text,
xpath_with_ns,
)
class RegioTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?regio-tv\.de/video/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'http://... |
import requests
import json
import feedparser
import datetime as dt
# class Weather():
weather_api_token = '05e9697d6d051b6c5073f673544b5418' # create account at https://darksky.net/dev/
weather_latg = 'nb' # see https://darksky.net/dev/docs/forecast for full list of latguage parameters values
weather_unit = 'si' # ... |
import faces.pcalendar as pcal
import openerp.tools as tools
import datetime
import sys
class TimeScale(object):
def __init__(self, calendar):
self.data_calendar = calendar
self._create_chart_calendar()
self.now = self.to_num(self.data_calendar.now)
def to_datetime(se... |
# -*- coding: utf-8 -*-
from observable import Observable
from flask import Blueprint, url_for
from twisted.web.resource import Resource
from txsockjs.utils import broadcast
from txsockjs.factory import SockJSResource
from .endpoint import Endpoint, EndpointProtocol, EndpointFactory
class SockJS(Observable):
def... |
"""Pushbullet platform for sensor component."""
import logging
import threading
from pushbullet import InvalidKeyError, Listener, PushBullet
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_API_KEY, CONF_MONITORED_CONDITIONS
import homeassistant... |
"""
Functions that modify an HTTP request or response in some way.
"""
# This group of functions are run as part of the response handling, after
# everything else, including all response middleware. Think of them as
# "compulsory response middleware". Be careful about what goes here, because
# it's a little fiddly to ... |
{
"name" : "Spanish - Accounting (PGCE 2008)",
"version" : "3.0",
"author" : "Spanish Localization Team",
'website' : 'https://launchpad.net/openerp-spain',
"category" : "Localization/Account Charts",
"description": """
Spanish Charts of Accounts (PGCE 2008).
====================================... |
from itertools import chain
import unittest
from robot.utils.asserts import assert_equal, assert_raises_with_msg, assert_true
from robot.errors import DataError
from robot.result import Keyword, TestCase, TestSuite
from robot.result.configurer import SuiteConfigurer
SETUP = Keyword.SETUP_TYPE
TEARDOWN = Keyword.TEAR... |
"""Tests for view_inator route."""
import json
import random
from http import HTTPStatus
from urllib.parse import urlparse
from utils import from_datetime
def test_login_required(app):
"""Redirect to login if we're not logged in."""
rv = app.get("/view/uuid-goes-here/")
assert rv.status_code == HTTPStat... |
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint, getdate, cstr, flt, add_days
import datetime
from webnotes import _, ValidationError
from controllers.stock_controller import StockController
class SerialNoCannotCreateDirectError(ValidationError): pass
class SerialNoCannotCanno... |
import mock
from twisted.internet import defer
from twisted.trial import unittest
from buildbot.data import builds
from buildbot.data import resultspec
from buildbot.test import fakedb
from buildbot.test.fake import fakemaster
from buildbot.test.util import endpoint
from buildbot.test.util import interfaces
from buil... |
import percolation as P
__doc__ = "functions for analysis of text by isolated functionalities \
or analysis and rendering roadmaps"
def measureAll(authors_messages, sectorialized_agents):
"""Overall text analysis routine, uses all resources
Uses: P.text.aux.textFromAuthors()
P.text.aux.tex... |
import os
import sys
from nova import exception
from nova import test
from nova.tests.virt.disk.vfs import fakeguestfs
from nova.virt.disk import api as diskapi
from nova.virt.disk.vfs import guestfs as vfsguestfs
class VirtDiskTest(test.NoDBTestCase):
def setUp(self):
super(VirtDiskTest, self).setUp()
... |
from collections import namedtuple
from django.db import models
from django.db.models.signals import pre_save
from django.contrib.auth.models import User
from main.models import Arch, Repo
from main.utils import set_created_field
class PackageRelation(models.Model):
'''
Represents maintainership (or interest... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['stableinterface'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.cloudstack import (
AnsibleCloudStack,
cs_argument_spec,
cs_required_together,
)... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for Processing CheckValidity algorithm.
.. 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 l... |
# $Id: data.py,v 1.1 2013/07/10 02:25:44 paus Exp $
import FWCore.ParameterSet.Config as cms
process = cms.Process('FILEFI')
# import of standard configurations
process.load('Configuration/StandardSequences/Services_cff')
process.load('FWCore/MessageService/MessageLogger_cfi')
process.load('Configuration.StandardSeq... |
#!/usr/bin/env python
"""Tests for grr.parsers.windows_persistence."""
from grr.lib import rdfvalue
from grr.lib import test_lib
from grr.parsers import windows_persistence
class WindowsPersistenceMechanismsParserTest(test_lib.FlowTestsBaseclass):
def testParse(self):
parser = windows_persistence.WindowsPersi... |
# coding: utf-8
from __future__ import unicode_literals
import unittest
import os
import numpy as np
from pymatgen.phasediagram.entries import PDEntryIO
from pymatgen.phasediagram.pdmaker import PhaseDiagram
from pymatgen.phasediagram.plotter import PDPlotter, uniquelines, \
triangular_coord, tet_coord
module... |
import re
import threading
from pyfaf.common import FafError, log
from pyfaf.queries import get_debug_files
from pyfaf.rpm import unpack_rpm_to_tmp
from pyfaf.utils.proc import safe_popen
# Instance of 'RootLogger' has no 'getChildLogger' member
# Invalid name "log" for type constant
# pylint: disable-msg=C0103,E1103
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module description
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module is re-pack of some pickle utility functions.
- :func:`load_pk`: Load Python Object from Pickle file.
- :func:`dump_pk`: Dump Picklable Python Object to fil... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^render_to_response/$', views.render_to_response_view),
url(r'^render_to_response/multiple_templates/$', views.render_to_response_view_with_multiple_templates),
url(r'^render_to_response/request_context/$', views.render_to_response... |
import os
from Cocoa import *
import objc
import leases
FILENAME = '/var/db/dhcpd_leases'
def getLeases(fn):
if os.path.exists(fn):
lines = file(fn, 'U')
else:
lines = leases.EXAMPLE.splitlines()
return list(leases.leases(lines))
class TableModelAppDelegate (NSObject):
mainWindow = ob... |
"""Tests for tf.contrib.tensor_forest.ops.best_splits_op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow # pylint: disable=unused-import
from tensorflow.contrib.tensor_forest.python.ops import training_ops
from tensorflow.python.fram... |
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint, cstr, flt, nowdate
from webnotes.model.doc import Document
from webnotes.model.code import get_obj
from webnotes import msgprint
class DocType:
def __init__(self, doc, doclist):
self.doc = doc
self.doclist = doclist... |
BASE_URL = "http://www.thetvdb.com"
HEADERS = {
"Referer": BASE_URL,
}
API_URL = "%s/api" % BASE_URL
API_KEY = "1D62F2F90030C444"
LANG = "en"
def dom2dict(node):
ret = {}
for child in node:
if len(child):
ret.setdefault(child.tag.lower(), []).append(dom2dict(child))
else:
... |
"""
rsync home directories of active users only.
When rsyncing home directories of users across disks, it is extremely
helpful to only do so for users who have been recently active. The hub
API allows us to see who those users are, and we can rsync just their
home directories.
An environment variable 'JUPYTERHUB_ADMI... |
import unittest
from unittest.mock import patch
import requests_mock
from frontstage import app
from frontstage.exceptions.exceptions import IncorrectAccountAccessError
from tests.integration.mocked_services import (
conversation_list_json,
encoded_jwt_token,
message_json,
url_banner_api,
url_get_... |
from m5.SimObject import SimObject
from m5.params import *
from m5.proxy import *
class MipsISA(SimObject):
type = 'MipsISA'
cxx_class = 'MipsISA::ISA'
cxx_header = "arch/mips/isa.hh"
system = Param.System(Parent.any, "System this ISA object belongs to")
num_threads = Param.UInt8(1, "Maximum numb... |
from os.path import abspath, join, dirname
from pyvows import Vows, expect
from tornado_pyvows.context import TornadoHTTPContext
from thumbor.app import ThumborServiceApp
from thumbor.importer import Importer
from thumbor.config import Config
from thumbor.context import Context, ServerParameters
storage_path = abspa... |
"""
Test Custom Exceptions
"""
import ddt
from django.test import TestCase
from rest_framework import exceptions as drf_exceptions
import six
@ddt.ddt
class TestDictExceptionsAllowDictDetails(TestCase):
"""
Test that standard DRF exceptions can return dictionaries in error details.
"""
def test_drf_... |
from __future__ import unicode_literals
from collections import namedtuple
from django.db.backends.base.introspection import (
BaseDatabaseIntrospection, FieldInfo, TableInfo,
)
from django.utils.encoding import force_text
FieldInfo = namedtuple('FieldInfo', FieldInfo._fields + ('default',))
class DatabaseIntr... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
RangePanel.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
****************************... |
"""
Requirements file parsing
"""
from __future__ import absolute_import
import os
import re
import shlex
import optparse
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves import filterfalse
import pip
from pip.download import get_file_content
from pip.req.req_install import ... |
from distutils import log, dir_util
import os, sys
from setuptools import Command
from setuptools import namespaces
from setuptools.archive_util import unpack_archive
import pkg_resources
class install_egg_info(namespaces.Installer, Command):
"""Install an .egg-info directory for the package"""
description ... |
"""
Musical Instrument Digital Interface (MIDI) audio file parser.
Documentation:
- Standard MIDI File Format, Dustin Caldwell (downloaded on wotsit.org)
Author: Victor Stinner
Creation: 27 december 2006
"""
from hachoir_parser import Parser
from hachoir_core.field import (FieldSet, Bits, ParserError,
String, U... |
"""
* Copyright 2007,2008,2009 John C. Gunther
* Copyright (C) 2009 Luke Kenneth Casson Leighton <<EMAIL>>
*
* 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/... |
# pylint: skip-file
def main():
'''
ansible git module for cloning
'''
module = AnsibleModule(
argument_spec=dict(
state=dict(default='present', type='str', choices=['present']),
dest=dict(default=None, required=True, type='str'),
repo=dict(default=None, requ... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
qgsfunction.py
---------------------
Date : May 2018
Copyright : (C) 2018 by Denis Rouzaud
Email : <EMAIL>
**********************************************... |
from importlib import import_module
from django.utils.version import get_docs_version
def deconstructible(*args, **kwargs):
"""
Class decorator that allow the decorated class to be serialized
by the migrations subsystem.
Accepts an optional kwarg `path` to specify the import path.
"""
path =... |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2008 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
h... |
"""
Scheduler base class that all Schedulers should inherit from
"""
import sys
from nova.compute import api as compute_api
from nova.compute import power_state
from nova.compute import rpcapi as compute_rpcapi
from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova import db
from... |
"""Test cases for Zinnia's sitemaps"""
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from tagging.models import Tag
from zinnia.models import Entry
from zinnia.models import Author
from zinnia.models import Category
from zinnia.managers impor... |
from django.contrib import admin
from taiga.projects.attachments.admin import AttachmentInline
from . import models
class TaskAdmin(admin.ModelAdmin):
list_display = ["project", "milestone", "user_story", "ref", "subject",]
list_display_links = ["ref", "subject",]
list_filter = ["project"]
# inlines... |
import os
import sys
from oslo_config import cfg
path_opts = [
cfg.StrOpt('pybasedir',
default=os.path.abspath(os.path.join(os.path.dirname(__file__),
'../')),
help='Directory where the nova python module is installed'),
cfg.Str... |
import sys
sys.path.insert(0, "../")
import unittest
from dip.typesystem import DNull, DBool, DInteger, DString, DList
from dip.parser import DipperParser
from dip.compiler import FrameCompiler
from dip.interpreter import VirtualMachine
from dip.namespace import Namespace
class TestCompiler(unittest.TestC... |
# -*- coding: utf-8 -*-
import base64
import functools
import hashlib
import logging
import os
import random
import re
import string
import time
import urllib
import flask
from M2Crypto import RSA
import requests
from docker_registry.core import compat
json = compat.json
from . import storage
from .lib import confi... |
"""Add response options to task group tasks
Revision ID: 4dd3191323da
Revises: 4c6ce142b434
Create Date: 2014-09-03 22:28:05.079477
"""
# revision identifiers, used by Alembic.
revision = '4dd3191323da'
down_revision = '4c6ce142b434'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, c... |
import os
import httplib2
import base64
import logging
import argparse
import re
import time
from sys import argv
from apiclient import discovery
from apiclient.http import MediaFileUpload
from AutoUploaderGoogleDrive.auth import Authorize
from AutoUploaderGoogleDrive.settings import *
from AutoUploaderGoogleDrive.t... |
from datetime import date
from django.forms import DateInput
from django.test import override_settings
from django.utils import translation
from .base import WidgetTest
class DateInputTest(WidgetTest):
widget = DateInput()
def test_render_none(self):
self.check_html(self.widget, 'date', None, html=... |
from datetime import datetime, timedelta
import gevent
import pytest
import time
from volttron.platform.agent import utils
DEBUGGER_CONFIG = {
"agent": {
"exec": "simulationclockagent-1.0-py2.7.egg --config \"%c\" --sub \"%s\" --pub \"%p\""
},
"agentid": "simulationclock",
}
@pytest.fixture(scop... |
#!/usr/bin/env python
from setuptools import setup
from io import open
# read the contents of your README file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='qbatch',
... |
from decimal import Decimal
from numbers import Number
from django.forms import DecimalField
class PercentageField(DecimalField):
MULTIPLIER = Decimal(100)
def prepare_value(self, value):
# Percentage values are 0..1 in database, so multiply by 100
if value is not None and isinstance(value, ... |
import asyncio
import re
from cloudbot import hook
@asyncio.coroutine
@hook.command("groups", "listgroups", "permgroups", permissions=["permissions_users"], autohelp=False)
def get_permission_groups(conn):
"""- lists all valid groups
:type conn: cloudbot.client.Client
"""
return "Valid groups: {}".fo... |
from cStringIO import StringIO
from twisted.python import failure
import html
import resource
import linecache
import string, re
import types
def redirectTo(URL, request):
request.redirect(URL)
return """
<html>
<head>
<meta http-equiv=\"refresh\" content=\"0;URL=%(url)s\">
</head>
<bo... |
"""
Standard container-class for easy multiple-inheritance.
Try to inherit from the ndarray instead of using this class as this is not
complete.
"""
from __future__ import division, absolute_import, print_function
from numpy.core import (
array, asarray, absolute, add, subtract, multiply, divide,
remainder, p... |
'''Finds and reads polyglot yaml tests (preferring the python tests),
normalizing their quirks into something that can be translated in a
sane way.
The idea is that this file contains nothing Go specific, so could
potentially be used to convert the tests for use with other drivers.
'''
import os
import sys
import os.... |
# -*- coding: utf-8 -*-
"""
flask.testing
~~~~~~~~~~~~~
Implements test support helpers. This module is lazily imported
and usually not used in production environments.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import werkzeug
from contextlib im... |
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tables
from horizon import workflows
from openstack_dashboard import api
from openstack_dashboard.dashboards.admin.flavors \
import tables as project_tables... |
from nova.api.validation import parameter_types
domain_entry_update = {
'type': 'object',
'properties': {
'domain_entry': {
'type': 'object',
'properties': {
'scope': {
'type': 'string',
'enum': ['public', 'private'],
... |
''' unit tests ONTAP Ansible module: na_ontap_lun_map '''
from __future__ import print_function
import json
import pytest
from units.compat import unittest
from units.compat.mock import patch
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
import ansible.module_utils.netapp as n... |
#! /usr/bin/env python3
# Read #define's and translate to Python code.
# Handle #include statements.
# Handle #define macros with one argument.
# Anything that isn't recognized or doesn't translate into valid
# Python is ignored.
# Without filename arguments, acts as a filter.
# If one or more filenames are given, ou... |
# camera streaming algorithm showing state of FSM
import time
import cv2 as opencv
import numpy as np
from naoqi import ALProxy, ALBroker, ALModule
from vision_definitions import kVGA, kBGRColorSpace
import ConfigParser, argparse
# function for getting video stream from nao camera
def nao_image_getter(alvideoproxy, ... |
from tools.docco.rl_doc_utils import *
#begin chapter oon paragraphs
heading1("Paragraphs")
disc("""
The $reportlab.platypus.Paragraph$ class is one of the most useful of the Platypus $Flowables$;
it can format fairly arbitrary text and provides for inline font style and colour changes using
an XML style markup. The o... |
# Patches openid's Consumer to function with Google Apps.
#
# Google Apps returns claimed_id values according to a working draft, but these
# are not part of the current 2.0 specification.
#
# See also:
# https://github.com/openid/python-openid/pull/39
# https://sites.google.com/site/oauthgoog/fedlogininterp/openiddisc... |
from openerp.tests.common import TransactionCase
from openerp.models import BaseModel
from datetime import date
class Base_Test_passport(TransactionCase):
"""
Simple test creating a passport
This is a base class for passport test cases.
Inherit from this and setup values.
"""
def setUp(self,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.