content
string
"""Trust Region Reflective algorithm for least-squares optimization. The algorithm is based on ideas from paper [STIR]_. The main idea is to account for the presence of the bounds by appropriate scaling of the variables (or, equivalently, changing a trust-region shape). Let's introduce a vector v: | ub[i] ...
from past.builtins import basestring from rest_framework import status as http_status from django.utils.translation import ugettext_lazy as _ from rest_framework import status from rest_framework.exceptions import APIException, AuthenticationFailed, ErrorDetail def get_resource_object_member(error_key, context): ...
from telemetry import test from benchmarks import silk_flags from measurements import thread_times class ThreadTimesKeySilkCases(test.Test): """Measures timeline metrics while performing smoothness action on key silk cases.""" test = thread_times.ThreadTimes page_set = 'page_sets/key_silk_cases.json' optio...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} # Import necessary libraries import itertools from ansible.module_utils.basic import AnsibleModule # end import modules # start defining the functions def check_current_entry(...
""" Fake VMEM REST client for testing drivers. """ import sys import mock # The following gymnastics to fake an exception class globally is done because # we want to globally model and make available certain exceptions. If we do # not do this, then the real-driver's import will not see our fakes. class NoMatchingO...
#!/usr/bin/env python """Before launching the LightDock simulation, a setup step is required. This step parses the input PDB structures, calculates the minimum ellipsoid containing each of them, calculates the swarms on the surface of the receptor and populates each swarm with random coordinates for each glowworm's...
DATE_FORMAT = 'j E Y' TIME_FORMAT = 'H:i:s' DATETIME_FORMAT = 'j E Y H:i:s' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'd-m-Y' SHORT_DATETIME_FORMAT = 'd-m-Y H:i:s' FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python....
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import distutils.spawn import os import os.path import subprocess import traceback from ansible import constants as C from ansible.compat.six.moves import shlex_quote from ansible.errors import AnsibleError from ansible.plugins.co...
# Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ import datetime import json import logging import os import random import socket import sys import tempfile import warnings from django.core.exceptions import ValidationError SESSION_...
import json import re from lib.ModFilter import ModFilterType from lib.ModFilterGroup import PSEUDO_MODS from lib.Utility import AppException class ModsHelper: MODS_FNAME = 'res\\mods.json' MOD_TEXT_REGEX = re.compile('\(([^()]+)\)\s+(.*)') def __init__(self): self.mod_list = None self.m...
"""util_test.py - test classes for util module This file is part of cMonkey Python. Please see README and LICENSE for more information and licensing details. """ import unittest import util import operator import numpy as np class DelimitedFileTest(unittest.TestCase): # pylint: disable-msg=R0904 """Test class f...
from __future__ import division, print_function, absolute_import import numpy as np from numpy.testing import (run_module_suite, assert_equal, assert_array_equal, assert_array_almost_equal, assert_approx_equal, assert_raises, assert_allclose) from scipy.special import xlogy from scipy.stats.contingen...
from webkitpy.common.system.executive import ScriptError from webkitpy.common.net.layouttestresults import LayoutTestResults class UnableToApplyPatch(Exception): def __init__(self, patch): Exception.__init__(self) self.patch = patch class PatchAnalysisTaskDelegate(object): def parent_command...
def main(): students = [ Student("Larsson", 37), Student("BonJovi", 55), ] printHeader() selection = getUserSelection() if selection == 0: printStudentsByAge(students) elif selection == 1: pass elif selection == 2: pass else: print "SELECTION NOT RECOGNIZED" class Student: d...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} import urllib class Pushover(object): ''' Instantiates a pushover object, use it to send notifications ''' base_uri = 'https://api.pushover.net' def __init__(self, ...
"""Operations for clipping (gradient, weight) tensors to min/max values.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import six from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes fro...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting model 'OriginPermission' db.rename_table('cors_originpermission', 'cors_origin') db.renam...
# # C naming conventions # # # Prefixes for generating C names. # Collected here to facilitate ensuring uniqueness. # pyrex_prefix = "__pyx_" codewriter_temp_prefix = pyrex_prefix + "t_" temp_prefix = u"__cyt_" builtin_prefix = pyrex_prefix + "builtin_" arg_prefix = pyrex_prefix + "arg_" f...
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2010 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http:...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} try: import shade HAS_SHADE = True except ImportError: HAS_SHADE = False from distutils.version import StrictVersion def main(): argument_spec = openstack_full_...
from __future__ import unicode_literals import re from .common import InfoExtractor class ParliamentLiveUKIE(InfoExtractor): IE_NAME = 'parliamentlive.tv' IE_DESC = 'UK parliament videos' _VALID_URL = r'https?://www\.parliamentlive\.tv/Main/Player\.aspx\?(?:[^&]+&)*?meetingId=(?P<id>[0-9]+)' _TEST ...
"""Fixer for operator functions. operator.isCallable(obj) -> hasattr(obj, '__call__') operator.sequenceIncludes(obj) -> operator.contains(obj) operator.isSequenceType(obj) -> isinstance(obj, collections.Sequence) operator.isMappingType(obj) -> isinstance(obj, collections.Mapping) operator.isNumberType(obj) ...
import wizard import sale_crm # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
import re import unittest2 as unittest from webkitpy.common.watchlist.filenamepattern import FilenamePattern class FileNamePatternTest(unittest.TestCase): def test_filename_pattern_literal(self): filename_pattern = FilenamePattern(re.compile(r'MyFileName\.cpp')) # Note the follow filenames are ...
"""The deferred instance delete extension.""" import webob from nova.api.openstack import common from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova import compute from nova import exception ALIAS = 'os-deferred-delete' authorize = extensions.os_compute_authorizer(ALIAS) class D...
#!/usr/bin/env python # -*- coding: utf-8 -*- from base import TestRailAPIBase class Plan(TestRailAPIBase): """ Use the following API methods to request details ...
from dplcm_estimation_config import dplcm_configuration as dplcm_gridcell_config from estimation_zone_config import run_configuration as config class dplcm_configuration(dplcm_gridcell_config): def get_configuration(self): run_configuration = config.copy() dplcm_local_configuration = self.get...
from StringIO import StringIO from cloudinit.distros.parsers import chop_comment # See: man hosts # or http://unixhelp.ed.ac.uk/CGI/man-cgi?hosts # or http://tinyurl.com/6lmox3 class HostsConf(object): def __init__(self, text): self._text = text self._contents = None def parse(self): ...
import json import logging from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms from horizon import workflows from openstack_dashboard.api import sahara as saharaclient import openstack_dashboard.dashboards.project.data_processing. \ cluster_templates.w...
import base64 import datetime import uuid from oslo.config import cfg import webob from nova.api.openstack.compute import plugins from nova.api.openstack.compute.plugins.v3 import servers from nova.api.openstack.compute.plugins.v3 import user_data from nova.compute import api as compute_api from nova.compute import f...
""" TODO: provider policy execution initialization for outputs """ import datetime import logging import time try: from google.cloud.storage import Bucket, Client as StorageClient except ImportError: Bucket, StorageClient = None, None try: from google.cloud.logging import Client as LogClient from g...
SHUT_RD=0 SHUT_WR=1 SHUT_RDWR=2 SOL_IP=0 SOL_SOCKET=1 SO_REUSEADDR=2 AI_PASSIVE=1 AF_UNIX=1 AF_INET=2 AF_INET6=10 IP_TOS=1 SOCK_STREAM=1 SOCK_DGRAM=2 SOMAXCONN=128 INADDR_ANY=0 INADDR_BROADCAST=0xffffffff INADDR_NONE=0xffffffff INADDR_LOOPBACK=0x7f000001 class error(Exception): pass class herror(Exception): pa...
"""Tests rendering of thumbnails.""" from future import standard_library from builtins import range import base64 import json from omero.model import EllipseI, LengthI, LineI, \ PointI, PolygonI, PolylineI, RectangleI, RoiI from omero.model.enums import UnitsLength from omero.rtypes import rstring, rint, rdouble f...
__all__ = ( "IBUS_IFACE_IBUS", "IBUS_SERVICE_IBUS", "IBUS_PATH_IBUS", "IBUS_IFACE_CONFIG", "IBUS_IFACE_PANEL", "IBUS_IFACE_ENGINE", "IBUS_IFACE_ENGINE_FACTORY", "IBUS_IFACE_INPUT_CONTEXT", "IBUS_IFACE_NOTIFICATIONS", "ORIENTATION_HORIZONTAL...
microcode = ''' def macroop PSHUFD_XMM_XMM_I { shuffle ufp1, xmmlm, xmmhm, size=4, ext="IMMEDIATE" shuffle xmmh, xmmlm, xmmhm, size=4, ext="IMMEDIATE >> 4" movfp xmml, ufp1, dataSize=8 }; def macroop PSHUFD_XMM_M_I { ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8 ldfp ufp2, seg, sib, "DISPLACEMENT...
"""Tests for third_party.tensorflow.contrib.ffmpeg.decode_video_op.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os.path import six # pylint: disable=unused-import from tensorflow.contrib import ffmpeg from tensorflow.python.ops import image...
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import ( compat_urllib_parse_unquote, compat_urllib_parse_urlparse, ) from ..utils import ( ExtractorError, float_or_none, sanitized_Request, unescapeHTML, update_url_query, ...
import gdb import os import re import string from linux import modules, utils if hasattr(gdb, 'Breakpoint'): class LoadModuleBreakpoint(gdb.Breakpoint): def __init__(self, spec, gdb_command): super(LoadModuleBreakpoint, self).__init__(spec, internal=True) self.silent = True ...
"""Shadow-volume implementation A volume is cast by a light from an edgeset, it's basically the volume of space which is shadowed by the given edgeset/object. """ from OpenGLContext.arrays import * from OpenGL.GL import * import weakref class Volume( object ): """A shadow-volume object This object represents...
import distutils.command.bdist_rpm as orig class bdist_rpm(orig.bdist_rpm): """ Override the default bdist_rpm behavior to do the following: 1. Run egg_info to ensure the name and version are properly calculated. 2. Always run 'install' using --single-version-externally-managed to disable eggs...
#!/usr/bin/env python ''' Copyright (C) 2014, Digium, Inc. Mark Michelson <<EMAIL>> This program is free software, distributed under the terms of the GNU General Public License Version 2. ''' class MWISender(object): '''Test module that updates MWI on the sending Asterisk server. This reads test module conf...
""" gettext for openstack-common modules. Usual usage in an openstack.common module: from akanda.rug.openstack.common.gettextutils import _ """ import gettext t = gettext.translation('openstack-common', 'locale', fallback=True) def _(msg): return t.ugettext(msg)
import os from sys import maxint _proc_status = '/proc/%d/status' % os.getpid() #_scale = {'kB': 1024.0, 'mB': 1024.0*1024.0, # 'KB': 1024.0, 'MB': 1024.0*1024.0} _scale = {'kB': 1, 'mB': 1024, 'gB': 1024 * 1024, 'KB': 1, 'MB': 1024, 'GB': 1024 * 1024} def _VmB(VmKey): '''Private. ''' ...
""" Kuwait-specific Form helpers """ import re from datetime import date from django.core.validators import EMPTY_VALUES from django.forms import ValidationError from django.forms.fields import Field, RegexField from django.utils.translation import gettext as _ id_re = re.compile(r'^(?P<initial>\d{1})(?P<yy>\d\d)(?P<...
import logging from odoo import models, api from ..mappings.compassion_child_pictures_mapping \ import MobileChildPicturesMapping logger = logging.getLogger(__name__) class CompassionChildPictures(models.Model): """ A sponsored child """ _inherit = 'compassion.child.pictures' @property def imag...
from osv import fields,osv from tools.translate import _ class wzd_massive_category_change(osv.osv_memory): _name = "wzd.massive_category_change" _columns = { 'name' : fields.many2one('product.category', 'Category'), } def change(self, cr, uid, ids, context={}): wzd = self.browse(cr, uid, ids[0], context) ...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} from ansible.module_utils.basic import AnsibleModule try: from ansible.module_utils.network.avi.avi import ( avi_common_argument_spec, avi_ansible_api, HAS_AVI) except ...
from __future__ import unicode_literals import frappe from frappe.utils import cstr from frappe import _ import json from frappe.model.document import Document class CustomField(Document): def autoname(self): self.set_fieldname() self.name = self.dt + "-" + self.fieldname def set_fieldname(self): if not self....
from __future__ import with_statement import errno import os import tempfile class Pidfile(object): """\ Manage a PID file. If a specific name is provided it and '"%s.oldpid" % name' will be used. Otherwise we create a temp file using os.mkstemp. """ def __init__(self, fname): self.f...
import logging log = logging.getLogger("Thug") def DownloadFile(self, *arg): log.ThugLogging.add_behavior_warn('[ZenturiProgramChecker ActiveX] Attack in DownloadFile function') log.ThugLogging.add_behavior_warn('[ZenturiProgramChecker ActiveX] Downloading from %s' % (arg[0], )) log.ThugLogging.add_behav...
# -*- coding: utf-8 -*- """ *************************************************************************** PointsToPaths.py --------------------- Date : April 2014 Copyright : (C) 2014 by Alexander Bruy Email : alexander dot bruy at gmail dot com *************...
#imports for database engine import os from sqlalchemy import create_engine from sqlalchemy.pool import NullPool from sqlalchemy.orm import scoped_session, sessionmaker #imports for models from datetime import datetime, timedelta from sqlalchemy import MetaData, Column, ForeignKey, Integer, String, DateTime, Float, Bo...
import os from django_evolution import EvolutionException, is_multi_db from django_evolution.builtin_evolutions import BUILTIN_SEQUENCES from django_evolution.models import Evolution from django_evolution.mutations import SQLMutation def get_evolution_sequence(app): "Obtain the full evolution sequence for an app...
DATE_FORMAT = 'j N Y' DATETIME_FORMAT = "j N Y, G:i:s" TIME_FORMAT = 'G:i:s' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'd-m-Y' SHORT_DATETIME_FORMAT = 'd-m-Y G:i:s' FIRST_DAY_OF_WEEK = 1 #Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.o...
import json import sys # This script helps parse out the private IP addresses from the # `juju run` command's JSON object, see cluster/juju/util.sh if len(sys.argv) > 1: # It takes the JSON output as the first argument. nodes = json.loads(sys.argv[1]) # There can be multiple nodes to print the Stdout. ...
from openerp.osv import fields, osv from openerp import tools from openerp.addons.crm import crm class project_issue_report(osv.osv): _name = "project.issue.report" _auto = False _columns = { 'section_id':fields.many2one('crm.case.section', 'Sale Team', readonly=True), 'company_id': fields...
''' This file implements the `with_lists` lookup filter for Ansible. In differenceto `with_items`, this one does *not* flatten the lists passed to. Example: - debug: msg="{{item.0}} -- {{item.1}} -- {{item.2}}" with_lists: - ["General", "Verbosity", "0"] - ["Mapping", "Nobody-User", "nobody"] - ...
from __future__ import print_function import numpy as np import tensorflow as tf from A2_fullyconnected.p1_relulayer import HiddenRelu import math import utility.logger_tool import logging class Mulilayer_HiddenRelu(HiddenRelu): def __init__(self): HiddenRelu.__init__(self) self.num_steps = 120 * ...
"""Remote control for MacOS FontLab. initFontLabRemote() registers a callback for appleevents and runFontLabRemote() sends the code from a different application, such as a Mac Python IDE or Python interpreter. """ from robofab.world import world if world.inFontLab and world.mac is not None: from Carbon import AE as ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import traceback from ansible.module_utils.basic import AnsibleModule from ansible.module_...
from __future__ import unicode_literals import warnings from django import forms from django.conf import settings from django.contrib.admin.templatetags.admin_static import static from django.contrib.admin.utils import ( display_for_field, flatten_fieldsets, help_text_for_field, label_for_field, lookup_field,...
__version__ = "0.4" from PIL import Image, ImageFile, ImagePalette, _binary MODES = { # (photoshop mode, bits) -> (pil mode, required channels) (0, 1): ("1", 1), (0, 8): ("L", 1), (1, 8): ("L", 1), (2, 8): ("P", 1), (3, 8): ("RGB", 3), (4, 8): ("CMYK", 4), (7, 8): ("L", 1), # FIXME: mu...
import unittest from ctypes import * from ctypes.test import need_symbol from struct import calcsize import _testcapi class SubclassesTest(unittest.TestCase): def test_subclass(self): class X(Structure): _fields_ = [("a", c_int)] class Y(X): _fields_ = [("b", c_int)] ...
"""Utilities for enumeration of finite and countably infinite sets. """ ### # Countable iteration # Simplifies some calculations class Aleph0(int): _singleton = None def __new__(type): if type._singleton is None: type._singleton = int.__new__(type) return type._singleton def __r...
"""Launches the firefox and does necessary preparation like installing the extension""" from subprocess import Popen from subprocess import PIPE import logging import shutil import tempfile import time import platform import os from extensionconnection import ExtensionConnection from firefox_profile import FirefoxPro...
import traceback from bs4 import BeautifulSoup from couchpotato.core.helpers.encoding import toUnicode from couchpotato.core.helpers.variable import tryInt from couchpotato.core.logger import CPLog from couchpotato.core.media._base.providers.torrent.base import TorrentProvider log = CPLog(__name__) class Base(Torr...
import os import json import time import logging try: import urllib.request as urllib2 except ImportError: import urllib2 log = logging.getLogger("travis.leader") log.addHandler(logging.StreamHandler()) log.setLevel(logging.INFO) TRAVIS_JOB_NUMBER = 'TRAVIS_JOB_NUMBER' TRAVIS_BUILD_ID = 'TRAVIS_BUILD_ID' POL...
from django.views.generic.list_detail import object_list, object_detail from django.shortcuts import get_object_or_404, render_to_response from django.template.context import RequestContext from django.http import HttpResponseRedirect from projects.models import Project from projects.forms import ProjectForm def pro...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} import re from ansible.module_utils.nxos import get_config, load_config, run_commands from ansible.module_utils.nxos import nxos_argument_spec, check_args from ansible.module_util...
# -*- coding: utf-8 -*- """ oauthlib.oauth1.rfc5849.endpoints.access_token ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module is an implementation of the access token provider logic of OAuth 1.0 RFC 5849. It validates the correctness of access token requests, creates and persists tokens as well as create the p...
import random from annoying.functions import get_object_or_None from datetime import datetime from pixelpuncher.game.utils.message import add_game_message from pixelpuncher.game.utils.messages import pixels_dropped_message, xp_gained_message, item_given, \ location_unlocked_message from pixelpuncher.item.utils im...
import unittest from IECore import * import math class MeshNormalsOpTest( unittest.TestCase ) : def testPlane( self ) : p = MeshPrimitive.createPlane( Box2f( V2f( -1 ), V2f( 1 ) ) ) if "N" in p : del p["N"] self.assert_( not "N" in p ) pp = MeshNormalsOp()( input=p ) self.assert_( "N" in pp ) self....
import re from unittest import TestCase from django import forms from django.core import validators from django.core.exceptions import ValidationError class TestFieldWithValidators(TestCase): def test_all_errors_get_reported(self): class UserForm(forms.Form): full_name = forms.CharField( ...
from weblate.trans.management.commands import WeblateLangCommand from optparse import make_option from django.db import transaction class Command(WeblateLangCommand): help = '(re)loads translations from disk' option_list = WeblateLangCommand.option_list + ( make_option( '--force', ...
from pytesla import Vehicle __all__ = [ 'FieldLists', 'ResultSets' ] class FieldLists(object): """ The lists of fields we want to return for each class """ VEHICLE = ['id', 'vin', 'mobile_enabled', 'charge_state', 'climate_state', 'drive_state', 'vehicle_state'] ...
""" Generate artificial datasets for the multi-step prediction experiments """ import os import random import datetime from optparse import OptionParser from nupic.data.file_record_stream import FileRecordStream def _generateSimple(filename="simple.csv", numSequences=1, elementsPerSeq=3, numRe...
from django.core.urlresolvers import reverse from rest_framework import status from rest_framework.authtoken.models import Token from rest_framework.test import APITestCase from data.tests.factories import DepartmentFactory from registration.models import User from ..models import Department class TestDepartment(A...
"""A library for integrating pyOpenSSL with CherryPy. The ssl module must be importable for SSL functionality. To use this module, set CherryPyWSGIServer.ssl_adapter to an instance of BuiltinSSLAdapter. ssl_adapter.certificate: the filename of the server SSL certificate. ssl_adapter.private_key: the filename...
from oneview_redfish_toolkit.api.redfish_json_validator \ import RedfishJsonValidator from oneview_redfish_toolkit.api.resource_block_collection \ import ResourceBlockCollection import oneview_redfish_toolkit.api.status_mapping as status_mapping class Processor(RedfishJsonValidator): """Creates a Processo...
from openerp.osv import fields,osv from openerp.addons.base_status.base_stage import base_stage from openerp.tools.translate import _ from lxml import etree from openerp import netsvc
import sys import unittest from django.core.exceptions import ImproperlyConfigured from django.db import ProgrammingError from django.utils import six try: from django.contrib.gis.db.backends.postgis.operations import PostGISOperations HAS_POSTGRES = True except ImportError: HAS_POSTGRES = False except Im...
from django.core.management import BaseCommand from geonode.gazetteer.models import GazetteerEntry from geonode.maps.models import Layer class Command(BaseCommand): help = """ Assigns usernames to all gazetteer features that do not have an associated username yet. """ args = '[none]' # TODO u...
import os import sys sys.path.insert(0, os.path.abspath('../..')) # -- General configuration ---------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx...
""" This module implements a tree builder for html5lib that generates lxml html element trees. This module uses camelCase as it follows the html5lib style guide. """ from html5lib.treebuilders import _base, etree as etree_builders from lxml import html, etree class DocumentType(object): def __init__(self, name...
"""code generator for OpenGL ES 2.0 conformance tests.""" import os import re import sys def ReadFileAsLines(filename): """Reads a file, removing blank lines and lines that start with #""" file = open(filename, "r") raw_lines = file.readlines() file.close() lines = [] for line in raw_lines: line = lin...
#!/usr/bin/env python # -*- coding: utf-8 -*- #----------------------- # Name: pager.py List-like structure designed for handling paged results # Python Library #----------------------- from collections import Sequence, Iterator class PagedIterator( Iterator ): def __init__(self, parent): self._parent ...
from __future__ import division from plugin import plugin @plugin('timeconv') class timeconv(): """ timeconv Documentation. timeconv is a time converter. Supports: picosecond, nanosecond, microsecond, millisecond, second, minute, hour, day, week, month, year Usage: The input time measurement units...
from collections import defaultdict from openerp.tools import mute_logger from openerp.tests import common UID = common.ADMIN_USER_ID DB = common.DB class TestORM(common.TransactionCase): """ test special behaviors of ORM CRUD functions TODO: use real Exceptions types instead of Exception """ d...
# -*- coding: utf-8 -*- ''' salt.utils.yamldumper ~~~~~~~~~~~~~~~~~~~~~ ''' # pylint: disable=W0232 # class has no __init__ method from __future__ import absolute_import try: from yaml import CDumper as Dumper from yaml import CSafeDumper as SafeDumper except ImportError: from yaml import ...
from google.appengine.api import search from google.appengine.ext import db from rogerthat.bizz.job import run_job from rogerthat.bizz.service import SERVICE_INDEX, SERVICE_LOCATION_INDEX, re_index from rogerthat.consts import HIGH_LOAD_WORKER_QUEUE from rogerthat.dal.profile import is_trial_service from rogerthat.mod...
#!/usr/bin/env python3 """ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Audiophiles Music Manager Build 20180119 VER0.0.0PREALPHA * * (C)2017 Mattijs Snepvangers <EMAIL> * * lib/reportbuider.py Report Builder VER0.0...
microcode = ''' def macroop CMP_R_M { ld t1, seg, sib, disp sub t0, reg, t1, flags=(OF, SF, ZF, AF, PF, CF) }; def macroop CMP_R_P { rdip t7 ld t1, seg, riprel, disp sub t0, reg, t1, flags=(OF, SF, ZF, AF, PF, CF) }; def macroop CMP_M_I { limm t2, imm ld t1, seg, sib, disp sub t0, t1, ...
# -*- Python -*- # Converted by ./convert_mime_type_table.py from: # /usr/src2/apache_1.2b6/conf/mime.types # content_type_map = \ { 'ai': 'application/postscript', 'aif': 'audio/x-aiff', 'aifc': 'audio/x-aiff', 'aiff': 'audio/x-aiff', 'au': 'audio/basic', 'avi': 'video...
# -*- coding: utf-8 -*- # taken from http://code.activestate.com/recipes/252524-length-limited-o1-lru-cache-implementation/ import threading from func import synchronized __all__ = ['LRU'] class LRUNode(object): __slots__ = ['prev', 'next', 'me'] def __init__(self, prev, me): self.prev = prev ...
import anyconfig.backend.backends as T import unittest class Test_00_pure_functions(unittest.TestCase): def test_10_find_by_file(self): ini_cf = "/a/b/c.ini" unknown_cf = "/a/b/c.xyz" jsn_cfs = ["/a/b/c.jsn", "/a/b/c.json", "/a/b/c.js"] yml_cfs = ["/a/b/c.yml", "/a/b/c.yaml"] ...
from oslo_serialization import jsonutils from nova import exception from nova.objects import base from nova.objects import fields from nova.virt import hardware def all_things_equal(obj_a, obj_b): for name in obj_a.fields: set_a = obj_a.obj_attr_is_set(name) set_b = obj_b.obj_attr_is_set(name) ...
"""Contains a factory for building various models.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools import tensorflow as tf from nets import alexnet from nets import cifarnet from nets import inception from nets import lenet from nets im...
__revision__ = '$Id: __init__.py,v 1.12 2005/11/15 02:22:41 jkloth Exp $' def PreprocessFiles(dirs, files): """ PreprocessFiles(dirs, files) -> (dirs, files) This function is responsible for sorting and trimming the file and directory lists as needed for proper testing. """ from Ft.Lib.TestSui...
""" Adapted from conda/history.py Licensed under BSD 3-clause license. """ from __future__ import print_function import re import time from json import loads from os.path import isfile, join from functools import lru_cache from ..common import lazyproperty class CondaHistoryException(Exception): pass class Co...
from temboo.core.choreography import Choreography from temboo.core.choreography import InputSet from temboo.core.choreography import ResultSet from temboo.core.choreography import ChoreographyExecution import json class UpdateEntry(Choreography): def __init__(self, temboo_session): """ Create a n...