content
string
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import base64 import os import re import shlex import pkgutil import xml.etree.ElementTree as ET from ansible.errors import AnsibleError from ansible.module_utils._text import to_bytes, to_text from ansible.plugins.shell import Sh...
#!/usr/bin/env python # LOG ANALYZER # by Kevin Yang # # Assumes VERY MUCH THIS FORMAT: # [<time>] <event> -> <data> import sys, re import numpy as np def find_outliers(array, mean = None, std = None, m = 6): if mean == None: mean = np.mean(array) if std == None: std = np.std(array) return array[abs(array - ...
from __future__ import unicode_literals # IMPORTANT: only import safe functions as this module will be included in jinja environment import frappe import operator import re, urllib, datetime, math import babel.dates # datetime functions def getdate(string_date): """ Coverts string date (yyyy-mm-dd) to datetime.da...
import os import time import tempfile import pickle as cPickle import mock from testtools import TestCase from cloudify.workflows import local from cloudify.decorators import operation from diamond_agent import tasks from diamond_agent.tests import IGNORED_LOCAL_WORKFLOW_MODULES class TestSingleNode(TestCase): ...
import inspect import os import re from django import template from django.template import RequestContext from django.conf import settings from django.contrib.admin.views.decorators import staff_member_required from django.db import models from django.shortcuts import render_to_response from django.core.exceptions imp...
import unittest from conans.client import tools from conans.test.utils.tools import TestClient from conans.test.utils.cpp_test_files import cpp_hello_conan_files from conans.util.files import save, load import os from conans.paths import CONANFILE from collections import OrderedDict from conans.test.utils.test_files i...
# -*- coding: utf-8 -*- """ *************************************************************************** OTBTester.py --------------------- Copyright : (C) 2013 by CS Systemes d'information (CS SI) Email : otb at c-s dot fr (CS SI) Contributors : Julien Malik (CS SI...
import ocl as cam import camvtk import time import vtk import datetime if __name__ == "__main__": myscreen = camvtk.VTKScreen() myscreen.setAmbient(1,1,1) #stl = camvtk.STLSurf(filename="demo.stl") stl = camvtk.STLSurf(filename="demo2.stl") print("STL surface read") myscreen.addActor(stl...
import numpy as np import scipy.sparse as sp from HPOlibConfigSpace.configuration_space import ConfigurationSpace from HPOlibConfigSpace.conditions import EqualsCondition, InCondition from HPOlibConfigSpace.hyperparameters import UniformFloatHyperparameter, \ UniformIntegerHyperparameter, CategoricalHyperparameter...
"""TerminatorEncoding by Emmanuel Bretelle <<EMAIL>> TerminatorEncoding supplies a list of possible encoding values. This list is taken from gnome-terminal's src/encoding.h and src/encoding.c """ from terminatorlib import translation class TerminatorEncoding: """Class to store encoding details""" encodings = ...
grid_size = 50 # assumes a square grid counter = 3 * (grid_size * grid_size) # all cases that won't be covered def gcd(a,b): while (b != 0) and (a != b) and (a != 0): if b < a: a = a - b else: b = b - a if a > 0: return a return b end = grid_size+1 def my_a...
from test_framework.test_framework import BitsendTestFramework from test_framework.util import * # Create one-input, one-output, no-fee transaction: class MempoolCoinbaseTest(BitsendTestFramework): def __init__(self): super().__init__() self.num_nodes = 2 self.setup_clean_chain = False ...
"""Module for enhancement UI.""" import logging import unittest import mock from letsencrypt import errors from letsencrypt.display import util as display_util class AskTest(unittest.TestCase): """Test the ask method.""" def setUp(self): logging.disable(logging.CRITICAL) def tearDown(self): ...
# encoding: 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 'FeedUpdateHistory' db.delete_table('rss_feeds_feedupdatehistory') def backwards(se...
import yaml, json import random import traceback import sys import os import next.utils as utils DICT = {'dict','dictionary','map'} LIST = {'list'} TUPLE = {'tuple'} ONEOF = {'oneof'} NUM = {'num','number','float'} STRING = {'str','string','multiline'} ANY = {'any','stuff'} FILE = {'file'} BOOL = {'boolean','bool'} ...
# encoding: utf-8 __author__ = "Nils Tobias Schmidt" __email__ = "schmidt89 at informatik.uni-marburg.de" ''' Utility module ''' from Queue import Empty import itertools from os.path import splitext import re import sys import time import traceback from androlyze.log.Log import log def sha256(data): ''' C...
__author__ = '<EMAIL> (David Byttow)' import logging import unittest import urllib2 import opensocial from opensocial import oauth class TestOAuth(unittest.TestCase): def setUp(self): self.config = opensocial.ContainerConfig( oauth_consumer_key='oauth.org:12345689', oauth_consumer_secret=...
"""A simple log mechanism styled after PEP 282.""" # This module should be kept compatible with Python 2.1. # The class here is styled after PEP 282 so that it could later be # replaced with a standard Python logging implementation. DEBUG = 1 INFO = 2 WARN = 3 ERROR = 4 FATAL = 5 import sys class Log: def __i...
from algo import mod_inv from random import randrange, randint from ecurves import * def elgalmal_encrypt(M,k,a,p): ''' Input: M - menssage k - recipient private key a - generator p - prime Output (c1,c2) [Encrypted] ''' s = randrange...
# coding: utf-8 from __future__ import unicode_literals import re import itertools from .common import InfoExtractor from ..utils import ( get_element_by_id, clean_html, ExtractorError, remove_start, ) class KuwoBaseIE(InfoExtractor): _FORMATS = [ {'format': 'ape', 'ext': 'ape', 'prefere...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import threading import unittest from pants.base.worker_pool import Work, WorkerPool from pants.base.workunit import WorkUnit from pants.util.contextutil import tempo...
"""The Laplace distribution class.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import numpy as np from tensorflow.contrib.distributions.python.ops import distribution from tensorflow.contrib.framework.python.framework import tensor_util...
"""MNE software for MEG and EEG data analysis.""" # PEP0440 compatible formatted version, see: # https://www.python.org/dev/peps/pep-0440/ # # Generic release markers: # X.Y # X.Y.Z # For bugfix releases # # Admissible pre-release markers: # X.YaN # Alpha release # X.YbN # Beta release # X.YrcN # Rele...
import glob from optparse import OptionParser import os import re import shutil import subprocess import sys version = 'build-all.py, version 1.99' build_dir = '../all-kernels' make_command = ["vmlinux", "modules", "dtbs"] all_options = {} compile64 = os.environ.get('CROSS_COMPILE64') def error(msg): sys.stderr....
import os from setuptools import setup def read(*paths): """Build a file path from *paths* and return the contents.""" with open(os.path.join(*paths), 'r') as f: return f.read() setup( name='git-history', version='0.0.1', description='Keep a history of all your git commands.', long_...
''' Steps for problem.feature lettuce tests ''' # pylint: disable=C0111 # pylint: disable=W0621 from lettuce import world, step from common import i_am_registered_for_the_course, visit_scenario_item from problems_setup import PROBLEM_DICT, answer_problem, problem_has_answer, add_problem_to_course def _view_problem(...
""" :copyright: (c) 2011 Local Projects, all rights reserved :license: Affero GNU GPL v3, see LICENSE for more details. """ import cgi, os import framework.filters as filters from lib import jinja2 from framework.config import * from framework.log import log log.info("_________________________________________...
import proto # type: ignore __protobuf__ = proto.module( package="google.ads.googleads.v8.errors", marshal="google.ads.googleads.v8", manifest={"ReachPlanErrorEnum",}, ) class ReachPlanErrorEnum(proto.Message): r"""Container for enum describing possible errors returned from the ReachPlanService...
ANSIBLE_METADATA = {'status': ['deprecated'], 'supported_by': 'community', 'version': '1.0'} CL_LICENSE_PATH='/usr/cumulus/bin/cl-license' def install_license(module): # license is not installed, install it _url = module.params.get('src') (_rc, out, _err) = module.r...
""" ============================ ``ctypes`` Utility Functions ============================ See Also --------- load_library : Load a C library. ndpointer : Array restype/argtype with verification. as_ctypes : Create a ctypes array from an ndarray. as_array : Create an ndarray from a ctypes array. References ----------...
from __future__ import absolute_import import errno import warnings import hmac from binascii import hexlify, unhexlify from hashlib import md5, sha1, sha256 from ..exceptions import SSLError, InsecurePlatformWarning, SNIMissingWarning SSLContext = None HAS_SNI = False IS_PYOPENSSL = False # Maps the length of a d...
import atexit import os import shutil import string import sys import tempfile import traceback import mock from .. import base from pulp.plugins.cataloger import Cataloger from pulp.plugins.distributor import Distributor from pulp.plugins.importer import Importer from pulp.plugins.loader import exceptions, loading, ...
"""Implementation of a fake volume API.""" import uuid from oslo_config import cfg from oslo_log import log as logging from oslo_utils import timeutils from nova import exception LOG = logging.getLogger(__name__) CONF = cfg.CONF CONF.import_opt('cross_az_attach', 'nova.volume.cinder', group='cinde...
from __future__ import absolute_import import collections import itertools import json import logging import os from django.conf import settings from django.core.files.uploadedfile import InMemoryUploadedFile from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.uploadedfile import Tem...
from __future__ import unicode_literals import collections import getpass import optparse import os import re import shutil import socket import subprocess import sys import itertools try: import urllib.request as compat_urllib_request except ImportError: # Python 2 import urllib2 as compat_urllib_request ...
import BoostBuild tester = BoostBuild.Tester(use_test_config=False) tester.write("test1.cpp", """\ template<bool, int M, class Next> struct time_waster { typedef typename time_waster<true, M-1, time_waster>::type type1; typedef typename time_waster<false, M-1, time_waster>::type type2; typedef void type; ...
from __future__ import print_function from builtins import range from six.moves import cPickle as pickle import numpy as np import os from scipy.misc import imread import platform def load_pickle(f): version = platform.python_version_tuple() if version[0] == '2': return pickle.load(f) elif versio...
from lib.hachoir_core.tools import (humanDatetime, humanDuration, timestampUNIX, timestampMac32, timestampUUID60, timestampWin64, durationWin64) from lib.hachoir_core.field import Bits, FieldSet from datetime import datetime class GenericTimestamp(Bits): def __init__(self, parent, name, size, description=N...
import attr import dataclasses @dataclasses.dataclass(frozen=True) class A1: a: int = 1 @dataclasses.dataclass(frozen=True) class B1(A1): b: str = "1" <error descr="'A1' object attribute 'a' is read-only">A1().a</error> = 2 <error descr="'B1' object attribute 'a' is read-only">B1().a</error> = 2 <error desc...
from openerp.addons.crm import crm from openerp.osv import fields, osv from openerp import tools class crm_opportunity_report(osv.Model): """ CRM Opportunity Analysis """ _name = "crm.opportunity.report" _auto = False _description = "CRM Opportunity Analysis" _rec_name = 'date_deadline' _inher...
from inspect import cleandoc from coala_utils.decorators import ( enforce_signature, generate_consistency_check) @generate_consistency_check('definition', 'example', 'example_language', 'importance_reason', 'fix_suggestions') class Documentation: """ This class contains docume...
#!/usr/bin/env python # -*- coding: utf-8 -*- from saml2 import BINDING_SOAP, BINDING_URI from saml2 import BINDING_HTTP_REDIRECT from saml2 import BINDING_HTTP_POST from saml2 import BINDING_HTTP_ARTIFACT from saml2.saml import NAMEID_FORMAT_PERSISTENT from saml2.saml import NAME_FORMAT_URI from pathutils import full...
import os from textwrap import dedent from pants.backend.codegen.ragel.java.java_ragel_library import JavaRagelLibrary from pants.backend.codegen.ragel.java.ragel_gen import RagelGen, calculate_genfile from pants.testutil.task_test_base import TaskTestBase from pants.util.contextutil import temporary_file from pants.u...
"""Exceptions used by Cisco Nexus ML2 mechanism driver.""" from neutron.common import exceptions class CredentialNotFound(exceptions.NeutronException): """Credential with this ID cannot be found.""" message = _("Credential %(credential_id)s could not be found.") class CredentialNameNotFound(exceptions.Neut...
""" Utilities for writing third_party_auth tests. Used by Django and non-Django tests; must not have Django deps. """ from contextlib import contextmanager from django.conf import settings import django.test import mock import os.path from third_party_auth.models import OAuth2ProviderConfig, SAMLProviderConfig, SAML...
# coding: utf-8 from flask import Flask, session, redirect, url_for, request,abort import config config = config.rec() def on_finish(): None def currentUserGet(): if 'user' in session: user = session['user'] return user['username'] else: return None def currentUserSet(username):...
from django.utils import unittest from django.utils.termcolors import (parse_color_setting, PALETTES, DEFAULT_PALETTE, LIGHT_PALETTE, DARK_PALETTE, NOCOLOR_PALETTE, colorize) class TermColorTests(unittest.TestCase): def test_empty_string(self): self.assertEqual(parse_color_setting(''), PALETTES[DEFAU...
import os import re from google.appengine.ext import webapp from google.appengine.ext.webapp import util from protorpc.webapp import service_handlers import protorpc_appstats # This regular expression is used to extract the full path of # an incoming request so that the service can be correctly # registered with it...
"""Checks WebKit style for JSON files.""" import json import re class JSONChecker(object): """Processes JSON lines for checking style.""" categories = set(('json/syntax',)) def __init__(self, file_path, handle_style_error): self._handle_style_error = handle_style_error self._handle_styl...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import re import json from .common import InfoExtractor from ..compat import compat_str from ..utils import ( qualities, unescapeHTML, xpath_element, ) class AllocineIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?allocine\.fr/(?P<...
from lxml import etree import webob from nova.api.openstack.compute.contrib import extended_availability_zone from nova import availability_zones from nova import compute from nova.compute import vm_states from nova import db from nova import exception from nova import objects from nova.objects import instance as inst...
from __future__ import print_function #import unittest import os import sys from functools import wraps from django.conf import settings from south.hacks import hacks # Make sure skipping tests is available. try: # easiest and best is unittest included in Django>=1.3 from django.utils import unittest except I...
#!/usr/bin/python """Interface to journalctl.""" from time import time import json import re import subprocess from ansible.module_utils.basic import AnsibleModule class InvalidMatcherRegexp(Exception): """Exception class for invalid matcher regexp.""" pass class InvalidLogEntry(Exception): """Excepti...
data = ( 'Chang ', # 0x00 'Chi ', # 0x01 'Bing ', # 0x02 'Zan ', # 0x03 'Yao ', # 0x04 'Cui ', # 0x05 'Lia ', # 0x06 'Wan ', # 0x07 'Lai ', # 0x08 'Cang ', # 0x09 'Zong ', # 0x0a 'Ge ', # 0x0b 'Guan ', # 0x0c 'Bei ', # 0x0d 'Tian ', # 0x0e 'Shu ', # 0x0f 'Shu ', # 0x10...
#!/usr/bin/python """ This is the utility for watering flowers """ # Copyright (c) 2010-2016 LiTtl3.1 Industries (LiTtl3.1). # All rights reserved. # This source code and any compilation or derivative thereof is the # proprietary information of LiTtl3.1 Industries and is # confidential in nature. # Use of this source...
"""Unit tests for the API endpoint.""" import httplib import StringIO import webob class FakeHttplibSocket(object): """A fake socket implementation for httplib.HTTPResponse, trivial.""" def __init__(self, response_string): self.response_string = response_string self._buffer = StringIO.String...
"""对应于save all""" from QUANTAXIS.QASU.main import (QA_SU_save_etf_day, QA_SU_save_etf_min, QA_SU_save_financialfiles, QA_SU_save_index_day, QA_SU_save_index_min, QA_SU_save_stock_block, QA_SU_save_stock_day, ...
from gnuradio import gr, gru from gnuradio import eng_notation from my_gnuradio import blks2 import copy import sys # ///////////////////////////////////////////////////////////////////////////// # receive path # ///////////////////////////////////////////////////////////////////////////...
""" Find in Demo Employees file by NAME, DEPTartment or MAKE Adapt DBID, FNR and AUTOFNR Note: when using FIND with MAKE and AUTOFNR != 12, file number in search criterium must be changed in searchfield() parms $Date: 2008-08-29 16:48:48 +0200 (Fri, 29 Aug 2008) $ $Rev: 68 $ """ # Copyright 2004-20...
import os from django.conf import settings as django_settings from django.test.signals import setting_changed DEFAULTS = { 'AWS_XRAY_DAEMON_ADDRESS': '127.0.0.1:2000', 'AUTO_INSTRUMENT': True, 'AWS_XRAY_CONTEXT_MISSING': 'RUNTIME_ERROR', 'PLUGINS': (), 'SAMPLING': True, 'SAMPLING_RULES': None,...
#!/usr/bin/env python import collections import json import os import requests from datetime import datetime from tabulate import tabulate IdleTimeRecord = collections.namedtuple('IdleTimeRecord', ['pull_request', 'idle_time']) def created_at(pull_request): # String format can parse: 2018-01-29T16:23:55Z, 2018-0...
import os import sys sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') from perf_trace_context import * from Core import * usage = "perf trace -s syscall-counts-by-pid.py [comm]\n"; for_comm = None if len(sys.argv) > 2: sys.exit(usage) if len(sys.argv) > 1: for_...
"""Fixer for dict methods. d.keys() -> list(d.keys()) d.items() -> list(d.items()) d.values() -> list(d.values()) d.iterkeys() -> iter(d.keys()) d.iteritems() -> iter(d.items()) d.itervalues() -> iter(d.values()) d.viewkeys() -> d.keys() d.viewitems() -> d.items() d.viewvalues() -> d.values() Except in certain very...
import functools import sys import unittest from test import test_support from weakref import proxy import pickle @staticmethod def PythonPartial(func, *args, **keywords): 'Pure Python approximation of partial()' def newfunc(*fargs, **fkeywords): newkeywords = keywords.copy() newkeywords.update...
#!/usr/bin/env python """ This script starts a process locally, using <client-id> <hostfile> as inputs. """ import os from os.path import dirname import time import sys from optparse import OptionParser if len(sys.argv) < 3: print "usage: %s <client-id> <hostfile>" % sys.argv[0] sys.exit(1) # app_dir is 2 dirs...
""" sentry.db.models.manager ~~~~~~~~~~~~~~~~~~~~~~~~ :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, print_function import hashlib import logging import threading import weakref from django.conf imp...
"""Drop-in replacement for the thread module. Meant to be used as a brain-dead substitute so that threaded code does not need to be rewritten for when the thread module is not present. Suggested usage is:: try: import _thread except ImportError: import _dummy_thread as _thread """ # Exports ...
""" Generator for fbocolorbuffer* tests. This file needs to be run in its folder. """ import sys _DO_NOT_EDIT_WARNING = """<!-- This file is auto-generated from fbocolorbuffer_test_generator.py DO NOT EDIT! --> """ _HTML_TEMPLATE = """<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=u...
import sys sys.dont_write_bytecode = True import sigma assert sigma.parse( """ #!/usr/bin/python ##{ print( "foo" ) ##} ##@ This is TOC. """.strip() ) == [ sigma.TagTxt( s_anchor = "##", l_raw = [ "#!/usr/bin/python", "" ] ), sigma.TagCode( s_anchor = "##", l_raw = [ "##{ print( \"foo\" )", "##}" ...
import py_pjsua status = py_pjsua.create() print "py status " + `status` # # Create configuration objects # ua_cfg = py_pjsua.config_default() log_cfg = py_pjsua.logging_config_default() media_cfg = py_pjsua.media_config_default() # # Logging callback. # def logging_cb1(level, str, len): print str, # # Config...
"""Bisection algorithms.""" def insort_right(a, x, lo=0, hi=None): """Insert item x in list a, and keep it sorted assuming a is sorted. If x is already in a, insert it to the right of the rightmost x. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. ...
from __future__ import (absolute_import, division) __metaclass__ = type import pwd import os import pytest from ansible import constants from ansible.module_utils.six import StringIO from ansible.module_utils.six.moves import configparser from ansible.module_utils._text import to_text @pytest.fixture def cfgparser...
""" Development script to get the multiplicity of the separation facets for some model coordination environments """ __author__ = "David Waroquiers" __copyright__ = "Copyright 2012, The Materials Project" __version__ = "2.0" __maintainer__ = "David Waroquiers" __email__ = "<EMAIL>" __date__ = "Feb 20, 2016" from pyma...
""" Test cases adapted from the test_bsddb.py module in Python's regression test suite. """ import os, string import unittest from test_all import db, hashopen, btopen, rnopen, verbose, \ get_new_database_path class CompatibilityTestCase(unittest.TestCase): def setUp(self): self.filename = get_n...
""" Version information for the python-daemon distribution. """ from version_info import version_info version_info['version_string'] = u"1.5.1" version_short = u"%(version_string)s" % version_info version_full = u"%(version_string)s.r%(revno)s" % version_info version = version_short author_name = u"Ben Finney" auth...
""" Management command to update content libraries' search index """ # lint-amnesty, pylint: disable=cyclic-import import logging from textwrap import dedent from django.core.management import BaseCommand from opaque_keys.edx.locator import LibraryLocatorV2 from openedx.core.djangoapps.content_libraries.api import...
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, js_to_json, ) class OnDemandKoreaIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?ondemandkorea\.com/(?P<id>[^/]+)\.html' _GEO_COUNTRIES = ['US', 'CA'] _TEST = { ...
"""Unit tests for checkpoint converter.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import glob import os import tempfile from tensorflow.contrib.rnn.python.tools import checkpoint_convert from tensorflow.python.client import session from tensorflow....
from openerp.osv import fields,osv class report_workcenter_load(osv.osv): _name="report.workcenter.load" _description="Work Center Load" _auto = False _log_access = False _columns = { 'name': fields.char('Week', required=True), 'workcenter_id': fields.many2one('mrp.workcenter', 'Wo...
"""Chrome Version Tool Scrapes Chrome channel information and prints out the requested nugget of information. """ import json import optparse import os import string import sys import urllib URL = 'https://omahaproxy.appspot.com/json' def main(): try: data = json.load(urllib.urlopen(URL)) except Exception ...
from packetbeat import BaseTest class Test(BaseTest): def test_amqp_emit_receive(self): self.render_config_template( amqp_ports=[5672], ) self.run_packetbeat(pcap="amqp_emit_receive.pcap", debug_selectors=["amqp,tcp,publish"]) o...
from bz2 import BZ2File from datetime import datetime from gzip import GzipFile from pdar import PDAR_VERSION, DEFAULT_HASH_TYPE from pdar.entry import * from pdar.errors import * from pdar.patcher import DEFAULT_PATCHER_TYPE from pkg_resources import parse_version from shutil import rmtree from tempfile import Spooled...
from django.contrib.syndication.views import Feed from django.contrib.syndication.views import FeedDoesNotExist from django.core.exceptions import ObjectDoesNotExist from django_fixmystreet.fixmystreet.models import Report class LatestReports(Feed): title = "All FixMyStreet Reports" link = "/reports/" des...
import ir_actions_report_xml
import os import random import numpy as np import mxnet as mx from mxnet import nd def transform(data, target_wd, target_ht, is_train, box): """Crop and normnalize an image nd array.""" if box is not None: x, y, w, h = box data = data[y:min(y+h, data.shape[0]), x:min(x+w, data.shape[1])] ...
import datetime import time import threading import traceback from sickbeard import logger from sickrage.helper.exceptions import ex class Scheduler(threading.Thread): def __init__(self, action, cycleTime=datetime.timedelta(minutes=10), run_delay=datetime.timedelta(minutes=0), start_time=None, t...
"""Utilities using NDG HTTPS Client, including a main module that can be used to fetch from a URL. """ __author__ = "R B Wilkinson" __date__ = "09/12/11" __copyright__ = "(C) 2011 Science and Technology Facilities Council" __license__ = "BSD - see LICENSE file in top-level directory" __contact__ = "<EMAIL>" __revision_...
#!/usr/bin/env python """Wrapper around yamllint that supports YAML embedded in Ansible modules.""" from __future__ import absolute_import, print_function import ast import json import os import sys from yamllint import linter from yamllint.config import YamlLintConfig def main(): """Main program body.""" ...
""" Module: feed_def_reader Description: Reads in fed def file and controls the feed construction process Authored by: MapLarge, Inc. (Scott Rowles) Change Log: """ """ Define all the imports for the feed_def_reader module """ import json import sys from website_feed_constructor import WebsiteFeedConstructor from d...
import six SERIALIZABLE_TYPES = (dict, list, tuple, set, bool, type(None)) + \ six.integer_types + six.string_types + \ (six.text_type, six.binary_type,) def partial_to_session(strategy, next, backend, request=None, *args, **kwargs): user = kwargs.get('user') social...
# This module implements the RFCs 3490 (IDNA) and 3491 (Nameprep) import stringprep, re, codecs from unicodedata import ucd_3_2_0 as unicodedata # IDNA section 3.1 dots = re.compile("[\u002E\u3002\uFF0E\uFF61]") # IDNA section 5 ace_prefix = b"xn--" sace_prefix = "xn--" # This assumes query strings, so AllowUnassig...
import os import sys from flumotion.common import common, log from flumotion.configure import configure from flumotion.service import service from flumotion.common.options import OptionParser def main(args): parser = OptionParser(domain=configure.PACKAGE) parser.add_option('-l', '--logfile', ...
""" Real spectrum tranforms (DCT, DST, MDCT) """ from __future__ import division, print_function, absolute_import __all__ = ['dct', 'idct', 'dst', 'idst'] import numpy as np from scipy.fftpack import _fftpack from scipy.fftpack.basic import _datacopied import atexit atexit.register(_fftpack.destroy_ddct1_cache) ate...
import os from contextlib import closing from StringIO import StringIO try: from urllib import parse as urlparse except ImportError: import urlparse import dropbox from libearth.repository import (FileNotFoundError, NotADirectoryError, Repository, RepositoryKeyError) __all__ =...
""" View validation code (using assertions, not the RNG schema). """ import logging _logger = logging.getLogger(__name__) def valid_page_in_book(arch): """A `page` node must be below a `book` node.""" return not arch.xpath('//page[not(ancestor::notebook)]') def valid_field_in_graph(arch): """ Children...
""" Unit tests for nonlinear solvers Author: Ondrej Certik May 2007 """ from __future__ import division, print_function, absolute_import from numpy.testing import assert_, dec, TestCase, run_module_suite from scipy._lib.six import xrange from scipy.optimize import nonlin, root from numpy import matrix, diag, dot from...
import sys, os from sphinx.highlighting import lexers from pygments.lexers.web import PhpLexer lexers['php'] = PhpLexer(startinline=True, linenos=1) lexers['php-annotations'] = PhpLexer(startinline=True, linenos=1) primary_domain = 'php' # -- General configuration -----------------------------------------------------...
from openerp import models, api class FeesComputer(models.BaseModel): """Model that compute dunnig fees. This class does not need any database storage as it contains pure logic. It inherits form ``models.BaseModel`` to benefit of orm facility Similar to AbstractModel but log access and actions ...
import hearthbreaker.game_objects class ProxyCharacter: def __init__(self, character_ref): if type(character_ref) is str: if character_ref.find(":") > -1: [self.player_ref, self.minion_ref] = character_ref.split(':') self.minion_ref = int(self.minion_ref) ...
import os class suppress_stdout_stderr(object): ''' A context manager for doing a "deep suppression" of stdout and stderr in Python, i.e. will suppress all print, even if the print originates in a compiled C/Fortran sub-function. This will not suppress raised exceptions, since exceptions are p...