content
stringlengths
4
20k
class RabbitMqVhost(object): def __init__(self, module, name, tracing, node): self.module = module self.name = name self.tracing = tracing self.node = node self._tracing = False self._rabbitmqctl = module.get_bin_path('rabbitmqctl', True) def _exec(self, args, r...
from cinder import exception from cinder.i18n import _ from cinder.openstack.common import log as logging from cinder import quota LOG = logging.getLogger(__name__) QUOTAS = quota.QUOTAS def get_volume_type_reservation(ctxt, volume, type_id): # Reserve quotas for the given volume type try: reserve_o...
from xml.dom.minidom import parse, Element, Node INPUT="map.svg" OUTPUT="web/map.svg" doc = parse(INPUT) svgroot=doc.getElementsByTagName('svg')[0] connectorsElement = None countriesElement = None for child in svgroot.childNodes: if (child.nodeType == Node.ELEMENT_NODE) and (child.nodeName == "g"): attrid...
"""Language Negotiator $Id: negotiator.py 26559 2004-07-15 21:22:32Z srichter $ """ from zope.i18n.interfaces import INegotiator from zope.i18n.interfaces import IUserPreferredLanguages from zope.interface import implements def normalize_lang(lang): lang = lang.strip().lower() lang = lang.replace('_', '-') ...
import os import yaml import logging class Config: def __init__(self): self.logger = logging.getLogger("DNSWatch.Config") self.dnsprovider = None self.dnszone = None def read(self, config_file): self.logger.debug("Loading configuration from {}".format(config_file)) with...
import json import logging from sugar3.bundle.bundleversion import NormalizedVersion, InvalidVersionError from gi.repository import Gio from jarabe.model.update import BundleUpdate from jarabe.util.downloader import Downloader from jarabe import config class NewAsloUpdater(object): """ Checks for updates us...
import json import os.path from datetime import datetime from django.forms.models import model_to_dict from django.http import HttpResponse, FileResponse, HttpRequest from django.shortcuts import render, redirect from django.views.decorators.csrf import ensure_csrf_cookie from django.views.decorators.http import condi...
from __future__ import print_function from rdkit import RDConfig from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import FunctionalGroups from rdkit.Chem import rdChemReactions import os def PreprocessReaction(reaction,funcGroupFilename=os.path.join(RDConfig.RDDataDir,'Functional_Group_Hierarchy...
### EXPERIMENTAL PROTOTYPE ### # e = 2.7182818284590452353602874713526624977572 # pi = math.pi from __future__ import division #PYTHON Y U NO TELL ME THIS BEFORE import math import random import re e = "2.7182818284590452353602874713526624977572" pi = str(math.pi) global pre pre = len("maths ") def maths(inf...
from pybench import Test from string import join class ConcatStrings(Test): version = 2.0 operations = 10 * 5 rounds = 100000 def test(self): # Make sure the strings are *not* interned s = join(map(str,range(100))) t = join(map(str,range(1,101))) for i in xrange(self...
"""Tests for the lms module itself.""" import mimetypes from mock import patch from django.test import TestCase from django.core.urlresolvers import reverse from edxmako import add_lookup, LOOKUP from lms import startup from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.djan...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division from __future__ import print_function import cPickle import hashlib import hmac import os import struct import sys import configobj import simplejson as json import ruamel.yaml as yaml from Crypto.PublicKey import RSA from Crypto.Cipher im...
"""SCons.Tool.sunf95 Tool-specific initialization for sunf95, the Sun Studio F95 compiler. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20...
#!/usr/bin/env python from __future__ import absolute_import, print_function, unicode_literals import os import stat from optparse import OptionParser from django.core.management import ManagementUtility class bcolors: """ ANSI escape sequences for terminal colors """ HEADER = "\033[95m" OKBLUE...
from PySide import QtGui, QtCore from patchcorral.src.engine import mididevice import traceback ## # Base class for voice list widgets. class VoiceListWidget(QtGui.QWidget): ## Currently-assigned patchcorral.src.engine.mididevice.MIDIVoiceList object. voiceList = None class TableWidget(QtGui.QT...
import unittest from dnd_character import Character, modifier # Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0 class DndCharacterTest(unittest.TestCase): def test_ability_modifier_for_score_3_is_n4(self): self.assertEqual(modifier(3), -4) def test_ability_modifier_for_sco...
""" Internationalization support. """ from __future__ import unicode_literals from django.utils.encoding import force_text from django.utils.functional import lazy from django.utils import six __all__ = [ 'activate', 'deactivate', 'override', 'deactivate_all', 'get_language', 'get_language_from_request', ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'certified'} DOCUMENTATION = r''' --- module: aci_tenant_ep_retention_policy short_description: Manage End...
import numpy as np class SpikeEnv: def __init__(self, K = 4, L = 4, baseu = 0.5, gapu = 0.4, basev = 0.5, gapv = 0.4): self.K = K self.L = L self.ubar = baseu * np.ones(K) self.ubar[K // 2] += gapu self.vbar = basev * np.ones(L) self.vbar[L // 2] += gapv ...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import sys import json from contextlib import contextmanager from io import BytesIO, StringIO from ansible.compat.tests import unittest from ansible.module_utils.six import PY3 from ansible.module_utils._text import to_bytes @co...
import bisect import mmap import os import sys import tempfile import threading from . import context from . import reduction from . import util __all__ = ['BufferWrapper'] # # Inheritable class which wraps an mmap, and from which blocks can be allocated # if sys.platform == 'win32': import _winapi class ...
""" Copyright 2007-2011 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion 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...
from django.db import models from django.contrib.auth.models import User # Create your models here. class Petition(models.Model): user = models.ForeignKey(User) name = models.CharField(max_length=30, unique=True) domain = models.CharField(max_length=255, blank=True) email = models.EmailField(blank=Tru...
from pyfits import getheader import pyfits import os class HeaderException(Exception): pass ############## ### ALFOSC ### ############## def extractALFOSCHeader(file): """ Extract ALFOSC keywords from a fits file """ try: hdulist = pyfits.open(file) hdulist.close() if len(hdulist) == 2: ...
import threading from openerp.osv import osv, fields from openerp import tools, SUPERUSER_ID from openerp.tools.translate import _ from openerp.tools.mail import plaintext2html class mail_followers(osv.Model): """ mail_followers holds the data related to the follow mechanism inside OpenERP. Partners can c...
import calendar import time import yaml import datetime from itsdangerous import TimedSerializer from flask import (current_app, request, render_template, Blueprint, abort, jsonify, g, session, Response) from lever import get_joined from .models import (Transaction, OneMinuteShare, Block, Payout, B...
"""Source file annotation for Coverage.""" import os, re from coverage.report import Reporter class AnnotateReporter(Reporter): """Generate annotated source files showing line coverage. This reporter creates annotated copies of the measured source files. Each .py file is copied as a .py,cover file, with...
import ns.internet_apps import ns.core import ns.csma import ns.internet import ns.network def main(argv): cmd = ns.core.CommandLine(); cmd.Parse(argv); # Create nodes print ("Create nodes") n0 = ns.network.Node(); r = ns.network.Node(); n1 = ns.network.Node(); net1 = ns.network.Nod...
""" Tests for L{twisted.internet.stdio}. """ import os, sys, itertools from twisted.trial import unittest from twisted.python import filepath, log from twisted.python.runtime import platform from twisted.internet import error, defer, protocol, stdio, reactor from twisted.test.test_tcp import ConnectionLostNotifyingPr...
"""Generic utilities for C++ parsing.""" import sys # Set to True to see the start/end token indices. DEBUG = True def ReadFile(filename, print_error=True): """Returns the contents of a file.""" try: fp = open(filename) try: return fp.read() finally: fp.close(...
""" Models for displaying maps in Bokeh plots. """ from __future__ import absolute_import from ..core import validation from ..core.validation.warnings import MISSING_RENDERERS, NO_DATA_RENDERERS from ..core.validation.errors import REQUIRED_RANGE from ..core.properties import HasProps, abstract from ..core.propertie...
from django.core.urlresolvers import reverse from django.conf import settings from django.db import models from django.db.models.signals import post_save from django.dispatch import receiver from django.template.loader import render_to_string from django.utils import timezone from markupfield.fields import MarkupField...
"""A class to help start/stop a local apache http server.""" import logging import optparse import os import subprocess import sys import time import urllib import google.path_utils import google.platform_utils class HttpdNotStarted(Exception): pass def UrlIsAlive(url): """Checks to see if we get an http response...
# coding: utf-8 from __future__ import unicode_literals from datetime import datetime import io import logging import os from jinja2.exceptions import TemplateNotFound import jinja2 import json from mkdocs import nav, search, utils from mkdocs.relative_path_ext import RelativePathExtension import mkdocs log = loggi...
# -*- coding: utf-8 -*- """ test_emails ~~~~~~~~~~~ Email functionality tests """ import pytest from flask_security import Security from flask_security.forms import LoginForm, RegisterForm, ConfirmRegisterForm, \ SendConfirmationForm, PasswordlessLoginForm, ForgotPasswordForm, ResetPasswordForm, \ ...
from sqlalchemy.exc import IntegrityError from sqlalchemy.sql import asc from Core.config import Config from Core.paconf import PA from Core.db import session from Core.maps import Updates, Planet, Target from Core.loadable import loadable, route, require_user class book(loadable): """Book a target for attack. You...
# coding: utf-8 import string import pandas as pd import pandas.util.testing as tm import pandas.util._test_decorators as td import pytest from numpy.random import randn import pandas.tools.plotting as plotting from pandas.tests.plotting.common import TestPlotBase """ Test cases for plot functions imported from ...
""" Extends Yapsy IPlugin interface to pass information about the board to plugins. Fields of interest for plugins: args: list of arguments passed to the plugins sample_rate: actual sample rate of the board eeg_channels: number of EEG aux_channels: number of AUX channels If needed, plugins that need to repo...
""" Utility functions """ import bz2 import contextlib import functools import gzip import itertools import os import os.path import shutil import sys import time import tempfile from Bio import SeqIO def apply_df_status(func, df, msg=''): """ """ tmp_column = 'index_number' row_count = float(len(d...
from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * import base64 try: import http.client as httplib except ImportError: import httplib try: import urllib.parse as urlparse except ImportError: import urlparse class HTTPBasicsTest (BitcoinTestFramework): ...
"""SavedModel contrib support. SavedModel provides a language-neutral format to save machine-learned models that is recoverable and hermetic. It enables higher-level systems and tools to produce, consume and transform TensorFlow models. """ from __future__ import absolute_import from __future__ import division from _...
import socket, cgi, errno from mercurial import util from common import ErrorResponse, statusmessage, HTTP_NOT_MODIFIED shortcuts = { 'cl': [('cmd', ['changelog']), ('rev', None)], 'sl': [('cmd', ['shortlog']), ('rev', None)], 'cs': [('cmd', ['changeset']), ('node', None)], 'f': [('cmd', ['file']), ('f...
# -*- 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 model 'CourseRegistrationCode' db.delete_table('student_courseregistrationcode') def backwa...
from pyblish import api from pyblish_bumpybox import inventory class ValidateOutputRange(api.InstancePlugin): """Validate the output range of the task. This compares the output range and clip associated with the task, so see whether there is a difference. This difference indicates that the user has s...
""" Test Custom Exceptions """ import ddt from django.test import TestCase from nose.plugins.attrib import attr from rest_framework import exceptions as drf_exceptions from .. import exceptions @attr('shard_2') @ddt.ddt class TestDictExceptionsAllowDictDetails(TestCase): """ Standard DRF exceptions coerce de...
_verbose = True import math from gnuradio import gr, gru, op25 as _op25 try: from gnuradio import fsk4 # LEGACY if _verbose: print "Imported legacy fsk4" except: pass SYMBOL_DEVIATION = 600 SYMBOL_RATE = 4800 class op25_fsk4(gr.hier_block2): def __init__(self, channel_rate, auto_tune_msgq=...
import os import math from numpy.testing import * from numpy import array import util def _path(*a): return os.path.join(*((os.path.dirname(__file__),) + a)) class TestSizeSumExample(util.F2PyTest): sources = [_path('src', 'size', 'foo.f90'), ] @dec.slow def test_all(self): r...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from sklearn import datasets, metrics from sklearn.cross_validation import train_test_split import tensorflow as tf iris = datasets.load_iris() X_train, X_test, y_train, y_test = train_test_split(iris.data, ...
import copy import sys import datetime import traceback import re import shlex import os # Dict of options and their defaults OPTIONS = {'chdir': None, 'creates': None, 'executable': None, 'NO_LOG': None, 'removes': None, 'warn': True, } # This is a pr...
from sqlalchemy.dialects.mssql import base, pyodbc, adodbapi, \ pymssql, zxjdbc, mxodbc base.dialect = pyodbc.dialect from sqlalchemy.dialects.mssql.base import \ INTEGER, BIGINT, SMALLINT, TINYINT, VARCHAR, NVARCHAR, CHAR, \ NCHAR, TEXT, NTEXT, DECIMAL, NUMERIC, FLOAT, DAT...
import urllib.request, urllib.error, urllib.parse import io import os import time import sys import lzma import re import string import threading import base64 from urllib import parse as urlparse from xml.sax.saxutils import escape, quoteattr class RaftCaptureProcessor(urllib.request.BaseHandler): class _wrapper(...
# coding=utf-8 __author__ = "AstroPrint Product Team <<EMAIL>>" __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' import logging from gi.repository import Gst from .base_video_enc import VideoEncBinBase class H264VideoEncBin(VideoEncBinBase): def __init__(self, size, rotation)...
import gensim import logging import multiprocessing import os import re import sys from pattern.en import tokenize from time import time logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) def cleanhtml(raw_html): cleanr = re.compile('<.*?>') clean...
import sys from services.spawn import MobileTemplate from services.spawn import WeaponTemplate from resources.datatables import WeaponType from resources.datatables import Difficulty from resources.datatables import Options from java.util import Vector def addTemplate(core): mobileTemplate = MobileTemplate() mobi...
from airflow.ti_deps.deps.base_ti_dep import BaseTIDep from airflow.utils.db import provide_session from airflow.utils.state import State class PrevDagrunDep(BaseTIDep): """ Is the past dagrun in a state that allows this task instance to run, e.g. did this task instance's task in the previous dagrun compl...
from optparse import SUPPRESS_HELP import sys from command import Command, MirrorSafeCommand from subcmds.sync import _PostRepoUpgrade from subcmds.sync import _PostRepoFetch class Selfupdate(Command, MirrorSafeCommand): common = False helpSummary = "Update repo to the latest version" helpUsage = """ %prog """ ...
from airflow.models import BaseOperator from airflow.utils.decorators import apply_defaults from airflow.contrib.hooks.qubole_hook import QuboleHook, COMMAND_ARGS, HYPHEN_ARGS, \ flatten_list, POSITIONAL_ARGS class QuboleOperator(BaseOperator): """ Execute tasks (commands) on QDS (https://qubole.com). ...
"""Handle Konnected messages.""" import logging from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.util import decorator from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_STATE, DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_HUMIDITY) from .const import (CONF_INVERSE, SIGNAL_SE...
import os, unittest from ctypes import * try: WINFUNCTYPE except NameError: # fake to enable this test on Linux WINFUNCTYPE = CFUNCTYPE import _ctypes_test lib = CDLL(_ctypes_test.__file__) class CFuncPtrTestCase(unittest.TestCase): def test_basic(self): X = WINFUNCTYPE(c_int, c_int, c_int) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ make-release ~~~~~~~~~~~~ Helper script that performs a release. Does pretty much everything automatically for us. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import sys import os import re from dat...
"""!search <query> will return the top google result for that query (!google is an alias)""" from bs4 import BeautifulSoup import re try: from urllib import quote, unquote except ImportError: from urllib.request import quote, unquote import requests def google(q): query = quote(q) url = "https://encry...
import unittest from dynd import nd import numpy as np from datashape import dshape from blaze.api.into import into, discover import blaze def skip(test_foo): return def skip_if_not(x): def maybe_a_test_function(test_foo): if not x: return else: return test_foo r...
"""SCons.Tool.masm Tool-specific initialization for the Microsoft Assembler. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons F...
"""Unit tests for bibcatalog_system_rt library.""" from invenio.base.wrappers import lazy_import from invenio.testsuite import make_test_suite, run_test_suite, InvenioTestCase bibcatalog_system_rt = lazy_import('invenio.legacy.bibcatalog.system_rt') class BibCatalogSystemRTTest(InvenioTestCase): """Testing of Bi...
#!/usr/bin/env python """Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. WSO2 Inc. licenses this file to you 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...
#!/usr/bin/python # -*- coding: utf-8 -*- """ This file is part of XBMC Mega Pack Addon. Copyright (C) 2014 Wolverine (<EMAIL>) 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, e...
import os """Chromium presubmit script for src/tools/ios. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details on the presubmit API built into gcl. """ WHITELIST_FILE = 'build/ios/grit_whitelist.txt' def _CheckWhitelistSorted(input_api, output_api): for path in input_api.Lo...
from pychron.mv.locator import Locator class CO2Locator(Locator): pass # ============= EOF =============================================
"""String formatting utilities .. codeauthor:: Joe DeCapo <<EMAIL>> """ import math from pathlib import Path from typing import List, Optional, Tuple, Union from clowder.util.console import CONSOLE Output = Union[str, Path] def bold(output: Output) -> str: return f'[bold]{output}[/bold]' def cyan(output: ...
"""Tests for handshake.hybi00 module.""" import unittest import set_sys_path # Update sys.path to locate mod_pywebsocket module. from mod_pywebsocket.handshake._base import HandshakeException from mod_pywebsocket.handshake.hybi00 import Handshaker from mod_pywebsocket.handshake.hybi00 import _validate_subprotocol ...
#!/usr/bin/python ''' Ansible module to test whether a yum update or install will succeed, without actually performing it or running yum. parameters: packages: (optional) A list of package names to install or update. If omitted, all installed RPMs are considered for updates. ''' import sys import yum #...
import numpy as np import csv import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import time GENS = 90 FIRST_DEATH_AGE = 68 OLDEST_IMMIGRANTS = 65 FIRST_FERTILITY_YEAR = 23 LAST_FERTILITY_YEAR = 45 FIRST_WORK_YEAR = 21 SKILL_GROUPS = 2 MAX_YEARS = 300 """ TODO: #net_migration only goes to age 65?...
import unittest2 as unittest from webkitpy.common.net.statusserver import StatusServer from webkitpy.common.system.outputcapture import OutputCaptureTestCaseBase from webkitpy.common.net.web_mock import MockBrowser class StatusServerTest(OutputCaptureTestCaseBase): def test_url_for_issue(self): mock_brow...
""" Project Euler Problem 50: https://projecteuler.net/problem=50 Consecutive prime sum The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred. The longest sum of consecutive primes below on...
import logging logger = logging.getLogger("papyon.util.async") __all__ = ["run"] def is_valid_callback(callback): return (isinstance(callback, tuple) and len(callback) > 0 and callback[0] is not None and callable(callback[0])) def run(callback, *args): if callback is None: return if ...
"""Contains the data classes of the Google Access Control List (ACL) Extension""" __author__ = '<EMAIL> (Jeff Scudder)' import atom.core import atom.data import gdata.data import gdata.opensearch.data GACL_TEMPLATE = '{http://schemas.google.com/acl/2007}%s' class AclRole(atom.core.XmlElement): """Describes th...
from .base import GeoNodeBaseTestSupport import os import glob import gisdata import logging from lxml import etree from owslib import fes from urllib.parse import urljoin from owslib.etree import etree as dlxml from django.conf import settings from geonode import geoserver from geonode.utils import check_ogc_backe...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} try: from pyVmomi import vim, vmodl HAS_PYVMOMI = True except ImportError: HAS_PYVMOMI = False def create_vsan_cluster(host_system, new_cluster_uuid): host_confi...
"""Common operations on Posix pathnames. Instead of importing this module directly, import os and refer to this module as os.path. The "os.path" name is an alias for this module on Posix systems; on other systems (e.g. Mac, Windows), os.path provides the same operations in a manner specific to that platform, and is a...
from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase class EAPITestCase(TestCase): def testEAPI(self): ebuilds = { #EAPI-1: IUSE-defaults "dev-libs/A-1.0": { "EAPI": 0, "IUSE": "+foo" }, "dev-libs/A-1.1": { "EAPI": 1, "IU...
""" kombu.transport.beanstalk ========================= Beanstalk transport. :copyright: (c) 2010 - 2013 by David Ziegler. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import socket from kombu.five import Empty from kombu.utils.encoding import bytes_to_str from kombu.util...
"""A generic class to build line-oriented command interpreters. Interpreters constructed with this class obey the following conventions: 1. End of file on input is processed as the command 'EOF'. 2. A command is parsed out of each line by collecting the prefix composed of characters in the identchars member. 3. A ...
from __future__ import absolute_import import logging import re import pip from pip.compat import stdlib_pkgs from pip.req import InstallRequirement from pip.utils import get_installed_distributions from pip._vendor import pkg_resources logger = logging.getLogger(__name__) # packages to exclude from freeze output ...
import json import re from bson.objectid import ObjectId from cerberus import Validator from falcon import HTTPBadRequest from ...schema.errors import InvalidDocumentError from ..filter_expressions import FilterExpressions from .base import BaseResource class ModelResource(BaseResource): create_replace_schema = ...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} class IPInterface(object): def __init__(self, module): self.module = module self.name = module.params['name'] self.temporary = module.params['tempora...
from slicc.ast.ExprAST import ExprAST from slicc.symbols import Type, Var class VarExprAST(ExprAST): def __init__(self, slicc, var): super(VarExprAST, self).__init__(slicc) self._var = var def __repr__(self): return "[VarExprAST: %r]" % self._var @property def name(self): ...
from __future__ import absolute_import from contextlib import contextmanager import zlib import io from socket import timeout as SocketTimeout from socket import error as SocketError from ._collections import HTTPHeaderDict from .exceptions import ( ProtocolError, DecodeError, ReadTimeoutError, ResponseNotChunked ...
from __future__ import unicode_literals """ Transactions are defined as collection of classes, a Bean represents collection of Document objects for a transaction with main and children. Group actions like save, etc are performed on doclists """ import webnotes from webnotes import _, msgprint from webnotes.utils impo...
DEFAULT_VOICE='Trinoids' def say(module, msg, voice): module.run_command(["/usr/bin/say", msg, "--voice=%s" % (voice)], check_rc=True) def main(): module = AnsibleModule( argument_spec=dict( msg=dict(required=True), voice=dict(required=False, default=DEFAULT_VOICE), ),...
# -*- coding: utf-8 -*- import datetime from dateutil.relativedelta import relativedelta from openerp import fields, tools from openerp.addons.event.tests.common import TestEventCommon from openerp.tools import mute_logger class TestMailSchedule(TestEventCommon): @mute_logger('openerp.addons.base.ir.ir_model',...
#!/usr/bin/env python ''' PEXPECT LICENSE This license is approved by the OSI and FSF as GPL-compatible. http://opensource.org/licenses/isc-license.txt Copyright (c) 2012, Noah Spurrier <<EMAIL>> PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY PURPOSE WITH OR WITHOUT F...
import pytest from pathod import language from pathod.language import base, exceptions def parse_request(s): return language.parse_pathoc(s).next() def test_times(): reqs = list(language.parse_pathoc("get:/:x5")) assert len(reqs) == 5 assert not reqs[0].times def test_caseless_literal(): clas...
import copy_reg import unittest from test import test_support from test.pickletester import ExtensionSaver class C: pass class WithoutSlots(object): pass class WithWeakref(object): __slots__ = ('__weakref__',) class WithPrivate(object): __slots__ = ('__spam',) class WithSingleString(object): ...
import os import ftplib import urlparse try: from cStringIO import StringIO except ImportError: from StringIO import StringIO from django.conf import settings from django.core.files.base import File from django.core.files.storage import Storage from django.core.exceptions import ImproperlyConfigured class F...
"""XVP VNC Console Proxy Server.""" import sys from oslo_log import log as logging from oslo_reports import guru_meditation_report as gmr from nova import config from nova import service from nova import version from nova.vnc import xvp_proxy def main(): config.parse_args(sys.argv) logging.setup(config.CON...
"""Utility funtions for the graph_editor. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import re from six import iteritems from tensorflow.python.framework import ops as tf_ops from tensorflow.python.ops import array_ops as tf_arra...
from django.core.management.base import BaseCommand from geonode.base.models import Link, ResourceBase from geonode.contrib.metadataxsl.models import add_xsl_link class Command(BaseCommand): help = 'Add missing links to ISO XSL metadata service' def handle(self, *args, **options): for resource in R...
from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.test.client import Client from django.test import TestCase from django.core.urlresolvers import reverse from geonode.security.enumerations import AUTHENTICATED_USERS, ANONYMOUS_USERS from geonode.layers.mo...
import argparse import tempfile import os from os.path import basename, dirname, isdir, join import signal import shutil import urllib import urllib.request import hashlib import time import socket import json import base64 from urllib.parse import urlparse from http.client import HTTPConnection def find_official_plu...
"""test_expr.py: Handle tests. """ __author__ = "Dilawar Singh" __copyright__ = "Copyright 2015, Dilawar Singh and NCBS Bangalore" __credits__ = ["NCBS Bangalore"] __license__ = "GNU GPL" __version__ = "1.0.0" __maintainer__ = "Dilawar Singh" __email__ ...