content
stringlengths
4
20k
from openid.extensions import sreg from openid.message import NamespaceMap, Message, registerNamespaceAlias from openid.server.server import OpenIDRequest, OpenIDResponse import unittest class SRegURITest(unittest.TestCase): def test_is11(self): self.failUnlessEqual(sreg.ns_uri_1_1, sreg.ns_uri) class Ch...
# -*- coding: utf-8 -*- from lxml import objectify import urlparse import openerp from openerp.addons.payment.models.payment_acquirer import ValidationError from openerp.addons.payment.tests.common import PaymentAcquirerCommon from openerp.addons.payment_buckaroo.controllers.main import BuckarooController from opener...
"""Constants/functions for interpreting results of os.stat() and os.lstat(). Suggested usage: from stat import * """ # XXX Strictly spoken, this module may have to be adapted for each POSIX # implementation; in practice, however, the numeric constants used by # stat() are almost universal (even for stat() emulations ...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'network'} from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, run_commands from ansible.module_utils.basic import AnsibleModule def checkpoint(filename, module): comm...
""" sentry.models.activity ~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from django.conf import settings from django.core.urlresolvers import reverse from django.db import mode...
# coding=utf-8 """ The NetAppCollector collects metric from a NetApp installation using the NetApp Manageability SDK. This allows access to many metrics not available via SNMP. For this to work you'll the SDK available on the system. This module has been developed using v5.0 of the SDK. As of writing the SDK can be f...
""" Serializers for all Course Enrollment related return objects. """ import logging from rest_framework import serializers from course_modes.models import CourseMode from student.models import CourseEnrollment log = logging.getLogger(__name__) class StringListField(serializers.CharField): """Custom Serialize...
"""Main entry point""" import optparse import os import shlex import shutil import sys import tempfile try: import configparser except ImportError: # pragma: nocover import ConfigParser as configparser from cram._cli import runcli from cram._encoding import b, fsencode, stderrb, stdoutb from cram._run import...
# -*- coding: utf-8 -*- """ Common type definitions and constants for edx-dl """ from collections import namedtuple # The next four named tuples represent the structure of courses in edX. The # structure is: # # * A Course contains Sections # * Each Section contains Subsections # * Each Subsection contains Units # ...
__all__ = [ 'get_task', 'unpack_task_input', 'set_base_image_properties', 'validate_location_uri', 'get_image_data_iter', ] from oslo_log import log as logging from six.moves import urllib from glance.common import exception from glance import i18n LOG = logging.getLogger(__name__) _ = i18n._ _...
import re def test_textgenerator(): from cloudbot.util.textgen import TextGenerator generator = TextGenerator( [ '{thing} is {stuff}' ], { 'thing': ['a', 'b'], 'stuff': [ 'c', ('d', 2), ] } ) ...
"""Base Command class, and related routines""" from __future__ import absolute_import import logging import os import sys import optparse import warnings from pip import cmdoptions from pip.locations import running_under_virtualenv from pip.download import PipSession from pip.exceptions import (BadCommand, Installati...
import os from wb import preprocess, home_fn, autogen, dict_def def main(config): preprocess(config, in_fn=home_fn('tap-win32/SOURCES.in'), out_fn=home_fn('tap-win32/SOURCES'), quote_begin='@@', quote_end='@@', head_comment='# %s\n...
import sys from weboob.capabilities.housing import ICapHousing, Query from weboob.tools.application.repl import ReplApplication, defaultcount from weboob.tools.application.formatters.iformatter import IFormatter, PrettyFormatter __all__ = ['Flatboob'] class HousingFormatter(IFormatter): MANDATORY_FIELDS = ('id...
""" gettext for openstack-common modules. Usual usage in an openstack.common module: from openstack_dashboard.openstack.common.gettextutils import _ """ import copy import gettext import logging.handlers import os import UserString _localedir = os.environ.get('openstack_dashboard'.upper() + '_LOCALEDIR') _t = g...
from django.core.management.color import no_style from django.core.management.sql import custom_sql_for_model from django.db import connections, DEFAULT_DB_ALIAS from django.test import TestCase from django.test.utils import override_settings from .models import Simple class InitialSQLTests(TestCase): """ Th...
"""Test code for space to batch""" import numpy as np import tvm from tvm import te from tvm import topi import tvm.testing import tvm.topi.testing def verify_space_to_batch_nd(input_shape, block_shape, pad_before, pad_after, pad_value=0): out_shape = [] out_shape.append(int((input_shape[0] * np.prod(block_sh...
import errno import os import shutil import tempfile import time import chainer from chainer.training import extension from chainer.utils import experimental def create_multi_node_checkpointer(name, comm, cp_interval=5, gc_interval=5, path=None): '''Create multi-node checkpoint...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Module description ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module offer high performance and memory efficient looping toolset. Usually we process elements one at a time rather than bringing the whole iterable into memory al...
""" Unit tests for course tools. """ import crum import datetime from mock import patch from nose.plugins.attrib import attr import pytz from django.test import RequestFactory from course_modes.models import CourseMode from course_modes.tests.factories import CourseModeFactory from courseware.course_tools import Ver...
""" ============================================== Scaling the regularization parameter for SVCs ============================================== The following example illustrates the effect of scaling the regularization parameter when using :ref:`svm` for :ref:`classification <svm_classification>`. For SVC classificati...
import time import logging log = logging.getLogger(__name__) class NeedRegenerationException(Exception): """An exception that when raised in the 'with' block, forces the 'has_value' flag to False and incurs a regeneration of the value. """ NOT_REGENERATED = object() class Lock(object): """Dogpi...
import unittest import records.person class TestRecordPerson(unittest.TestCase): def setUp(self): pass def test_typical_passwd_entry(self): instance = records.person.produce("bunny:8XvAVu/sWGcZQ:1344:504:Bugs Bunny,,,:/home/bbugs:/bin/bash") self.assertEqual(instance.username, "bunny...
""" A driver for devices running Juniper ERX OS. """ import re from Exscript.protocols.drivers.driver import Driver from Exscript.protocols.drivers.ios import _prompt_re _user_re = [re.compile(r'[\r\n]User: $')] _password_re = [re.compile(r'[\r\n](Telnet password:|Password:) $')] _junos_re = re.compile(r'\bJ...
""" Support for Waterfurnace. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.waterfurnace/ """ from homeassistant.components.sensor import ENTITY_ID_FORMAT from homeassistant.components.waterfurnace import ( DOMAIN as WF_DOMAIN, UPDATE_TOPIC ...
""" Verifies that a rule that generates multiple outputs rebuilds correctly when the inputs change. """ import TestGyp test = TestGyp.TestGyp(workdir='workarea_default') test.run_gyp('same_target.gyp', chdir='src') test.relocate('src', 'relocate/src') test.build('same_target.gyp', chdir='relocate/src') expect = ...
""" sentry.tasks.options ~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from datetime import timedelta from django.utils import timezone from sentry.models import Option from sent...
from mitmproxy import contentviews from mitmproxy.net import http from mitmproxy.utils import strutils from . import base class ViewAuto(base.View): name = "Auto" def __call__(self, data, **metadata): headers = metadata.get("headers", {}) ctype = headers.get("content-type") if data an...
def split_entry(entry): ''' splits entry and ensures normalized return''' a = entry.split(':') d = None if entry.lower().startswith("d"): d = True a.pop(0) if len(a) == 2: a.append(None) t, e, p = a t = t.lower() if t.startswith("u"): t = "user" e...
import sys import os from os import path import time import datetime import argparse import subprocess TOP_DIR = path.join("..", "..") GUARD_TIME = 20 SUMMARY_OUTPUT = "summary.txt" def get_command(layout_thread_count, renderer, page, profile): """Get the command to execute. """ return path.join(TOP_DIR,...
import logging from datetime import datetime, timedelta from string import Template import matplotlib.dates as mdates import numpy import pkg_resources import svgwrite as svg from matplotlib import pyplot from .conditions import Conditions from .objects.messier import Messier from .objects.planets import Planets from...
import requests from bs4 import BeautifulSoup import sys import numpy as np # then add this function lower down from memory_profiler import profile import pandas as pd from sortedcontainers import SortedDict import datetime import bs4 # TODO # http://www.meilleursagents.com/immobilier/recherche/?item_types%5B%5D=3696...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'core'} DOCUMENTATION = r''' module: win_domain short_description: Ensures the existence of a Windows domain version_added: 2.3 description: - Ensure that the domain named by C(dns_domain_name)...
from django.conf.urls import patterns, url from .views import ( picturegallery, dashboard, events, approvals, suggestions, vidly_media, comments, loggedsearches, users, groups, channels, locations, regions, templates, topics, tags, recruitmentmessages...
import sys import pretend from pip.utils import appdirs class TestUserCacheDir: def test_user_cache_dir_win(self, monkeypatch): @pretend.call_recorder def _get_win_folder(base): return "C:\\Users\\test\\AppData\\Local" monkeypatch.setattr( appdirs, "...
import subprocess import os import sys from openerp import report import tempfile import time import logging from functools import partial from report_helper import WebKitHelper import openerp from openerp.modules.module import get_module_resource from openerp.report.report_sxw import * from openerp import tools from ...
from PyQt4 import QtGui, QtCore #PyFRAP GUI classes import pyfrp_gui_basics #PyFRAP modules from pyfrp.modules.pyfrp_term_module import * from pyfrp.modules import pyfrp_img_module from pyfrp.modules import pyfrp_misc_module #Numpy/Scipy import numpy as np #Misc import os #=======================================...
""" Plugins folder for the WinAppDbg interactive debugger. """ __revision__ = "$Id: __init__.py 1125 2012-10-22 14:54:39Z qvasimodo $"
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import distutils.spawn import os import os.path import subprocess import traceback from ansible import constants as C from ansible.errors import AnsibleError from ansible.module_utils.six.moves import shlex_quote from ansible.modu...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } from traceback import format_exc from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.digit...
# encoding: utf-8 # Thomas Nagy, 2008-2010 (ita) """ Execute the tasks with gcc -MD, read the dependencies from the .d file and prepare the dependency calculation for the next run """ import os, re, threading import Task, Logs, Utils, preproc from TaskGen import before, after, feature lock = threading.Lock() prepro...
#!/usr/bin/env python """ @package mi.dataset.driver.ctdmo_ghqr.imodem @file mi-dataset/mi/dataset/driver/ctdmo_ghqr/imodem/ctdmo_ghqr_imodem_telemetered_driver.py @author Mark Worden @brief Driver for the ctdmo_ghqr_imodem instrument Release notes: Initial Release """ from mi.dataset.dataset_parser import DataSetD...
from django.http import HttpResponse, JsonResponse from django.template import loader from django.utils import timezone from django.utils.cache import patch_response_headers import requests from dashboard.models import Bounty from git.utils import get_user, org_name from PIL import Image, ImageDraw, ImageFont from rat...
import xml.etree.ElementTree as etree import re import array import struct import math import logging def natural_sort(l): convert = lambda text: int(text) if text.isdigit() else text.lower() alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ] return sorted(l, key = alpha...
from __future__ import unicode_literals try: from urllib.parse import urlencode except: from urllib import urlencode import format import hashlib def get_url(email, size=20): md5hash = hashlib.md5(email.encode("utf-8").lower().strip()).hexdigest() base_url = "https://www.gravatar.com/avatar/" + md5hash params = N...
import numpy as np from scipy.linalg import block_diag from scipy.sparse import csr_matrix from scipy.special import psi from sklearn.decomposition import LatentDirichletAllocation from sklearn.decomposition._online_lda import (_dirichlet_expectation_1d, _dirichlet_expect...
from bokeh.models import StaticLayoutProvider, ColumnDataSource, HoverTool, TapTool from bokeh.models.graphs import NodesAndLinkedEdges from bokeh.palettes import Set3_12 from bokeh.plotting import figure, show, output_file from bokeh.sampledata.us_states import data as us_states from bokeh.sampledata.airport_routes im...
""" Validator project admin.py Copyright (c) 2009 Brian Shumate Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,...
import unittest import mock from pulp.bindings.upload import UploadAPI class TestUploadAPI(unittest.TestCase): def setUp(self): self.api = UploadAPI(mock.MagicMock()) def test_import_upload_with_override_config(self): ret = self.api.import_upload('upload_id', 'repo_id', 'unit_type_id', unit...
""" The CustomPermissionsUser users email as the identifier, but uses the normal Django permissions model. This allows us to check that the PermissionsMixin includes everything that is needed to interact with the ModelBackend. """ from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin from django.db ...
# -*- 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): # Deleting field 'Template.template' db.delete_column('popcorn_template', 'template') def backwards(se...
from .product_properties import ProductProperties from .product import Product from .operation_result import OperationResult from .paging_get_multiple_pages_options import PagingGetMultiplePagesOptions from .paging_get_odata_multiple_pages_options import PagingGetOdataMultiplePagesOptions from .paging_get_multiple_page...
"""Native adapter for serving CherryPy via its builtin server.""" import logging try: from cStringIO import StringIO except ImportError: from StringIO import StringIO import cherrypy from cherrypy._cperror import format_exc, bare_error from cherrypy.lib import httputil from cherrypy import wsgiserver class ...
from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import flt, cstr from frappe.model.mapper import get_mapped_doc from frappe.model.document import Document class VehicleLog(Document): def validate(self): if flt(self.odometer) < flt(self.last_odometer): frappe.throw(_("...
import sys import operator import functools try: import builtins except ImportError: import __builtin__ as builtins PY2 = sys.version_info[0] == 2 _identity = lambda x: x if PY2: unichr = unichr text_type = unicode string_types = (str, unicode) integer_types = (int, long) int_to_byte = c...
from datetime import date from django.conf import settings from django.utils.http import int_to_base36, base36_to_int from django.utils.crypto import constant_time_compare, salted_hmac from django.utils import six from seahub.base.models import UserLastLogin class PasswordResetTokenGenerator(object): """ Stra...
from __future__ import unicode_literals import argparse import difflib import sys from operator import itemgetter from .base import ( NoCommandError, UnknownCommandError, UnrecognizedArgumentError, ) class CommandFormatter(argparse.HelpFormatter): """Custom formatter to format just a subcommand."""...
from django.urls import NoReverseMatch from django.db import models from olympia import activity, amo from olympia.amo.fields import PositiveAutoField from olympia.amo.models import ManagerBase, ModelBase from olympia.amo.urlresolvers import reverse class TagManager(ManagerBase): def not_denied(self): "...
# -*- 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 'CourseSoftware' db.create_table('licenses_coursesoftware', ( ('id', self.gf('dja...
# CER encoder from pyasn1.type import univ from pyasn1.codec.ber import encoder from pyasn1.compat.octets import int2oct, null class BooleanEncoder(encoder.IntegerEncoder): def encodeValue(self, encodeFun, client, defMode, maxChunkSize): if client == 0: substrate = int2oct(0) else: ...
# -*- coding: utf-8 -*- import time import re import urlparse from ..internal.misc import json from ..internal.XFSAccount import XFSAccount class UptoboxCom(XFSAccount): __name__ = "UptoboxCom" __type__ = "account" __version__ = "0.23" __status__ = "testing" __description__ = """Uptobox.com acc...
# coding: UTF-8 """ Tests for support views. """ import itertools import json import re from datetime import datetime, timedelta import ddt import pytest from django.contrib.auth.models import User from django.urls import reverse from django.db.models import signals from nose.plugins.attrib import attr from pytz impo...
from django.conf import settings from django.contrib import admin from jinja2 import escape, Markup, contextfunction from jingo import register from allauth.utils import get_request_param from allauth.account.utils import user_display from allauth.socialaccount import providers from allauth.socialaccount.templatetags...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import ast import sys from six.moves import builtins from ansible import constants as C from ansible.plugins import filter_loader, test_loader def safe_eval(expr, locals={}, include_exceptions=False): ''' This is intende...
# tilt_buzzer.py # # This is an project using the Grove Switch, Buzzer and accelerometer from the GrovePi starter kit # # In this project, the buzzer starts making a sound when the accelerometer is held perpendicular and the Switch is on ''' ## License The MIT License (MIT) GrovePi for the Raspberry Pi: an open sou...
#!/usr/bin/env python """ Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ import re from lib.core.common import randomRange from lib.core.data import kb from lib.core.enums import PRIORITY __priority__ = PRIORITY.NORMAL def dependencies(): pa...
""" QoS Specs interface. """ from cinderclient import base class QoSSpecs(base.Resource): """QoS specs entity represents quality-of-service parameters/requirements. A QoS specs is a set of parameters or requirements for quality-of-service purpose, which can be associated with volume types (for now). In...
from nova import db from nova import objects from nova.objects import base from nova.objects import fields # TODO(berrange): Remove NovaObjectDictCompat @base.NovaObjectRegistry.register class DNSDomain(base.NovaPersistentObject, base.NovaObject, base.NovaObjectDictCompat): # Version 1.0: Initial ...
# coding=utf-8 """InaSAFE Wizard Step Classifications.""" # noinspection PyPackageRequirements from PyQt4 import QtCore from PyQt4.QtGui import QListWidgetItem from safe.utilities.i18n import tr from safe import messaging as m from safe.common.exceptions import InvalidWizardStep from safe.definitions.layer_purposes ...
"""The backups api.""" from oslo_log import log as logging import webob from webob import exc from cinder.api import common from cinder.api import extensions from cinder.api.openstack import wsgi from cinder.api.views import backups as backup_views from cinder.api import xmlutil from cinder import backup as backupAPI...
""" <name>Select Attributes</name> <description>Manual selection of attributes.<br>Aside from a data set with the selected attributes, the widget also outputs an "Attribute List" which can be used with another "Select Attribute" widget to make the same variable selection</description> <icon>icons/SelectAttributes.png</...
import re import sys from xml.etree import ElementTree as etree from mapproxy.util.ext.wmsparse.util import resolve_ns from mapproxy.util.py import reraise_exception from .exceptions import CapabilitiesError class WMTSCapabilities(object): _default_namespace = 'http://www.opengis.net/wmts/1.0' _namespaces ...
import attendance_errors # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
""" tap2deb creates Debian packages which wrap .tap files. """ import os import sys import shutil import subprocess from email.utils import formatdate as now from twisted.python import usage from twisted.python.filepath import FilePath class MyOptions(usage.Options): optFlags = [["unsigned", "u"]] optParame...
from __future__ import absolute_import, unicode_literals import unittest import pykka from mopidy import core from mopidy.internal import deprecation from mopidy.mpd.dispatcher import MpdDispatcher from mopidy.mpd.exceptions import MpdAckError from tests import dummy_backend class MpdDispatcherTest(unittest.TestC...
"""Create a gobject constructor object for a specific combination of property name using g_object_new. Compared to g_object_newv, this saves us two function calls per parameter. """ from .backend import get_backend from .utils import CodeBlock from pgi.clib.gir import GITypeTag, GIInfoType from pgi.util import unesc...
import logging log = logging.getLogger("Thug") class Sidebar(object): def __init__(self): self._providers = set() self._engines = set() self._favorites = set() self._generators = set() def addMicrosummaryGenerator(self, generatorURL): self._generators.add(generato...
from __future__ import absolute_import import logging __all__ = [ 'ExtraLogFormatter' ] class ExtraLogFormatter(logging.Formatter): """ Custom log formatter which attaches all the attributes from the "extra" dictionary which start with an underscore to the end of the log message. For example: ...
from sources import * from content import * from utils import * ################################################################ ## ## FORMATTER CLASS ## class Formatter: def __init__( self, processor ): self.processor = processor self.identifiers = {} self.chapters = processor....
"""Support for Wink fans.""" import pywink from homeassistant.components.fan import ( SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM, SUPPORT_DIRECTION, SUPPORT_SET_SPEED, FanEntity, ) from . import DOMAIN, WinkDevice SPEED_AUTO = "auto" SPEED_LOWEST = "lowest" SUPPORTED_FEATURES = SUPPORT_DIRECTION + S...
""" Implementation referenced from https://github.com/handcraftsman/GeneticAlgorithmsWithPython/blob/master/ch02/genetic.py """ import random from qutip import * import numpy as np import pandas as pd from functools import reduce import datetime import time import pickle import copy # QUTIP NOTES # hadamard = "SNOT"...
from django.db import connection, models from south.db import generic class DatabaseOperations(generic.DatabaseOperations): """ PsycoPG2 implementation of database operations. """ backend_name = "postgres" def rename_column(self, table_name, old, new): if old == new: # Sh...
import datetime, time from django.http import Http404 from django.db.models import Sum from django.template import RequestContext from django.contrib.auth.models import User from django.shortcuts import render_to_response from timesheet.models import Timesheet def week_archive(request, username, year, week, templat...
#!/usr/bin/env python3 # 6/27/2019 # Use away if this is somehow relevant to ya import os import subprocess import shutil import stat # Install required packages via yum def install_packages(): package_list = ['python3-pip', 'gcc', 'git', 'python3-dev',...
""" django-guardian helper functions. Functions defined within this module should be considered as django-guardian's internal functionality. They are **not** guaranteed to be stable - which means they actual input parameters/output type may change in future releases. """ import os import logging from django.conf impor...
#!/usr/bin/env python import unittest import sys import os.path import SocketServer import threading import socket import signal from copy import copy sys.path.append(os.path.dirname(__file__) + "/../../..") from pox.lib.epoll_select import EpollSelect class TCPEcho(SocketServer.StreamRequestHandler): def handle...
# -*- coding: utf-8 -*- """ *************************************************************************** QgisAlgorithmProvider.py --------------------- Date : December 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ***************...
# -*- coding: utf_8 -*- # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # Crypto Key Database import os import sqlite3 import shutil import uuid import random import base64 import Crypto.PublicKey.RSA import Crypto.Random.random import Crypto.Cipher.PKCS1_OAEP import Crypto.Hash.SHA256 # increment keydb_ver...
from django.conf import settings from django.conf.urls import url from django.contrib import admin, messages from django.contrib.admin.options import IS_POPUP_VAR from django.contrib.admin.utils import unquote from django.contrib.auth import update_session_auth_hash from django.contrib.auth.forms import ( AdminPass...
# -*- coding: utf-8 -*- from datetime import datetime import freezegun import pytest from almost_equal import datetime_almost_equal from astral.geocoder import database, lookup from astral.location import Location from astral.sun import adjust_to_horizon, adjust_to_obscuring_feature, sunrise class TestE...
from odoo import api, fields, models, tools class L10nInExemptedReport(models.Model): _name = "l10n_in.exempted.report" _description = "Exempted Gst Supplied Statistics" _auto = False account_move_id = fields.Many2one('account.move', string="Account Move") partner_id = fields.Many2one('res.partne...
import sys from testrunner import run def testfunc(child): child.expect_exact(u"Calling test_sock_udp_create__EADDRINUSE()") child.expect_exact(u"Calling test_sock_udp_create__EAFNOSUPPORT()") child.expect_exact(u"Calling test_sock_udp_create__EINVAL_addr()") child.expect_exact(u"Calling test_sock_udp...
import os import subprocess import re import locale import logging import sys logger = logging.getLogger(__name__) def convert_time(raw): # Converts raw time to 'hh:mm:ss' with leading zeros as appropriate h, m, s = ['%02d' % c for c in (raw / 3600, (raw % 3600) / 60, raw % 60)] if h == '00': if...
from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * class BIP65Test(BitcoinTestFramework): def __init__(self): super().__init__() self.num_nodes = 3 self.setup_clean_chain = False def setup_network(self): self.nodes = [] self...
from rest_framework.compat import django_filters FilterSet = django_filters and django_filters.FilterSet or None class BaseFilterBackend(object): """ A base class from which all filter backend classes should inherit. """ def filter_queryset(self, request, queryset, view): """ Return ...
""" Adding hooks before/after saving and deleting To execute arbitrary code around ``save()`` and ``delete()``, just subclass the methods. """ from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class Person(...
import datetime import mock from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api from neutron.common import utils from neutron.db import agents_db from neutron.openstack.common import timeutils from neutron.tests import base class TestDhcpAgentNotifyAPI(base.BaseTestCase): def setUp(self): supe...
#@+leo-ver=5-thin #@+node:office.20150407074720.1: * @file gear.py #@@language python #@@tabwidth -4 #@+<<declarations>> #@+node:office.20150407074720.2: ** <<declarations>> (application) #@@language python import cherrypy import os import sys # 這個程式要計算正齒輪的齒面寬, 資料庫連結希望使用 pybean 與 SQLite # 導入 pybean 模組與所要使用的 Store 及 S...
"""Test Z-Wave sensor.""" from homeassistant.components.zwave import const, sensor import homeassistant.const from tests.mock.zwave import ( MockNode, MockValue, MockEntityValues, value_changed) def test_get_device_detects_none(mock_openzwave): """Test get_device returns None.""" node = MockNode() val...
""" Data migration creation command """ import sys import os import re from optparse import make_option try: set except NameError: from sets import Set as set from django.core.management.base import BaseCommand from django.core.management.color import no_style from django.db import models from django.conf im...