content
string
import json import logging from StringIO import StringIO import posixpath from appengine_blobstore import AppEngineBlobstore, BLOBSTORE_GITHUB from appengine_url_fetcher import AppEngineUrlFetcher from appengine_wrappers import urlfetch, blobstore from docs_server_utils import StringIdentity from file_system import Fi...
#!/usr/bin/env python from sqlite3 import dbapi2 from db.migrations import migrations_util from node import constants def upgrade(db_path): with dbapi2.connect(db_path) as con: cur = con.cursor() # Use PRAGMA key to encrypt / decrypt database. cur.execute("PRAGMA key = '%s';" % constants...
import document_configuration # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
"""Tests for SparseReorder.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.framework import sparse_tensor from tensorflow.python.ops import sparse_ops from tensorflow.python.platform import test class SparseS...
from __future__ import absolute_import, print_function import types from .base_spec import base_converter from . import base_info #---------------------------------------------------------------------------- # C++ code template for converting code from python objects to C++ objects # # This is silly code. There is a...
import argparse import importlib import inspect import os import sys import json from fnmatch import fnmatch from mozdevice import DeviceManagerADB from mozlog.structured import commandline from mcts.webapi_tests import semiauto from mcts.webapi_tests.semiauto import environment stingray_test = ['apps', 'device_sto...
from openerp.osv import fields, osv class purchase_order(osv.osv): _name = "purchase.order" _inherit = "purchase.order" _description = "Purchase Order" def _choose_account_from_po_line(self, cr, uid, order_line, context=None): account_id = super(purchase_order, self)._choose_account_from_po_li...
""" Python 'latin-1' Codec Written by Marc-Andre Lemburg (<EMAIL>). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. """ import codecs ### Codec APIs class Codec(codecs.Codec): # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. encod...
"""Statistics gathering for the distcc-pump include server.""" __author__ = "Nils Klarlund" import time resolve_expr_counter = 0 # number of computed includes master_hit_counter = 0 # summary node hits master_miss_counter = 0 # summary node misses resolve_counter = 0 # calls of Resolve method search_counter = 0 # nu...
""" Course API """ import logging import search from django.conf import settings from django.contrib.auth.models import AnonymousUser, User # lint-amnesty, pylint: disable=imported-auth-user from django.urls import reverse from edx_django_utils.monitoring import function_trace from edx_when.api import get_dates_for_c...
"""Django admin interface for the shopping cart models. """ from ratelimitbackend import admin from shoppingcart.models import ( PaidCourseRegistrationAnnotation, Coupon, DonationConfiguration, Invoice, CourseRegistrationCodeInvoiceItem, InvoiceTransaction ) class SoftDeleteCouponAdmin(admin.M...
from __future__ import unicode_literals from datetime import date from django.db.models.query_utils import InvalidQuery from django.test import TestCase, skipUnlessDBFeature from .models import Author, Book, BookFkAsPk, Coffee, FriendlyAuthor, Reviewer class RawQueryTests(TestCase): @classmethod def setUp...
class QueuePropertyMixin(object): def _queue_getter(self): # Import at runtime to avoid circular imports from model.queues import Queue return Queue.queue_with_name(self.queue_name) def _queue_setter(self, queue): self.queue_name = queue.name() if queue else None queue = pr...
"Implementation of tzinfo classes for use with datetime.datetime." from __future__ import unicode_literals from datetime import timedelta, tzinfo import time import warnings from django.utils.deprecation import RemovedInDjango19Warning from django.utils.encoding import force_str, force_text, DEFAULT_LOCALE_ENCODING ...
import logging import os import re import time import serial from serial import SerialTimeoutException import struct from threading import Lock from serial.tools import list_ports logger = logging.getLogger('universe') class Maestro: """ Implementation of the controller for Pololu Mini Maestro Controller. ...
from django import http from django.db import models from django.contrib.databrowse.datastructures import EasyModel from django.contrib.databrowse.sites import DatabrowsePlugin from django.shortcuts import render_to_response from django.utils.text import capfirst from django.utils.encoding import smart_str, force_unico...
#!/usr/bin/env python # This example demonstrates the use of streamlines generated from seeds, # combined with a tube filter to create several streamtubes. import vtk from vtk.util.misc import vtkGetDataRoot from vtk.util.colors import * VTK_DATA_ROOT = vtkGetDataRoot() # We read a data file the is a CFD a...
from six.moves import range from webob import exc from nova import context from nova.i18n import _ from nova import objects from nova import utils CHUNKS = 4 CHUNK_LENGTH = 255 MAX_SIZE = CHUNKS * CHUNK_LENGTH def extract_password(instance): result = '' sys_meta = utils.instance_sys_meta(instance) for ...
import locale from locale import localeconv import logging import re from openerp import tools from openerp.osv import fields, osv from openerp.tools.safe_eval import safe_eval as eval from openerp.tools.translate import _ _logger = logging.getLogger(__name__) class lang(osv.osv): _name = "res.lang" _descrip...
#!/usr/bin/env python3 import os import sys import json from munch import Munch import re from ortools.algorithms import pywrapknapsack_solver ref, output = sys.argv[1:] if not ref.startswith('refs/heads/'): print(ref, 'is not a branch') sys.exit(0) branch = ref.split('/')[-1] print('rebalance', branch, '=>', ou...
{ 'name' : 'Venezuela - Accounting', 'version': '1.0', 'author': ['OpenERP SA', 'Vauxoo'], 'category': 'Localization/Account Charts', 'description': """ Chart of Account for Venezuela. =============================== Venezuela doesn't have any chart of account by law, but the default proposed in Op...
"""Generates sample data for a course and its users.""" __author__ = ['Timothy Johnson (<EMAIL>)'] import os import random from common import safe_dom from common import users from common import utils as common_utils from controllers import utils from models import analytics from models import courses from models im...
import sys, glob from optparse import OptionParser parser = OptionParser() parser.add_option('--genpydir', type='string', dest='genpydir', default='gen-py') options, args = parser.parse_args() del sys.argv[1:] # clean up hack so unittest doesn't complain sys.path.insert(0, options.genpydir) sys.path.insert(0, glob.glob...
"""Test the maas package.""" from __future__ import ( absolute_import, print_function, unicode_literals, ) str = None __metaclass__ = type __all__ = [] from importlib import import_module import new import os.path import sys from textwrap import dedent from unittest import skipIf from fixtures impo...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os import unittest from twitter.common.collections import OrderedSet from pants.base.address import Address, parse_spec from pants.base.exceptions import Targ...
import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) TEMPLATE_DIRS = ( os.path.join(BASE_DIR, 'templates'), ) SECRET_KEY = 'lv^ce%zv9ppcl(v-mix+-&x2q#1mtq3@qxl==_bvyqy-k9soru' DEBUG = True TEMPLATE_DEBUG = True ALLOWED_HOSTS = ['127.0.0.1', 'localhost'] CRISPY_TEMPLATE_PACK = 'bootstrap3' INSTALL...
import os from collections import Counter from collections import OrderedDict import nltk from nltk.tokenize import * from nltk.probability import * def main(): ran = range(3) d_file = open('dictionary2').readlines() dict_key = [] dict_occ = [] for line in d_file: tmp = line.strip() tmp = tmp.split() ...
#!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2010 (ita) """ Dumb C/C++ preprocessor for finding dependencies It will look at all include files it can find after removing the comments, so the following will always add the dependency on both "a.h" and "b.h":: #include "a.h" #ifdef B #include "b.h" ...
#!/usr/bin/env python # -*- coding:utf-8 -*- from jumeaux.addons.reqs2reqs.add import Executor from jumeaux.models import Reqs2ReqsAddOnPayload class TestExec: def test(self): payload: Reqs2ReqsAddOnPayload = Reqs2ReqsAddOnPayload.from_dict( { "requests": [ ...
from collections import OrderedDict from os.path import join from .base_view import BaseView from math import asin, cos, radians, sin, sqrt try: import shapefile import shapely.geometry from pyproj import Proj except ImportError as e: import warnings warnings.warn(str(e)) warnings.warn('SHP libr...
#!/usr/bin/env python # -*- coding: utf-8 -*- import random import pygame from pygame.locals import * import util class Tile: def __init__(self, color, image = None): self.color = color self.image = image class Shape(object): SHAPE_WIDTH = 4 SHAPE_HEIGHT = 4 SHAPES = ( ...
""" atexit.py - allow programmer to define multiple exit functions to be executed upon normal program termination. One public function, register, is defined. """ __all__ = ["register"] import sys _exithandlers = [] def _run_exitfuncs(): """run any registered exit functions _exithandlers is traversed in rev...
""" homeassistant.components.isy994 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Connects to an ISY-994 controller and loads relevant components to control its devices. Also contains the base classes for ISY Sensors, Lights, and Switches. For configuration details please visit the documentation for this component at https://home-a...
from ..Qt import QtGui, QtCore from ..Point import Point class GraphicsWidgetAnchor(object): """ Class used to allow GraphicsWidgets to anchor to a specific position on their parent. The item will be automatically repositioned if the parent is resized. This is used, for example, to anchor a LegendIte...
"""AffineLinearOperator Tests.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.contrib import linalg from tensorflow.contrib.distributions.python.ops.bijectors import affine_linear_operator as affine_linear_operator_li...
from osv import osv from openerp_sxw2rml import sxw2rml from StringIO import StringIO import base64 import pooler import addons class report_xml(osv.osv): _inherit = 'ir.actions.report.xml' def sxwtorml(self, cr, uid, file_sxw, file_type): ''' The use of this function is to get rml file from...
{ 'name': 'Costa Rica - Accounting', 'version': '0.1', 'url': 'http://launchpad.net/openerp-costa-rica', 'author': 'ClearCorp S.A.', 'website': 'http://clearcorp.co.cr', 'category': 'Localization/Account Charts', 'description': """ Chart of accounts for Costa Rica. ==========================...
import logging import os import shutil import sys import tempfile from pyflink.table import EnvironmentSettings, TableEnvironment from pyflink.table import expressions as expr def word_count(): content = "line Licensed to the Apache Software Foundation ASF under one " \ "line or more contributor li...
from webob import exc from nova.api.openstack import common from nova.api.openstack import wsgi from nova import exception from nova.i18n import _ import nova.image class Controller(object): """The image metadata API controller for the OpenStack API.""" def __init__(self): self.image_api = nova.imag...
import datetime import re import socket from .compat import str_types from .exceptions import FormatError class FormatChecker(object): """ A ``format`` property checker. JSON Schema does not mandate that the ``format`` property actually do any validation. If validation is desired however, instances ...
from string import Template def start_response(resp="text/html"): return('Content-type: ' + resp + '\n\n') def include_header(the_title): with open('templates/header.html') as headf: head_text = headf.read() header = Template(head_text) return(header.substitute(title=the_title)) def include_f...
from setuptools import setup, find_packages import os version = '0.1' setup(name='mtj.eve.tracker', version=version, description="EVE Online Tracker", long_description=open("README.rst").read() + "\n" + open(os.path.join("docs", "HISTORY.rst")).read(), # Get more strings...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: cobbler_system version_added: '2.7' short_description: Manag...
import threading, sys, os, time, platform, getpass import wx if platform.system() == "Linux": from wx.lib.pubsub import setupkwargs from wx.lib.pubsub import pub as Publisher else: from wx.lib.pubsub import pub as Publisher if platform.system() == "Linux": if 'fedora' in platform.dist(): user =...
"""Universal Unique Identifiers (UUIDs). By default, UUIDs generated here are purely random, with no internal structure. However, they are the same size, and are formatted by the same conventions, as the UUIDs in the Open Software Foundation's Distributed Computing Environment (OSF DCE). This allows Xend to be used ...
import re def process_dollars(app, docname, source): r""" Replace dollar signs with backticks. More precisely, do a regular expression search. Replace a plain dollar sign ($) by a backtick (`). Replace an escaped dollar sign (\$) by a dollar sign ($). Don't change a dollar sign preceded or ...
import struct import dns.exception import dns.rdata import dns.name class SOA(dns.rdata.Rdata): """SOA record @ivar mname: the SOA MNAME (master name) field @type mname: dns.name.Name object @ivar rname: the SOA RNAME (responsible name) field @type rname: dns.name.Name object @ivar serial: Th...
#!/usr/bin/env python3 import os import sys import time sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")) from panda import Panda # noqa: E402 WHITE_GMLAN_BUS = 3 OTHER_GMLAN_BUS = 1 def set_gmlan(p): if p.is_white(): p.set_gmlan(2) else: p.set_obd(True) def set_speed_kb...
from __future__ import division import unittest import numpy as np from wyrm.types import Data from wyrm.processing import variance from wyrm.processing import swapaxes class TestVariance(unittest.TestCase): def setUp(self): ones = np.ones((10, 5)) # epo with 0, 1, 2 data = np.array([0...
""" Base-backends for django-rcsfield. Used to hold common functionality of all backends. Every backend module implementd a very simple API. Three functions are exported: * fetch(key, revision): knows how to fetch a specific revision of the entity referenced by ``key`` * commit(key, data): knows how to com...
''' Created on Mar 28, 2017 @author: Leo Zhong ''' import numpy as np # for metrics calculation #define functions def tanh(x): return np.tanh(x) def tanh_deriv(x): #derivative for tanh return 1.0 - np.tanh(x)*np.tanh(x) def logistic(x): return 1/(1 + np.exp(-x)) def logistic_derivative(x): #deriv...
"""Fixer that changes filter(F, X) into list(filter(F, X)). We avoid the transformation if the filter() call is directly contained in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. NOTE: This is still not correct if the original code was depending on filter(F, X) to return a string if X is a...
"""Testing for kernels for Gaussian processes.""" # Licence: BSD 3 clause from collections import Hashable from sklearn.externals.funcsigs import signature import numpy as np from sklearn.gaussian_process.kernels import _approx_fprime from sklearn.metrics.pairwise \ import PAIRWISE_KERNEL_FUNCTIONS, euclidean_...
"""Marathon acceptance tests for DC/OS.""" import common import pytest import retrying import shakedown from datetime import timedelta from dcos import packagemanager, cosmos PACKAGE_NAME = 'marathon' SERVICE_NAME = 'marathon-user' DCOS_SERVICE_URL = shakedown.dcos_service_url(PACKAGE_NAME) WAIT_TIME_IN_SECS = 300 ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'certified'} from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network.comm...
""" Example to generate a .fit, .mod and .dat file to feed in MrMoose for demonstration. The model consists of one single power-laws and two black bodies, with 15 data points. All is a mixture of unresolved and blended/spatially identified components, with the black bodies being at different redshifts (z=2 and z=4)...
from typing import Any, Dict from django.http import HttpRequest, HttpResponse from zerver.decorator import webhook_view from zerver.lib.request import REQ, has_request_variables from zerver.lib.response import json_success from zerver.lib.webhooks.common import check_send_webhook_message from zerver.models import Us...
#! /usr/bin/env python # xxci # # check in files for which rcsdiff returns nonzero exit status import sys import os from stat import * import fnmatch EXECMAGIC = '\001\140\000\010' MAXSIZE = 200*1024 # Files this big must be binaries and are skipped. def getargs(): args = sys.argv[1:] if a...
import os import re import sys import tempfile import mimetypes import subprocess import click FILENAME = object() OUTPUT_FOLDER = object() unpackers = [] def register_unpacker(cls): unpackers.append(cls) return cls def fnmatch(pattern, filename): filename = os.path.basename(os.path.normcase(filename...
import os import sys from importlib import import_module from saml2.s_utils import factory from saml2.s_utils import do_ava from saml2 import saml from saml2 import extension_elements_to_elements from saml2 import SAMLError from saml2.saml import NAME_FORMAT_UNSPECIFIED import logging logger = logging.getLogger(__nam...
#!/usr/bin/env python3 """Python binding of LED wrapper of LetMeCreate library.""" import ctypes _LIB = ctypes.CDLL('libletmecreate_core.so') LED_0 = 0x01 LED_1 = 0x02 LED_2 = 0x04 LED_3 = 0x08 LED_4 = 0x10 LED_5 = 0x20 LED_6 = 0x40 LED_HEARTBEAT = LED_7 = 0x80 ALL_LEDS = 0xFF LED_CNT = 8 ON_OFF_MODE = 0 TIMER_MOD...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.contrib.solvers.python.ops import util from tensorflow.python.framework import constant_op from tensorflow.python.framework import ops from tensorflow.python.ops import array...
config_vars = { 'billing_project_id': 'billing_project', 'billing_dataset_id': 'billing_dataset', 'billing_table_name': 'billing_table', 'output_dataset_id': 'output_dataset', 'output_table_name': 'output_table', 'sql_file_path': 'cud_sud_attribution_query.sql', # There are two slightly dif...
import logging import time import urllib2 _log = logging.getLogger(__name__) class NetworkTimeout(Exception): def __str__(self): return 'NetworkTimeout' class NetworkTransaction(object): def __init__(self, initial_backoff_seconds=10, grown_factor=1.5, timeout_seconds=(10 * 60), convert_404_to_None=...
import wx # Install under unity: <sudo apt-get install python-appindicator> import appindicator import gtk class AppIndicator(): '''Application Indicator object for the MindfulClock. AppIndicator(rame, icon, path, textdic, menutime) frame = wx.Window icon = icon (without extension) path = path to...
"""Version-independent api tests""" import httplib2 from glance.openstack.common import jsonutils from glance.tests import functional class TestRootApi(functional.FunctionalTest): def test_version_configurations(self): """Test that versioning is handled properly through all channels""" #v1 an...
from __future__ import unicode_literals from django.contrib.localflavor.cz.forms import (CZPostalCodeField, CZRegionSelect, CZBirthNumberField, CZICNumberField) from django.core.exceptions import ValidationError from django.test import SimpleTestCase class CZLocalFlavorTests(SimpleTestCase): def test_CZRegi...
import array import random import numpy from deap import algorithms from deap import base from deap import creator from deap import tools creator.create("FitnessMax", base.Fitness, weights=(1.0,)) creator.create("Individual", array.array, typecode='b', fitness=creator.FitnessMax) toolbox = base.Toolbox() # Attribu...
r"""Test correct treatment of various string literals by the parser. There are four types of string literals: 'abc' -- normal str r'abc' -- raw str b'xyz' -- normal bytes br'xyz' -- raw bytes The difference between normal and raw strings is of course that in a raw string, \ escapes (while still u...
import os import sys import re import time import chardet import tempfile import urllib2 import urlparse import shutil import traceback import logging from azure.storage import BlobService from Utils.WAAgentUtil import waagent import Utils.HandlerUtil as Util from patch import * # Global variables definition Extension...
""" This module describes fuel use with considerations of unit commitment and incremental heat rates using piecewise linear expressions. If you want to use this module directly in a list of switch modules (instead of including the package project.unitcommit), you will also need to include the module operations.unitcom...
import contextlib import mock import fixtures from oslo_config import cfg from oslo_log import log as logging from nova.tests.functional.test_servers import ServersTestBase from nova.tests.unit import fake_network from nova.tests.unit.virt.libvirt import fake_libvirt_utils from nova.tests.unit.virt.libvirt import fak...
""" Tests for L{twisted.python.versions}. """ from __future__ import division, absolute_import import sys import operator from io import BytesIO from twisted.python.versions import getVersionString, IncomparableVersions from twisted.python.versions import Version, _inf from twisted.python.filepath import FilePath f...
"""The Extended Availability Zone Status API extension.""" from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova import availability_zones as avail_zone ALIAS = "os-extended-availability-zone" authorize = extensions.os_compute_soft_authorizer(ALIAS) PREFIX = "OS-EXT-AZ" class Exten...
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=80: import os try: from lxml import etree as ET except ImportError: try: import xml.etree.cElementTree as ET except ImportError: try: import xml.etree.ElementTree as ET except ImportError: print "Failed to ...
# -*- coding: utf-8 -*- import codecs from distutils.spawn import find_executable import logging import click from path import Path import ruamel.yaml from chanjo.store.api import ChanjoDB from chanjo.init.bootstrap import pull, BED_NAME, DB_NAME from chanjo.init.demo import setup_demo, DEMO_BED_NAME LOG = logging.g...
#/usr/bin/env python # Script which goes with hpp-rbprm-corba package. from hpp.corbaserver.rbprm.rbprmbuilder import Builder from hpp.corbaserver.rbprm.rbprmfullbody import FullBody from hpp.corbaserver.rbprm.problem_solver import ProblemSolver from hpp.gepetto import Viewer, PathPlayer import numpy as np from viewer...
"""gypd output module This module produces gyp input as its output. Output files are given the .gypd extension to avoid overwriting the .gyp files that they are generated from. Internal references to .gyp files (such as those found in "dependencies" sections) are not adjusted to point to .gypd files instead; unlike ...
from weboob.tools.capabilities.messages.genericArticle import GenericNewsPage,\ NoBodyElement, NoAuthorElement, NoneMainDiv class ArticlePage(GenericNewsPage): "ArticlePage object for Libe" def on_loaded(self): self.main_div = self.document.getroot() self.element_title_selector = "title" ...
# -*- coding: utf-8 -*- from django.conf import settings from django.utils.translation import ugettext from notification import backends MOBILE_NUMBER_SETTING_KEY = "NOTIFICATION_TWILIO_USER_MOBILE_NUMBER" TWILIO_ACCOUNT_SETTING_KEY = "TWILIO_ACCOUNT_SID" TWILIO_AUTH_SETTING_KEY = "TWILIO_AUTH_TOKEN" TWILIO_FROM_SETT...
# -*- coding: utf-8 -*- # # Sphinx documentation build configuration file, created by # sphinx-quickstart.py on Sat Mar 8 21:47:50 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickl...
# -*- coding: utf-8 -*- """Tests for jslex.""" # originally from https://bitbucket.org/ned/jslex from __future__ import unicode_literals from django.test import SimpleTestCase from django.utils.jslex import JsLexer, prepare_js_for_gettext class JsTokensTest(SimpleTestCase): LEX_CASES = [ # ids ("...
from __future__ import division from fractions import Fraction from pyparsing import (Literal, StringEnd, OneOrMore, ParseException) import nltk from nltk.tree import Tree ARROWS = ('<->', '->') ## Defines a simple pyparsing tokenizer for chemical equations elements = ['Ac', 'Ag', 'Al', 'Am', 'Ar', 'As', 'At', 'Au',...
from collections import Mapping from inspect import isgeneratorfunction from functools import wraps, partial from asyncio import Future, CancelledError, TimeoutError, async, sleep from .consts import MAX_ASYNC_WHILE from .access import get_event_loop, LOGGER, isfuture, is_async __all__ = ['maybe_async', '...
__author__ = "Ian Goodfellow" import numpy as np from theano import function from theano import tensor as T from pylearn2.compat import OrderedDict from pylearn2.sandbox.lisa_rl.bandit.agent import Agent from pylearn2.utils import sharedX class AverageAgent(Agent): """ A simple n-armed bandit playing agent...
from django.test import TestCase from synnefo.logic import rapi_pool from mock import patch @patch('synnefo.logic.rapi_pool.GanetiRapiClient', spec=True) class GanetiRapiPoolTest(TestCase): def test_new_client(self, rclient): cl = rapi_pool.get_rapi_client(1, 'amxixa', 'cluster0', '5080', 'user', ...
# -*- test-case-name: openid.test.test_xri -*- """Utility functions for handling XRIs. @see: XRI Syntax v2.0 at the U{OASIS XRI Technical Committee<http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xri>} """ import re XRI_AUTHORITIES = ['!', '=', '@', '+', '$', '('] try: unichr(0x10000) except ValueErr...
""" The I{metrics} module defines classes and other resources designed for collecting and reporting performance metrics. """ import time from logging import getLogger from suds import * from math import modf log = getLogger(__name__) class Timer: def __init__(self): self.started = 0 self.stopped...
import mock import datetime import urlparse from django.test import TestCase from django.core.files.base import ContentFile from boto.s3.key import Key from storages.backends import s3boto __all__ = ( 'ParseTsExtendedCase', 'SafeJoinTest', 'S3BotoStorageTests', #'S3BotoStorageFileTest...
import time from datetime import datetime from dateutil import relativedelta from openerp.osv import fields, osv class payslip_lines_contribution_register(osv.osv_memory): _name = 'payslip.lines.contribution.register' _description = 'PaySlip Lines by Contribution Registers' _columns = { 'date_from...
""" lockfile.py - Platform-independent advisory file locks. Requires Python 2.5 unless you apply 2.4.diff Locking is done on a per-thread basis instead of a per-process basis. Usage: >>> lock = FileLock('somefile') >>> try: ... lock.acquire() ... except AlreadyLocked: ... print 'somefile', 'is locked already...
import re import os import libvirt from . import generatename from . import progress from . import xmlutil from .guest import Guest from .devices import DeviceInterface from .devices import DeviceDisk from .logger import log from .devices import DeviceChannel def _replace_vm(conn, name): """ Remove the exis...
# -*- coding: utf-8 -*- ''' Copyright (C) 2011,2012 Maximilian Maahn, IGMK (<EMAIL>) make quicklooks from IMProToo NetCDF files. use: python batch_makeQuicklooks.py pathIn pathOut site requires: numpy, matplotlib, netcdf4-python or python-netcdf ''' import sys import numpy as np import glob import calendar imp...
"""Here we define the exported functions, types, etc... which need to be exported through a global C pointer. Each dictionary contains name -> index pair. Whenever you change one index, you break the ABI (and the ABI version number should be incremented). Whenever you add an item to one of the dict, the API needs to ...
import uuid from boto.cloudfront.identity import OriginAccessIdentity from boto.cloudfront.object import Object, StreamingObject from boto.cloudfront.signers import ActiveTrustedSigners, TrustedSigners from boto.cloudfront.logging import LoggingInfo from boto.s3.acl import ACL class DistributionConfig: def __init...
import re XML_ENCODING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" class RepoView: def __init__(self, primary, filelists, other, updateinfo, groups, fileobj, checksum_type): self.primary = primary self.filelists = filelists self.other = other self.updateinfo =...
{ 'name': 'Ethiopia - Accounting', 'version': '1.0', 'category': 'Localization/Account Charts', 'description': """ Base Module for Ethiopian Localization ====================================== This is the latest Ethiopian OpenERP localization and consists of: - Chart of Accounts - VAT tax struc...
import os import numpy import vigra from functools import partial from StringIO import StringIO ## Instead of importing requests and PIL here, ## use late imports (below) so people who don't use TiledVolume don't have to have them # New dependency: requests is way more convenient than urllib or httplib #import reque...
from decimal import Decimal from sys import float_info from unittest import TestCase from django.utils.numberformat import format as nformat class TestNumberFormat(TestCase): def test_format_number(self): self.assertEqual(nformat(1234, '.'), '1234') self.assertEqual(nformat(1234.2, '.'), '1234.2...
# Keypoints descriptor example. # This example shows how to save a keypoints descriptor to file. Show the camera an object # and then run the script. The script will extract and save a keypoints descriptor and the image. # You can use the keypoints_editor.py util to remove unwanted keypoints. # # NOTE: Please reset the...