content
stringlengths
4
20k
#!/usr/bin/env python # automatic execution of HPC exercises import shutil, sys, os, re, glob counter = 0 def edit(from_to, filename='F77WAVE.fcp'): """ substitute (from,to) in from_to list, e.g. edit((r'from',r'to')) """ shutil.copy(filename + ".orig", filename) f = open(filename, 'r') f...
""" BZIP2 archive file Author: Victor Stinner """ from lib.hachoir_parser import Parser from lib.hachoir_core.field import (ParserError, String, Bytes, Character, UInt8, UInt32, CompressedField) from lib.hachoir_core.endian import LITTLE_ENDIAN from lib.hachoir_core.text_handler import textHandler, hexadecimal t...
from pycp2k.inputsection import InputSection class _each6(InputSection): def __init__(self): InputSection.__init__(self) self.Just_energy = None self.Powell_opt = None self.Qs_scf = None self.Xas_scf = None self.Md = None self.Pint = None self.Metady...
""" Generally helpful utility functions. """ def _ask_for_it_by_name(name): "Returns an object referenced by absolute path." bits = str(name).split(".") ## what if there is no absolute reference? if len(bits) > 1: modulename = ".".join(bits[:-1]) else: modulename = bits[0] mo...
import json import datetime import time from django.conf import settings from django.http import HttpResponse from django.template import loader def epoch_time(add=0): 'Returns time since epoch' return time.mktime(datetime.datetime.now().timetuple()) + add def jsonify(*args, **kwargs): 'Returns a json res...
{ 'name': 'Employee Directory', 'version': '1.1', 'author': 'OpenERP SA', 'category': 'Human Resources', 'sequence': 21, 'website': 'https://www.odoo.com', 'summary': 'Jobs, Departments, Employees Details', 'description': """ Human Resources Management ========================== This ap...
""" """ from __future__ import absolute_import from ..unitquantity import UnitQuantity from .length import m, rod are = ares = UnitQuantity( 'are', 100*m**2, aliases=['ares'] ) b = barn = UnitQuantity( 'barn', 1e-28*m**2, symbol='b', aliases=['barnes'] ) cmil = circular_mil = UnitQuantity(...
from odoo import models class Product(models.Model): _inherit = "product.product" def _get_domain_locations(self): if self._context.get('analytic_account_id'): locations = self.env['stock.location'].search( [('analytic_account_id', '=', self._context.get( ...
import copy import uuid import mock from oslo_utils import timeutils from nova import exception from nova import objects from nova.tests.unit.objects import test_objects _TS_NOW = timeutils.utcnow(with_timezone=True) # o.vo.fields.DateTimeField converts to tz-aware and # in process we lose microsecond resolution. _T...
r"""Creates TFRecords of Open Images dataset for object detection. Example usage: python object_detection/dataset_tools/create_oid_tf_record.py \ --input_box_annotations_csv=/path/to/input/annotations-human-bbox.csv \ --input_image_label_annotations_csv=/path/to/input/annotations-label.csv \ --input_imag...
"""BibFormat element - Prints collection identifier """ __revision__ = "$Id$" def format_element(bfo, kb): """ Prints the collection identifier. Translate using given knowledge base. @param kb: a knowledge base use to translate the collection identifier """ collection_identifiers = bfo.field...
from decimal import Decimal import random import django from waffle.utils import get_setting VERSION = (0, 10, 1) __version__ = '.'.join(map(str, VERSION)) def set_flag(request, flag_name, active=True, session_only=False): """Set a flag value on a request object.""" if not hasattr(request, 'waffles'): ...
import io import os import setuptools # type: ignore version = "0.5.0" package_root = os.path.abspath(os.path.dirname(__file__)) readme_filename = os.path.join(package_root, "README.rst") with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() setuptools.setup( name="go...
class AbstractHealthStatisticsReader: """ Abstract class to implement to create a custom health stat reader """ def stat_cartridge_health(self): """ Abstract method that when implemented reads the memory usage and the load average of the instance running the agent and returns a ...
from __future__ import print_function import unittest import json import math class Test(unittest.TestCase): def test_linestrings_intersect(self): from geojson_utils import linestrings_intersect diagonal_up_str = '{ "type": "LineString","coordinates": [[0, 0], [10, 10]]}' diagonal_down_st...
from .command import Command from selenium.webdriver.common.alert import Alert from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementException, NoSuchFrameException, NoSuchWindowException try: basestring except NameError: basestring = str class SwitchTo: def __in...
""" Processing of metarelate metOcean content to provide Iris encodings of metOcean mapping translations. """ from datetime import datetime import os.path import requests import sys import metarelate from metarelate.fuseki import FusekiServer from translator import (FORMAT_URIS, FieldcodeCFMappings, StashCFNameMapp...
# -*- coding: utf-8 -*- """ *************************************************************************** PointsDisplacement.py --------------------- Date : July 2013 Copyright : (C) 2013 by Alexander Bruy Email : alexander dot bruy at gmail dot com *********...
# coding: utf-8 from __future__ import unicode_literals import re import base64 from .common import InfoExtractor from ..compat import ( compat_urlparse, compat_parse_qs, ) from ..utils import ( clean_html, ExtractorError, int_or_none, unsmuggle_url, smuggle_url, ) class KalturaIE(InfoEx...
from lib.common import helpers class Module: def __init__(self, mainMenu, params=[]): self.info = { 'Name': 'Invoke-Mimikatz DCsync', 'Author': ['@gentilkiwi', '@JosephBialek'], 'Description': ("Runs PowerSploit's Invoke-Mimikatz function " ...
"""Test NULLDUMMY softfork. Connect to a single node. Generate 2 blocks (save the coinbases for later). Generate 427 more blocks. [Policy/Consensus] Check that NULLDUMMY compliant transactions are accepted in the 430th block. [Policy] Check that non-NULLDUMMY transactions are rejected before activation. [Consensus] Ch...
"""Dependency injector coroutine providers unit tests.""" import asyncio import unittest2 as unittest from dependency_injector import ( providers, errors, ) # Runtime import to get asyncutils module import os _TOP_DIR = os.path.abspath( os.path.sep.join(( os.path.dirname(__file__), '../'...
from __future__ import (absolute_import, division) __metaclass__ = type import sys import syslog from ansible.compat.tests import unittest from ansible.compat.tests.mock import patch, MagicMock from ansible.module_utils.basic import heuristic_log_sanitize class TestHeuristicLogSanitize(unittest.TestCase): def s...
import datetime import json import time from conf import _ from init import db, cur, opener import log import lib import stats lcount = 0 def get(url): log.write("Getting %d page(s) of %d links from: %s..." % (_['page_limit'], _['links_per_page'], url), 'message') start = time.time() after = '' fo...
# -*- coding: utf-8 -*- """ eve.methods.put ~~~~~~~~~~~~~~~ This module imlements the PUT method. :copyright: (c) 2015 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ from werkzeug import exceptions from datetime import datetime from eve.auth import requires_auth from eve.def...
# -*- coding: utf-8 -*- """ sphinx.ext.coverage ~~~~~~~~~~~~~~~~~~~ Check Python modules and C API for coverage. Mostly written by Josip Dzolonga for the Google Highly Open Participation contest. :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for d...
"""Support for ADS sensors.""" import logging import voluptuous as vol from homeassistant.components import ads from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import CONF_NAME, CONF_UNIT_OF_MEASUREMENT import homeassistant.helpers.config_validation as cv from . import CONF_ADS_F...
#!/usr/bin/python # -*- coding: utf-8 -*- # please set paths to the required tools in config.py # this scripts performs (part of) the experiments described in (Sennrich, Schwenk & Aransa 2013). # Specifically, it takes a vector of (source-side) texts (LM_TEXTS), trains a language model on each, # and then clusters a ...
""" ============================================== Face completion with a multi-output estimators ============================================== This example shows the use of multi-output estimator to complete images. The goal is to predict the lower half of a face given its upper half. The first column of images sho...
from __future__ import absolute_import, division, print_function __metaclass__ = type ################################################################################ # Documentation ################################################################################ ANSIBLE_METADATA = {'metadata_version': '1.1', 'statu...
""" Created on 11 May 2017 @author: Bruno Beloff (<EMAIL>) https://pymotw.com/2/subprocess/ """ import os from collections import OrderedDict from subprocess import Popen, PIPE, TimeoutExpired from scs_core.data.json import JSONable, JSONify # ---------------------------------------------------------------------...
from __future__ import absolute_import, unicode_literals # Import from pygit2 from .errors import check_error from .ffi import ffi, C from .utils import to_bytes, is_string, to_str from _pygit2 import Signature, Oid def wrap_signature(csig): if not csig: return None return Signature(ffi.string(csig.n...
from django import template from simpleoncall.models import NotificationType from simpleoncall.templatetags.icons import EvilIconNode register = template.Library() def pop_default(l, d): if len(l): return l.pop(0) return d class NotificationSettingRowNode(template.Node): TYPE_OPTIONS = { ...
'''Complete the current word before the cursor with words in the editor. Each menu selection or shortcut key selection replaces the word with a different word with the same prefix. The search for matches begins before the target and moves toward the top of the editor. It then starts after the cursor and moves down. It...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.module_utils import distro from ansible.module_utils.six import string_types # Generic test case with minimal assertions about specific returned values. class TestDistro(): # should run on any platform without er...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import os from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.onea...
from __future__ import unicode_literals from django.core.management import call_command from django.db import connection from django.test import TransactionTestCase, skipUnlessDBFeature @skipUnlessDBFeature("gis_enabled") class MigrateTests(TransactionTestCase): """ Tests running the migrate command in Geodj...
######################################################################## # $Header: /var/local/cvsroot/4Suite/Ft/Lib/TestSuite/TestModule.py,v 1.9 2006/08/11 15:50:12 jkloth Exp $ """ Provides the TestModule class for wrapping modules/packages. Copyright 2006 Fourthought, Inc. (USA). Detailed license and copyright inf...
r""" A simple, fast, extensible JSON encoder and decoder JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. simplejson exposes an API familiar to uses of the standard library marshal and pickle modules. Encoding b...
bl_info = { "name": "Cycles Automatic Materials", "author": "Théo Friberg", "blender": (2, 70, 0), "version": (0, 39), "location": "Space > Automatic / Adjustable Material from Image", "description": "One-click material setup from texture for Cycles. Blur from b°wide node pack.", "warning": "Still a work in prog...
# -*- coding: utf-8 -*- """ requests.adapters ~~~~~~~~~~~~~~~~~ This module contains the transport adapters that Requests uses to define and maintain connections. """ import socket from .models import Response from .packages.urllib3.poolmanager import PoolManager, ProxyManager from .packages.urllib3.response import...
from __future__ import absolute_import import json import makerbot_driver """ A machine profile object that holds all values for a specific profile. """ import json import os import re import logging GcodeRecipes = { "PLA" : { "print_start_sequence" : { "heat_platform" : "no_heat" }, "print_e...
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import re import string import sys import TestSCons import TestCmd _python_ = TestSCons._python_ test = TestSCons.TestSCons(match=TestCmd.match_re) # Run all of the tests with both types of source signature # to make sure there's no difference ...
"""Test a corner-case at the level of the Cython API.""" import threading import unittest from grpc._cython import cygrpc _INFINITE_FUTURE = cygrpc.Timespec(float('+inf')) _EMPTY_FLAGS = 0 _EMPTY_METADATA = cygrpc.Metadata(()) class _ServerDriver(object): def __init__(self, completion_queue, shutdown_tag): ...
"""String-array-handling code for PyOpenGL """ #from OpenGL.arrays._strings import dataPointer as old from OpenGL import constants from OpenGL.arrays import formathandler import ctypes psas = ctypes.pythonapi.PyString_AsString # it's a c_char_p, but if we use that then the code will # attempt to use null-terminated v...
__author__ = "Kurt McKee <<EMAIL>>" import re import urllib import urlparse DEFAULT_PORTS = { 'http': u'80', 'https': u'443', } NETLOC = re.compile(""" ^ (?: (?P<username>[^:@]+)? (?: : (?P<password>[^@]*) )? @ )? (?P<hostname>[^:]+) ...
from __future__ import division, absolute_import, print_function import numpy as np from numpy.matrixlib.defmatrix import matrix, asmatrix # need * as we're copying the numpy namespace from numpy import * __version__ = np.__version__ __all__ = np.__all__[:] # copy numpy namespace __all__ += ['rand', 'randn', 'repmat...
import os import unittest from pavelib.prereqs import no_prereq_install class TestPaverPrereqInstall(unittest.TestCase): """ Test the status of the NO_PREREQ_INSTALL variable, its presence and how paver handles it. """ def check_val(self, set_val, expected_val): """ Verify that set...
import sys import textwrap from StringIO import StringIO from test import test_support import traceback import unittest class Test_TestResult(unittest.TestCase): # Note: there are not separate tests for TestResult.wasSuccessful(), # TestResult.errors, TestResult.failures, TestResult.testsRun or # TestRes...
# coding=utf-8 import unittest """934. Shortest Bridge https://leetcode.com/problems/shortest-bridge/description/ In a given 2D binary array `A`, there are two islands. (An island is a 4-directionally connected group of `1`s not connected to any other 1s.) Now, we may change `0`s to `1`s so as to connect the two is...
"""Exponential Distribution.""" __all__ = ['Exponential'] from .exp_family import ExponentialFamily from .constraint import Positive from .utils import getF, sample_n_shape_converter, cached_property class Exponential(ExponentialFamily): r"""Create a Exponential distribution object parameterized by `scale`. ...
""" Tests for L{twisted.scripts.mktap}. """ import sys try: import pwd, grp except ImportError: pwd = None from twisted.trial.unittest import TestCase from twisted.scripts.mktap import run, getid, loadPlugins from twisted.application.service import IProcess, loadApplication from twisted.test.test_twistd impo...
""" MultiSelectBlock can render and process MultiSelectIdevices as XHTML """ import logging from exe.webui.block import Block from exe.webui.element import SelectquestionElement from exe.webui import common log = logging.getLogger(__name__) # ============================================================...
import re from os.path import dirname, normpath from datetime import datetime from pipeline.compilers import SubProcessCompiler class BaseFileTree(object): """ The BaseFileTree represents a node and its children in a tree of @imported CSS files. It handles the parsing of them, in order to be able to chec...
from __future__ import division, absolute_import, print_function import os from numpy.distutils.fcompiler.gnu import GnuFCompiler compilers = ['VastFCompiler'] class VastFCompiler(GnuFCompiler): compiler_type = 'vast' compiler_aliases = () description = 'Pacific-Sierra Research Fortran 90 Compiler' ...
"""Component for the Slide API.""" from datetime import timedelta import logging from goslideapi import GoSlideCloud, goslideapi import voluptuous as vol from homeassistant.const import ( CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME, STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPEN...
from gnuradio import gr, filter from gnuradio import blocks import sys try: from gnuradio import qtgui from PyQt4 import QtGui, QtCore import sip except ImportError: sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") sys.exit(1) try: from gnuradio import analog except ImportErro...
from django.db import models import MySQLdb as mysql import pytest from pyquery import PyQuery as pq from olympia.addons.models import Addon @pytest.yield_fixture def read_only_mode(client, settings, db): def _db_error(*args, **kwargs): raise mysql.OperationalError("You can't do this in read-only mode....
"""Check whether we or not we should build the documentation If the last commit message has a "[doc skip]" marker, do not build the doc. On the contrary if a "[doc build]" marker is found, build the doc instead of relying on the subsequent rules. We always build the documentation for jobs that are not related to a sp...
import urllib2, urllib, xbmcgui, xbmcplugin, xbmc, re, sys, os, xbmcaddon, json, time ADDON_PATH = xbmc.translatePath('special://home/addons/plugin.video.sanctuary/') USERDATA_PATH = xbmc.translatePath('special://home/userdata/addon_data') ADDON_DATA = USERDATA_PATH + '/Sanctuary/' if not os.path.exists(ADDON_DATA): ...
from __future__ import print_function, division from sympy import Symbol, Integer, sympify from sympy.core.compatibility import range class PlotInterval(object): """ """ _v, _v_min, _v_max, _v_steps = None, None, None, None def require_all_args(f): def check(self, *args, **kwargs): ...
# coding: utf-8 import pickle import tempfile import os import logging logging.basicConfig() logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) debug = logger.debug warn = logger.warn import subprocess as sp import shutil import datetime as dt from urllib import quote import sphinx # noqa Some pickles...
#!/usr/bin/env python # _#_ coding:utf-8 _*_ import os,sys from django.http import JsonResponse from django.shortcuts import render from django.template import RequestContext from django.contrib.auth.decorators import login_required from ops.models import * from ops.views.ssh_settings import keyfile_dir from django.db...
from .checks import * from .models import simple_model, mv_simple, mv_simple_discrete, simple_2model from theano.tensor import constant from scipy.stats.mstats import moment def check_stat(name, trace, var, stat, value, bound): s = stat(trace[var][2000:], axis=0) close_to(s, value, bound) def test_step_cont...
"""Classes and functions implementing to Network SavedModel serialization.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.keras.saving.saved_model import constants from tensorflow.python.keras.saving.saved_model import model_seria...
import flask import flask_restless import flask_sqlalchemy # Create the Flask application and the Flask-SQLAlchemy object. app = flask.Flask(__name__) app.config['DEBUG'] = True app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db' app.config['SQLALCHEMY_ECHO'] = True db = flask_sqlalchemy.SQLAlchemy(app) ...
import functools import nose.exc import random import os _tmpfiles = [] def random_ipc_endpoint(): tmpfile = '/tmp/zerorpc_test_socket_{0}.sock'.format( str(random.random())[2:]) _tmpfiles.append(tmpfile) return 'ipc://{0}'.format(tmpfile) def teardown(): global _tmpfiles for tmpfile ...
import logging import time from struct import pack try: import threading as _threading except ImportError: import dummy_threading as _threading from . import BaseBackend, BaseConnection from ..certificate import BaseCertificate # python 3 support import six # module level logger LOG = logging.getLogger(__na...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import copy import traceback from ansible.module_utils._text import to_native from ansible...
from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.maxDiff = None filename = 'default_row01.xlsx' ...
from test_framework.test_framework import ComparisonTestFramework from test_framework.util import * from test_framework.comptool import TestManager, TestInstance, RejectResult from test_framework.blocktools import * import copy import time ''' In this test we connect to one node over p2p, and test block requests: 1) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import datetime import logging as loggers import deepy logging = loggers.getLogger(__name__) class TrainLogger(object): def __init__(self): self.log_pool = [] def load(self, model_path): log_path = self._log_path(model_path) if ...
from datetime import datetime from django.core.urlresolvers import reverse from fcm.utils import get_device_model from django.contrib.auth.models import Group from django.core.exceptions import ValidationError from django.contrib.contenttypes.fields import GenericRelation from django.db import models from django.db.mo...
#!/usr/bin/env python """Tests for records.py.""" from __future__ import with_statement import array import unittest from mapreduce.third_party import crc32c from mapreduce import records class StringWriter(object): """records.FileWriter compliant writer to string.""" def __init__(self): self.data = '' ...
from pycroft.model import session from pycroft.model.traffic import TrafficVolume, pmacct_traffic_egress, \ pmacct_traffic_ingress from tests import FactoryDataTestBase from tests.factories import UserWithHostFactory class PMAcctViewTest(FactoryDataTestBase): ip = '141.30.228.39' bad_ip = '141.30.228.1' ...
import os import re import subprocess import devops_pb2 import fabric_pb2 import chaincode_pb2 import bdd_test_util from grpc.beta import implementations def getSecretForUserRegistration(userRegistration): return devops_pb2.Secret(enrollId=userRegistration.secretMsg['enrollId'],enrollSecret=userRegistration.secr...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import time from ansible.module_utils.azure_rm_common import AzureRMModuleBase try: fr...
""" Tagging related views. """ from django.http import Http404 from django.utils.translation import ugettext as _ from django.views.generic.list_detail import object_list from tagging.models import Tag, TaggedItem from tagging.utils import get_tag, get_queryset_and_model def tagged_object_list(request, queryset_or_mo...
#http://www.compaq.com/fortran/docs/ from __future__ import division, absolute_import, print_function import os import sys from numpy.distutils.fcompiler import FCompiler from numpy.distutils.compat import get_exception from distutils.errors import DistutilsPlatformError compilers = ['CompaqFCompiler'] if os.name !=...
import frappe, os import unittest, email test_records = frappe.get_test_records('Email Account') from frappe.core.doctype.communication.communication import make from frappe.desk.form.load import get_attachments from frappe.utils.file_manager import delete_file_from_filesystem class TestEmailAccount(unittest.TestCas...
"""Helpers to manipulate a tensor graph in python. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow.python.platform from tensorflow.core.framework import graph_pb2 from tensorflow.python.framework import device as pydev from tensorflow...
from browser import window, alert def _randint(a, b): return int(window.Math.random()*(b-a+1)+a) def _rand_with_seed(x, rand_obj): x = window.Math.sin(rand_obj._state) * 10000 # Adding 1 is not reliable because of current integer implementation # If rand_obj._state is not a "safe integer" in the r...
import logging from openerp.osv import osv from edi import EDIMixin from openerp import SUPERUSER_ID _logger = logging.getLogger(__name__) RES_PARTNER_EDI_STRUCT = { 'name': True, 'ref': True, 'lang': True, 'website': True, 'email': True, 'street': True, 'street2': True, 'zip': True, ...
from hamcrest import ( assert_that, contains_exactly, empty, equal_to, has_entries ) import requests from ycmd.utils import ReadFile from ycmd.tests.java import PathToTestFile, SharedYcmd from ycmd.tests.test_utils import ( Com...
# pylint: disable=missing-docstring import json import logging import urllib2 class SpectatorClient(object): """Helper class for pulling data from Spectator servers.""" SERVICE_PORT_MAP = { 'clouddriver': 7002, 'echo': 8089, 'fiat': 7003, 'front50': 8080, 'gate': 8084, 'igor': 8088, ...
""" Commerce API v0 view tests. """ import itertools import json from datetime import datetime, timedelta from uuid import uuid4 import ddt import mock import pytz from django.conf import settings from django.urls import reverse, reverse_lazy from django.test import TestCase from django.test.utils import override_sett...
#!/usr/bin/env python """Python syntax checker with lint friendly output.""" import os import parser import re import sys def main(): paths, verbose, skip_patterns = parse_options() paths = filter_paths(paths, skip_patterns) check(paths, verbose) def parse_options(): paths = [] skip_patterns = ...
"""Parsing related helper function to be used in `input_fn`.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import six from tensorflow.python.feature_column import feature_column as fc from tensorflow.python.framework import dtypes from tensorflow.pyth...
#!/usr/bin/env python from sciwonc.dataflow.DataStoreClient import DataStoreClient import ConfigDB_Longest_1 import pprint import datetime # connector and config client = DataStoreClient("mongodb", ConfigDB_Longest_1) config = ConfigDB_Longest_1 # according to config dataList = client.getData() # return an array of d...
import sys from subprocess import Popen,PIPE try: import json except ImportError: import simplejson as json VBOX="VBoxManage" def get_hosts(host=None): returned = {} try: if host: p = Popen([VBOX, 'showvminfo', host], stdout=PIPE) else: returned = { 'all': s...
from llvmlite import ir from llvmlite import binding as ll from numba.core import datamodel import unittest class DataModelTester(unittest.TestCase): """ Test the implementation of a DataModel for a frontend type. """ fe_type = NotImplemented def setUp(self): self.module = ir.Module() ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} from ansible.module_utils.aws.core import AnsibleAWSModule from ansible.module_utils.ec2 imp...
import json import unittest from collections import namedtuple from airflow import configuration, AirflowException from airflow import models from airflow.contrib.hooks.wasb_hook import WasbHook from airflow.utils import db try: from unittest import mock except ImportError: try: import mock except...
# coding: utf-8 """ Deals with generating the site-wide navigation. This consists of building a set of interlinked page and header objects. """ from __future__ import unicode_literals import datetime import logging import os from mkdocs import utils, exceptions log = logging.getLogger(__name__) def filename_to_t...
import os import optparse import platform import re import sys from error import NoSuchProjectError from error import InvalidProjectGroupsError class Command(object): """Base class for any command line action in repo. """ common = False manifest = None _optparse = None def WantPager(self, opt): ret...
from test.test_support import findfile, TESTFN, unlink import unittest import array import io import pickle import sys import base64 def fromhex(s): return base64.b16decode(s.replace(' ', '')) def byteswap2(data): a = array.array('h', data) a.byteswap() return a.tostring() def byteswap3(data): ba...
""" ====================================================== Classification of text documents using sparse features ====================================================== This is an example showing how scikit-learn can be used to classify documents by topics using a bag-of-words approach. This example uses a scipy.spars...
# -*- coding: utf-8 -*- """ *************************************************************************** NumberInputDialog.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com *********************...
import collections from collections import OrderedDict from operator import index as operator_index import numpy as np class Row: """A class to represent one row of a Table object. A Row object is returned when a Table object is indexed with an integer or when iterating over a table:: >>> from as...
"""engine.SCons.Tool.g77 Tool-specific initialization for g77. 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, 2010, 2011, 2012, 2013 T...