code
stringlengths
1
199k
""" ================================================================================ mingus - Music theory Python package, Win32 Sequencer Copyright (C) 2008-2010, Bart Spaans, Ben Fisher This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public Li...
from django.shortcuts import render, get_object_or_404, redirect from django.views.decorators.http import require_POST from django.utils.translation import ugettext as _ from django.http import HttpResponseRedirect, HttpResponse from django.contrib import messages from django.contrib.auth.decorators import login_requir...
'''Generate ctypes binding from syntax tree.''' from cbind.codegen.helper import gen_tree_node, gen_record from cbind.codegen.helper import make_function_argtypes, make_function_restype import cbind.annotations as annotations class CodeGen: '''Generate ctypes binding from syntax tree.''' # Generate C++ bindings...
import os import platform import ctypes import json import re import subprocess import paasmaker from base import BaseStats, BaseStatsTest import tornado.process def get_free_space(path): """ Return folder/drive free space (in bytes) """ if platform.system() == 'Windows': free_bytes = ctypes.c_ulonglong(0) ctyp...
from oscar.core.loading import get_model from oscar.test.factories import ProductFactory from ecommerce.core.constants import COURSE_ENTITLEMENT_PRODUCT_CLASS_NAME from ecommerce.tests.testcases import TestCase Product = get_model('catalogue', 'Product') ProductClass = get_model('catalogue', 'ProductClass') class Cours...
from __future__ import unicode_literals from django.db import migrations, models def copy_questionpage_to_page(apps, schema_editor): current_database = schema_editor.connection.alias QuestionPage = apps.get_model("wizard_builder.QuestionPage") for question_page in QuestionPage.objects.using(current_database...
from .trees import ( container_difference as container_difference_tree, container_similarity as container_similarity_tree, container_tree, make_container_tree, make_package_tree, make_interactive_tree )
"""Immutable objects.""" def main(): """This is the only way to make a variable immutable. Python doesn't have constant so you can't really "protect" your variables.""" test = 123 example = (test,) example[0] = example[0] + 1 if __name__ == "__main__": main()
""" Copyright 2015 Telefonica Investigación y Desarrollo, S.A.U This file is part of telefonica-iotqatools iotqatools is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at ...
""" Implements the set of tests for the NSHMP adjustments to the NGA West 2 Ground Motion Prediction Equations Each of the test tables is generated from the original GMPE tables, which are subsequently modified using the adjustment factors presented in the module openquake.hazardlib.gsim.nshmp_2014 """ import unittest ...
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('conversations', '0026_conversationmeta'), ] operations = [ migrations.AddField( model_name='conversation', name='is_closed', field=models.BooleanField(defaul...
import os import subprocess import sys import tempfile from compile_error import CompileError def find_nth(haystack, needle, n): start = haystack.find(needle) while start >= 0 and n > 1: start = haystack.find(needle, start+len(needle)) n -= 1 return start def checkJavaCSyntax(src): with op...
from __future__ import unicode_literals import pytest import random from decimal import Decimal from django.test.utils import override_settings from shuup.core.models import CustomerTaxGroup, Tax, TaxClass from shuup.core.taxing import TaxingContext, get_tax_module from shuup.default_tax.admin_module.views import TaxRu...
from tendrl.commons.flows.exceptions import FlowExecutionFailedError from tendrl.commons.utils import log_utils as logger def get_node_ips(parameters): node_ips = [] for node, config in parameters["Cluster.node_configuration"].iteritems(): node_ips.append(config["provisioning_ip"]) return node_ips d...
def commonpath(paths): """Given a sequence of path names, returns the longest common sub-path.""" if not paths: raise ValueError('commonpath() arg is an empty sequence') if isinstance(paths[0], bytes): sep = b'/' curdir = b'.' else: sep = '/' curdir = '.' spli...
import iris.tests as tests from .extest_util import ( add_examples_to_path, show_replaced_by_check_graphic, fail_any_deprecation_warnings, ) class TestLineplotWithLegend(tests.GraphicsTest): """Test the lineplot_with_legend example code.""" def test_lineplot_with_legend(self): with fail_any_...
import json from common import SearpcError def _fret_int(ret_str): try: dicts = json.loads(ret_str) except: raise SearpcError('Invalid response format') if dicts.has_key('err_code'): raise SearpcError(dicts['err_msg']) if dicts.has_key('ret'): return dicts['ret'] else...
"""Abstract base-class for all font implementations""" import weakref from OpenGLContext.arrays import * from OpenGL.GL import * from OpenGLContext import doinchildmatrix import logging log = logging.getLogger( __name__ ) class Font(object): """Abstract base-class for all font implementations""" fontStyle = Non...
from weboob.capabilities.housing import HOUSE_TYPES, POSTS_TYPES QUERY_TYPES = { POSTS_TYPES.RENT: 2, POSTS_TYPES.SALE: 1, POSTS_TYPES.SHARING: 2, # There is no special search for shared appartments. POSTS_TYPES.FURNISHED_RENT: 2, POSTS_TYPES.VIAGER: 1 } QUERY_HOUSE_TYPES = { HOUSE_TYPES.APART:...
import os GRAVITY_LIB_HOME = os.path.dirname(os.path.dirname(__file__)) GRAVITY_LIB_HOME = os.path.realpath(GRAVITY_LIB_HOME)
from django.conf import settings from appconf import AppConf class LizardWmsConf(AppConf): # Override this setting in settings.py as # 'WMS_PROXIED_WMS_SERVERS' PROXIED_WMS_SERVERS = { } class Meta: prefix = 'wms'
import sys from resources.datatables import Options from resources.datatables import State def addPlanetSpawns(core, planet): stcSvc = core.staticService objSvc = core.objectService # TODO Check all NPCs for personalized scripting, change format. stcSvc.spawnObject('jundland_eopie', 'tatooine', long(0), float(-6098...
''' Adapted from https://github.com/tornadomeet/ResNet/blob/master/symbol_resnet.py Original author Wei Wu Implemented the following paper: Saining Xie, Ross Girshick, Piotr Dollar, Zhuowen Tu, Kaiming He. "Aggregated Residual Transformations for Deep Neural Network" ''' import mxnet as mx import numpy as np def residu...
from .base import BaseMessage from .records import RecordUpdateMessage, RecordDeleteMessage, RecordCreateMessage from ..exceptions import PyOrientBadMethodCallException from ..constants import COMMAND_OP, FIELD_BOOLEAN, FIELD_BYTE, FIELD_CHAR, \ FIELD_INT, FIELD_LONG, FIELD_SHORT, FIELD_STRING, QUERY_SYNC, FIELD_BY...
import pytest import gen from dcos_installer import cli def test_default_arg_parser(): parser = cli.get_argument_parser().parse_args([]) assert parser.verbose is False assert parser.port == 9000 assert parser.action == 'genconf' def test_set_arg_parser(): argument_parser = cli.get_argument_parser() ...
""" core.version """ import commands import ConfigParser import json import os from datetime import datetime def get_version_base__release_type__provides(): """ get_version_base ... get version string base from the setup.cfg """ config = ConfigParser.ConfigParser() config.read(os.path.dirnam...
import string import mock import webob from nova.api.openstack.compute import console_output \ as console_output_v21 from nova.compute import api as compute_api from nova import exception from nova import test from nova.tests.unit.api.openstack import fakes from nova.tests.unit import fake_instance def fake_get...
from oslo_log import log as logging from quark.drivers import base from quark.drivers import security_groups as sg_driver from quark import network_strategy STRATEGY = network_strategy.STRATEGY LOG = logging.getLogger(__name__) class UnmanagedDriver(base.BaseDriver): """Unmanaged network driver. Returns a bridg...
import os,os.path,sys,getopt 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""" de...
import os import errno import urlparse from django.conf import settings from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation from django.core.files import locks, File from django.core.files.move import file_move_safe from django.utils.encoding import force_unicode from django.utils.functional im...
import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.test_state as test_state import os import test_stub test_obj_dict = test_state.TestStateDict() def test(): l3_vr_network = os.environ['l3vCenterNoVlanNetworkName'] image_name = os.environ['image_dhcp_...
import dxpy import json import matplotlib matplotlib.use("Agg") # Used for headless environments like the DNAnexus workspace import matplotlib.pyplot as pyplot import numpy import subprocess use_html = False # True to generate an HTML file containing the images and extra info lines_filename = "lines.png" bars_filenam...
""" Shared code between AMQP based openstack.common.rpc implementations. The code in this module is shared between the rpc implementations based on AMQP. Specifically, this includes impl_kombu and impl_qpid. impl_carrot also uses AMQP, but is deprecated and predates this code. """ import collections import inspect impo...
import os import sys import time import datetime import importlib import sphinx_rtd_theme sys.path.insert(0, os.path.abspath('../../')) extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo', 'sphinx.ext.inheritance_diagram', 'sphinx.ext.coverage', 'sphinx.ext.ifconfig', 'sphinx.ext.g...
from setuptools import setup, find_packages __version__ = "0.0.1" setup( version=__version__, name="Ferment", description="A tool to provide the current docker config in ferm format", author="Oliver Berger", author_email="diefans@gmail.com", classifiers=[ 'Development Status :: 3 - Alpha...
import logging from oslo_utils import units from django.conf import settings from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse_lazy from django.utils.translation import ugettext_lazy as _ from django.views import generic from horizon import exceptions from horizon import messages...
""" This module provides examples for raising and handling errors In plenum there are several general errors, which placed in plenum/common/exceptions module """ from common.exceptions import PlenumTypeError, PlenumValueError, LogicError from plenum.common.exceptions import UnauthorizedClientRequest, SuspiciousNode fro...
import Queue import threading import logging import msgpack from org.o3project.odenos.remoteobject.transport.base_message_transport import ( BaseMessageTransport ) from org.o3project.odenos.remoteobject.message.response import Response import message_dispatcher class RemoteMessageTransport(BaseMessageTransport): ...
from datetime import datetime import six import traceback from decorator import decorator from oslo.serialization import jsonutils from sqlalchemy import exc as sa_exc import web from nailgun.api.v1.validators.base import BaseDefferedTaskValidator from nailgun.api.v1.validators.base import BasicValidator from nailgun.a...
''' Test the VIA header. This runs several requests through ATS and extracts the upstream VIA headers. Those are then checked against a gold file to verify the protocol stack based output is correct. ''' import os import subprocess Test.Summary = ''' Check VIA header for protocol stack data. ''' Test.SkipUnless( Co...
from models import * from django.contrib import admin admin.site.register(Coin) admin.site.register(Product, ProductAdmin) admin.site.register(ProductType)
import os from cloudbaseinit.osutils import base class PosixUtil(base.BaseOSUtils): def reboot(self): os.system('reboot')
from __future__ import with_statement from alembic import context from sqlalchemy import engine_from_config, pool from logging import config as logging_config config = context.config logging_config.fileConfig(config.config_file_name) target_metadata = None def run_migrations_offline(): """Run migrations in 'offline...
import logging import sys from functools import wraps from types import TracebackType from typing import Any, Callable, Dict, Iterator, NoReturn, Optional, Tuple, Type from unittest.mock import MagicMock, patch from django.conf import settings from django.contrib.auth.models import AnonymousUser from django.http import...
import os import re import sys import subprocess import gyp import gyp.common import gyp.xcode_emulation from gyp.common import GetEnvironFallback from gyp.common import GypError generator_default_variables = { 'EXECUTABLE_PREFIX': '', 'EXECUTABLE_SUFFIX': '', 'STATIC_LIB_PREFIX': 'lib', 'SHARED_LIB_PREFIX': 'l...
def flip_0s_to_maximize_consecutive_1s(input, flips_allowed): window_start = 0 count_zero = 0 result = 0 for i in range(len(input)): if input[i] == 1: result = max(result, i - window_start + 1) else: if count_zero < flips_allowed: count_zero = coun...
import six from tempest.common import image as common_image from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils import tempest.test CONF = config.CONF class BaseImageTest(tempest.test.BaseTestCase): """Base test class for Image API tests.""" ...
import json import os import eventlet from collections import namedtuple from functools import wraps from neutron.common import constants from neutron.common.exceptions import PortNotFound from neutron.db import models_v2 from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers import mech_age...
""" Python program for attaching a first class disk (fcd) to a virtual machine """ import atexit from tools import cli, tasks, disk from pyVim import connect from pyVmomi import vmodl from pyVmomi import vim def get_args(): """ Adds additional args for attaching a fcd to a vm -d datastore -v vdisk -...
""" felix.test.test_devices ~~~~~~~~~~~ Test the device handling code. """ import logging import mock import os import sys import uuid from contextlib import nested if sys.version_info < (2, 7): import unittest2 as unittest else: import unittest import calico.felix.devices as devices import calico.felix.futils ...
""" This file collects common code for every app. It is general across all apps and makes a call to the specified app in the appropriate place. Apps are specified with a YAML file with a specific structure. A given instance of an app is verified before creation. """ import os import sys import numpy import json import ...
"""Support for Wink water heaters.""" import logging from homeassistant.components.water_heater import ( ATTR_TEMPERATURE, STATE_ECO, STATE_ELECTRIC, STATE_PERFORMANCE, SUPPORT_AWAY_MODE, STATE_HEAT_PUMP, STATE_GAS, STATE_HIGH_DEMAND, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, WaterHeaterDe...
import sys, os sys.path.insert(1, os.path.join("..","..","..")) import h2o from tests import pyunit_utils def anomaly(): print "Deep Learning Anomaly Detection MNIST" train = h2o.import_file(pyunit_utils.locate("bigdata/laptop/mnist/train.csv.gz")) test = h2o.import_file(pyunit_utils.locate("bigdata/laptop/...
""" tests for the spec-format command """ import pscheduler import unittest class SpecFormatTest(pscheduler.TestSpecFormatUnitTest): name = 'latency' def test_format(self): #test invalid format self.assert_formatted_output("text/unsupported-format", "{}", expected_status=1, expected_...
import turbo.log from base import BaseHandler logger = turbo.log.getLogger(__file__) class HomeHandler(BaseHandler): def GET(self): pass
from beritest_tools import BaseBERITestCase from nose.plugins.attrib import attr class test_cp2_c0_lhu(BaseBERITestCase): @attr('capabilities') def test_cp2_lhu_64aligned(self): '''Test a 64-bit aligned half-word load via a constrained c0''' self.assertRegisterEqual(self.MIPS.a0, 0x0011, "64-bit...
""" Contains information gathered during cooking, to be used mostly if the cook failed in order to resume using the same destdir """ import time class BuildInfo(dict): def __init__(self, builddir): self.__builddir = builddir self.__infofile = builddir + "/conary-build-info" self.__fd = None ...
from __future__ import absolute_import, unicode_literals import os from celery import Celery os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings') app = Celery('proj') app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks() @app.task(bind=True) def debug_task(self): pr...
""" Registry for the applications """ import glob import logging import os import sys import json import common from common import cmp if sys.version_info[0] > 2: from builtins import object LOG = logging.getLogger(__name__) class AppRegistry(object): """ Represents a registry. """ def __init__(self): """...
""" Lambda entry point """ import base64 import boto3 import getpass import json import logging import os logging.root.setLevel(logging.DEBUG) logging.getLogger('botocore').setLevel(logging.WARNING) log = logging.getLogger('custodian.mailer') def bootstrap(): log.debug("Initializing") task_dir = os.environ.get(...
""" Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.7.4 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys import unittest import kubern...
""" Example that trains a small multi-layer perceptron with fully connected layers on MNIST. This example has some command line arguments that enable different neon features. Examples: python mnist_mlp.py -b gpu -e 10 Run the example for 10 epochs of mnist data using the nervana gpu backend python mnist...
from ..base import BitbucketBase class BitbucketServerBase(BitbucketBase): def get_link(self, link): """ Get a link from the data. :param link: string: The link identifier :return: The requested list of links or None if it isn't present """ links = self.get_data("link...
import os import csv REPO_DIR = os.path.join(os.path.dirname(__file__), '..') PROP_DESC_PATH = os.path.join(REPO_DIR, 'properties_description.csv') """The CSV file where the leftmost columns of the aggregate crosswalk table are (parent type, property name, type, and description.""" SOURCE_DIR = os.path.join(REPO_DIR, '...
""" Module performs gradient based RHF, [WIP] UHF, [WIP] GHF Module needs AO integrals """ from typing import Callable, Dict, List, Optional, Tuple, Union from itertools import product import numpy as np import scipy as sp from scipy.optimize.optimize import OptimizeResult from openfermion.ops.representations import (I...
import datetime from sqlalchemy import bindparam from sqlalchemy import Column from sqlalchemy import DateTime from sqlalchemy import func from sqlalchemy import Integer from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import testing from sqlalchemy.dialects import mysql from sqlalchemy.engi...
import os import unittest from robot.output import LEVELS from robotide.contrib.testrunner.testrunner import TestRunner from robotide.contrib.testrunner.testrunnerplugin import TestRunnerPlugin class CommandCreator(TestRunner): def _get_listener_to_cmd(self): return 'listener' def _write_argfile(self, a...
import datetime import tempfile try: import subprocess32 as subprocess except: import subprocess from pandaharvester.harvestercore import core_utils from pandaharvester.harvestercore.plugin_base import PluginBase baseLogger = core_utils.setup_logger('pbs_submitter') class PBSSubmitter(PluginBase): # constru...
"""Tests for Tensorflow -> CPURT compilation.""" import numpy as np import unittest from tensorflow.compiler.mlir.tfrt.jit.python_binding import tf_cpurt cpurt = tf_cpurt.TfCpurtExecutor() specializations = [ tf_cpurt.Specialization.ENABLED, tf_cpurt.Specialization.DISABLED, tf_cpurt.Specialization.ALWAYS, ...
import mock from oslo.config import cfg from nova.api.openstack.compute.plugins.v3 import attach_interfaces from nova.compute import api as compute_api from nova import context from nova import exception from nova.network import api as network_api from nova.openstack.common import jsonutils from nova import test from n...
""" Sample command-line program for listing Google Dataproc Clusters """ import argparse from apiclient import discovery from oauth2client.client import GoogleCredentials REGION = 'global' def list_clusters(dataproc, project): result = dataproc.projects().regions().clusters().list( projectId=project, ...
"""Decorator to overrides the gradient for a function.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.eager import backprop from tensorflow.python.eager import context from tensorflow.python.eager import tape as tape_lib from tensor...
from COPASI import * import sys from random import random MODEL_STRING="""<?xml version=\"1.0\" encoding=\"UTF-8\"?> <!-- Created by COPASI version 4.5.30 (Debug) on 2009-03-30 08:01 with libSBML version 3.3.2. --> <sbml xmlns=\"http://www.sbml.org/sbml/level2\" level=\"2\" version=\"1\"> <model metaid=\"COPASI1\" id...
import inflection from django.utils.translation import ugettext_lazy as _ from rest_framework.exceptions import ParseError from rest_framework.serializers import * from rest_framework_json_api.relations import ResourceRelatedField from rest_framework_json_api.utils import ( get_resource_type_from_model, get_resourc...
from __future__ import print_function from django.core.management.base import BaseCommand from realtime.models.volcano import load_volcano_data, Volcano __author__ = 'Rizky Maulana Nugraha <lana.pcfre@gmail.com>' __date__ = '7/18/16' class Command(BaseCommand): """Script to check indicator status. Can be executed v...
''' =========================================================== Expanding a string into subfields prepended with ^ markers =========================================================== Common case:: >>> expand('Start^xX part^yY part^zEnd') [('_', 'Start'), ('x', 'X part'), ('y', 'Y part'), ('z', 'End')] Subfield ...
from datetime import datetime import functools import commonware.log from django import http from django.core.exceptions import ObjectDoesNotExist, PermissionDenied from django.shortcuts import get_object_or_404 from django.utils.http import http_date import amo from amo.utils import Token from access import acl from f...
""" utilities.set_cookies ~~~~~~~~~~~~~~~~~~~~~ Flask Set Cookies by Response http://flask.pocoo.org/snippets/30/ """ import os import sys sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from flask import redirect, current_app from app import app @app.route('/set_cookie')...
from dbparti.backends import BasePartitionFilter from dbparti.backends.exceptions import ( PartitionRangeError, PartitionRangeSubtypeError, PartitionShowError ) """PostgreSQL backend partition filters for django admin""" class PartitionFilter(BasePartitionFilter): """Common methods for all partition fil...
""" The feed is an assembly of items of different content types. For ease of querying, each different content type is housed in the FeedItem model, which also houses metadata indicating the conditions under which it should be included. So a feed is actually just a listing of FeedItem instances that match the user's reg...
""" Display battery information. Configuration parameters: battery_id: id of the battery to be displayed set to 'all' for combined display of all batteries (default 0) blocks: a string, where each character represents battery level especially useful when using icon fonts (e.g. FontAwesom...
"""Python client library for the Facebook Platform. This client library is designed to support the Graph API and the official Facebook JavaScript SDK, which is the canonical way to implement Facebook authentication. Read more about the Graph API at http://developers.facebook.com/docs/api. You can download the Facebook ...
import re from custom.ewsghana.handlers.receipts import ReceiptsHandler from custom.ewsghana.handlers.requisition import RequisitionHandler from custom.ewsghana.handlers.alerts import AlertsHandler from custom.ewsghana.models import EWSGhanaConfig from custom.ilsgateway.tanzania.handlers.language import LanguageHandler...
from django.template.defaultfilters import linenumbers from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import render, setup class LinenumbersTests(SimpleTestCase): """ The contents of "linenumbers" is escaped according to the current autoescape setting. ...
from functools import wraps import traceback from ..external.qt.QtGui import QMessageBox def set_cursor(shape): """Set the Qt cursor for the duration of a function call, and unset :param shape: Cursor shape to set. """ def wrapper(func): @wraps(func) def result(*args, **kwargs): ...
"""Tests for pymco.utils""" import collections import os import pytest import six from pymco import utils from pymco.test.utils import mock @pytest.fixture def client_public(): path = os.path.join(os.path.dirname(__file__), os.path.pardir, 'fixtures', ...
""" Eigenvector centrality. """ import networkx as nx __author__ = "\n".join(['Aric Hagberg (aric.hagberg@gmail.com)', 'Pieter Swart (swart@lanl.gov)', 'Sasha Gutfraind (ag362@cornell.edu)']) __all__ = ['eigenvector_centrality', 'eigenvector_centrality_numpy'] ...
import vtk from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() ren = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren) iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) v16 = vtk.vtkVolume16Reader() v16.SetDataDimensions(64, 64) v16.SetImageRange(1, 93) v16...
import sys from osgpypp import osg from osgpypp import osgDB from osgpypp import osgParticle from osgpypp import osgSim from osgpypp import osgText from osgpypp import osgUtil from osgpypp import osgViewer def createAnimationPath(center, radius, looptime): # set up the animation path animationPath = osg.Animati...
""" Created on Fri May 30 22:56:57 2014 Author: Josef Perktold License: BSD-3 """ import numpy as np from numpy.testing import assert_allclose, assert_raises from statsmodels.base._constraints import ( TransformRestriction, fit_constrained, transform_params_constraint, ) if __name__ == '__main__': R = n...
""" This file is part of spinsys. Spinsys is free software: you can redistribute it and/or modify it under the terms of the BSD 3-clause license. See LICENSE.txt for exact terms and conditions. This module provides custom exception classes for more convenient exception handling. The following classes are included: ...
"""Tests of session structure.""" import os import os.path as op import numpy as np from numpy.testing import assert_allclose as ac from numpy.testing import assert_equal as ae from pytest import raises, yield_fixture, mark from ..session import Session from ...utils.array import _spikes_in_clusters from ...utils.loggi...
import argparse from os.path import join import re from subprocess import CalledProcessError, check_output, STDOUT import sys from packaging.version import Version as V try: import colorama def bright(text): return "%s%s%s" % (colorama.Style.BRIGHT, text, colorama.Style.RESET_ALL) def dim(text): return "...
from distutils.core import setup app_name = 'wmd' setup(name='django-%s-editor' % app_name, version='0.9.0', packages=[app_name], package_data = {app_name: ['static/wmd/*.js', 'static/wmd/*.css', 'static/wmd/images/*.png']}, author = 'Joshua Partogi', author_email = 'joshua.parto...
import collections from django import http from django.shortcuts import render, redirect, get_object_or_404 from django.views.decorators.http import require_POST from django.db import transaction from django.views.decorators.cache import cache_page from django.db.models import Q from django.core.urlresolvers import rev...
from django.conf import settings from django.core.exceptions import MultipleObjectsReturned from django.db.models.query_utils import Q def get_page_from_placeholder_if_exists(placeholder): from cms.models.pagemodel import Page try: return Page.objects.get(placeholders=placeholder) except (Page.DoesN...
from sympy.core.add import Add from sympy.core.function import Function from sympy.core.numbers import Float, I, oo, pi, Rational from sympy.core.singleton import S from sympy.core.symbol import Symbol from sympy.functions.elementary.miscellaneous import sqrt, cbrt, root, Min, Max, real_root from sympy.functions.elemen...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import sys from ansible import constants as C from ansible.errors import AnsibleError from ansible.inventory.group import Group from ansible.inventory.host import Host from ansible.module_utils.six import iteritems from ansible.plug...
from pathlib import Path from setuptools import find_packages, setup import versioneer rootpath = Path(__file__).parent.absolute() def read(*parts): return open(rootpath.joinpath(*parts), "r").read() with open("requirements.txt") as f: require = f.readlines() install_requires = [r.strip() for r in require] setu...
from pytest_bdd import when, scenarios scenarios('features/validation/xml_lang_attribute.feature') @when('it has xml:lang attribute <lang>') def when_lang(lang, template_dict): template_dict['lang'] = lang