content
string
import builtins import collections import datetime import decimal import enum import functools import math import re import types import uuid from django.db import models from django.db.migrations.operations.base import Operation from django.db.migrations.utils import COMPILED_REGEX_TYPE, RegexObject from django.utils...
from slicc.ast.TypeFieldAST import TypeFieldAST class TypeFieldMethodAST(TypeFieldAST): def __init__(self, slicc, return_type_ast, ident, type_asts, pairs, statements = None): super(TypeFieldMethodAST, self).__init__(slicc, pairs) self.return_type_ast = return_type_ast self.ident =...
import numpy as np import pandas as pd from statsmodels.tools.grouputils import Grouping from statsmodels.tools.tools import categorical from statsmodels.datasets import grunfeld, anes96 from pandas.util import testing as ptesting class CheckGrouping(object): def test_reindex(self): # smoke test ...
ClimateDataPortal = local_import('ClimateDataPortal') def clear_tables(): ClimateDataPortal.place.truncate() ClimateDataPortal.rainfall_mm.truncate() ClimateDataPortal.temperature_celsius.truncate() db.commit() #clear_tables() def frange(start, end, inc=1.0): value = start i = 0 while True...
import warnings from django.conf import settings from django.conf.urls import patterns, url from django.core.urlresolvers import LocaleRegexURLResolver from django.utils import six from django.utils.deprecation import RemovedInDjango20Warning from django.views.i18n import set_language def i18n_patterns(prefix, *args...
from django.test import TestCase from crawler.engine import LinkFinder, IngredientFinder import urllib.request from ..models import DataIngredient class CrawlerTestCase(TestCase): def test_links_finder_count(self): """Test the count of links in link finder is equal to the expected amount""" finde...
#!/usr/bin/env python """ Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): def __i...
""" Implements a simple polling interface for file descriptors that don't work with select() - this is pretty much only useful on Windows. """ from zope.interface import implements from twisted.internet.interfaces import IConsumer, IPushProducer MIN_TIMEOUT = 0.000000001 MAX_TIMEOUT = 0.1 class _PollableResource...
"""Tests for user API middleware""" from mock import Mock, patch from unittest import TestCase from django.http import HttpResponse from django.test.client import RequestFactory from student.tests.factories import UserFactory, AnonymousUserFactory from ..tests.factories import UserCourseTagFactory from ..middleware ...
# -*- coding: utf-8 -*- from south.db import db from django.db import models from adm.application.models import * class Migration: def forwards(self, orm): # Adding field 'Applicant.is_offline' db.add_column('application_applicant', 'is_offline', orm['application.applicant:is_offline...
from openerp.osv import fields, osv from openerp.tools.translate import _ class res_company(osv.osv): _inherit = 'res.company' _columns = { 'project_time_mode_id': fields.many2one('product.uom', 'Project Time Unit', help='This will set the unit of measure used in projects and tasks.\n' \ "I...
import os import sys here = os.path.abspath(os.path.split(__file__)[0]) repo_root = os.path.abspath(os.path.join(here, os.pardir, os.pardir)) sys.path.insert(0, os.path.join(repo_root, "tools")) sys.path.insert(0, os.path.join(repo_root, "tools", "six")) sys.path.insert(0, os.path.join(repo_root, "tools", "html5lib")...
import io import os from .context import reduction, set_spawning_popen if not reduction.HAVE_SEND_HANDLE: raise ImportError('No support for sending fds between processes') from . import forkserver from . import popen_fork from . import spawn from . import util __all__ = ['Popen'] # # Wrapper for an fd used whil...
"""Pure-Python RSA implementation.""" from cryptomath import * import xmltools from ASN1Parser import ASN1Parser from RSAKey import * class Python_RSAKey(RSAKey): def __init__(self, n=0, e=0, d=0, p=0, q=0, dP=0, dQ=0, qInv=0): if (n and not e) or (e and not n): raise AssertionError() ...
import os import marshal import struct import shutil from CodernityDB.storage import IU_Storage, DummyStorage try: from CodernityDB import __version__ except ImportError: from __init__ import __version__ import io class IndexException(Exception): pass class IndexNotFoundException(IndexException): ...
import json from copy import deepcopy from . import api class Search: """Build and execute a search query.""" def __init__(self): self.query = {} def expression(self, value): """Specify the search query expression.""" self.query["expression"] = value return self def m...
from tmapi.models import Association from base_manager import BaseManager from entity_type import EntityType from property_assertion import PropertyAssertion class EntityTypePropertyAssertionManager (BaseManager): def filter_by_authority_entity_type (self, authority, entity_type): return self.filter(sco...
""" Useful form fields for use with SQLAlchemy ORM. """ import operator from wtforms import widgets from wtforms.fields import SelectFieldBase from wtforms.validators import ValidationError from .tools import get_primary_key from flask_admin._compat import text_type, string_types from flask_admin.form import Form...
''' Implement and provide message protocols for communication between Bokeh Servers and clients. ''' #----------------------------------------------------------------------------- # Boilerplate #----------------------------------------------------------------------------- from __future__ import absolute_import, divis...
import time import urllib import http.client # RESTful interface of Kyoto Tycoon class KyotoTycoon: # connect to the server def open(self, host = "127.0.0.1", port = 1978, timeout = 30): self.ua = http.client.HTTPConnection(host, port, False, timeout) # close the connection def close(self): ...
"""pyversioncheck - Module to help with checking versions""" import types import rfc822 import urllib import sys # Verbose options VERBOSE_SILENT=0 # Single-line reports per package VERBOSE_NORMAL=1 # Single-line reports per package, more info if outdated VERBOSE_EACHFILE=2 # Report on each URL chec...
__doc__=""" NOTES: See https://rdflib.readthedocs.org/en/4.2.1/_modules/rdflib/plugins/stores/sparqlstore.html where SparQLClient + SparQLQuery is called a "sparql store" INSERTs and DELETEs without a WHERE clause have the DATA keyword: INSERT DATA { ... } DELETE DATA { ... }. DELETE INSERT WHERE ...
from multiprocessing import Process, Pipe from aux.engine.actor.base import BaseActor import select class Reactor(BaseActor): def __init__(self, name, looper="select"): self.parent = super(Reactor, self) self.parent.__init__(name) self.callbacks = list() self.shouldStop = F...
from distaf.util import tc, testcase from distaf.distaf_base_class import DistafTestClass from distaf.mount_ops import mount_volume, umount_volume from distaf.volume_ops import setup_vol, stop_volume, delete_volume @testcase("gluster_basic_test") class gluster_basic_test(DistafTestClass): """ runs_on_volu...
#! /usr/bin/python # -*- coding: utf-8 -*- import tensorflow as tf import tensorlayer as tl tf.logging.set_verbosity(tf.logging.DEBUG) tl.logging.set_verbosity(tl.logging.DEBUG) sess = tf.InteractiveSession() # prepare data X_train, y_train, X_val, y_val, X_test, y_test = tl.files.load_mnist_dataset(shape=(-1, 784)...
import curses import weakref import npyscreen import email import mimetypes import os.path class EmailTreeLine(npyscreen.TreeLine): def display_value(self, vl): return vl if vl: return vl.getContent().get_content_type() else: return "" class EmailTree(npyscreen....
import logging from django.core.urlresolvers import reverse # noqa from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms from horizon import messages from openstack_dashboard import api LOG = logging.getLogger(__name__) class UpdateNetwork(forms...
import sys import scipy import numpy as np def read_pcm_file(file_path, file_type=scipy.complex64): with open(file_path, 'rb') as f: return scipy.fromfile(f, dtype=file_type) def write_pcm_file(file_path, signal_data, file_type='complex64'): np.array(signal_data).astype('complex64').tofile(file_path) ...
""" Player datablock generator, written to test an experimental super-2046 DB count patch. """ import sys import math class PseudoNumber: _value = None _digits = None _decimal_value = None _converted = None def __init__(self, digits=None, value=None): self._digits = digits self._decimal_value = int(value)...
from __future__ import print_function import time, sys, signal, atexit from upm import pyupm_mcp2515 as MCP2515 def main(): # Instantiate a MCP2515 on SPI bus 0 using a hw CS pin (-1). sensor = MCP2515.MCP2515(0, -1) ## Exit handlers ## # This function stops python from printing a stacktrace when you ...
#!/usr/bin/python import time import os from random import randint GPIO.setmode(GPIO.BCM); BUTON_SUS=17;BUTON_JOS=22;BUTON_STANGA=27;BUTON_DREAPTA=4; LED0=23;LED1=24;LED2=25; GPIO.setup(BUTON_SUS,GPIO.IN); GPIO.setup(BUTON_JOS,GPIO.IN); GPIO.setup(BUTON_STANGA,GPIO.IN); GPIO.setup(BUTON_DREAPTA,GPIO.IN); GPIO.setup(...
from __future__ import with_statement, absolute_import import re from contextlib import closing import MySQLdb import MySQLdb.cursors re_column_length = re.compile(r'\((\d+)\)') re_column_precision = re.compile(r'\((\d+),(\d+)\)') re_key_1 = re.compile(r'CONSTRAINT `(\w+)` FOREIGN KEY \(`(\w+)`\) REFERENCES `(\w+)`...
from pyanaconda.core.glib import timeout_add, timeout_add_seconds, idle_add, source_remove class Timer(object): """Object to schedule functions and methods to the GLib event loop. Everything scheduled by Timer is ran on the main thread! """ def __init__(self): self._id = 0 def timeout_s...
"""SCons.Tool.ifort Tool-specific initialization for newer versions of the Intel Fortran Compiler for Linux/Windows (and possibly Mac OS X). 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) ...
'''Helpers for parsing command line options''' import logging import os import sys from optparse import NO_DEFAULT, OptionGroup from tempfile import gettempdir from tests.comparison.types import TYPES def add_logging_options(section, default_debug_log_file=None): if not default_debug_log_file: default_debug_lo...
class ModuleDocFragment(object): # Standard files documentation fragment DOCUMENTATION = """ options: provider: description: - A dict object containing connection details. default: null suboptions: host: description: - Specifies the DNS host name or address for conne...
from __future__ import absolute_import import six class EventError(object): INVALID_DATA = 'invalid_data' INVALID_ATTRIBUTE = 'invalid_attribute' VALUE_TOO_LONG = 'value_too_long' UNKNOWN_ERROR = 'unknown_error' SECURITY_VIOLATION = 'security_violation' RESTRICTED_IP = 'restricted_ip' JS...
""" ========================================================= Using FunctionTransformer to select columns ========================================================= Shows how to use a function transformer in a pipeline. If you know your dataset's first principle component is irrelevant for a classification task, you ca...
#! /usr/bin/python """ test_frame.py Paul Malmsten, 2010 <EMAIL> Tests frame module for proper behavior """ import unittest from xbee.frame import APIFrame from xbee.python2to3 import byteToInt, intToByte class TestAPIFrameGeneration(unittest.TestCase): """ XBee class must be able to create a valid API frame...
import argparse import logging import os import select from subprocess import Popen, PIPE from time import sleep from conf import LisaLogging from android import System, Workload from env import TestEnv from devlib.utils.misc import memoized from devlib.utils.android import fastboot_command class LisaBenchmark(obje...
"""The mock module allows easy mocking of apitools clients. This module allows you to mock out the constructor of a particular apitools client, for a specific API and version. Then, when the client is created, it will be run against an expected session that you define. This way code that is not aware of the testing fr...
"""Invenio standard theme.""" from __future__ import absolute_import, division, print_function from flask_breadcrumbs import Breadcrumbs from flask_login import user_logged_in from flask_menu import Menu from .views import blueprint, unauthorized, insufficient_permissions, \ page_not_found, internal_error from ...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: win_scheduled_task version_added: "2.0" short_description: Manage scheduled tasks description: - Creates/modified or removes Windows scheduled tas...
import abc from oslo.config import cfg import requests from requests import auth import six from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log CONF = cfg.CONF CONF.import_opt('http_timeout', 'ceilometer.service') LOG = log.getLogger(__name__) @six.add_metaclass(ab...
# -*- coding: utf-8 -*- import collections import mock import unittest2 from openerp.http import request as req from . import common from ..controllers import main class Placeholder(object): def __init__(self, **kwargs): for k, v in kwargs.iteritems(): setattr(self, k, v) class LoadTest(co...
"""Provides SchemaManager class.""" from __future__ import absolute_import import logging from elasticsearch import NotFoundError, TransportError from copy import deepcopy class SchemaManager(object): """Manage the 'schemas' for different types of log data. A detailed description of schemas is given in th...
#!/usr/bin/env/python """ merge_filter.py -- find the courses in VIVO, and match them to the courses in the source. They must match on ccn There are two inputs: 1. Courses in VIVO. Keyed by ccn 2. UF courses in the source. Keyed the same. There are three cases 1. Course in VIVO and in ...
#!/usr/bin/env python # Simple script to filter lines of the input for meeting a numeric # threshold on one, or one of multiple (comma-separated) column numbers. # If threshold is required on each column, you can chain multiple # scorethresh.py calls with pipes. # by default, the column value has to be larger or equa...
import json import logging from django.http import HttpResponse from django.utils.translation import ugettext as _ from celery.states import FAILURE, REVOKED, READY_STATES from instructor_task.api_helper import (get_status_from_instructor_task, get_updated_instructor_task) fro...
from openerp import api from openerp.osv import osv from openerp.tools.translate import _ class stock_picking(osv.osv): _inherit = 'stock.picking' @api.cr_uid_ids_context def do_transfer(self, cr, uid, picking_ids, context=None): """Launch Create invoice wizard if invoice state is To be Invoiced,...
__all__ = ['BOP2020M'] from auspex.log import logger from .instrument import SCPIInstrument, StringCommand, RampCommand class BOP2020M(SCPIInstrument): """For controlling the BOP2020M power supply via GPIB interface card""" output = StringCommand(scpi_string="OUTPUT", value_map={True: '1', False: '0'}) c...
from spack import * class P4est(AutotoolsPackage): """Dynamic management of a collection (a forest) of adaptive octrees in parallel""" homepage = "http://www.p4est.org" url = "http://p4est.github.io/release/p4est-1.1.tar.gz" maintainers = ['davydden'] version('2.0', 'c522c5b69896aab39aa...
# -*- coding: utf-8 -*- import re from module.plugins.internal.SimpleCrypter import SimpleCrypter from module.plugins.internal.misc import json, uniqify class ImgurCom(SimpleCrypter): __name__ = "ImgurCom" __type__ = "crypter" __version__ = "0.59" __status__ = "testing" __pattern__ = r'h...
import logging from django import shortcuts from django.contrib import messages from django.utils.translation import ugettext as _ from glance.common import exception as glance_exception from horizon import api from horizon import forms LOG = logging.getLogger(__name__) class DeleteImage(forms.SelfHandlingForm):...
""" Create and delete FILES_PER_THREAD temp files (via tempfile.TemporaryFile) in each of NUM_THREADS threads, recording the number of successes and failures. A failure is a bug in tempfile, and may be due to: + Trying to create more than one tempfile with the same name. + Trying to delete a tempfile that doesn't sti...
import json from social.tests.backends.oauth import OAuth2Test class TwitchOAuth2Test(OAuth2Test): backend_path = 'social.backends.twitch.TwitchOAuth2' user_data_url = 'https://api.twitch.tv/kraken/user/' expected_username = 'test_user1' access_token_body = json.dumps({ 'access_token': 'foobar...
from vmw.vco.generated.VSOWebControlService_types import ns0 from vmw.ZSI.schema import GTD __schema = ns0.targetNamespace def __getClass(name): return GTD(__schema, name)(name).pyclass Workflow = __getClass("Workflow") WorkflowToken = __getClass("WorkflowToken") WorkflowTokenAttribute = __getClass("WorkflowToke...
import zookeeper, zktestbase, unittest, threading import time class CloseDeadlockTest(zktestbase.TestBase): """ This tests for the issue found in https://issues.apache.org/jira/browse/ZOOKEEPER-763 zookeeper.close blocks on waiting for all completions to finish. Previously it was doing so while holding teh...
#! /usr/bin/python #changelog: #10/13/2005b: replaced the # in tmp(.#*)* with alphanumeric and _, this will then remove #nodes such as %tmp.1.i and %tmp._i.3 #10/13/2005: exntended to remove variables of the form %tmp(.#)* rather than just #%tmp.#, i.e. it now will remove %tmp.12.3.15 etc, additionally fixed a spell...
# coding=utf-8 from django import forms from django.contrib.auth.forms import (UserCreationForm, UserChangeForm, AdminPasswordChangeForm, PasswordChangeForm) from django.contrib.auth.models import Group, Permission from django.core.exceptions import PermissionDenied from dja...
''' The following code requires python-stix v1.1.1.0 or greater installed. For installation instructions, please refer to https://github.com/STIXProject/python-stix. ''' import sys from stix.core import STIXPackage def parse_stix(stix_package): for indicator in stix_package.indicators: print("== INDICATO...
from sos.report.plugins import Plugin, RedHatPlugin from fnmatch import translate import os import re class Openshift(Plugin, RedHatPlugin): """This is the plugin for OCP 4.x collections. While this product is still built ontop of kubernetes, there is enough difference in the collection requirements and a...
"""Request Handler to allow test mask updates.""" import webapp2 import re import sys import os from common import constants from common import image_tools from common import ispy_utils import gs_bucket class UpdateMaskHandler(webapp2.RequestHandler): """Request handler to allow test mask updates.""" def post...
from __future__ import unicode_literals import logging import os # TODO: Remove entirely if you don't register GStreamer elements below import pygst pygst.require('0.10') import gst import gobject from mopidy import config, ext __version__ = '0.1.0' # TODO: If you need to log, use loggers named after the current ...
"""SCons.Tool.Packaging.zip The zip SRC packager. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the S...
''' The :mod:`pulsar.apps.wsgi.utils` module include several utilities used by various components in the :ref:`wsgi application <apps-wsgi>` ''' import time import re import textwrap import logging from datetime import datetime, timedelta from email.utils import formatdate from urllib.parse import parse_qsl from pulsa...
from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova import quota QUOTAS = quota.QUOTAS class ExtendedLimitsController(wsgi.Controller): @wsgi.extends def index(self, req, resp_obj): context = req.environ['nova.context'] quotas = QUOTAS.get_project_quotas(...
# Python Classes/Functions used to Import Tycho Datasets # ------------------------------------- # # Python Package Importing # # ------------------------------------- # # TO-DO: Add time back to the read state function for Tyler's code # Importing Necessary System Packages import math import io import ...
from Shard import * from ComponentShard import * from LoopShard import * from InitShard import initShard from FunctionShard import functionShard """ Example to recreate Sketches/MPS/Shard/Shards.py with code generation setup, i.e. class with the same functionality as ShardedPygameAppChassis Current test (MagnaGen.py)...
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor class RestudyIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?restudy\.dk/video/play/id/(?P<id>[0-9]+)' _TEST = { 'url': 'https://www.restudy.dk/video/play/id/1637', 'info_dict': { 'id': ...
import os import IECore import IECoreNuke def addOpCreationCommands( menu ) : loader = IECore.ClassLoader.defaultOpLoader() for c in loader.classNames() : menuPath = "/".join( [ IECore.CamelCase.toSpaced( x ) for x in c.split( "/" ) ] ) menu.addCommand( menuPath, IECore.curry( IECoreNuke.FnOpHolder.create, os....
""" Cookie "Saved" Authentication This authentication middleware saves the current REMOTE_USER, REMOTE_SESSION, and any other environment variables specified in a cookie so that it can be retrieved during the next request without requiring re-authentication. This uses a session cookie on the client side (so it goes aw...
"""Utility code for managing design documents.""" from copy import deepcopy from inspect import getsource from itertools import groupby from operator import attrgetter from textwrap import dedent from types import FunctionType __all__ = ['ViewDefinition'] __docformat__ = 'restructuredtext en' class ViewDefinition(o...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Detect Screens Copyright (C) 2016 Thomaz de Oliveira dos Reis <<EMAIL>> 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 ve...
""" Copyright (c) 2017, University of Southern Denmark All rights reserved. This code is licensed under BSD 2-clause license. See LICENSE file in the project root for license terms. """ import logging import random import pandas as pd import numpy as np import copy from modestpy.estim.error import calc_err class Indi...
import re from glob import glob from scapy.dadict import DADict,fixname from scapy.config import conf from scapy.utils import do_graph ################# ## MIB parsing ## ################# _mib_re_integer = re.compile("^[0-9]+$") _mib_re_both = re.compile("^([a-zA-Z_][a-zA-Z0-9_-]*)\(([0-9]+)\)$") _mib_re_oiddecl = r...
# -*- coding: utf-8 -*- """ werkzeug.local ~~~~~~~~~~~~~~ This module implements context-local objects. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from werkzeug.wsgi import ClosingIterator from werkzeug._internal import...
#!/usr/bin/python from nltk.stem.snowball import SnowballStemmer import string def parseOutText(f): """ given an opened email file f, parse out all text below the metadata block at the top (in Part 2, you will also add stemming capabilities) and return a string that contains all the words ...
#%end #%flag #% key: c #% description: Include column names in output file #% guisection: Files & format #%end import sys import os import threading from grass.script import core as grass class TrThread(threading.Thread): def __init__(self, ifs, inf, outf): threading.Thread.__init__(self) self.if...
from sympy.functions import adjoint, conjugate, transpose from sympy.matrices.expressions import MatrixSymbol, Adjoint, trace, Transpose from sympy.matrices import eye, Matrix from sympy import symbols, S from sympy import refine, Q n, m, l, k, p = symbols('n m l k p', integer=True) A = MatrixSymbol('A', n, m) B = Mat...
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 GetBatchRelationships(Choreography): def __init__(self, temboo_session): """ ...
"""Creates a TOC file from a Java jar. The TOC file contains the non-package API of the jar. This includes all public/protected classes/functions/members and the values of static final variables. Some other information (major/minor javac version) is also included. This TOC file then can be used to determine if a depe...
#!/usr/bin/env python3 from app import create_app, db, graph, forge from app.email import send_email from app.models import Person, Link from app.faker import fake from flask_script import Manager, Shell from flask_migrate import Migrate, MigrateCommand import os app = create_app(os.getenv('HISTORIA_CONFIG') or 'defa...
from __future__ import absolute_import import sys from pip.basecommand import Command BASE_COMPLETION = """ # pip %(shell)s completion start%(script)s# pip %(shell)s completion end """ COMPLETION_SCRIPTS = { 'bash': """ _pip_completion() { COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \\ CO...
""" Django settings for {{ project_name }} project. Generated by 'django-admin startproject' using Django {{ django_version }}. For more information on this file, see https://docs.djangoproject.com/en/{{ docs_version }}/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.c...
# -*- coding: utf-8 -*- from nose.tools import * # flake8: noqa import mock # noqa import unittest from rest_framework import fields from rest_framework.exceptions import ValidationError from api.base import utils as api_utils from tests.base import ApiTestCase from framework.status import push_status_message clas...
import filecmp import hashlib import os import random import requests import string import tempfile import traceback import uuid from io import open from unittest import mock, skip from synapseclient import File import synapseclient.core.config import synapseclient.core.utils as utils from synapseclient.core.upload.m...
import logging import pytz import time from datetime import datetime, timedelta from openerp import _, api, fields, models from openerp.exceptions import UserError _logger = logging.getLogger(__name__) def _create_sequence(cr, seq_name, number_increment, number_next): """ Create a PostreSQL sequence. There...
"""Test that importing modules in Objective-C works as expected.""" import unittest2 import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class ObjCModulesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) def setUp(self)...
""" Square path. """ from __future__ import absolute_import #Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module. import __init__ from fabmetheus_utilities.geometry.creation import lineation from fabmetheus_utilit...
# pyboard testing functions for CPython import time def delay(n): #time.sleep(float(n) / 1000) pass rand_seed = 1 def rng(): global rand_seed # for these choice of numbers, see P L'Ecuyer, "Tables of linear congruential generators of different sizes and good lattice structure" rand_seed = (rand_se...
from __future__ import unicode_literals import frappe from frappe.utils import cint @frappe.whitelist() def add(doctype, name, user=None, read=1, write=0, share=0, everyone=0, flags=None): """Share the given document with a user.""" if not user: user = frappe.session.user share_name = get_share_name(doctype, nam...
"""\ Some tests for the serial module. Part of pyserial (http://pyserial.sf.net) (C)2001-2009 <EMAIL> Intended to be run on different platforms, to ensure portability of the code. For all these tests a simple hardware is required. Loopback HW adapter: Shortcut these pin pairs: TX <-> RX RTS <-> CTS DTR <-> DSR ...
""" Script for generating a form signature for use with FormPost middleware. """ import hmac from hashlib import sha1 from os.path import basename from time import time def main(argv): if len(argv) != 7: prog = basename(argv[0]) print 'Syntax: %s <path> <redirect> <max_file_size> ' \ ...
import utils import unittest from usb.util import * from devinfo import * from usb._debug import methodtrace import usb.backend class _ConfigurationDescriptor(object): def __init__(self, bConfigurationValue): self.bLength = 9 self.bDescriptorType = DESC_TYPE_CONFIG self.wTotalLength = 18 ...
import math import socket from boto.glacier.exceptions import TreeHashDoesNotMatchError, \ DownloadArchiveError from boto.glacier.utils import tree_hash_from_str class Job(object): DefaultPartSize = 4 * 1024 * 1024 ResponseDataElements = (('Action', 'action', None), ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import json import traceback from ansible.module_utils.basic import AnsibleModule from ans...
from __future__ import division,print_function,unicode_literals import os import bctest import buildenv import argparse import logging help_text="""Test framework for bitcoin utils. Runs automatically during `make check`. Can also be run manually from the src directory by specifying the source directory: test/bitco...
""" Generic FileSystem class to be used by the Content Manager """ from s3contents.ipycompat import HasTraits class GenericFS(HasTraits): def ls(self, path=""): raise NotImplementedError( "Should be implemented by the file system abstraction" ) def isfile(self, path): rai...
pluginType = MODULE # moduleInformation() must return a tuple (module, widget_list). If "module" # is "A" and any widget from this module is used, the code generator will write # "import A". If "module" is "A[.B].C", the code generator will write # "from A[.B] import C". Each entry in "widget_list" must be unique....