content
stringlengths
4
20k
"""Config flow to configure SmartThings.""" import logging from aiohttp import ClientResponseError from pysmartthings import APIResponseError, AppOAuth, SmartThings from pysmartthings.installedapp import format_install_url import voluptuous as vol from homeassistant import config_entries from homeassistant.const impo...
import os from nova.virt.libvirt import config from nova.virt.libvirt import imagebackend class Backend(object): def __init__(self, use_cow): pass def image(self, instance, name, image_type=''): class FakeImage(imagebackend.Image): def __init__(self, instance, name): ...
"""adjusting key length Revision ID: 956a063c52b3 Revises: f0fbf6129e13 Create Date: 2016-05-11 17:28:32.407340 """ # revision identifiers, used by Alembic. revision = '956a063c52b3' down_revision = 'f0fbf6129e13' from alembic import op import sqlalchemy as sa def upgrade(): with op.batch_alter_table('cluster...
from tempest_lib.common.utils import data_utils from testtools import matchers from tempest.api.volume import base from tempest import config from tempest import test CONF = config.CONF class VolumesV2GetTest(base.BaseVolumeTest): @classmethod def setup_clients(cls): super(VolumesV2GetTest, cls).se...
import os import re import sys import unittest from unittest.mock import MagicMock, patch from coalib import coala from coala_utils.ContextManagers import prepare_file from tests.TestUtilities import execute_coala, bear_test_module # patch gets strangely lost when only defined in method or with context where # act...
import json import os def reject_duplicate_keys(pairs): found_keys = {} for key, value in pairs: if key in found_keys: raise ValueError("duplicate key: %r" % (key,)) else: found_keys[key] = value return found_keys def load_json(path): with open(path) as map_file: ...
#! /usr/bin/env python # Client and server for udp (datagram) echo. # # Usage: udpecho -s [port] (to start a server) # or: udpecho -c host [port] <file (client) import sys from socket import * ECHO_PORT = 50000 + 7 BUFSIZE = 1024 def main(): if len(sys.argv) < 2: usage() if sys.argv[1] == '-s': ...
import re import types from .entity import CampfireEntity class Message(CampfireEntity): """ Campfire message """ _TYPE_ENTER = "EnterMessage" _TYPE_LEAVE = "LeaveMessage" _TYPE_KICK = "KickMessage" _TYPE_PASTE = "PasteMessage" _TYPE_SOUND = "SoundMessage" _TYPE_TEXT = "TextMessage" ...
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'WMSSource.metadata' db.add_column('lizard_wms_wmssource', 'metadata', self.gf('jsonfield.f...
import numpy as np import scipy.sparse as sp from sklearn.datasets import make_regression from sklearn.linear_model import Ridge from sklearn.kernel_ridge import KernelRidge from sklearn.metrics.pairwise import pairwise_kernels from sklearn.utils.testing import ignore_warnings from sklearn.utils.testing import assert...
# coding: utf8 # babelizer.py - API for simple access to babelfish.altavista.com. # Requires python 2.0 or better. # From: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/64937 # Modified by Steven Bird to work with current babelfish # # See it in use at http://babel.MrFeinberg.com/ r"""API for ...
from tempest import test from neutron.tests.tempest.api import base class SubnetsSearchCriteriaTest(base.BaseSearchCriteriaTest): resource = 'subnet' list_kwargs = {'shared': False} @classmethod def resource_setup(cls): super(SubnetsSearchCriteriaTest, cls).resource_setup() net = c...
from Components.Console import Console from os import listdir as os_listdir, path as os_path from re import compile as re_compile from enigma import eEnv class Keyboard: def __init__(self): self.keyboardmaps = [] self.readKeyboardMapFiles() def readKeyboardMapFiles(self): for keymapfile in os_listdir(eEnv.res...
import os import imp from itertools import product, starmap import distutils.command.install_lib as orig class install_lib(orig.install_lib): """Don't add compiled flags to filenames of non-Python files""" def run(self): self.build() outfiles = self.install() if outfiles is not None: ...
"""Test for version 3 of the zero_out op.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from tensorflow.examples.adding_an_op import zero_out_op_3 from tensorflow.python.framework import test_util class ZeroOut3Test(tf.test.Te...
# -*- coding: utf-8 -*- from __future__ import absolute_import import base64 import hashlib import os from time import sleep from django.conf import settings def statsd_key(val, clean_periods=False): if not isinstance(val, str): val = str(val) if ':' in val: val = val.split(':')[0] val =...
# -*- coding: utf-8 -*- """Example results for GAM from tests Created on Mon Nov 07 13:13:15 2011 Author: Josef Perktold The example is loaded from a test module. The test still fails but the results look relatively good. I don't know yet why there is the small difference and why GAM doesn't converge in this case "...
#!/usr/bin/env python # # this program is used to find source code that includes linux kernel headers directly # (e.g. with #include <linux/...> or #include <asm/...>) # # then it lists them on the standard output. import sys, cpp, glob, os, re, getopt, kernel from utils import * from defaults import * program_dir = ...
import os from openfisca_core.taxbenefitsystems import XmlBasedTaxBenefitSystem from .entities import entity_class_by_symbol from .scenarios import Scenario from . import param from .param import preprocessing # TaxBenefitSystems def init_country(): class TaxBenefitSystem(XmlBasedTaxBenefitSystem): ent...
import sys try: from setuptools import setup, Extension except: from distutils.core import setup, Extension, Command from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError include_dirs = [] if sys.platform == 'win32': inclu...
from __future__ import absolute_import from django.conf import settings from django.contrib import comments from django.contrib.comments.models import Comment from django.contrib.comments.forms import CommentForm from django.core.exceptions import ImproperlyConfigured from django.test.utils import override_settings fr...
#!/usr/bin/env python import datetime import json import logging import os import re import tempfile import time import unittest import environment import tablet import utils from zk import zkocc # We check in this test that we can achieve at least this QPS. # Sometimes on slow machines this won't work. # We used to...
from __future__ import absolute_import, division, print_function __metaclass__ = type import pytest from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson from ansible.module_utils import basic from ansible.modules.network.check_point import cp_mgmt_time OBJECT = { "name": "timeOb...
""" Namespace that defines fields common to all blocks used in the LMS """ from xblock.core import Namespace, Boolean, Scope, String, Float from xmodule.fields import Date, Timedelta from datetime import datetime from pytz import UTC class LmsNamespace(Namespace): """ Namespace that defines fields common to a...
import mock from boto.compat import json from tests.unit import unittest from .test_search import HOSTNAME, CloudSearchSearchBaseTest from boto.cloudsearch2.search import SearchConnection, SearchServiceException def fake_loads_value_error(content, *args, **kwargs): """Callable to generate a fake ValueError""" ...
from pcalendar import Calendar, WorkingDate, StartDate, EndDate, Minutes from task import Project, BalancedProject, AdjustedProject, Task, \ STRICT, SLOPPY, SMART, Multi, YearlyMax, WeeklyMax, MonthlyMax, \ DailyMax, VariableLoad from resource import Resource # vim:expandtab:smartindent:tabstop=4:softtabstop...
from hachoir_core.field import (MissingField, BasicFieldSet, Field, ParserError, createRawField, createNullField, createPaddingField, FakeArray) from hachoir_core.dict import Dict, UniqKeyError from hachoir_core.error import HACHOIR_ERRORS from hachoir_core.tools import lowerBound import hachoir_core.config as conf...
import glob import os import struct import sys import unittest from time import time, sleep from pyspark import SparkContext, SparkConf have_scipy = False have_numpy = False try: import scipy.sparse # noqa: F401 have_scipy = True except: # No SciPy, but that's okay, we'll skip those tests pass try: ...
import imghdr import io import os import unittest import warnings from test.support import findfile, TESTFN, unlink TEST_FILES = ( ('python.png', 'png'), ('python.gif', 'gif'), ('python.bmp', 'bmp'), ('python.ppm', 'ppm'), ('python.pgm', 'pgm'), ('python.pbm', 'pbm'), ('python.jpg', 'jpeg')...
from openerp.osv import fields, osv class account_report_general_ledger(osv.osv_memory): _inherit = "account.common.account.report" _name = "account.report.general.ledger" _description = "General Ledger Report" _columns = { 'landscape': fields.boolean("Landscape Mode"), 'initial_balan...
"""Support for the ZHA platform.""" import functools import time from homeassistant.components.device_tracker import DOMAIN, SOURCE_TYPE_ROUTER from homeassistant.components.device_tracker.config_entry import ScannerEntity from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispa...
from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.http import Request, HtmlResponse, FormRequest from scrapy.utils.url import urljoin_rfc from scrapy.utils.response import get_base_url from product_spiders.items import Product, ProductLoaderWithNameStrip as ProductLoader ...
import logging import pyxn from django.http import HttpResponse, HttpResponseRedirect from django.core.exceptions import ImproperlyConfigured from django.conf import settings from member.models import User try: from threading import local except ImportError: from django.utils._threading_local import local _...
from bokeh.sampledata.glucose import data from bokeh.sampledata.iris import flowers from bokeh.io import show, output_file from bokeh.layouts import layout from bokeh.models import ColumnDataSource, Paragraph, HoverTool, Div from bokeh.plotting import figure output_file("words_and_plots.html") def text(): retur...
# coding: utf-8 from __future__ import unicode_literals from .theplatform import ThePlatformIE from ..utils import ( int_or_none, parse_age_limit, try_get, update_url_query, ) class AMCNetworksIE(ThePlatformIE): _VALID_URL = r'https?://(?:www\.)?(?:amc|bbcamerica|ifc|(?:we|sundance)tv)\.com/(?:mo...
#!/usr/bin/python import sys, os, time import simplejson as json from os.path import * def exec_cmd(cmd,toprint,toexec): if toprint: print cmd if toexec: os.system(cmd) def gm_argument(switch,argtype,default,message_prefix): if switch in sys.argv: switch_index = sys.argv.index(sw...
import fixtures class EmptyEnvironmentFixture(fixtures.Fixture): def setUp(self): super(EmptyEnvironmentFixture, self).setUp() self.env_desc = { "tenant_id": "tenant_id", "name": "my_environment", "id": "template_id" } self.addCleanup(delattr, se...
""" Option class representing a number. """ #------------------------------------------------------------------------- # # gramps modules # #------------------------------------------------------------------------- from . import Option #------------------------------------------------------------------------- # # Num...
import locale import time import datetime if not hasattr(locale, 'D_FMT'): locale.D_FMT = 1 if not hasattr(locale, 'T_FMT'): locale.T_FMT = 2 if not hasattr(locale, 'nl_langinfo'): def nl_langinfo(param): if param == locale.D_FMT: val = time.strptime('30/12/2004', '%d/%m/%Y') ...
""" Verifies building a target and a subsidiary dependent target from a .gyp file in a subdirectory, without specifying an explicit output build directory, and using the generated solution or project file at the top of the tree as the entry point. There is a difference here in the default behavior of the underlying bu...
from django.contrib.gis.gdal.error import GDALException from django.utils import six class OGRGeomType(object): "Encapulates OGR Geometry Types." wkb25bit = -2147483648 # Dictionary of acceptable OGRwkbGeometryType s and their string names. _types = {0: 'Unknown', 1: 'Point', ...
from __future__ import absolute_import from django.test import TestCase from django.core.exceptions import FieldError from .models import Poll, Choice, OuterA, Inner, OuterB class NullQueriesTests(TestCase): def test_none_as_null(self): """ Regression test for the use of None as a query value. ...
from optparse import OptionParser arg_parser = OptionParser() def run(options, args): import json, os from regscrape_lib.transfer import bulk_download if len(args) > 1: metadata_path = args[0] out_path = args[1] else: print "Specify files" sys.exit(0) input = j...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'CourseMode.expiration_date' db.add_column('course_modes_coursemode', 'expiration_date', ...
""" Tests for providerconfig """ try: import unittest2 as unittest except ImportError: import unittest import os import json import copy from leap.bitmask.config.providerconfig import ProviderConfig, MissingCACert from leap.bitmask.services import get_supported from leap.common.testing.basetest import BaseLe...
#!/usr/bin/env python """ Example of announcing a service (in this case, a fake HTTP server) """ import socket import time from six.moves import input from zeroconf import ServiceInfo, Zeroconf, InterfaceChoice, DNSOutgoing, _FLAGS_QR_RESPONSE, _FLAGS_AA, _TYPE_PTR, _TYPE_SRV, _CLASS_IN, _TYPE_TXT, _TYPE_A, DNSAddre...
from django.test import TestCase, override_settings from django.core.urlresolvers import reverse from django.core import mail from wagtail.tests.utils import WagtailTestUtils from wagtail.wagtailcore.models import Page from wagtail.wagtailadmin.utils import send_mail class TestHome(TestCase, WagtailTestUtils): d...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network.netv...
"""Ensure emitted events contain the fields legacy processors expect to find.""" from datetime import datetime from freezegun import freeze_time from mock import sentinel from django.test import TestCase from django.test.utils import override_settings from pytz import UTC from eventtracking.django import DjangoTrack...
# The plot server must be running # Go to http://localhost:5006/bokeh to view this plot import numpy as np from bokeh.models import BoxSelectTool, LassoSelectTool, Paragraph from bokeh.plotting import ( curdoc, cursession, figure, output_server, show, hplot, vplot ) # create three normal population samples with ...
from django.contrib.gis.db import models class State(models.Model): name = models.CharField(max_length=20) objects = models.GeoManager() class County(models.Model): name = models.CharField(max_length=25) state = models.ForeignKey(State) mpoly = models.MultiPolygonField(srid=4269) # Multipolygon in...
from mrjob.job import MRJob import json as simplejson from datetime import datetime, timedelta class MRRetweetRate(MRJob): def mapper_get_hour_day(self, _, line): startTime = datetime.strptime('2014-03-01T00:00:00.000Z', '%Y-%m-%dT%H:%M:%S.%fZ') tweet = simplejson.loads(line) language = 'es' if 'twitter_la...
from django import http from django.core.exceptions import ImproperlyConfigured from django.template import RequestContext, loader from django.template.response import TemplateResponse from django.utils.functional import update_wrapper from django.utils.log import getLogger from django.utils.decorators import classonly...
"""The spyne.interface.xml_schema package contains an implementation of a subset of the Xml Schema 1.0 standard. Volunteers are needed to see whether the brand new Xml Schema 1.1 standard is worth the trouble, and patch as necessary. """ from spyne.interface.xml_schema._base import XmlSchema
"Test the functionality of Python classes implementing operators." import unittest from test import test_support testmeths = [ # Binary operations "add", "radd", "sub", "rsub", "mul", "rmul", "div", "rdiv", "mod", "rmod", "divmod", "rdivmod", "pow", "rpow", ...
"""JSON token scanner """ import re try: from simplejson._speedups import make_scanner as c_make_scanner except ImportError: c_make_scanner = None __all__ = ['make_scanner'] NUMBER_RE = re.compile( r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?', (re.VERBOSE | re.MULTILINE | re.DOTALL)) def py_make_scan...
"""Usage: <win-path-to-pdb.pdb> This tool will take a PDB on the command line, extract the source files that were used in building the PDB, query the source server for which repository and revision these files are at, and then finally write this information back into the PDB in a format that the debugging tools underst...
"""This module is deprecated. Please use :mod:`airflow.task.task_runner.cgroup_task_runner`.""" import warnings from airflow.task.task_runner.cgroup_task_runner import CgroupTaskRunner # noqa warnings.warn( "This module is deprecated. Please use `airflow.task.task_runner.cgroup_task_runner`.", DeprecationWa...
from distutils.errors import DistutilsOptionError from unittest import TestLoader import unittest import sys from pkg_resources import (resource_listdir, resource_exists, normalize_path, working_set, _namespace_packages, add_activation_listener, require, EntryPoint...
from direct.directnotify.DirectNotifyGlobal import * from direct.distributed.DistributedObjectAI import DistributedObjectAI from toontown.fishing import FishingTargetGlobals from toontown.fishing.DistributedFishingTargetAI import DistributedFishingTargetAI class DistributedFishingPondAI(DistributedObjectAI): noti...
"""JsLex: a lexer for Javascript""" # Originally from https://bitbucket.org/ned/jslex from __future__ import unicode_literals import re class Tok(object): """ A specification for a token class. """ num = 0 def __init__(self, name, regex, next=None): self.id = Tok.num Tok.num += 1...
from __future__ import print_function import numba.unittest_support as unittest from numba.compiler import compile_isolated, Flags from numba import types force_pyobj_flags = Flags() force_pyobj_flags.set("force_pyobject") no_pyobj_flags = Flags() def return_int(a, b): return a + b class TestPythonInt(unitt...
"""This module is deprecated. Please use `airflow.providers.google.cloud.operators.sql_to_gcs`.""" import warnings from airflow.providers.google.cloud.operators.sql_to_gcs import BaseSQLToGCSOperator warnings.warn( "This module is deprecated. Please use `airflow.providers.google.cloud.operators.sql_to_gcs`.", ...
"""Tests of grpc.beta.utilities.""" import threading import time import unittest from grpc._adapter import _low from grpc._adapter import _types from grpc.beta import implementations from grpc.beta import utilities from grpc.framework.foundation import future from grpc_test.framework.common import test_constants de...
# -*- coding: utf-8 -*- """ jinja2.sandbox ~~~~~~~~~~~~~~ Adds a sandbox layer to Jinja as it was the default behavior in the old Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the default behavior is easier to use. The behavior can be changed by subclassing the environm...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from jinja2.exceptions import UndefinedError from ansible.errors import AnsibleError, AnsibleUndefinedVariable from ansible.plugins.lookup import LookupBase from ansible.utils.listify import listify_lookup_plugin_terms class Look...
from alert.AuthenticationBackend import ConfirmedEmailAuthenticationForm from alert.userHandling.forms import ( CustomPasswordResetForm, CustomSetPasswordForm, ) from alert.userHandling.views import ( confirmEmail, deleteProfile, deleteProfileDone, emailConfirmSuccess, password_change, register, register_su...
import os import sys import argparse import subprocess import signal import re boost_tests = [ 'alloc_test', 'futures_test', 'thread_test', 'memcached/test_ascii_parser', 'sstring_test', 'output_stream_test', 'httpd', 'fstream_test', 'foreign_ptr_test', 'semaphore_test', 'sh...
# -*- coding: utf-8 -*- """ *************************************************************************** DeleteColumn.py --------------------- Date : May 2010 Copyright : (C) 2010 by Michael Minn Email : pyqgis at michaelminn dot com ************************...
#!/usr/local/bin/python # Code Fights Frequency Analysis Problem from collections import Counter def frequencyAnalysis(encryptedText): return Counter(encryptedText).most_common(1)[0][0] def main(): tests = [ ["$~NmiNmim$/NVeirp@dlzrCCCCfFfQQQ", "C"], ["Agoodglassinthebishop'shostelinthedevi...
"""Converter for list operations. This includes converting Python lists to TensorArray/TensorList. """ # TODO(mdan): Elaborate the logic here. # TODO(mdan): Does it even make sense to attempt to try to use TAs? # The current rule (always convert to TensorArray) is naive and insufficient. # In general, a better mechan...
#!/usr/bin/env python # -*- coding: utf-8 -*- # call jtrrouter twice and check that the output differs import sys,os,subprocess,random sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', '..', '..', '..', "tools")) from sumolib import checkBinary net_output = 'joined.net.xml' trips_output = 'trips.log' ...
#!/usr/bin/env python from tools.load import LoadMatrix lm=LoadMatrix() traindat = lm.load_dna('../data/fm_train_dna.dat') testdat = lm.load_dna('../data/fm_test_dna.dat') parameter_list = [[traindat,testdat,20],[traindat,testdat,22]] def kernel_weighted_degree_position_string_modular (fm_train_dna=traindat,fm_test_d...
""" Basic GLS Syntax Version 0.0.1 Josh Goldberg """ # Function Definitions def sayHello(): print("Hello world!") def combineStrings(a, b): return a + b # Class Declarations class Point: x = None y = None def __init__(self, x, y): self.x = x self.y = y def setX(self, ...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'StaticPlaceholder.site' db.alter_column(u'cms_staticpl...
from sympy.core.numbers import Integer, Rational def continued_fraction_periodic(p, q, d=0): r""" Find the periodic continued fraction expansion of a quadratic irrational. Compute the continued fraction expansion of a rational or a quadratic irrational number, i.e. `\frac{p + \sqrt{d}}{q}`, where ...
import os import fnmatch from django.conf import settings from django.core.exceptions import ImproperlyConfigured def matches_patterns(path, patterns=None): """ Return True or False depending on whether the ``path`` should be ignored (if it matches any pattern in ``ignore_patterns``). """ if patter...
"""Main QISKit public functionality.""" # First, check for required Python and API version from . import _util from ._qiskiterror import QISKitError from ._classicalregister import ClassicalRegister from ._quantumregister import QuantumRegister from ._quantumcircuit import QuantumCircuit from ._gate import Gate from ...
import nose import re from itertools import imap import unittest class Web2pyNosePlugin(nose.plugins.base.Plugin): # see: http://somethingaboutorange.com/mrl/projects/nose/0.11.1/plugins/writing.html """This plugin is designed to give the web2py environment to the tests. """ score = 0 # always...
# coding=utf-8 import unittest """712. Minimum ASCII Delete Sum for Two Strings https://leetcode.com/problems/minimum-ascii-delete-sum-for-two-strings/description/ Given two strings `s1, s2`, find the lowest ASCII sum of deleted characters to make two strings equal. **Example 1:** **Input:** s1 = "...
"""Trains and Evaluates the MNIST network using a feed dictionary.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function # pylint: disable=missing-docstring import argparse import os import sys import time from six.moves import xrange # pylint: disable=redefi...
import pandas as pd import ibis import ibis.expr.api as api import ibis.expr.operations as ops import ibis.expr.types as ir from ibis.expr.tests.mocks import MockConnection from ibis.compat import unittest class TestTimestamp(unittest.TestCase): def setUp(self): self.con = MockConnection() self...
import dedupe import dedupe.training as training import unittest class TrainingTest(unittest.TestCase): def setUp(self): field_definition = [{'field': 'name', 'type': 'String'}] self.data_model = dedupe.Dedupe(field_definition).data_model self.training_pairs = { 'match': [({"n...
"""distutils.archive_util Utility functions for creating archive files (tarballs, zip files, that sort of thing).""" import os from warnings import warn import sys try: import zipfile except ImportError: zipfile = None from distutils.errors import DistutilsExecError from distutils.spawn import spawn from d...
from sqlalchemy import and_ from sqlalchemy import case from sqlalchemy import distinct from sqlalchemy import event from sqlalchemy import func from sqlalchemy import literal from sqlalchemy import or_ from sqlalchemy import union from sqlalchemy.sql import false from sqlalchemy.schema import DDL from sqlalchemy.ext.d...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} try: import boto3 from botocore.exceptions import ClientError, ParamValidationError, MissingParametersError HAS_BOTO3 = True except ImportError: HAS_BOTO3 = False ...
from auth import auth import model.ordergroup def protected(**pars): """ .protected() Decorator to only allowed login users. We use the auth.protect method. Note that this method can only be used on the 'top' level function (GET) as it re- directs directly and thus fails on nested functions. ...
import os import sys import unittest from compiled_file_system import CompiledFileSystem from in_memory_object_store import InMemoryObjectStore from local_file_system import LocalFileSystem from sidenav_data_source import SidenavDataSource class SamplesDataSourceTest(unittest.TestCase): def setUp(self): self._b...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.conf.urls import url from .tables_ajax import ContractTableJson, ContractorTableJson, SupportContractTableJson, \ ContractorContactTableJson from .views import ContractTable, ContractorTable, SupportContractTable, Contrac...
''' ''' # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License");...
try: from django.conf.urls import include, patterns, url except ImportError: from django.conf.urls.defaults import include, patterns, url from django.conf import settings # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', ...
""" Classes allowing "generic" relations through ContentType and object-id fields. """ from django.core.exceptions import ObjectDoesNotExist from django.db import connection from django.db.models import signals from django.db import models, router, DEFAULT_DB_ALIAS from django.db.models.fields.related import RelatedFi...
from direct.distributed.ClockDelta import * from direct.directnotify import DirectNotifyGlobal import DistributedSwitchBase from direct.task import Task from direct.fsm import ClassicFSM, State from direct.fsm import State from otp.level import DistributedEntityAI class DistributedSwitchAI(DistributedSwitchBase.Distri...
""" =================== Isotonic Regression =================== An illustration of the isotonic regression on generated data. The isotonic regression finds a non-decreasing approximation of a function while minimizing the mean squared error on the training data. The benefit of such a model is that it does not assume a...
""" This module aims to give a little more fine-tuned control of caching and cache invalidation. Import these instead of django.core.cache. Note that 'default' is being preserved for user session caching, which we're not migrating so as not to inconvenience users by logging them all out. """ import urllib from functoo...
def window(L, size): """list * size -> window iterable Returns a sliding 'window' through the list L of size size.""" assert not isinstance(L, int), 'Argument order swapped: window(L, size)' if size < 1: raise ValueError, 'size <= 0 disallowed.' for i in xrange(len(L) - (size-1)): y...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='ExternalResource', fields=[ ('id', models.AutoF...
from traits.api import Str, Property, cached_property, Float # ============= standard library imports ======================== # ============= local library imports ========================== from uncertainties import ufloat from pychron.processing.analyses.analysis import Analysis class NonDBAnalysis(Analysis): ...
from django.db import connection from django.db.models import Max from django.test import TestCase from .models import Cash, CashModel class FromDBValueTest(TestCase): def setUp(self): CashModel.objects.create(cash='12.50') def test_simple_load(self): instance = CashModel.objects.get() ...
import os import sys import bb_utils import bb_annotations sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from pylib import constants SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') VALID_HOST_TESTS = set(['check_webview_licenses', 'findbugs']) DIR_BUILD_ROOT = os.path.d...