code
stringlengths
1
199k
from allura.tests import TestController class TestSearch(TestController): def test_global_search_controller(self): r = self.app.get('/gsearch/') r = self.app.get('/gsearch/', params=dict(q='Root')) def test_project_search_controller(self): r = self.app.get('/search/') r = self.ap...
import jsonschema from .raml import named_params_to_json_schema class RAMLValidator(object): def __init__(self, response, raml): self.response = response self.raml = raml self.raml_response = raml.responses.get(response.status_code) def validate(self, validate=["headers", "body"]): ...
from kubernetes_py.utils import is_valid_string, filter_model class PodCondition(object): """ http://kubernetes.io/docs/api-reference/v1/definitions/#_v1_podcondition """ def __init__(self, model=None): super(PodCondition, self).__init__() self._last_probe_time = None self._last_...
import logging import tempfile from son_editor.util.requestutil import CONFIG logging.info("Setting up config for temporary db") handle, CONFIG['database']['location'] = tempfile.mkstemp() from son_editor.app.database import init_db CONFIG['testing'] = True CONFIG["workspaces-location"] = tempfile.mkdtemp() + '/' init_...
"""This module is deprecated. Please use `airflow.providers.microsoft.azure.operators.adls_list`.""" import warnings from airflow.providers.microsoft.azure.operators.adls_list import AzureDataLakeStorageListOperator # noqa warnings.warn( "This module is deprecated. Please use `airflow.providers.microsoft.azure.ope...
from six import moves from sqlalchemy.orm import exc as s_exc from testtools import matchers from neutron.common import exceptions as n_exc from neutron import context from neutron.db import api as db from neutron.db import common_db_mixin from neutron.plugins.cisco.common import cisco_constants as c_const from neutron...
from __future__ import absolute_import from openpyxl.descriptors.serialisable import Serialisable from openpyxl.descriptors import ( Typed, Float, NoneSet, Bool, Integer, MinMax, NoneSet, Set, String, Alias, ) from openpyxl.descriptors.excel import ( ExtensionList, Percen...
"""Extremely random forest graph builder. go/brain-tree.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import random import sys from tensorflow.contrib.losses.python.losses import loss_ops from tensorflow.contrib.tensor_forest.python import c...
"""service-management enable helper functions.""" from apitools.base.py import list_pager from googlecloudsdk.api_lib.service_management import services_util from googlecloudsdk.core import log def EnableServiceApiCall(project_id, service_name): """Make API call to enable a specific API. Args: project_id: The I...
from abc import ABCMeta from fuse import Operations, LoggingMixIn class View(LoggingMixIn, Operations): __metaclass__ = ABCMeta def __init__(self, *args, **kwargs): self.args = args for attr in kwargs: setattr(self, attr, kwargs[attr]) def getattr(self, path, fh=None): re...
"""Module executing integration tests against certbot with nginx plugin.""" import os import ssl from typing import Generator from typing import List import pytest from certbot_integration_tests.nginx_tests.context import IntegrationTestsContext @pytest.fixture(name='context') def test_context(request: pytest.FixtureRe...
import pytest from tests.providers.google.cloud.utils.gcp_authenticator import GCP_WORKFLOWS_KEY from tests.test_utils.gcp_system_helpers import CLOUD_DAG_FOLDER, GoogleSystemTest, provide_gcp_context @pytest.mark.system("google.cloud") @pytest.mark.credential_file(GCP_WORKFLOWS_KEY) class CloudVisionExampleDagsSystemT...
"""The auth command gets tokens via oauth2.""" import argparse import textwrap from googlecloudsdk.api_lib.auth import util as auth_util from googlecloudsdk.calliope import base from googlecloudsdk.calliope import exceptions as c_exc from googlecloudsdk.core import config from googlecloudsdk.core import log from google...
""" Concatenate =========== Concatenate (append) two or more data sets. """ from collections import OrderedDict from functools import reduce from itertools import chain, repeat from operator import itemgetter import numpy from PyQt4 import QtGui from PyQt4.QtCore import Qt import Orange.data from Orange.widgets import ...
"""SCons.Tool.g++ Tool-specific initialization for g++. 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. """ __revision__ = "src/engine/SCons/Tool/g++.py 3897 2009/01/13 06:45:54 scons" import os.path import re impor...
from mock import Mock, patch from evennia.utils.test_resources import EvenniaTest from .bodyfunctions import BodyFunctions @patch("evennia.contrib.tutorial_examples.bodyfunctions.random") class TestBodyFunctions(EvenniaTest): script_typeclass = BodyFunctions def setUp(self): super(TestBodyFunctions, sel...
import datetime from django import http from django.utils import timezone from django.shortcuts import get_object_or_404, redirect, render from django.db.models import Count from django.contrib import messages from django.db import transaction from django.contrib.auth.decorators import login_required from airmozilla.ma...
from recipe_engine import recipe_api from . import default from . import ssh """Chromebook flavor, used for running code on Chromebooks.""" class ChromebookFlavor(ssh.SSHFlavor): def __init__(self, m, app_name): super(ChromebookFlavor, self).__init__(m, app_name) self.chromeos_homedir = '/home/chronos/user/' ...
descriptions = {"ADAP_FILE_NAME": "NAME OF ADAPTATION DATA FILE", "ADAP_FORMAT": "FORMAT OF ADAPTATION DATA FILE", "ADAP_REVISION": "REVISION NUMBER OF ADAPTATION DATA FILE", "ADAP_DATE": "LAST MODIFIED DATE ADAPTATION DATA FILE", "ADAP_TIME": "LAST MODIFI...
import sys try: import uctypes except ImportError: print("SKIP") sys.exit() if sys.byteorder != "little": print("SKIP") sys.exit() desc = { "s0": uctypes.UINT16 | 0, "sub": (0, { "b0": uctypes.UINT8 | 0, "b1": uctypes.UINT8 | 1, }), "arr": (uctypes.ARRAY | 0, uctypes....
from braintree.exceptions.braintree_error import BraintreeError class ServerError(BraintreeError): """ Raised when the gateway raises an error. Please contant support at support@getbraintree.com. See https://developers.braintreepayments.com/ios+python/reference/general/exceptions#server-error """ p...
""" Connect to a MySensors gateway via pymysensors API. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.mysensors/ """ import logging import socket import voluptuous as vol from homeassistant.bootstrap import setup_component import homeassistant.hel...
import re from functools import partial from rebulk.pattern import FunctionalPattern, StringPattern, RePattern from ..rebulk import Rebulk from ..validators import chars_surround def test_chain_close(): rebulk = Rebulk() ret = rebulk.chain().close() assert ret == rebulk assert len(rebulk.effective_patte...
"""scons.Node.Python Python nodes. """ __revision__ = "src/engine/SCons/Node/Python.py 2014/07/05 09:42:21 garyo" import SCons.Node class ValueNodeInfo(SCons.Node.NodeInfoBase): current_version_id = 1 field_list = ['csig'] def str_to_node(self, s): return Value(s) class ValueBuildInfo(SCons.Node.Bu...
""" EasyBuild support for building and installing freetype, implemented as an easyblock @author: Kenneth Hoste (Ghent University) """ from easybuild.easyblocks.generic.configuremake import ConfigureMake from easybuild.tools.systemtools import get_shared_lib_ext class EB_freetype(ConfigureMake): """Support for build...
""" Gives access for reading and writing application configuration parameters """ __author__ = 'Bitcraze AB' __all__ = ['Config'] import sys import json import logging from .singleton import Singleton logger = logging.getLogger(__name__) class Config(): """ Singleton class for accessing application configuration ""...
"""enhance.py - Image enhancement handler and dialog (e.g. contrast, brightness etc.) """ import gtk import histogram import image _dialog = None class ImageEnhancer: """The ImageEnhancer keeps track of the "enhancement" values and performs these enhancements on pixbufs. Changes to the ImageEnhancer's values ...
import re import logging from autotest.client.shared import error from virttest import virsh def run(test, params, env): """ Test command: virsh schedinfo. This version provide base test of virsh schedinfo command: virsh schedinfo <vm> [--set<set_ref>] TODO: to support more parameters. 1) Get pa...
import karamba menu1 = 0 menu2 = 0 id1 = 0 id2 = 0 id3 = 0 id4 = 0 id5 = 0 def initWidget(widget): global menu1 global menu2 global id1 global id2 global id3 global id4 global id5 menu1 = karamba.createMenu(widget) print "menu 1 created!" menu2 = karamba.createMenu(widget) print "menu 2 created!" id1 = kara...
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} DOCUMENTATION = ''' --- module: sorcery short_description: Package manager for Source Mage GNU/Linux description: - Manages "spells" on Source Mage GNU/Linux using I(sorcery) toolchain a...
import moose import os sdir = os.path.dirname( __file__ ) print( '[INFO] Using moose from %s' % moose.__file__ ) print( '[WONTFIX] See https://github.com/BhallaLab/moose-core/issues/47') if False: moose.loadModel(os.path.join(sdir,'../data/acc94.g'),'/acc94','gsl') #moose.loadModel(os.path.join(sdir,'../data/ac...
def dodo(verts,edges,verts_o,k): for i in edges: if k in i: # this is awesome !! k = i[int(not i.index(k))] verts_o.append(verts[k]) return k, i return False, False def sv_main(v=[],e=[]): in_sockets = [ ['v', 'v', v], ['s', 'e', e]] ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: aci_epg_to_domain short_description: Bind EPGs to Domains on C...
""" This module contains utilities to manipulate trigger lists based on segment. """ import numpy from glue.ligolw import table, lsctables, utils as ligolw_utils from ligo.segments import segment, segmentlist def start_end_to_segments(start, end): return segmentlist([segment(s, e) for s, e in zip(start, end)]) def ...
"""CGI-savvy HTTP Server. This module builds on SimpleHTTPServer by implementing GET and POST requests to cgi-bin scripts. If the os.fork() function is not present (e.g. on Windows), os.popen2() is used as a fallback, with slightly altered semantics; if that function is not present either (e.g. on Macintosh), only Pyth...
import re import sys import types import copy import os import inspect StringTypes = (str, bytes) _is_identifier = re.compile(r'^[a-zA-Z0-9_]+$') class LexError(Exception): def __init__(self, message, s): self.args = (message,) self.text = s class LexToken(object): def __repr__(self): re...
from datetime import datetime, timedelta import time import logging import openerp from openerp import SUPERUSER_ID from openerp.osv import fields, osv from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT _logger = logging.getLogger(__name__) DATE_RANGE_FUNCTION = { 'minutes': lambda interval: timedelta(minutes...
""" Tests of various instructor dashboard features that include lists of students """ from django.conf import settings from django.test.client import RequestFactory from django.test.utils import override_settings from markupsafe import escape from courseware.tests.tests import TEST_DATA_MONGO_MODULESTORE from student.t...
"""Index fkey to user Revision ID: 4616e70f18f4 Revises: 5269eb17ff82 Create Date: 2015-01-31 03:05:19.836389 """ revision = '4616e70f18f4' down_revision = '5269eb17ff82' from alembic import op def upgrade(): op.create_index(op.f('ix_job_application_replied_by_id'), 'job_application', ['replied_by_id'], unique=Fals...
from spack import * class PyPox(PythonPackage): """Utilities for filesystem exploration and automated builds.""" homepage = "https://github.com/uqfoundation/pox" pypi = "pox/pox-0.2.5.tar.gz" version('0.3.0', sha256='cb968350b186466bb4905a21084587ec3aa6fd7aa0ef55d416ee0d523e2abe31') version('0.2.5',...
import sys, os import matplotlib.pyplot, numpy from pylab import * sys.path.append(os.path.join(os.getenv('PIKA_DIR'), 'python')) from tools import * x, y = extractPostprocessorData('out', x = 'h_max', xlabel='Element Size', ylabel='L2_error') plt2 = ConvergencePlot(x,y) plt2.fit() show()
from spack import * class PyWand(PythonPackage): """Wand is a ctypes-based simple ImageMagick binding for Python. """ homepage = "https://docs.wand-py.org" pypi = "Wand/Wand-0.5.6.tar.gz" version('0.5.6', sha256='d06b59f36454024ce952488956319eb542d5dc65f1e1b00fead71df94dbfcf88') version('0.4.2',...
""" Runtime context for the integration tests. This is used both by the test runner to start and stop tor, and by the integration tests themselves for information about the tor test instance they're running against. :: RunnerStopped - Runner doesn't have an active tor instance TorInaccessable - Tor can't be queried...
"""This example creates a test network. You do not need to have a DFP account to run this example, but you do need to have a Google account (created at http://www.google.com/accounts/newaccount if you currently don't have one) that is not associated with any other DFP test networks. Once this network is created, you ca...
"""Error handling examples."""
import functools import httplib as http import itertools from operator import itemgetter from dateutil.parser import parse as parse_date from django.utils import timezone from flask import request, redirect import pytz from modularodm import Q from modularodm.exceptions import ValidationValueError from framework.mongo....
"""Tests for the experimental input pipeline ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import numpy as np from tensorflow.core.protobuf import config_pb2 from tensorflow.python.client import session from tensorflow.python.data.ops impo...
import argparse import copy import logging import re import subprocess import sys import apt_pkg import yaml LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.INFO) stdout_channel = logging.StreamHandler(sys.stdout) LOGGER.addHandler(stdout_channel) class PackageStore(object): """Store a list of PackageL...
"""make labels unique Revision ID: 264ddaebdfcc Revises: 89ff8a6d72b2 Create Date: 2018-03-12 11:15:09.729850 """ from alembic import op revision = '264ddaebdfcc' down_revision = '89ff8a6d72b2' branch_labels = None def upgrade(): op.create_unique_constraint(None, 'network', ['label']) op.create_unique_constrain...
"""HPE LeftHand SAN ISCSI REST Proxy. Volume driver for HPE LeftHand Storage array. This driver requires 11.5 or greater firmware on the LeftHand array, using the 2.0 or greater version of the hpelefthandclient. You will need to install the python hpelefthandclient module. sudo pip install python-lefthandclient Set the...
import nose if __name__ == '__main__': result = nose.runmodule(name='tests', argv=[ '', '-s', '--verbose', '--logging-level=INFO', '--rednose', ])
import json import os import sys sys.path.append('../../../libbeat/tests/system') from beat.beat import TestCase class BaseTest(TestCase): @classmethod def setUpClass(self): self.beat_name = "filebeat" super(BaseTest, self).setUpClass() def get_registry(self): # Returns content of th...
from datetime import datetime, timedelta from django import http from django.contrib.auth.models import AnonymousUser from django.core.exceptions import PermissionDenied from django.test import RequestFactory import mock import pytest from olympia import amo from olympia.amo import decorators from olympia.amo.tests imp...
from django.db import migrations class Migration(migrations.Migration): dependencies = [("page", "0002_auto_20180321_0417")] operations = [ migrations.AlterModelOptions( name="page", options={ "ordering": ("slug",), "permissions": (("manage_pages",...
import unittest import base class GifTestCase(base.ShellParserTestCase, unittest.TestCase): extension = 'gif'
import unittest from pycoin.serialize import b2h from pycoin.tx.Tx import Tx TX_E1A18B843FC420734DEEB68FF6DF041A2585E1A0D7DBF3B82AAB98291A6D9952_HEX = ("0100000001a8f57056b016d7d243fc0fc2a73f9146e7e4c7766ec6033b5ac4cb89c" "64e19d0000000008a4730440220251acb534ba1b8a269260ad3fa80e075cd150d3ff" "ba76ad20cd2e8178dee98b7022...
"""Transform a roidb into a trainable roidb by adding a bunch of metadata.""" import numpy as np from ..fast_rcnn.config import cfg from ..fast_rcnn.bbox_transform import bbox_transform from ..utils.cython_bbox import bbox_overlaps def prepare_roidb(imdb): """Enrich the imdb's roidb by adding some derived quantitie...
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that env.Requires() nodes are evaluated before other children. """ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ def copy_and_create_func(target, source, env): fp = open(str(target[0]), 'wb') for s in source: ...
import unittest import base class XlsxTestCase(base.BaseParserTestCase, unittest.TestCase): extension = 'xlsx'
import os import re import time import logging from autotest.client.shared import error from autotest.client.shared import utils from virttest import storage from virttest import data_dir from virttest import utils_misc @error.context_aware def run(test, params, env): """ Install/upgrade special kernel package ...
from __future__ import unicode_literals from .common import InfoExtractor from ..compat import compat_urllib_parse from ..utils import ( ExtractorError, NO_DEFAULT, sanitized_Request, ) class VodlockerIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?vodlocker\.(?:com|city)/(?:embed-)?(?P<id>[0-9a-zA...
from m5.SimObject import SimObject class QoSTurnaroundPolicy(SimObject): type = 'QoSTurnaroundPolicy' cxx_header = "mem/qos/turnaround_policy.hh" cxx_class = 'QoS::TurnaroundPolicy' abstract = True class QoSTurnaroundPolicyIdeal(QoSTurnaroundPolicy): type = 'QoSTurnaroundPolicyIdeal' cxx_header ...
""" Detect the Intel C++ compiler """ import os, sys from waflib.Tools import ccroot, ar, gxx from waflib.Configure import conf @conf def find_icpc(conf): """ Find the program icpc, and execute it to ensure it really is icpc """ if sys.platform == 'cygwin': conf.fatal('The Intel compiler does not work on Cygwin')...
from __future__ import unicode_literals import webnotes from webnotes.utils import getdate, flt, add_days import json @webnotes.whitelist() def get_item_details(args): """ args = { "doctype": "", "docname": "", "item_code": "", "warehouse": None, "supplier": None, "transaction_date": None, "conv...
""" Usage: get-addons [-m] path1 [path2 ...] Given a list of paths, finds and returns a list of valid addons paths. With -m flag, will return a list of modules names instead. """ from __future__ import print_function import os import sys def is_module(path): if not os.path.isdir(path): return False man...
""" Django Views for service status app """ import json import time from celery.exceptions import TimeoutError from django.http import HttpResponse from celery import current_app as celery from openedx.core.djangoapps.service_status.tasks import delayed_ping def index(_): """ An empty view """ return Ht...
''' This IconView widget shows the contents of the currently selected directory on the disk. it is based on a tutorial from ZetCode PyGTK tutorial the original code is under the BSD license author: jan bodnar website: zetcode.com Copyright 2012 Norbert Schechner nieson@web.de This pr...
import re from .common import InfoExtractor from .ooyala import OoyalaIE from ..utils import ExtractorError class ViceIE(InfoExtractor): _VALID_URL = r'http://www.vice.com/.*?/(?P<name>.+)' _TEST = { u'url': u'http://www.vice.com/Fringes/cowboy-capitalists-part-1', u'file': u'43cW1mYzpia9IlestBj...
"""Schemas for BigQuery tables / queries.""" class SchemaField(object): """Describe a single field within a table schema. :type name: str :param name: the name of the field. :type field_type: str :param field_type: the type of the field (one of 'STRING', 'INTEGER', 'FLOAT', 'B...
"""Unit tests for oauth2client._pure_python_crypt.""" import os import mock from pyasn1_modules import pem import rsa import six import unittest2 from oauth2client._helpers import _from_bytes from oauth2client import _pure_python_crypt from oauth2client.crypt import RsaSigner from oauth2client.crypt import RsaVerifier ...
import itertools from collections import defaultdict import unittest from mock import patch from swift.proxy.controllers.base import headers_to_container_info, \ headers_to_account_info, headers_to_object_info, get_container_info, \ get_container_memcache_key, get_account_info, get_account_memcache_key, \ g...
"""Copyright 2008 Orbitz WorldWide 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 License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
import mock import six from cinder import exception from cinder import test import cinder.tests.volume.drivers.netapp.fakes as na_fakes import cinder.volume.drivers.netapp.common as na_common import cinder.volume.drivers.netapp.dataontap.fc_cmode as fc_cmode import cinder.volume.drivers.netapp.utils as na_utils class N...
FILTERED_LIMITS = ['floating_ips', 'security_groups', 'security_group_rules'] class ViewBuilder(object): """OpenStack API base limits view builder.""" limit_names = {} def __init__(self): self.limit_names = { "ram": ["maxTotalRAMSize"], "instances": ["maxTotalInstances"], ...
import jsonschema import mock from rally.plugins.common.runners import rps from rally.task import runner from tests.unit import fakes from tests.unit import test RUNNERS_BASE = "rally.task.runner." RUNNERS = "rally.plugins.common.runners." class RPSScenarioRunnerTestCase(test.TestCase): def setUp(self): sup...
"""command to split a changeset into smaller ones (EXPERIMENTAL)""" from __future__ import absolute_import from mercurial.i18n import _ from mercurial.node import ( nullrev, short, ) from mercurial import ( bookmarks, cmdutil, commands, error, hg, pycompat, registrar, revsetlang,...
from streamlink.plugins.wwenetwork import WWENetwork from tests.plugins import PluginCanHandleUrl class TestPluginCanHandleUrlWWENetwork(PluginCanHandleUrl): __plugin__ = WWENetwork should_match = [ 'https://watch.wwe.com/in-ring/3622', ]
'''WebSocket_ Protocol is implemented via the :class:`Frame` and :class:`FrameParser` classes. To obtain a frame parser one should use the :func:`frame_parser` function. frame parser ~~~~~~~~~~~~~~~~~~~ .. autofunction:: frame_parser Frame ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. autoclass:: Frame :members: :member-order:...
""" Testing for Clustering methods """ import numpy as np from numpy.testing import assert_equal, assert_array_equal from ..affinity_propagation_ import AffinityPropagation, \ affinity_propagation from ...datasets.samples_generator import make_blobs n_clusters = 3 centers = np.array(...
from __future__ import absolute_import, division, print_function import pytest from cryptography.exceptions import _Reasons from cryptography.hazmat.backends.interfaces import HMACBackend from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.twofactor import InvalidToken from cryptograph...
""" Test lldb process crash info. """ import os import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil from lldbsuite.test import lldbtest class PlatformProcessCrashInfoTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) def setUp(s...
from __future__ import unicode_literals import frappe, os from frappe.model.meta import Meta from frappe.modules import scrub, get_module_path, load_doctype_module from frappe.model.workflow import get_workflow_name from frappe.utils import get_html_format from frappe.translate import make_dict_from_messages, extract_m...
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2014 Alex Forencich 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 Software without restriction, including without limitation the rights ...
import os import sys import inspect import traceback import optparse import logging import configobj try: # python 2.6 import unittest2 as unittest except ImportError: import unittest try: import cPickle as pickle except ImportError: import pickle as pickle try: from cStringIO import StringIO ex...
""" This is our testing framework. Goals: * it should be compatible with py.test and operate very similarly (or identically) * doesn't require any external dependencies * preferably all the functionality should be in this file only * no magic, just import the test file and execute the test functions, that's it * portab...
from yade import pack,ymport import gts surf=gts.read(open('horse.coarse.gts')) pred=pack.inGtsSurface(surf) aabb=pred.aabb() dim0=aabb[1][0]-aabb[0][0]; radius=dim0/40. O.bodies.append(pack.regularHexa(pred,radius=radius,gap=radius/4.)) tetras = ymport.ele('horse.node','horse.ele',shift=(0,0,-1*(aabb[1][2]-aabb[0][2])...
import os, glob, sys import shutil import deluge.common build_version = deluge.common.get_version() print "Deluge Version: %s" % build_version python_path = os.path.dirname(sys.executable) + "\\" print "Python Path: %s" % python_path gtk_root = python_path + "Lib\\site-packages\\gtk-2.0\\runtime\\" shutil.copy(python_p...
from __future__ import unicode_literals import frappe import frappe.defaults from frappe import msgprint, _ from frappe.utils import cstr, flt, cint from erpnext.stock.stock_ledger import update_entries_after from erpnext.controllers.stock_controller import StockController from erpnext.stock.utils import get_stock_bala...
from openerp.osv import orm, fields from openerp.tools.translate import _ class payment_mode(orm.Model): _inherit = 'payment.mode' def onchange_partner(self, cr, uid, ids, partner_id): if partner_id: obj = self.pool['res.partner'] field = ['name'] ids = [partner_id] ...
import chigger reader = chigger.exodus.ExodusReader('../input/mug_blocks_out.e', time=1, timestep=1) reader.update()
from spack import * class Velvetoptimiser(Package): """Automatically optimise three of Velvet's assembly parameters.""" homepage = "https://github.com/tseemann/VelvetOptimiser" url = "https://github.com/tseemann/VelvetOptimiser/archive/2.2.6.tar.gz" version('2.2.6', sha256='b407db61b58ed983760b80a3...
from jsonschema import validate from pprint import pprint schema = { "type" : "object", "properties" : { "price" : {"type" : "number"}, "name" : {"type" : "string"}, }, } validate({"name" : "Eggs", "price" : 34.99}, schema) import json with open('api.json') as f: schema = json.loads(f.re...
"""Tests the Home Assistant workday binary sensor.""" from datetime import date from unittest.mock import patch import pytest import voluptuous as vol import homeassistant.components.workday.binary_sensor as binary_sensor from homeassistant.setup import setup_component from tests.common import assert_setup_component, g...
import itertools import os from json import JSONEncoder from lit.BooleanExpression import BooleanExpression class ResultCode(object): """Test result codes.""" # All result codes (including user-defined ones) in declaration order _all_codes = [] @staticmethod def all_codes(): return ResultCod...
"""Nuki.io lock platform.""" from abc import ABC, abstractmethod import logging from pynuki import MODE_OPENER_CONTINUOUS import voluptuous as vol from homeassistant.components.lock import PLATFORM_SCHEMA, SUPPORT_OPEN, LockEntity from homeassistant.const import CONF_HOST, CONF_PORT, CONF_TOKEN from homeassistant.helpe...
from euca2ools.commands.argtypes import b64encoded_file_contents from euca2ools.commands.ec2 import EC2Request from requestbuilder import Arg class ImportKeyPair(EC2Request): DESCRIPTION = 'Import a public RSA key as a new key pair' ARGS = [Arg('KeyName', metavar='KEYPAIR', help='name for the ne...
from ctypes import * import os if(os.getenv('STINGER_LIB_PATH')): libstinger_core = cdll.LoadLibrary(os.getenv('STINGER_LIB_PATH') + '/libstinger_core.so') else: libstinger_core = cdll.LoadLibrary('libstinger_core.so') class Stinger: def __init__(self, s=None, filename=None): if(filename != None): self....
""" Recurrent layers. TODO: write more documentation """ __docformat__ = 'restructedtext en' __authors__ = ("Razvan Pascanu " "KyungHyun Cho " "Caglar Gulcehre ") __contact__ = "Razvan Pascanu <r.pascanu@gmail>" import numpy import copy import theano import theano.tensor as TT from theano....
class MessageSendingError(StandardError): """ This exception is raised when an outgoing message cannot be sent. Where possible, a more specific exception should be raised, along with a descriptive message. """ class NoRouterError(MessageSendingError): """ This exception is raised when no Rou...
""" test_models.py ~~~~~~~~ newsmeme tests :copyright: (c) 2010 by Dan Jacob. :license: BSD, see LICENSE for more details. """ from flaskext.sqlalchemy import get_debug_queries from flaskext.principal import Identity, AnonymousIdentity from newsmeme import signals from newsmeme.models import User, P...