content
stringlengths
4
20k
############################################################################ # GE class representing SGE batch system # 10.11.2014 ############################################################################ """ Torque.py is a DIRAC independent class representing Torque batch system. Torque objects are used as b...
from __future__ import absolute_import, division, print_function __metaclass__ = type ################################################################################ # Documentation ################################################################################ ANSIBLE_METADATA = {'metadata_version': '1.1', ...
import os,os.path,sys,getopt,popen2 import threading from ConfigParser import ConfigParser def usage(): print "%s [-f, --file <server.cfg>] [-m, --machines <chunkservers.txt>] [ [-s, --start] | [-S, --stop] ]\n" % sys.argv[0] class Worker(threading.Thread): """Worker thread that runs a command on remote node"...
from __future__ import unicode_literals import gzip import os import re from difflib import SequenceMatcher from django.conf import settings from django.core.exceptions import ImproperlyConfigured, ValidationError from django.utils import lru_cache from django.utils._os import upath from django.utils.encoding import ...
import time import signal from cosmetics import getTerminalSize, colors global_state = {"termSize": getTerminalSize(), "message": "", "pstate": []} def print_conf(conf, value): "Print a configuration line" return colors["green"] + conf + ": " + colors["end"] + str(value) de...
from robotide.controller.basecontroller import _BaseController class Tag(_BaseController): tooltip = "Own tag" def __init__(self, name, index=None, controller=None): self.name = name self.controller = controller self._index = index def set_index(self, index): self._index ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Results menu. """ # Import: std import sys # Import: PyCEGUI import PyCEGUI # Import: Configuration from configuration import TheConfig # Import: Menus from menu import Menu from menumanager import MenuManager # Results menu class MenuResults(Menu): # Static d...
import copy from heat.common import exception from heat.common.i18n import _ from heat.engine import constraints from heat.engine import properties from heat.engine import resource from heat.engine import support class Policy(resource.Resource): """A resource that creates a Senlin Policy. A policy is a set ...
# -*- coding: utf-8 -*- # __ # /__) _ _ _ _ _/ _ # / ( (- (/ (/ (- _) / _) # / """ Requests HTTP library ~~~~~~~~~~~~~~~~~~~~~ Requests is an HTTP library, written in Python, for human beings. Basic GET usage: >>> import requests >>> r = requests.get('https://www.python.org') >>> ...
"""pytest configuration Extends output capture as needed by pybind11: ignore constructors, optional unordered lines. Adds docstring and exceptions message sanitizers: ignore Python 2 vs 3 differences. """ import pytest import textwrap import difflib import re import sys import contextlib import platform import gc _u...
import time import traceback import json import datetime import httplib import coinwatcher # Watcher class class BitfinexLTCWatcher (coinwatcher.CoinWatcher) : def __init__ ( self, shortname, with_coinrefd, logger ): coinwatcher.CoinWatcher.__init__ ( self, shortname, with_coinrefd, logger ) self....
""" http://stackoverflow.com/questions/9860667/writing-robust-color-and-size-invariant-circle-detection-with-opencv-based-on """ import cv2 import math import numpy as np d_red = cv2.cv.RGB(150, 55, 65) l_red = cv2.cv.RGB(250, 200, 200) orig = cv2.imread("N16.png") img = orig.copy() img2 = cv2.cvtColor(img, cv2.COLOR...
import json import sys from pprint import pformat import requests from requests.packages import urllib3 from httpie import sessions from httpie import __version__ from httpie.compat import str from httpie.plugins import plugin_manager # https://urllib3.readthedocs.org/en/latest/security.html urllib3.disable_warning...
"""Unittests for mainframe_selection_helper.py.""" import unittest import launcher from wxgladegen import main_frame class FakeProject(object): """Mock class that stands in for a launcher.Project. The selection helper is just interested in the valid and runstate of projects, so this simple class lets tests cr...
from pysollib.mygettext import _ import gtk import gtk.glade # ************************************************************************ # * # ************************************************************************ class TimeoutsDialog: def __init__(self, parent, title, app, **kw): glade_file = app.dat...
from __future__ import print_function, division import json import struct import re import os import base64 import httplib import sys import hashlib import datetime import time from collections import namedtuple settings = {} def uint32(x): return x & 0xffffffffL def bytereverse(x): return uint32(( ((x) << 24) | (...
from gnuradio import gr, gr_unittest import sys import random def make_random_complex_tuple(L): result = [] for x in range(L): result.append(complex(random.uniform(-1000,1000), random.uniform(-1000,1000))) return tuple(result) def make_random_float_tuple(L): resul...
import logging from django.db import models from django.contrib.auth.models import User from django.dispatch import receiver from django.db.models.signals import post_save from django.utils.translation import ugettext_noop from config_models.models import ConfigurationModel from student.models import CourseEnrollmen...
""" Performance test for asset metadata in the modulestore. """ from path import path import unittest from tempfile import mkdtemp import itertools from shutil import rmtree from bson.code import Code import datetime import ddt #from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest from xmodule.a...
# -*- coding: utf-8 -*- #------------------------------------------------------------ # pelisalacarta - XBMC Plugin # Conector para 1fichier # http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/ #------------------------------------------------------------ import urlparse,urllib2,urllib,re import os from core impo...
import traceback from submissions.Conklin import music class DataFrame: data = [] feature_names = [] target = [] target_names = [] musicECHP = DataFrame() musicECHP.data = [] targetInfo = [] list_of_songs = music.get_songs() for song in list_of_songs: try: tempo = float(song['song']["te...
"""State and behavior for operation expiration.""" import time from grpc.framework.base import _interfaces from grpc.framework.base import interfaces from grpc.framework.foundation import later class _ExpirationManager(_interfaces.ExpirationManager): """An implementation of _interfaces.ExpirationManager.""" de...
from __future__ import unicode_literals import datetime from django.conf.urls import include, url from django.contrib import admin from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test import TestCase, override_settings from django.test.client import RequestFactory ...
from .vectormanager import VectorManager from .vectortablecreator import VectorTableCreator from .df import DocumentFrequencyVectorCreator from .tf import TermFrequencyVectorCreator from .tfidf import TfIdfVectorCreator from .idf import InverseDocumentFrequencyVectorCreator class ProductVectorManager(VectorManager): ...
# ----------------------------------------------------------------------------- # yacc_notfunc.py # # p_rule not defined as a function # ----------------------------------------------------------------------------- import sys if ".." not in sys.path: sys.path.insert(0,"..") import ply.yacc as yacc from calclex import...
#!/usr/bin/env python # encoding: utf-8 from __future__ import unicode_literals import yaml class Configuration(object): """Class for reprezentation of configuration""" def __init__(self, path): """Loads configuration. :path: unicode path to configuration file in YAML format ...
""" Contains methods for accessing weekly course highlights. Weekly highlights is a schedule experience built on the Schedules app. """ import logging from openedx.core.djangoapps.course_date_signals.utils import spaced_out_sections from openedx.core.djangoapps.schedules.config import COURSE_UPDATE_WAFFLE_FLAG from ...
import scipy as sp import sys from healpy import query_disc from multiprocessing import Pool np = None nt = None rp_max = None rt_max = None angmax = None nside = None counter = None lock = None npix = None z0 = None alpha= None def fill_neighs(data): for i,p1 in enumerate(data): if i%10==0: ...
#!/usr/bin/env python """Converts Java JUnit3.8 test classes to TestNG, with ordering dependencies. """ import os.path, sys from gnosis.xml.objectify import XML_Objectify, DOM class JunitToTestNgConverterUsingSuiteXml: def __init__(self): self.testNgTestImportLine = "import org.testng.annotations.Test;" ...
import platform import re import urllib2 import urlparse from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import smart_unicode # These values, if given to validate(), will trigger the self.required check. EMPTY_VALUES = (None, '', []...
"""Functional tests for BiasAdd.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.ops import array_ops from tenso...
""" Tests the msvs specific msvs_target_platform option. """ import TestGyp import TestCommon def RunX64(exe, stdout): try: test.run_built_executable(exe, stdout=stdout) except WindowsError, e: # Assume the exe is 64-bit if it can't load on 32-bit systems. # Both versions of the error are required be...
"""Test that lldb command 'process signal SIGUSR1' to send a signal to the inferior works.""" import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class SendSignalTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) def set...
microcode = ''' def macroop ROL_R_I { roli reg, reg, imm, flags=(OF,CF) }; def macroop ROL_M_I { ldst t1, seg, sib, disp roli t1, t1, imm, flags=(OF,CF) st t1, seg, sib, disp }; def macroop ROL_P_I { rdip t7 ldst t1, seg, riprel, disp roli t1, t1, imm, flags=(OF,CF) st t1, seg, riprel,...
""" A module to return a trained model. This module can be invoked manually to train a new model from existing samples. $ python ./models.py """ import logging import os import pickle from sklearn import svm from sklearn.cross_validation import cross_val_score import config import samples logger = logging.getLogger(...
class ScalarWrapper(object): def __init__(self, value): self.value = value def evaluate(self): return self.value def __call__(self): return self.value class SubexpressionWrapper(object): def __init__(self, subexpression): self.subexpression = subexpression def ev...
""" Utilities to process and visualize data from the sensorimotor experiment """ import csv import glob import os import sys import matplotlib.pyplot as plt from pylab import rcParams def combineCsvFiles(directoryPath, outputFileName): """ Combines all csv files in specified path. All files are assumed to ha...
import numpy as np import pylab as plt from NonlinearTMM import SecondOrderNLTMM, Material if __name__ == "__main__": # Define params wlP1 = 1000e-9 wlP2 = 1000e-9 polP1 = "s" polP2 = "s" polGen = "s" I0P1 = 1.0 I0P2 = I0P1 betas = np.linspace(0.0, 0.99, 10000) cry...
import time from gi.repository import Gtk, Gdk, Pango #------------------------------------------------------------------------ # # GRAMPS modules # #------------------------------------------------------------------------ from gramps.gen.plug import Gramplet from gramps.gen.const import GRAMPS_LOCALE as glocale try: ...
# -*- coding: utf-8 -*- """ pygments.styles.manni ~~~~~~~~~~~~~~~~~~~~~ A colorful style, inspired by the terminal highlighting style. This is a port of the style used in the `php port`_ of pygments by Manni. The style is called 'default' there. :copyright: Copyright 2006-2020 by the Pygments...
import json from datetime import datetime, date from enum import Enum import pytest from plenum.common.types import f from plenum.common.constants import AML from plenum.common.util import get_utc_epoch from plenum.common.request import SafeRequest from plenum.common.exceptions import ( InvalidClientTaaAcceptanceE...
""" Replicate from a cobbler master. Copyright 2007-2008, Red Hat, Inc Michael DeHaan <<EMAIL>> Scott Henson <<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 version 2 of the License...
# -*- coding: utf-8 #------------------------------------------------------------------# __author__ = "Xavier MARCELET <<EMAIL>>" #------------------------------------------------------------------# class XtdError(BaseException): def __init__(self, p_module, p_message, *p_args, **p_kwds): self.m_module = p...
from __future__ import absolute_import, division, print_function, unicode_literals from concurrent.futures import ( ProcessPoolExecutor, ThreadPoolExecutor) from c7n.registry import PluginRegistry import threading class ExecutorRegistry(PluginRegistry): def __init__(self, plugin_type): super(Execu...
from __future__ import unicode_literals import importlib from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils.translation import get_language_info import pytz from appconf import AppConf from account.timezones import TIMEZONES def load_path_attr(path): i ...
""" Displays a page with an error message """ import logging from exe.webui import common from twisted.web.resource import Resource log = logging.getLogger(__name__) class ErrorPage(Resource): """ Displays a page with an error message """ def __init__(self, errMessage): """ Init...
# Django 1.5 only supports Python >= 2.6, where the standard library includes # the json module. Previous version of Django shipped a copy for Python < 2.6. # For backwards compatibility, we're keeping an importable json module # at this location, with the same lookup sequence. # Avoid shadowing the simplejson module...
import unittest from katas.kyu_3.finding_an_appointment import get_start_time class GetStartTimeTestCase(unittest.TestCase): def setUp(self): self.schedule_1 = [ [['09:00', '11:30'], ['13:30', '16:00'], ['16:00', '17:30'], ['17:45', '19:00']], [['09:15', '12:00'], ['1...
__tests__ = 'stoqlib/domain/attachment.py' from stoqlib.domain.attachment import Attachment from stoqlib.domain.test.domaintest import DomainTest class TestAttachment(DomainTest): """Tests for Attachment class""" def test_get_description(self): attachment = Attachment(name=u'TesteAttachment') ...
import random from sqlalchemy.orm import exc from sqlalchemy.sql import exists from neutron.common import constants from neutron.db import agents_db from neutron.db import l3_agentschedulers_db from neutron.db import l3_db from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) class...
class Menu: def __init__(self,parent,title,description='Select an entry:'): self.parent = parent self.title = title self.description = description self.entries = [] def add_entry(self,text,fn): self.entries.append((text,fn)) def display(self,client): client.se...
# -*- coding: utf-8 -*- """""" # - # Copyright (C) 2015 ZetaOps Inc. # # This file is licensed under the GNU General Public License v3 # (GPLv3). See LICENSE.txt for details. from SpiffWorkflow import Task from SpiffWorkflow.bpmn.BpmnWorkflow import BpmnWorkflow from tests.SpiffWorkflow.pytests.testengine import Bpmn...
"""Helper class to quickly write a loop over all standard input files. Typical use is: import fileinput for line in fileinput.input(): process(line) This iterates over the lines of all files listed in sys.argv[1:], defaulting to sys.stdin if the list is empty. If a filename is '-' it is also replace...
""" Test base helpers. """ # Python3 support from __future__ import print_function from __future__ import unicode_literals # Python std lib import os import sys import unittest # third party libs try: import jinja2 # noqa HAS_JINJA = True except ImportError: HAS_JINJA = False try: import jtextfsm a...
from ssmpy.data import * from ssmpy.calculations import * import multiprocessing as mp def get_all_commom_ancestors(all_ancestors, it1, it2): """ Get all common ancestors for it1 and it2 :param all_ancestors: pandas DataFrame of all ancestors :param it1: entity 1 (id) :param it2: entity 2 (id) ...
# pylint: skip-file # flake8: noqa # pylint: disable=too-many-instance-attributes class OCService(OpenShiftCLI): ''' Class to wrap the oc command line tools ''' kind = 'service' # pylint allows 5 # pylint: disable=too-many-arguments def __init__(self, sname, name...
import json import optparse import os import re import sys if sys.version_info < (2, 6, 0): sys.stderr.write("python 2.6 or later is required run this script\n") sys.exit(1) import buildbot_common import build_projects import build_version import easy_template import parse_dsc from build_paths import SDK_SRC_DIR...
from __future__ import division, absolute_import, print_function import os from tempfile import mkstemp from numpy.distutils.npy_pkg_config import read_config, parse_flags from numpy.testing import TestCase, run_module_suite simple = """\ [meta] Name = foo Description = foo lib Version = 0.1 [default] cflags = -I/u...
#!/usr/bin/env Python from __future__ import print_function from collections import OrderedDict import pprint def CPUinfo(): ''' Return the information in /proc/CPUinfo as a dictionary in the following format: CPU_info['proc0']={...} CPU_info['proc1']={...} ''' CPUinfo=OrderedDict() procin...
# -*- coding: utf-8 -*- from bpy.types import Panel class MMDMaterialPanel(Panel): bl_idname = 'MATERIAL_PT_mmd_tools_material' bl_label = 'MMD Material' bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = 'material' @classmethod def poll(cls, context): material = ...
""" This module contains the implementation of the TCP forwarding, which allows clients and servers to forward arbitrary TCP data across the connection. Maintainer: Paul Swartz """ import struct from twisted.internet import protocol, reactor from twisted.python import log import common, channel class SSHListenForw...
""" 设计模式相关。 """ import inspect class Callable(object): """ 将对象或函数转化成可回调对象。 如果输入参数是可回调对象(或函数),则调用后,返回回调结果。 如果输入参数是不可回调对象,则调用后,返回对象本身。 """ def __init__(self, callback, signature=None, doc=None): self.__signature__ = self.signature = signature or (callable(callback) and str(inspec...
import collections class Buffer(): def __init__(self, size = 100, abandon_output = True): self.buf_short = collections.deque(maxlen = size) self.buf = [] self.abandon_output = abandon_output def put(self, line): if not self.abandon_output: self.buf.append(line) ...
### Author: <krikava$gmail,com> ### Condor queue plugin ### Display information about jobs in queue (using condor_q(1)) ### ### WARNING: with many jobs in the queue, the condor_q might take quite ### some time to execute and use quite a bit of resources. Consider ### using a longer delay. import os import re global ...
import numpy as np import scipy.interpolate import scipy.ndimage def congrid(a, newdims, method='linear', centre=False, minusone=False): '''Arbitrary resampling of source array to new dimension sizes. Currently only supports maintaining the same number of dimensions. To use 1-D arrays, first promote them ...
import sys from ctypes.util import find_library from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db.backends.sqlite3.base import (Database, DatabaseWrapper as SQLiteDatabaseWrapper, DatabaseFeatures as SQLiteDatabaseFeatures, SQLiteCursorWrapper) from django....
"""Registrations for LinearOperator.adjoint.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.ops import math_ops from tensorflow.python.ops.linalg import linear_operator from tensorflow.python.ops.linalg import linear_operator_adjo...
import sys, traceback import mal_readline import mal_types as types from mal_types import (MalSym, MalInt, MalStr, nil, true, false, _symbol, _keywordu, MalList, _list, MalVector, MalHashMap, MalFunc) import reader, printer from env import Env import core # read def READ(s...
""" Management utility to create superusers. """ from __future__ import unicode_literals import getpass import sys from optparse import make_option from django.contrib.auth import get_user_model from django.contrib.auth.management import get_default_username from django.core import exceptions from django.core.managem...
class InvalidDefinitionError(Exception): pass class NotFoundError(Exception): pass class ProcessingError(Exception): ''' An error occurred while processing a request to the XModule. For example: if an exception occurs while checking a capa problem. ''' pass class InvalidVersionError(Ex...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' simpleplayer.py (c) Will Roberts 13 January, 2017 Simple AI cribbage player. This player uses Monte Carlo simulation to try to pick the best cards to discard and play. ''' from __future__ import absolute_import, print_function import random import numpy as np from ...
from tests.common import BaseTest class TestElastiCacheCluster(BaseTest): def test_elasticache_cluster_simple(self): session_factory = self.replay_flight_data('test_elasticache_cluster_simple') p = self.load_policy({ 'name': 'elasticache-cluster-simple', ...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} def get_bundler_executable(module): if module.params.get('executable'): return module.params.get('executable').split(' ') else: return [ module.get_bin_pat...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import re from ansible.plugins.terminal import TerminalBase from ansible.errors import AnsibleConnectionFailure class TerminalModule(TerminalBase): terminal_prompts_re = [ re.compile(r'[\r\n]?[a-zA-Z]{1}[a-zA-Z0-9-]...
""" *Real* reloading support for Python. """ # System Imports import sys import types import time import linecache # Sibling Imports from twisted.python import log, reflect lastRebuild = time.time() class Sensitive: """ A utility mixin that's sensitive to rebuilds. This is a mixin for classes (usually...
import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration cblas_libs, blas_info = get_blas_info() libraries = [] if os.name == 'posix': cblas_libs.a...
from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import flt, getdate, add_days, formatdate from frappe.model.document import Document from datetime import date from erpnext.stock.doctype.item.item import ItemTemplateCannotHaveStock class StockFreezeError(frappe.ValidationErr...
import WebIDL def WebIDLTest(parser, harness): parser.parse(""" [Flippety] interface TestExtendedAttr { [Foopy] attribute byte b; }; """) results = parser.finish() parser = parser.reset() parser.parse(""" [Flippety="foo.bar",Floppety=flop] interfa...
from __future__ import division import matplotlib.pyplot as plt from matplotlib import colors as mcolors colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS) # Sort colors by hue, saturation, value and name. by_hsv = sorted((tuple(mcolors.rgb_to_hsv(mcolors.to_rgba(color)[:3])), name) for name, color in colo...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'community'} from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.urls...
from channel import Channel from connection import Connection import hashlib import thread import hmac import logging try: import simplejson as json except: import json VERSION = "0.2.0" class Pusher(object): host = "ws.pusherapp.com" client_id = 'PythonPusherClient' protocol = 6 def __init__(self, ke...
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Lice...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui_gui.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow...
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import #################################################################### # fixXreacs.py # The program is meant to take a model and reconfigure any cross-compartment # reactions so that they are split into portions on either side coupl...
""" Seismic: Invert vertical seismic profile (VSP) traveltimes using smoothness regularization and unknown layer thicknesses """ import numpy from fatiando import utils from fatiando.seismic.profile import layered_straight_ray, LayeredStraight from fatiando.inversion import Smoothness1D from fatiando.vis import mpl # ...
from __future__ import unicode_literals from django.contrib.gis.gdal import CoordTransform, SpatialReference from django.core.serializers.base import SerializerDoesNotExist from django.core.serializers.json import Serializer as JSONSerializer class Serializer(JSONSerializer): """ Convert a queryset to GeoJSO...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from wechatpy.client.api.base import BaseWeChatAPI class WeChatTag(BaseWeChatAPI): def create(self, name): return self._post( 'tag/create', data={ 'tagname': name } ...
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2018 Fortinet, Inc. # # 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 Lic...
import copy def SlurpFile(filename): f = open(filename) lines = f.readlines() f.close() return lines openConfig = SlurpFile def parseConfigFile(lines, default_config, things_which_are_ints = [ "port", "smtp_port", "inactivity_timeout" ], ): config = copy.dee...
import json import time import logging from nupic.support import initLogging class ModelChooser(object): """Utility Class to help with the selection of the 'best' model during hypersearch for a particular job. The main interface method is updateResultsForJob(), which is to be called periodically from the hy...
#! /usr/bin/env python from __future__ import print_function from openturns import * TESTPREAMBLE() RandomGenerator.SetSeed(0) try: # Instanciate one distribution object distribution = Trapezoidal(1.0, 1.2, 3.0, 14.0) print("Distribution ", repr(distribution)) print("Distribution ", distribution) ...
# -*- coding: utf-8 -*- """ *************************************************************************** customwidgets.py --------------------- Date : May 2014 Copyright : (C) 2014 by Denis Rouzaud Email : <EMAIL> ********************************************...
""" Unit tests for stub EdxNotes implementation. """ import ddt import urlparse import json import unittest import requests from uuid import uuid4 from ..edxnotes import StubEdxNotesService @ddt.ddt class StubEdxNotesServiceTest(unittest.TestCase): """ Test cases for the stub EdxNotes service. """ def...
import os import re import json import time from collections import defaultdict, OrderedDict import requests import demjson LINUX_PRICING_URLS = [ # Deprecated instances (JSON format) 'https://aws.amazon.com/ec2/pricing/json/linux-od.json', # Previous generation instances (JavaScript file) 'https://a0...
"""Script for unittesting the ganeti.utils.storage module""" import mock import unittest from ganeti import constants from ganeti.utils import storage import testutils class TestGetStorageUnitForDiskTemplate(unittest.TestCase): def setUp(self): self._default_vg_name = "some_vg_name" self._cluster = moc...
# Script Name : check_file.py # Last Modified : # Modifications : with statement added to ensure correct file closure # Description : Check a file exists and that we can read the file import sys # Import the Modules import os # Import the Modules # Readfile Functions which open the file that is passed to the scri...
"""Tests for generator.rdflib_function_handler.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import rdflib from rdflib import compare from rdflib.extras import infixowl from rdfformat.generator import constants from rdfformat.generator import rdf_hel...
from __future__ import absolute_import import json import logging import requests from dropbox.session import DropboxSession from dropbox.client import DropboxClient from tornado.httpclient import AsyncHTTPClient, HTTPRequest from cloudtunes import settings from cloudtunes.utils import cached_property class Session...
""" Tests for PDF billing statement generation """ from decimal import Decimal import mock from go.vumitools.tests.helpers import djangotest_imports with djangotest_imports(globals()): from django.core.urlresolvers import reverse from go.base.tests.helpers import DjangoVumiApiHelper, GoDjangoTestCase fr...
from collections import defaultdict import mock from searx.engines import stackoverflow from searx.testing import SearxTestCase class TestStackoverflowEngine(SearxTestCase): def test_request(self): query = 'test_query' dicto = defaultdict(dict) dicto['pageno'] = 0 params = stackov...