content
stringlengths
4
20k
# -*- coding: utf-8 -*- from django.db import models from ..fields import VectorField from ..models import SearchManager class Person(models.Model): name = models.CharField(max_length=32) description = models.TextField() search_index = VectorField() objects = SearchManager( fields=('name', 'd...
"""Module containing utilities for apk packages.""" import os.path import re from pylib import cmd_helper from pylib import constants _AAPT_PATH = os.path.join(constants.ANDROID_SDK_TOOLS, 'aapt') _MANIFEST_ATTRIBUTE_RE = re.compile( r'\s*A: ([^\(\)= ]*)\([^\(\)= ]*\)="(.*)" \(Raw: .*\)$') _MANIFEST_ELEMENT_RE ...
import logging import re from django.conf import settings from sleekxmpp.basexmpp import BaseXMPP from sleekxmpp.clientxmpp import ClientXMPP from sleekxmpp.exceptions import IqError from sleekxmpp.plugins.base import load_plugin from sleekxmpp.stanza import StreamFeatures from sleekxmpp.xmlstream.handler import Call...
'''config.py: util functions for config, mainly for heron-cli''' import argparse import contextlib import getpass import os import sys import subprocess import tarfile import tempfile import yaml from heron.common.src.python.utils.log import Log # pylint: disable=logging-not-lazy # default environ tag, if not provi...
__author__ = 'Nicklas Boerjesson' from plyer import notification import os from kivy.utils import platform platform = platform() if __name__ == '__main__': """Initialize the service""" try: # Import the service main class from syncservice import SyncService except Exception as e: ...
"""Tests for tensorflow.ops.reverse_sequence_op.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import itertools import sys import numpy as np from tensorflow.python.client import session from tensorflow.python.framework import constant_op from tensor...
import StGermain.Base.Bindings.Dictionary as bindings def copyright(): return "StGermain.Base.IO.Dictionary Python module: Copyright (c) 2003 Victorian Partnership for Advanced Computing (VPAC) Ltd. Australia."; def new(): return bindings.New() class Dictionary: def Print( self ): return bindings.Print( self._h...
from __future__ import unicode_literals import frappe from frappe import _ def execute(filters=None): columns, data = [], [] columns=get_columns() data=get_data(filters,columns) return columns, data def get_columns(): return [ { "label": _("Item Code"), "fieldname": "item_code", "fieldtype": "Link", ...
from django.core.urlresolvers import reverse from django import http from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test class QosSpecsTests(test.BaseAdminViewTests): @test.create_stubs({api.cinder: ('qos_spec_get',), }) def test_manage_qos_sp...
from pyanaconda.modules.payloads.constants import PayloadType __all__ = ["PayloadFactory"] class PayloadFactory(object): """Factory to create payloads.""" @staticmethod def create_payload(payload_type: PayloadType): """Create a partitioning module. :param payload_type: a payload type ...
from __future__ import print_function import json import mmap import os import re import sys import argparse parser = argparse.ArgumentParser() parser.add_argument("filenames", help="list of files to check, all files if unspecified", nargs='*') args = parser.parse_args() # Cargo culted from http://stackoverflow.com/...
#!/usr/bin/env python import argparse import signal import subprocess import sys import threading from datetime import datetime import boto3 import colorama import requests import tarfile import tempfile import workerpool from boto3.s3.transfer import S3Transfer from colorama import Fore, Style is_debug = False def...
# extremely simple XML writer # # This is to remove libxml2 dependency on platforms where it's # difficult to build # # 2003 Attila Tajti <<EMAIL>> class XMLDoc: def __init__(self, version): self.version = version self.root_element = None def saveFile(self, filename): f = file(filename, "w") f.write('<?xm...
"""Python representation for Chromium Plugins info. This is the info available at about:plugins. Obtain one of these from PyUITestSuite::GetPluginsInfo() call. Example: class MyTest(pyauto.PyUITest): def testBasic(self): info = self.GetPluginsInfo() # fetch plugins snapshot print info.Plugins() See more e...
#-*- coding: utf-8 -*- """ Pyramid helper that mirror and serve file automatically from PyPI. Package are mirrored safety by validating the PyPI certificate. It is possible to use an HTTP Proxy. Pyshop use the requests library, so, you just have to export your proxy in the environment variable `https_proxy`. """ imp...
""" Quadratic Discriminant Analysis """ # # License: BSD 3 clause import warnings import numpy as np from .base import BaseEstimator, ClassifierMixin from .externals.six.moves import xrange from .utils import check_array, check_X_y from .utils.validation import check_is_fitted from .utils.fixes import bincount __a...
""" This module contains different functions for tracking objects in videos, manually or automatically. The tracking functions return results under the form: ``( txy, (fx,fy) )`` where txy is of the form [(ti, xi, yi)...] and (fx(t),fy(t)) give the position of the track for all times t (if the time t is out of the tim...
import warnings from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo, TableInfo, ) from django.db.models.indexes import Index from django.utils.deprecation import RemovedInDjango21Warning class DatabaseIntrospection(BaseDatabaseIntrospection): # Maps type codes to Django F...
import struct import base64 import dns.exception import dns.inet import dns.name class IPSECKEY(dns.rdata.Rdata): """IPSECKEY record @ivar precedence: the precedence for this key data @type precedence: int @ivar gateway_type: the gateway type @type gateway_type: int @ivar algorithm: the alg...
import iris.tests as tests import numpy as np import iris import iris.fileformats.nimrod_load_rules as nimrod_load_rules def mock_nimrod_field(): field = iris.fileformats.nimrod.NimrodField() field.int_mdi = -32767 field.float32_mdi = -32767.0 return field class TestLoad(tests.IrisTest): @test...
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2019 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 glob import os import string from .. import bar, xkeysyms, xcbq, command from . import base class NullCompleter: def __init__(self, qtile): self.qtile = qtile self.thisfinal = "" def actual(self): return self.thisfinal def reset(self): pass def complete(self, ...
# pylint: disable=missing-docstring import re from ansible.errors import AnsibleError from ansible.plugins.lookup import LookupBase class LookupModule(LookupBase): # pylint: disable=too-many-branches,too-many-statements,too-many-arguments def run(self, terms, variables=None, zones_enabled=True, short_versio...
""" Test functions for the sparse.linalg.eigen.lobpcg module """ from __future__ import division, print_function, absolute_import import numpy as np from numpy.testing import (assert_almost_equal, assert_equal, assert_allclose, assert_array_less, assert_) from scipy import ones, rand, r_, diag, linalg, eye fr...
from botocore.session import get_session _H2_REQUIRED = object() # Service names to list of known HTTP 2 operations _KNOWN_SERVICES = { 'kinesis': ['SubscribeToShard'], 'lexv2-runtime': ['StartConversation'], } def test_all_uses_of_h2_are_known(): session = get_session() loader = session.get_componen...
""" Process macro batches of data in a pipelined fashion. """ import logging from glob import glob import functools import gzip from multiprocessing import Pool import numpy as np import os import tarfile import struct from PIL import Image as PILImage from neon.util.compat import range, StringIO from neon.util.persi...
from django import forms from django.forms.formsets import BaseFormSet from rapidsms.contrib.locations.models import Location, LocationType from survey.models import LocationTypeDetails class BaseArticleFormSet(BaseFormSet): def clean(self): for form_count in range(0, self.total_form_count()): ...
"""Democracy Database (DemDb) See: https://github.com/jollyrogue/demdb """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the ...
""" A script for testing DraftRegistrationApprovals. Automatically adds comments to and rejects pending DraftRegistrationApprovals """ import sys import logging import datetime as dt from website.app import init_app from website.models import DraftRegistration, Sanction, User logger = logging.getLogger(__name__) logg...
import time import mock from tempest.common import waiters from tempest import exceptions from tempest.tests import base class TestImageWaiters(base.TestCase): def setUp(self): super(TestImageWaiters, self).setUp() self.client = mock.MagicMock() self.client.build_timeout = 1 self...
from django.forms.models import ModelFormMetaclass, ModelForm from django.template import RequestContext, loader from django.http import Http404, HttpResponse, HttpResponseRedirect from django.core.xheaders import populate_xheaders from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured from django....
import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.md')).read() CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() requires = [ 'pyramid>=1.4', 'pyramid_chameleon', # for compatibility with pyramid 1.5 branch ...
from .. import InstanceResource, ListResource class IpAccessControlListMapping(InstanceResource): def delete(self): """ Remove this mapping (disassociate the ACL from the Domain). """ return self.parent.delete_instance(self.name) class IpAccessControlListMappings(ListResource): ...
from msrest.pipeline import ClientRawResponse from .. import models class Paths(object): """Paths operations. :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An objec model deserialize...
import threading import traceback import Queue class ThreadedWorkQueue(object): def __init__(self, num_threads): self._num_threads = num_threads self._main_thread_tasks = None self._any_thread_tasks = None self._running = False self._stop = False self._stop_result = None self.Reset()...
# coding=utf-8 from __future__ import absolute_import __author__ = "Gina Häußge <<EMAIL>>" __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License" import unittest import os import mo...
"""Tests for tensorflow.python.training.saver.py.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from tensorflow.core.protobuf import saver_pb2 from tensorflow.python.client import session from tensorflow.python.framework import constant_op f...
"""ANSII Color formatting for output in terminal.""" from __future__ import print_function import os __ALL__ = [ 'colored', 'cprint' ] VERSION = (1, 1, 0) ATTRIBUTES = dict( list(zip([ 'bold', 'dark', '', 'underline', 'blink', '', ...
import unittest, time, sys, random sys.path.extend(['.','..','py']) import h2o, h2o_cmd, h2o_hosts, h2o_glm, h2o_browse as h2b, h2o_import as h2i class Basic(unittest.TestCase): def tearDown(self): h2o.check_sandbox_for_errors() @classmethod def setUpClass(cls): # assume we're at 0xdata wi...
# -*- 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 model 'CellCountInstance' db.create_table('main_cellcountinstance', ( ('id', self.gf('d...
'''A Python-based startup script for conveyor.''' from __future__ import (absolute_import, print_function, unicode_literals) import json import os import os.path import subprocess import sys try: # The argparse module was added to Python as of version 2.7. However, there # is a backport for older versions of...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['deprecated'], 'supported_by': 'community'} import re from ansible.module_utils.basic import AnsibleModule from ansible.module_utils...
from odoo import models, fields, api from odoo.tools import populate, pycompat class TestPopulateModel(models.Model): _name = 'test.populate' _description = 'Test Populate' name = fields.Char(default='Foo') state = fields.Selection([('a', 'A'), ('b', 'B')], default='a') active = fields.Boolean('...
""" mbed SDK Copyright (c) 2011-2013 ARM Limited 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 wr...
# encoding: utf-8 import json import requests from .exceptions import PagarmeApiError, NotPaidException, NotBoundException from .resource import AbstractResource class Transaction(AbstractResource): BASE_URL = 'https://api.pagar.me/1/transactions' def __init__( self, api_key=None, ...
#!/usr/bin/env python """ # OpenWrt download directory cleanup utility. # Delete all but the very last version of the program tarballs. # # Copyright (C) 2010 Michael Buesch <<EMAIL>> # Copyright (C) 2013 OpenWrt.org """ import sys import os import re import getopt # Commandline options opt_dryrun = False def parse...
from django.conf.urls import patterns, include, url from django.conf import settings ''' Module that keeps url redirection settings. @package logviewer.urls @authors Deniz Eren @authors Ibrahim Ercan @authors Ersan Vural Zorlu @authors Nijad Ahmadli @copyright This project is released under BSD l...
""" ConqueSubprocess Create and interact with a subprocess through a pty. Usage: p = ConqueSubprocess() p.open('bash', {'TERM':'vt100'}) output = p.read() p.write('cd ~/vim' + "\r") p.write('ls -lha' + "\r") output += p.read(timeout = 500) p.close() """ import os import signal import pty...
import logging from miro import app from miro import prefs from miro.gtcache import gettext as _ from miro.frontends.widgets import dialogs # We can't really do much here ... this shouldn't happen on the Mac # but it's better than cold hard crash? def install_bonjour(): title = _("Install Bonjour") descriptio...
"""example of using ComfyChair""" import comfychair class OnePlusOne(comfychair.TestCase): def runtest(self): self.assert_(1 + 1 == 2) class FailTest(comfychair.TestCase): def runtest(self): self.assert_(1 + 1 == 3) tests = [OnePlusOne] extra_tests = [FailTest] if __name__ == '__main__': ...
# Stolen from here: # https://github.com/slobdell/motion_detection/blob/master/shaky_motion_detection.py import sys import cv2 import numpy as np IMAGE_WIDTH = 800 def resized_frame(frame): height, width = frame.shape[0: 2] desired_width = IMAGE_WIDTH desired_to_actual = float(desired_width) / width ...
from case9_4_1 import Case9_4_1 class Case9_4_2(Case9_4_1): DESCRIPTION = """Send fragmented binary message message with message payload of length 4 * 2**20 (4M). Sent out in fragments of 256.""" EXPECTATION = """Receive echo'ed binary message (with payload as sent).""" def init(self): self....
import unittest from spacewalk.common.rhnConfig import CFG, initCFG from spacewalk.server import rhnSQL import misc_functions DB_SETTINGS = misc_functions.db_settings("oracle") class ExceptionsTest(unittest.TestCase): def test_failed_connection(self): # Connect to localhost and look for db on a totally...
__version__=''' $Id: randomtext.py 3342 2008-12-12 15:55:34Z andy $ ''' ############################################################################### # generates so-called 'Greek Text' for use in filling documents. ############################################################################### __doc__="""Like Lore...
"""Compressed Sparse Column matrix format""" from __future__ import division, print_function, absolute_import __docformat__ = "restructuredtext en" __all__ = ['csc_matrix', 'isspmatrix_csc'] import numpy as np from .base import spmatrix from ._sparsetools import csc_tocsr from . import _sparsetools from .sputils i...
from superdesk import get_resource_service from superdesk.metadata.item import CONTENT_STATE FIELD_SCHEME_MAP = { 'subject': 'category', 'genre': 'genre_custom', 'anpa_category': None, } def callback(item, **kwargs): if item.get('state') not in (CONTENT_STATE.INGESTED, ): return try: ...
"""Profiler setting methods.""" import ctypes import contextlib import contextvars import warnings from .base import _LIB, check_call, c_str, ProfileHandle, c_str_array, py_str, KVStoreHandle profiler_kvstore_handle = KVStoreHandle() def set_kvstore_handle(handle): global profiler_kvstore_handle profiler_kvst...
import sys # ------------------------------------------------------------------------ # # #TODO #FIXME Airflow 2.0 # # Old import machinary below. # # This is deprecated but should be kept until Airflow 2.0 # for compatibility. # # ------------------------------------------------------------------------ # Imports th...
"""Faux ``threading`` version using ``dummy_thread`` instead of ``thread``. The module ``_dummy_threading`` is added to ``sys.modules`` in order to not have ``threading`` considered imported. Had ``threading`` been directly imported it would have made all subsequent imports succeed regardless of whether ``thread`` wa...
"""Thread-local objects. (Note that this module provides a Python version of the threading.local class. Depending on the version of Python you're using, there may be a faster one available. You should always import the `local` class from `threading`.) Thread-local objects support the management of thread-local d...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'network'} import re from ansible.module_utils.network.nxos.nxos import get_config, load_config, run_commands from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args...
{ 'name': 'Sale Payment Method', 'version': '0.2', 'category': 'Generic Modules/Others', 'license': 'AGPL-3', 'description': """ Sale Payment Method =================== This module adds low-level features used for instance by modules: - Sale Automatic Workflow - Sale Quick Payment It adds a payme...
"""Sort performance test. See main() for command line syntax. See tabulate() for output format. """ import sys import time import random import marshal import tempfile import os td = tempfile.gettempdir() def randfloats(n): """Return a list of n random floats in [0, 1).""" # Generating floats is expensive,...
"""Self-test for cipher modules""" __revision__ = "$Id$" def get_tests(config={}): tests = [] from Crypto.SelfTest.Cipher import test_AES; tests += test_AES.get_tests(config=config) from Crypto.SelfTest.Cipher import test_ARC2; tests += test_ARC2.get_tests(config=config) from Crypto.SelfTest....
def getDefaultGateway(): f = open("/proc/net/route", "r") if f: for line in f.readlines(): tokens = line.split('\t') if tokens[1] == '00000000': #dest 0.0.0.0 return int(tokens[2], 16) return None def getTelephone(): f = open("/etc/ppp/options", "r") if f: for line in f.readlines(): if line.find(...
"""Converts Common Alerting Protocol (CAP) files into KML files suitable for use with Diana (http://diana.met.no). Usage: cap2kml.py <CAP file> [<KML file for Diana> [<input file for bdiana>]] Parses and validates the given CAP file. If an output KML file is specified, the KML text is written to the file; otherwise...
from .catalog_item_py3 import CatalogItem class USqlAssemblyClr(CatalogItem): """A Data Lake Analytics catalog U-SQL assembly CLR item. :param compute_account_name: the name of the Data Lake Analytics account. :type compute_account_name: str :param version: the version of the catalog item. :type ...
""" anitya tests for the custom backend. """ import unittest import mock import anitya.lib.backends.gnu as backend from anitya.db import models from anitya.lib.exceptions import AnityaPluginException from anitya.tests.base import DatabaseTestCase, create_distro BACKEND = "GNU project" class GnuBackendtests(Databa...
#!/usr/bin/env python # -*- coding: utf-8 -*- """The migrate command-line tool.""" import sys import inspect import logging from optparse import OptionParser, BadOptionError from migrate import exceptions from migrate.versioning import api from migrate.versioning.config import * from migrate.versioning.util import a...
# -*- coding: ascii -*- import sys, os, os.path import unittest, doctest import cPickle as pickle from datetime import datetime, tzinfo, timedelta if __name__ == '__main__': # Only munge path if invoked as a script. Testrunners should have setup # the paths already sys.path.insert(0, os.path.abspath(os.pa...
from __future__ import print_function import xlrd from xlrd.timemachine import REPR import sys import glob def scope_as_string(book, scope): if 0 <= scope < book.nsheets: return "sheet #%d (%r)" % (scope, REPR(book.sheet_names()[scope])) if scope == -1: return "Global" if scope == -2: ...
""" The View, deriving from QAbstractScrollArea. """ import contextlib from PyQt5.QtCore import pyqtSignal, QPoint, QSize, Qt from PyQt5.QtGui import QPainter, QPalette from PyQt5.QtWidgets import QStyle from . import layout from . import scrollarea from .constants import ( # rotation: Rotate_0, Rotate...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'curated'} from ansible.module_utils.basic import * from ansible.module_utils.azure_rm_common import * try: from msrestazure.azure_exceptions import CloudError from azure.common impor...
from __future__ import unicode_literals import logging import os import re import shutil import sys from mopidy import local from mopidy.local import translator from mopidy.models import Ref, SearchResult from mopidy.utils import path import whoosh import whoosh.fields import whoosh.index import whoosh.query logger...
"""Example of DNNClassifier for Iris plant dataset, with exponential decay.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from sklearn import datasets from sklearn import metrics from sklearn import model_selection import tensorflow ...
"""Unit tests for newstringio module.""" import unittest2 as unittest import newstringio class NewStringIOTest(unittest.TestCase): def test_with(self): with newstringio.StringIO("foo") as f: contents = f.read() self.assertEqual(contents, "foo")
import unittest import os.path import cv2.cv as cv import pyvision as pv #import numpy as np #from scipy.ndimage import convolve #from scipy.ndimage import maximum_filter def canny(im,threshold1=40.0,threshold2=100.0,aperture_size=3,sigma=None): ''' void cvCanny( const CvArr* image, CvArr* edges, double th...
import ast import os import urlparse # Import global settings to make it easier to extend settings. from django.conf.global_settings import * # pylint: disable=W0614,W0401 import dj_database_url #============================================================================== # Generic Django project settings #=======...
"""This script reads in graph and attribute data, constructs similarity matrices for each text attribute of interest, then embeds each of these into Euclidean space. Usage: python3 embed.py [path] The directory [path] must include a file params.py containing all necessary parameters.""" import os import sys...
import unittest from cuddlefish.property_parser import parse, MalformedLocaleFileError class TestParser(unittest.TestCase): def test_parse(self): lines = [ # Comments are striped only if `#` is the first non-space character "sharp=#can be in value", "# comment", "#...
# -*- coding: utf-8 -*- import warnings from anytree.iterators import PreOrderIter from .exceptions import LoopError from .exceptions import TreeError class NodeMixin(object): separator = "/" u""" The :any:`NodeMixin` class extends any Python class to a tree node. The only tree relevant informat...
""" test docstring inspection""" def foo1(a, b): """ Parameters: a: foo b: bar """ pass def foo(a, <weak_warning descr="Missing parameter b in docstring">b</weak_warning>, <weak_warning descr="Missing parameter n in docstring">n</weak_warning>): """ Parameters: a: foo """ pass def foo():...
#!/usr/bin/python import sys Usage = r''' USAGE: python configure.py [options] Options: (options in the same section are mutually exclusive) -o <file> - write output to <file> -srcdir <dir> - change source directory -builddir <dir> - change build directory -test ...
""" This module implements the fast connection scanning @author: AAron Walters and Brendan Dolan-Gavitt @license: GNU General Public License 2.0 @contact: <EMAIL>,<EMAIL> @organization: Volatility Foundation """ #pylint: disable-msg=C0111 import volatility.scan as scan import volatility.plugins.commo...
#!/usr/bin/env python '''Test depth buffer save. A scene consisting of a single coloured triangle will be rendered. The depth buffer will then be saved to a stream and loaded as a texture. You will see the original scene first for up to several seconds before the depth buffer image appears (because retrie...
""" Create a wheel (.whl) distribution. A wheel is a built archive format. """ import csv import hashlib import os import subprocess import warnings import shutil import json import wheel try: import sysconfig except ImportError: # pragma nocover # Python < 2.7 import distutils.sysconfig as sysconfig i...
import argparse def Parser(): the_parser = argparse.ArgumentParser() the_parser.add_argument( '--minCandidateVariantSize', type=int, default=8, help="Run Manta reporting for all SVs/indels at or above this size") the_parser.add_argument( '--rnaMinCandidateVariantSize', type=int, de...
import os import sys from nose.tools import assert_raises from github.issues import main repo = 'jsmits/github-cli-public-test' prog = 'ghi' def test_commands(): for cmd, exp in test_input: def check_command(cmd, exp): base = [prog, '-r', repo] args = cmd.split(' ') if...
from heat.common import exception class Timestamp(object): """A descriptor for writing a timestamp to the database.""" def __init__(self, db_fetch, attribute): """Initialise the timestamp descriptor. Initialise with a function to fetch the database representation of an object (given ...
try: import StringIO except: import io as StringIO import traceback from os.path import basename try: __setFalse = False except: import __builtin__ setattr(__builtin__, 'True', 1) setattr(__builtin__, 'False', 0) import pydevd_constants from pydevd_constants import DictIterItems, DictKeys, xra...
from functools import wraps from django.conf import settings from django.contrib.auth import REDIRECT_FIELD_NAME from django.core.exceptions import PermissionDenied from django.utils.decorators import available_attrs from django.utils.encoding import force_str from django.utils.six.moves.urllib.parse import urlparse fr...
from django.conf import settings from django.contrib.auth.models import User from django.contrib.flatpages.models import FlatPage from django.contrib.sites.models import Site from django.test import TestCase, modify_settings, override_settings from django.test.utils import ignore_warnings from django.utils.deprecation ...
import unittest import xml.etree.ElementTree as ET from programy.parser.exceptions import ParserException from programy.parser.template.nodes.base import TemplateNode from programy.parser.template.nodes.rand import TemplateRandomNode from test.parser.template.graph.test_graph_client import TemplateGraphTestClient c...
from numpy.testing import * from numpy.lib import * from numpy.core import * from numpy.compat import asbytes def assert_all(x): assert(all(x)), x class TestCommonType(TestCase): def test_basic(self): ai32 = array([[1,2],[3,4]], dtype=int32) af32 = array([[1,2],[3,4]], dtype=float32) ...
from django import template from django.db.models import get_models register = template.Library() class AdminApplistNode(template.Node): def __init__(self, varname): self.varname = varname def render(self, context): from django.db import models from django.utils.text import capfirst ...
from datetime import datetime, timedelta from shortuuidfield import ShortUUIDField from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models from django.utils.timezone import now from django.conf import settings from django.utils.html import format_html from network.users.mo...
# -*- coding: utf-8 -*- ''' Module for low-level interaction with JbossAS7 through CLI. This module exposes two ways of interaction with the CLI, either through commands or operations. .. note:: Following JBoss documentation (https://developer.jboss.org/wiki/CommandLineInterface): "Operations are considered a low...
# -*- coding: utf-8 -*- """ *************************************************************************** r_null.py --------------------- Date : February 2016 Copyright : (C) 2016 by Médéric Ribreux Email : medspx at medspx dot fr ****************************...
# coding: utf-8 import os, tempfile from tests.shared import assertException, getEmptyCol from anki.stdmodels import addBasicModel from anki import Collection as aopen newPath = None newMod = None def test_create(): global newPath, newMod (fd, path) = tempfile.mkstemp(suffix=".anki2", prefix="test_attachNew...
import re import random import datetime from django.utils.translation import ugettext as _ from django.utils.translation import ungettext from django.utils.html import escape def get_from_dict_or_object(source, key): try: return source[key] except: return getattr(source, key) def enumerate_st...