content
string
from __future__ import unicode_literals import re from django.core.exceptions import FieldDoesNotExist from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import Col, Expression from django.db.models.lookups import Lookup from django.utils import six gis_lookups = {} class GISLookup...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from units.compat.mock import patch from ansible.modules.network.onyx import onyx_ptp_global from units.modules.utils import set_module_args from .onyx_module import TestOnyxModule, load_fixture class TestOnyxPtpModule(TestOnyxMo...
# -*- coding: utf-8 -*- import itsdangerous import mock from nose.tools import * # noqa: import unittest from django.utils import timezone import pytest from tests.base import ApiTestCase from osf_tests.factories import ( AuthUserFactory, ApiOAuth2ScopeFactory, ) from api.base.settings.defaults import API_BA...
import io import unittest import sys import xml.sax from xml.sax.xmlreader import AttributesImpl from xml.dom import pulldom from test.support import run_unittest, findfile tstfile = findfile("test.xml", subdir="xmltestdata") # A handy XML snippet, containing attributes, a namespace prefix, and a # self-closing ta...
import os import sys from django.core.exceptions import ImproperlyConfigured from django.db.backends.base.creation import BaseDatabaseCreation from django.utils.six.moves import input class DatabaseCreation(BaseDatabaseCreation): def _get_test_db_name(self): test_database_name = self.connection.settings...
from compose_box import ComposeBox from maillist_actions import MailListActions from mail_list import MailList from tag_list import TagList import random import string class PixelatedPage(object): def __init__(self, context, timeout=10): self.maillist_actions = MailListActions(context) self.compos...
input = """ c num blocks = 1 c num vars = 180 c minblockids[0] = 1 c maxblockids[0] = 180 p cnf 180 745 -91 56 -175 0 118 74 115 0 -36 -83 167 0 16 44 142 0 -88 33 20 0 177 132 -8 0 115 121 2 0 -13 -47 28 0 48 -174 163 0 -67 -54 123 0 -130 -132 -71 0 -171 -158 2 0 -35 23 83 0 129 109 -137 0 -8 -139 75 0 -52 -42 -79 0 5...
import json from django.contrib.auth import get_user_model from django.contrib.auth.models import Group from django.core.urlresolvers import reverse from django.test import TestCase from django.conf import settings from guardian.shortcuts import get_anonymous_user from geonode.groups.models import GroupProfile, Group...
from oslo_log import log as logging from sqlalchemy import MetaData, Table, Index from jacket.i18n import _LI LOG = logging.getLogger(__name__) def upgrade(migrate_engine): """Change instances (project_id) index to cover (project_id, deleted).""" meta = MetaData(bind=migrate_engine) # Indexes can't be...
from opus_core.variables.variable import Variable from urbansim.functions import attribute_label from numpy import reshape class income_less_housing_cost_scaled(Variable): """ (income - housing_cost) / 10000 where income > housing_cost""" housing_cost = "housing_cost" hh_income = "income" ...
"""Class that runs a named gsutil command.""" import boto import os from boto.storage_uri import BucketStorageUri from gslib.command import Command from gslib.command import COMMAND_NAME from gslib.command import COMMAND_NAME_ALIASES from gslib.exception import CommandException class CommandRunner(object): def _...
import os import fnmatch import re # for htest import sys from tkinter import StringVar, BooleanVar, Checkbutton # for GrepDialog from tkinter import Tk, Text, Button, SEL, END # for htest from idlelib import SearchEngine import itertools from idlelib.SearchDialogBase import SearchDialogBase # Importing OutputWindow...
# -*- coding: utf-8 -*- """ pygments.styles.autumn ~~~~~~~~~~~~~~~~~~~~~~ A colorful style, inspired by the terminal highlighting style. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.style import Style from pygments.to...
{ 'name': 'Assets Management', 'version': '1.0', 'depends': ['account'], 'author': 'OpenERP S.A.', 'description': """ Financial and accounting asset management. ========================================== This Module manages the assets owned by a company or an individual. It will keep track of depr...
""" Cells Scheduler """ import copy import time from oslo_config import cfg from oslo_log import log as logging from six.moves import range from nova.cells import filters from nova.cells import weights from nova import compute from nova.compute import instance_actions from nova.compute import vm_states from nova impo...
"""Utility functions""" from PyQt4 import QtGui from PyQt4 import QtCore import logging logger = logging.getLogger('camelot.core.utils') def is_deleted_pyqt( qobj ): """ :param qobj: a :class:`QtCore.QObject` :return: :keyword:`True` if the qobj was deleted, :keyword:`False` otherwise """ ...
from __future__ import absolute_import, division, unicode_literals from xml.sax.xmlreader import AttributesNSImpl from ..constants import adjustForeignAttributes, unadjustForeignAttributes prefix_mapping = {} for prefix, localName, namespace in adjustForeignAttributes.values(): if prefix is not None: pre...
""" Selectors for Nursing Shift Change Wizard """ from selenium.webdriver.common.by import By WIZARD_STAGE_CONTAINER = ( By.CSS_SELECTOR, '.modal .oe_form_field_status' ) WIZARD_STAGE = ( By.CSS_SELECTOR, '.modal .oe_form_field_status .label' ) WIZARD_BUTTON = ( By.CSS_SELECTOR, '.modal .oe_fo...
"""Main program for testing the infrastructure.""" __author__ = "Guido van Rossum <<EMAIL>>" # Support imports (need to be imported first) from . import support # Python imports import os import sys import logging # Local imports from .. import pytree import pgen2 from pgen2 import driver logging.basicConfig() de...
"""pyCrypto Crypto-related routines for oauth2client.""" from Crypto.PublicKey import RSA from Crypto.Hash import SHA256 from Crypto.Signature import PKCS1_v1_5 from Crypto.Util.asn1 import DerSequence from oauth2client._helpers import _parse_pem_key from oauth2client._helpers import _to_bytes from oauth2client._help...
AXAPI_PORT_PROTOCOLS = { 'tcp': 2, 'udp': 3, } AXAPI_VPORT_PROTOCOLS = { 'tcp': 2, 'udp': 3, 'fast-http': 9, 'http': 11, 'https': 12, } def a10_argument_spec(): return dict( host=dict(type='str', required=True), username=dict(type='str', aliases=['user', 'admin'], requi...
from ansible.module_utils._text import to_text from ansible.module_utils.basic import env_fallback, return_values from ansible.module_utils.network_common import to_list from ansible.module_utils.connection import exec_command _DEVICE_CONFIGS = {} vyos_provider_spec = { 'host': dict(), 'port': dict(type='int'...
from __future__ import unicode_literals import functools import re from .turner import TurnerBaseIE from ..compat import ( compat_urllib_parse_urlencode, compat_urlparse, ) from ..utils import ( OnDemandPagedList, remove_start, ) class NBAIE(TurnerBaseIE): _VALID_URL = r'https?://(?:watch\.|www\...
import os import json from celery.utils.log import get_task_logger from vsi.iglob import glob as iglob logger = get_task_logger(__name__); #Move to ingest.tools when done devving def match_images(images, camera_names, json_config={}): ''' returns dictionary camera_name:image pairs json example: {...
""" Tests for the score change signals defined in the courseware models module. """ import re from datetime import datetime from unittest.mock import MagicMock, patch import ddt import pytest import pytz from django.test import TestCase from submissions.models import score_reset, score_set from common.djangoapps.ut...
"""Python 'hex_codec' Codec - 2-digit hex content transfer encoding. This codec de/encodes from bytes to bytes. Written by Marc-Andre Lemburg (<EMAIL>). """ import codecs import binascii ### Codec APIs def hex_encode(input, errors='strict'): assert errors == 'strict' return (binascii.b2a_hex(input), len(in...
try: from urllib.parse import urljoin except ImportError: # Python 2 from urlparse import urljoin from django import template from django.template.base import Node from django.utils.encoding import iri_to_uri register = template.Library() class PrefixNode(template.Node): def __repr__(self): ...
""" Tests for Volume Code. """ import cStringIO from nova import context from nova import exception from nova import db from nova import flags from nova import log as logging from nova import test from nova import utils FLAGS = flags.FLAGS LOG = logging.getLogger('nova.tests.volume') class VolumeTestCase(test.Tes...
from util import CachedDict from util.serial import query_serial cache = CachedDict() table_act = { 'TEMP': 0, 'TXOUT': 1, 'RXOUT': 1, 'P12V': 3, 'PA3': 4, 'PA4': 5, 'PA5': 6, 'PA6': 7, 'N5V': 8, 'OSLPLL': 9, 'TXPLL': 10, 'RXPLL': 11, 'LNBV': 12, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import binascii PAYLOAD_HEADER_SIZE_IN_BITS = 200 PAYLOAD_HEADER_SIZE_IN_BYTES = PAYLOAD_HEADER_SIZE_IN_BITS / 8 NORMAL = 0x1 END_OF_STREAM = 0x2 class Cell(object): def __init__(self, model_uuid, model_instance_id, stream_id, seq_id, length=0, ce...
#!/opt/anaconda2/bin/python # -*- coding: utf-8 -*- """ ################################################################################ # # Copyright (c) 2015 Wojciech Migda # All rights reserved # Distributed under the terms of the MIT license # ####################################################################...
class EventSubscription(object): SUBSCRIBER_ID = "subscriber_id" EVENT_FILTERS = "event_filters" def __init__(self, subscriber_id=None, event_filters={}): self.subscriber_id = subscriber_id self.event_filters = {k: set(v) for k, v in event_filters.items()} def clear_filter(self): ...
"""Extensible class instrumentation. The :mod:`sqlalchemy.ext.instrumentation` package provides for alternate systems of class instrumentation within the ORM. Class instrumentation refers to how the ORM places attributes on the class which maintain data and track changes to that data, as well as event hooks installed...
"""Class representing instrumentation test apk and jar.""" import os from pylib.utils import apk_helper import test_jar class TestPackage(test_jar.TestJar): def __init__(self, apk_path, jar_path): test_jar.TestJar.__init__(self, jar_path) if not os.path.exists(apk_path): raise Exception('%s not fo...
from .expression import ( Alias, ClauseElement, ColumnCollection, ColumnElement, CompoundSelect, Delete, FromClause, Insert, Join, Select, Selectable, TableClause, Update, alias, and_, asc, between, bindparam, case, cast, collate, c...
#from sympy.mpmath.calculus import ODE_step_euler, ODE_step_rk4, odeint, arange from sympy.mpmath import odefun, cos, sin, mpf, sinc, mp ''' solvers = [ODE_step_euler, ODE_step_rk4] def test_ode1(): """ Let's solve: x'' + w**2 * x = 0 i.e. x1 = x, x2 = x1': x1' = x2 x2' = -x1 """ d...
#!/usr/bin/python -u # -*- coding: ISO-8859-1 -*- # # this tests the basic APIs of the XmlTextReader interface # import libxml2 import sys try: import StringIO str_io = StringIO.StringIO except: import io str_io = io.StringIO # Memory debug specific libxml2.debugMemory(1) f = str_io("""<a><b b1="b1"/>...
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import locale from django.contrib.auth import get_user_model from django.contrib.auth.management.commands import createsuperuser from django.contrib.auth.models import User, AnonymousUser from django.contrib.auth.tests.custom_user import CustomUser fro...
"""Utility functions for HTTP header value parsing and construction. Copyright 1997-1998, Gisle Aas Copyright 2002-2006, John J. Lee This code is free software; you can redistribute it and/or modify it under the terms of the BSD or ZPL 2.1 licenses (see the file COPYING.txt included with the distribution). """ impo...
import operator from functools import reduce from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured from django.core.paginator import InvalidPage from django.core.urlresolvers import reverse from django.db import models from django.db.models.fields import FieldDoesNotExist from django.utils.datas...
from django.core.files.uploadedfile import UploadedFile from django.utils.datastructures import MultiValueDict from django.utils.functional import lazy_property from django.utils import six from django.contrib.formtools.wizard.storage.exceptions import NoFileStorageConfigured class BaseStorage(object): step_key ...
import copy from db.versions.v0_9_3.domain import DBVistrail, DBAction, DBTag, DBModule, \ DBConnection, DBPortSpec, DBFunction, DBParameter, DBLocation, DBAdd, \ DBChange, DBDelete, DBAnnotation, DBPort, DBAbstractionRef, DBGroup, \ DBWorkflow, DBLog def translateVistrail(_vistrail): def update_key(ol...
# -*- coding: utf-8 -*- """ pygments.cmdline ~~~~~~~~~~~~~~~~ Command line interface. :copyright: 2006-2008 by Georg Brandl. :license: BSD, see LICENSE for more details. """ import sys import getopt from textwrap import dedent from pygments import __version__, __author__, highlight from pygments....
"""Low-level memory management tracking""" VERBOSITY = 0 # TODO: use logging class Bitmap(object): """Just a raw bitmap for reserving the pages""" def __init__(self, size, verbosity): self._size = size self._bits = 0 self._verbosity = verbosity self._bits_allocd = 0 def _m...
from django.core.cache import cache from django.db.utils import DatabaseError from django.db.models.signals import post_save from django.test import override_settings from mock import patch from pathlib2 import Path from bedrock.mozorg.models import BlogArticle, TwitterCache from bedrock.mozorg.tests import TestCase ...
__docformat__ = 'restructuredtext' import os import sys import traceback try: from sphinx.application import Sphinx except ImportError: print "#################################" print "Dependency missing: Python Sphinx" print "#################################" sys.exit(1) import os class SphinxB...
import errno import re import os import sys import subprocess # Note that gcc uses unicode, which may depend on the locale. TODO: # force LANG to be set to en_US.UTF-8 to get consistent warnings. allowed_warnings = set([ "return_address.c:62", "hci_conn.c:407", "cpufreq_interactive.c:804", "cpufreq_i...
"""Provides utilities to preprocess images for the Inception networks.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from tensorflow.python.ops import control_flow_ops def apply_with_random_selector(x, func, num_cases): """...
from __future__ import (absolute_import, division) __metaclass__ = type from ansible.compat.tests import unittest from ansible.compat.tests.mock import Mock class BaseFactsTest(unittest.TestCase): # just a base class, not an actual test __test__ = False gather_subset = ['all'] valid_subsets = None ...
"""Deals with creating the atoms class. Copyright (C) 2013, Joshua More and Michele Ceriotti This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any ...
# NamedType specification for constructed types import sys from pyasn1.type import tagmap from pyasn1 import error class NamedType: isOptional = 0 isDefaulted = 0 def __init__(self, name, t): self.__name = name; self.__type = t def __repr__(self): return '%s(%r, %r)' % ( self.__class__....
self.description = "-U --recursive upgrades outdated dependencies" # git (new package) # |-- perl (up to date) # |-- glibc (out of date, will be updated) # |-- curl (out of date, will be updated) # |-- expat (up to date) perl_lpkg = pmpkg("perl", "5.14.1-3") perl_lpkg.depends = ["glibc"] self.addpkg2db("local", p...
import command_common import logging import manifest_util def Info(manifest, bundle_names): valid_bundles, invalid_bundles = command_common.GetValidBundles(manifest, bundle_names) if invalid_bundles: logging.warn('Unknown bundle(s): %s\n' % (', ...
import os import sys def patch_process_for_coverage(): # patch multiprocessing module to get coverage # https://bitbucket.org/ned/coveragepy/issue/117/enable-coverage-measurement-of-code-run-by from coverage.collector import Collector from coverage import coverage import multiprocessing # dete...
data = ( 'Ie', # 0x00 'Io', # 0x01 'Dj', # 0x02 'Gj', # 0x03 'Ie', # 0x04 'Dz', # 0x05 'I', # 0x06 'Yi', # 0x07 'J', # 0x08 'Lj', # 0x09 'Nj', # 0x0a 'Tsh', # 0x0b 'Kj', # 0x0c 'I', # 0x0d 'U', # 0x0e 'Dzh', # 0x0f 'A', # 0x10 'B', # 0x11 'V', # 0x12 'G', # 0x...
#!/bin/python # -*- coding: utf-8 -*- """ Unit tests for gluon.tools """ import os import sys if sys.version < "2.7": import unittest2 as unittest else: import unittest from fix_path import fix_sys_path fix_sys_path(__file__) DEFAULT_URI = os.getenv('DB', 'sqlite:memory') from gluon.dal import DAL, Fie...
# -*- coding: utf-8 -*- """ pygments.lexers.make ~~~~~~~~~~~~~~~~~~~~ Lexers for Makefiles and similar. :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import Lexer, RegexLexer, include, bygroups, \ ...
from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'd/m/Y' TIME_FORMAT = 'P' DATETIME_FORMAT = 'd/m/Y P' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'd/m/Y' SH...
# -*- coding: utf-8 -*- import pytest from wasp_general.network.messenger.proto import WMessengerOnionProto, WMessengerEnvelopeProto from wasp_general.network.messenger.proto import WMessengerOnionSessionProto, WMessengerOnionLayerProto from wasp_general.network.messenger.proto import WMessengerOnionSessionFlowProto ...
from boto.regioninfo import RegionInfo class EC2RegionInfo(RegionInfo): """ Represents an EC2 Region """ def __init__(self, connection=None, name=None, endpoint=None, connection_cls=None): from boto.ec2.connection import EC2Connection super(EC2RegionInfo, self).__init...
""" IPython/Jupyter Notebook progressbar decorator for iterators. Includes a default (x)range iterator printing to stderr. Usage: >>> from tqdm_notebook import tnrange[, tqdm_notebook] >>> for i in tnrange(10): #same as: for i in tqdm_notebook(xrange(10)) ... ... """ # future division is important to divide ...
from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.db import models class Award(models.Model): name = models.CharField(max_length=25) object_id = models.PositiveIntegerField() content_type = mode...
"""Generic Node base class for all workers that run on hosts.""" import errno import logging as std_logging import os import random import signal import sys import time try: # Importing just the symbol here because the io module does not # exist in Python 2.6. from io import UnsupportedOperation # noqa e...
"""Unittests for test_dispatcher.py.""" # pylint: disable=R0201 # pylint: disable=W0212 import os import sys import unittest from pylib import constants from pylib.base import base_test_result from pylib.base import test_collection from pylib.base import test_dispatcher from pylib.device import adb_wrapper from pyli...
############## outhid = outhid_dropout(outhid, use_noise=False) ############## outhid_activ = UnaryOp(activation=eval(state['dout_activ'])) ############## emb_words_out = MultiLayer( rng, n_in=state['n_in'], n_hids=eval(state['dout_nhid']), activation=linear, init_fn='sample_weights_classic', ...
from django.db import models from django.contrib.auth.models import User class Component(models.Model): name = models.CharField(default='', max_length=200) notes = models.CharField(default='', max_length=500) is_working = models.CharField(default='', max_length=10) rating = models.CharField(default=''...
from flask import Flask, request, jsonify import heapq import logging import trie server = Flask(__name__, static_url_path='') LOGGING_FILE_NAME = 'log.txt' NUM_SUGGESTIONS_TO_RETURN = 10 single_word_trie = None def init(): global single_word_trie logging.basicConfig(filename=LOGGING_FILE_NAME, level=logging...
"""Create a new bug entry.""" __author__ = '<EMAIL> (Jason Stredwick)' import logging import webapp2 from bugs import kind from bugs.models.bugs import bug from bugs.providers import services from common.handlers import base class Error(base.Error): pass class CreateHandler(base.BaseHandler): """Create a new...
import logging from collections import namedtuple import pytest import torch import pyro.distributions as dist from pyro.contrib.gp.kernels import Cosine, Matern32, RBF, WhiteNoise from pyro.contrib.gp.likelihoods import Gaussian from pyro.contrib.gp.models import (GPLVM, GPRegression, SparseGPRegression, ...
from __future__ import absolute_import import logging import time import pystache from flask import request from .authentication import current_org from flask_login import current_user, login_required from flask_restful import abort from redash import models, utils from redash.handlers import routes from redash.handl...
import uuid import keystoneclient from keystoneclient.v2_0 import client as client_v2 from keystoneclient.v3 import client from keystoneworkout import benchmark ADMIN_USERNAME = 'admin' ADMIN_PASSWORD = 'secrete' ADMIN_PROJECT_NAME = 'admin' ADMIN_ROLE_NAME = 'admin' def uid(): return uuid.uuid4().hex[:6] c...
from __future__ import print_function from boto.sdb.db.model import Model from boto.sdb.db.property import StringProperty, IntegerProperty, ListProperty, ReferenceProperty, CalculatedProperty from boto.manage.server import Server from boto.manage import propget import boto.utils import boto.ec2 import time import trac...
from time import sleep from distutils.version import StrictVersion try: import shade HAS_SHADE = True except ImportError: HAS_SHADE = False ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} def _create_stack(module, stack, clo...
"""Gaussian processes regression. """ # Authors: Jan Hendrik Metzen <<EMAIL>> # # License: BSD 3 clause import warnings from operator import itemgetter import numpy as np from scipy.linalg import cholesky, cho_solve, solve_triangular from scipy.optimize import fmin_l_bfgs_b from sklearn.base import BaseEstimator, R...
import os import unittest import six import bmemcached from bmemcached.exceptions import AuthenticationNotSupported, InvalidCredentials, MemcachedException if six.PY3: from unittest import mock else: import mock class TestServerAuth(unittest.TestCase): @mock.patch.object(bmemcached.protocol.Protocol, '...
""" Generic Python Character Mapping Codec. Use this codec directly rather than through the automatic conversion mechanisms supplied by unicode() and .encode(). Written by Marc-Andre Lemburg (<EMAIL>). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. """#" import codecs ### Codec APIs ...
from m5.objects import * from arm_generic import * root = LinuxArmFSSystemUniprocessor(mem_mode='timing', cpu_class=TimingSimpleCPU).create_root()
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import forms from django.forms.formsets import BaseFormSet, formset_factory from bootstrap3.tests import TestForm RADIO_CHOICES = ( ('1', 'Radio 1'), ('2', 'Radio 2'), ) MEDIA_CHOICES = ( ('Audio', ( ('vinyl', 'Vinyl'), ...
# This class manages all the menu items in the main menu of the editor import wx from constants import * from evhdlr import * import util import logging from preference import Preferences from wx.lib.pubsub import setupkwargs, pub import pvscomm class MainFrameMenu(wx.MenuBar): """The class implementing and mana...
"""A cache for storing small matrices in multiple formats.""" from __future__ import print_function, division from sympy import Matrix, I, Pow, Rational, exp, pi from sympy.physics.quantum.matrixutils import ( to_sympy, to_numpy, to_scipy_sparse ) class MatrixCache(object): """A cache for small matrices in...
import os from colorama import Fore from helpers import deflate, inflate, run_cmd outDirDefault = 'test-outs' testDirDefault = 'test-files' """ Run a single test @param tFile- required; the full path to the file to run @param level- optional (default: all); the compression level [1-9] @param delete- optional (defaul...
from __future__ import print_function import numpy as np from numba import cuda from numba.cuda.testing import unittest class CudaArrayIndexing(unittest.TestCase): def test_index_1d(self): arr = np.arange(10) darr = cuda.to_device(arr) for i in range(arr.size): self.assertEqual...
from __future__ import unicode_literals import webnotes from webnotes import msgprint, _ from webnotes.utils import getdate, nowdate, flt, cstr def execute(filters=None): if not filters: filters = {} columns = get_columns() entries = get_gl_entries(filters) entries_after_report_date = [[gle.voucher_type, gle.vou...
from __future__ import unicode_literals from __future__ import absolute_import import sys from itertools import cycle from .multiplexer import Multiplexer from . import colors from .utils import split_buffer class LogPrinter(object): def __init__(self, containers, attach_params=None, output=sys.stdout, monochro...
from openerp.osv import fields, osv class account_tax_chart(osv.osv_memory): """ For Chart of taxes """ _name = "account.tax.chart" _description = "Account tax chart" _columns = { 'period_id': fields.many2one('account.period', \ 'Period', \ ...
from openerp.osv import orm, fields from datetime import datetime class WarningLog(orm.Model): _name = "warning.log" _rec_name = 'user' _columns = { "date": fields.datetime("Date"), "user": fields.many2one("res.users", "User"), "msg": fields.text("Message"), "type": fields....
import copy import logging _log = logging.getLogger(__name__) # Yes, it's a hypergraph. # FIXME: Should this function live with the ports somewhere? # Perhaps this should move onto PortFactory? def _baseline_search_hypergraph(host, port_names): hypergraph = {} # These edges in the hypergraph aren't visible...
"""Tests for distutils.command.build.""" import unittest import os import sys from test.support import run_unittest from distutils.command.build import build from distutils.tests import support from sysconfig import get_platform class BuildTestCase(support.TempdirManager, support.LoggingSilencer, ...
import sys try: from setuptools import setup, Extension except: from distutils.core import setup, Extension, Command setup(name = 'thrift_fb303', version = '1.0.0-dev', description = 'Python bindings for the Apache Thrift FB303', author = ['Thrift Developers'], author_email = ['<EMAIL>'...
""" XPath query support. This module provides L{XPathQuery} to match L{domish.Element<twisted.words.xish.domish.Element>} instances against XPath-like expressions. """ try: import cStringIO as StringIO except ImportError: import StringIO class LiteralValue(str): def value(self, elem): return self...
"""Unit tests for download_from_google_storage.py.""" import optparse import os import Queue import shutil import sys import tempfile import threading import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import upload_to_google_storage import download_from_google_storage #...
""" # Majic # Copyright (C) 2014 CEH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This pr...
#!/usr/bin/env python """simple thread pool @author: dn13(<EMAIL>) @author: Fibrizof(<EMAIL>) """ import threading import Queue import new def WorkerPoolError( Exception ): pass class Task(threading.Thread): def __init__(self, queue, result_queue): threading.Thread.__init__(self) self.queue...
import os import re def main(request, response): type = request.GET['type'] encoding = request.GET['encoding'] # We want the raw input for 'q' q = re.search(r'q=([^&]+)', request.url_parts.query).groups()[0] if type == 'html': return [("Content-Type", "text/html; charset=utf-8")], q eli...
from openerp import tools from openerp.osv import fields, osv class payslip_report(osv.osv): _name = "payslip.report" _description = "Payslip Analysis" _auto = False _columns = { 'name':fields.char('Name', readonly=True), 'date_from': fields.date('Date From', readonly=True,), 'd...
data = ( 'Mie ', # 0x00 'Xu ', # 0x01 'Mang ', # 0x02 'Chi ', # 0x03 'Ge ', # 0x04 'Xuan ', # 0x05 'Yao ', # 0x06 'Zi ', # 0x07 'He ', # 0x08 'Ji ', # 0x09 'Diao ', # 0x0a 'Cun ', # 0x0b 'Tong ', # 0x0c 'Ming ', # 0x0d 'Hou ', # 0x0e 'Li ', # 0x0f 'Tu ', # 0x10 'Xiang ...
#!/usr/bin/env python # # A module to analyze and identify any common problems which can be determined from log files # # Initial code by Andrew Chapman (<EMAIL>), 16th Jan 2014 # # some logging oddities noticed while doing this, to be followed up on: # - tradheli MOT labels Mot1,Mot2,Mot3,Mot4,GGain # - Pixhawk ...
#!/usr/bin/python # # last modified : 11/4/16 # script that takes feature file and ranks the features based on Pearson Correlation. from __future__ import division import os import numpy as np import scipy.stats # reading the data file into an array data = np.genfromtxt("features.dat", delimiter = ',') data = np.ma...
import glob import os import shutil import sys import unittest from test.test_support import run_unittest, TESTFN def fsdecode(s): return unicode(s, sys.getfilesystemencoding()) class GlobTests(unittest.TestCase): def norm(self, *parts): return os.path.normpath(os.path.join(self.tempdir, *parts)) ...
from hendrix import __version__ import errno import os import sys from setuptools import setup, find_packages def file_name(rel_path): dir_path = os.path.dirname(__file__) return os.path.join(dir_path, rel_path) def read(rel_path): with open(file_name(rel_path)) as f: return f.read() def readl...