content
stringlengths
4
20k
from openerp.osv import fields, osv class document_page_create_menu(osv.osv_memory): """ Create Menu """ _name = "document.page.create.menu" _description = "Wizard Create Menu" _columns = { 'menu_name': fields.char('Menu Name', size=256, required=True), 'menu_parent_id': fields.many2on...
from datetime import datetime from operator import attrgetter from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.test import TestCase from models import Article class CountContainer(object): def count(self): return 42 class LenContainer(object): def __len__(self): ...
import unittest import os from test import test_support aetypes = test_support.import_module('aetypes') aepack = test_support.import_module('aepack') class TestAepack(unittest.TestCase): OBJECTS = [ aetypes.Enum('enum'), aetypes.Type('type'), aetypes.Keyword('kwrd'), ae...
""" Django settings for teste project. Generated by 'django-admin startproject' using Django 1.11.10. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os ...
#!/usr/bin/env python # encoding: utf-8 # Ali Sabil, 2007 import os.path, shutil import Task, Runner, Utils, Logs, Build, Node, Options from TaskGen import extension, after, before EXT_VALA = ['.vala', '.gs'] class valac_task(Task.Task): vars = ("VALAC", "VALAC_VERSION", "VALAFLAGS") before = ("cc", "cxx") def ...
import getpass from distutils.command import upload as orig class upload(orig.upload): """ Override default upload behavior to obtain password in a variety of different ways. """ def finalize_options(self): orig.upload.finalize_options(self) self.username = ( self.user...
from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal REPORT_PLAYER = 'REPORT_PLAYER' ReportFoulLanguage = 'MODERATION_FOUL_LANGUAGE' ReportPersonalInfo = 'MODERATION_PERSONAL_INFO' ReportRudeBehavior = 'MODERATION_RUDE_BEHAVIOR' ReportBadName = 'MODERATION_BAD_NAME' ReportHacking = 'MODERATION...
"""\ A library of useful helper classes to the SAX classes, for the convenience of application and driver writers. """ import os, urllib.parse, urllib.request import io import codecs from . import handler from . import xmlreader def __dict_replace(s, d): """Replace substrings of a string using a dictionary.""" ...
class ClassBasedRegistry: """Allow to register/un-register and filter items using a reference class. The filter "check" whenever the filter-class is a subclass of the one used to register the item or exactly the the same. .. highlight:: reg = ClassBasedRegistry() reg.add_item('Object-...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import members.models class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Member', fields=[ ('id', ...
from . import win32 # from wincon.h class WinColor(object): BLACK = 0 BLUE = 1 GREEN = 2 CYAN = 3 RED = 4 MAGENTA = 5 YELLOW = 6 GREY = 7 # from wincon.h class WinStyle(object): NORMAL = 0x00 # dim text, dim background BRIGHT = 0x08 # bright text, dim backgro...
# portalocker.py - Cross-platform (posix/nt) API for flock-style file locking. # Requires python 1.5.2 or better. """Cross-platform (posix/nt) API for flock-style file locking. Synopsis: import portalocker file = open("somefile", "r+") portalocker.lock(file, portalocker.LOCK_EX) file.seek...
import random import jinja2 from jingo import register @register.function def emaillink(email, title=None, klass=None): if not email: return "" fallback = email[::-1] # reverse # inject junk somewhere i = random.randint(0, len(email) - 1) fallback = u"%s%s%s" % (jinja2.escape(fallback[:...
DATE_FORMAT = 'j F Y' TIME_FORMAT = 'H:i' DATETIME_FORMAT = 'j F Y H:i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'j N Y' SHORT_DATETIME_FORMAT = 'j N Y H:i' FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/li...
"""Support to control a Salda Smarty XP/XV ventilation unit.""" from datetime import timedelta import ipaddress import logging from pysmarty import Smarty import voluptuous as vol from homeassistant.const import CONF_HOST, CONF_NAME from homeassistant.helpers import discovery import homeassistant.helpers.config_vali...
# TODO: Disabled the RETURN as it was breaking docs building. Someone needs to # fix this try: import boto.ec2 from boto.exception import BotoServerError HAS_BOTO = True except ImportError: HAS_BOTO = False def get_volume_info(volume): attachment = volume.attach_data volume_info = { ...
""" Install script for pystif. Usage: python setup.py install Before running this script, install 'cython'. """ from setuptools import setup, Extension from Cython.Build import cythonize with open('README.rst', encoding='utf-8') as f: README = f.read() setup( name='pystif', version='0.0.0', des...
from uptodate import * import add usage = _("uptodate [options] auto name url version") summary = _("Add a new module with no need of a regular expression") description = _("""Auto is used in order to add a new module with no need of the regular expression used to get versions. You must give: + the module's name. If...
''' Tutorial - Getting started - create a organization, course and problem objects Here we create an institution(i.e., Reddit). ''' from common_settings import * import praw # Python Reddit API Wrapper # boilerplate login code session = requests.session() response = login_to_discern(session) # add a problem stateme...
import json import logging import socket from django.utils.translation import ugettext as _ from sqoop import client, conf from desktop.lib.django_util import JsonResponse from desktop.lib.exceptions import StructuredException from desktop.lib.rest.http_client import RestException from exception import handle_rest_ex...
"""Support for Vallox ventilation units.""" from datetime import timedelta import ipaddress import logging from vallox_websocket_api import PROFILE as VALLOX_PROFILE, Vallox from vallox_websocket_api.constants import vlxDevConstants from vallox_websocket_api.exceptions import ValloxApiException import voluptuous as v...
#static is here mvpland_static #postgresql -- mvpland #username -- cfedeploy #password -- ## """ Django settings for trydjango18 project. Generated by 'django-admin startproject' using Django 1.8. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of set...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import traceback from ansible.module_utils.basic import AnsibleModule from ansible.module_u...
"""Restructure Gettxt PO files produced by :doc:`poconflicts </commands/poconflicts>` into the original directory tree for merging using :doc:`pomerge </commands/pomerge>`. See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pomerge.html for examples and usage instructions. """ import os...
from __future__ import unicode_literals import webnotes from webnotes.utils import add_days, cstr, getdate from webnotes.model.doc import Document, addchild from webnotes.model.bean import getlist from webnotes.model.code import get_obj from webnotes import msgprint sql = webnotes.conn.sql from utilities.transacti...
# -*- coding: utf-8 -*- ''' Exodus Add-on Copyright (C) 2016 Exodus 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 License, or (at your option) any l...
import functools import re from oslo_log import log as logging from oslo_utils import timeutils from oslo_utils import uuidutils import six from nova import context from nova import exception from nova.i18n import _ from nova.i18n import _LI from nova.network import model as network_model from nova import objects fro...
""" ============================== Generate simulated evoked data ============================== Use :func:`~mne.simulation.simulate_sparse_stc` to simulate evoked data. """ # Alexandre Gramfort <<EMAIL>> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne.datas...
import os import sys STAGE_PRODUCT = 'firefox' STAGE_USERNAME = 'ffxbld' STAGE_SSH_KEY = 'ffxbld_dsa' config = { ######################################################################### ######## WINDOWS GENERIC CONFIG KEYS/VAlUES # if you are updating this with custom 32 bit keys/values please add them ...
from sympy import sqrt, Matrix from sympy.physics.quantum.represent import represent from sympy.physics.quantum.qapply import qapply from sympy.physics.quantum.qubit import IntQubit from sympy.physics.quantum.grover import (apply_grover, superposition_basis, OracleGate, grover_iteration, WGate) def return_one...
import json import logging import os import time from distutils.version import LooseVersion from PIL import Image from ..common import cloud_bucket from ..common import ispy_utils class ChromeUtils(object): """A utility for using ISpy with Chrome.""" def __init__(self, cloud_bucket, version_file, screenshot_fun...
from tempest_lib.common.utils import data_utils from tempest.api.compute import base from tempest import test class KeyPairsV2TestJSON(base.BaseComputeTest): _api_version = 2 @classmethod def setup_clients(cls): super(KeyPairsV2TestJSON, cls).setup_clients() cls.client = cls.keypairs_cl...
# -*- coding: utf-8 -*- """ Holds the code for cleaning out unwanted tags from the lxml dom xpath. """ from .utils import ReplaceSequence class DocumentCleaner(object): def __init__(self, config): """Set appropriate tag names and regexes of tags to remove from the HTML """ self.co...
""" """ import json from django.contrib.auth.mixins import LoginRequiredMixin from django.http import HttpResponseRedirect, HttpResponse from django.shortcuts import get_object_or_404 from django.utils.translation import ugettext as _ from django.views.generic import View from django.views.generic.edit import DeleteVi...
""" SQLAlchemy models for Wallets """ from __init__ import sa, Base, LedgerAmount __all__ = ['Quote', 'QuoteRequest', 'Payment'] class QuoteRequest(Base): """A Request for a quote to convert one currency to another.""" __tablename__ = "quote_request" __name__ = "quote_request" id = sa.Column(sa.Integ...
# import cloudstack common from ansible.module_utils.cloudstack import * class AnsibleCloudStackAccount(AnsibleCloudStack): def __init__(self, module): super(AnsibleCloudStackAccount, self).__init__(module) self.returns = { 'networkdomain': 'network_domain', } self.acc...
from __future__ import print_function import sys import time import traceback import warnings from functools import wraps from six import iteritems from . import formats from . import levels from . import outputs from .lib import iso8601time from .message import Message def emit(level): """a decorator that emi...
from django.contrib.sites.shortcuts import get_current_site from django.contrib.syndication.views import Feed from django.utils.translation import ugettext as _ import django_comments class LatestCommentFeed(Feed): """Feed of latest comments on the current site.""" def __call__(self, request, *args, **kwarg...
#!/usr/bin/env python """ This class represent a Dallas 1-wire teperature probe Author: Elias Bakken email: elias(dot)bakken(at)gmail(dot)com Website: http://www.thing-printer.com License: GNU GPL v3: http://www.gnu.org/copyleft/gpl.html Redeem is free software: you can redistribute it and/or modify it under the te...
"""Import names of Tensor Flow standard Ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys as _sys # Imports the following modules so that @RegisterGradient get executed. from tensorflow.python.ops import array_grad from tensorflow.python.o...
"""Generate an XPIDL typelib for the IDL files specified on the command line""" import os import sys import xpidl, xpt # A map of xpidl.py types to xpt.py types TypeMap = { # nsresult is not strictly an xpidl.py type, but it's useful here 'nsresult': xpt.Type.Tags.uint32, # builtins 'boolean...
"""Produce DBpedia datasets of a smaller size (deprecated). This module and all its submodules are deprecated. See [contrib/learn/README.md](https://www.tensorflow.org/code/tensorflow/contrib/learn/README.md) for migration instructions. """ from __future__ import absolute_import from __future__ import division from _...
from weboob.capabilities.messages import ICapMessages, Message, Thread from weboob.tools.backend import BaseBackend, BackendConfig from weboob.tools.value import Value from .browser import FourChan __all__ = ['FourChanBackend'] class FourChanBackend(BaseBackend, ICapMessages): NAME = 'fourchan' MAINTAINER ...
#!/usr/bin/env python # Demonstrate how to use the vtkBoxWidget to translate, scale, and # rotate actors. The basic idea is that the box widget controls an # actor's transform. A callback which modifies the transform is # invoked as the box widget is manipulated. import vtk # Start by creating some simple geometry;...
#!/usr/bin/python """ Ansible module to manage DNS records using dnspython (c) 2016, Marcin Skarbek <<EMAIL>> (c) 2016, Andreas Olsson <<EMAIL>> (c) 2017, Loic Blot <<EMAIL>> This module was ported from https://github.com/mskarbek/ansible-nsupdate This file is part of Ansible Ansible is free software: you can redis...
"""Tests for gmock.scripts.generator.cpp.gmock_class.""" __author__ = '<EMAIL> (Neal Norwitz)' import os import sys import unittest # Allow the cpp imports below to work when run as a standalone script. sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from cpp import ast from cpp import gmock_class ...
""" Copyright (c) 2012-2020 RockStor, Inc. <http://rockstor.com> This file is part of RockStor. RockStor is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any la...
import unittest from telemetry import decorators from telemetry.core import util from telemetry.unittest import run_tests class MockPossibleBrowser(object): def __init__(self, browser_type, os_name, os_version_name, supports_tab_control): self.browser_type = browser_type self.platform = Mock...
import copy import itertools import functools import re # from collections import OrderedDict __all__ = [ "Field", "FieldList", "fieldlist", # FIXME remove this "expand_record", "collapse_record", "FieldMap", "storage_types", "analytical_types", "coalesce_value" ] """Abstracted fie...
""" Time related utilities and helper functions. """ import calendar import datetime import time import iso8601 import six # ISO 8601 extended time format with microseconds _ISO8601_TIME_FORMAT_SUBSECOND = '%Y-%m-%dT%H:%M:%S.%f' _ISO8601_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S' PERFECT_TIME_FORMAT = _ISO860...
class PhoneNumberParseException(Exception): pass class PhoneNumber(object): def __init__(self, country_code, national_number): self.country_code = country_code self.national_number = national_number def parse_phone_number(number, region=None, failhard=True): from phonenumbers.phonenumberu...
# This program is public domain r""" Allow $math$ markup in text and docstrings, ignoring \$. The $math$ markup should be separated from the surrounding text by spaces. To embed markup within a word, place backslash-space before and after. For convenience, the final $ can be followed by punctuation (period, comma or...
"""Test the Litter-Robot config flow.""" from unittest.mock import patch from pylitterbot.exceptions import LitterRobotException, LitterRobotLoginException from homeassistant import config_entries, setup from homeassistant.components import litterrobot from .common import CONF_USERNAME, CONFIG, DOMAIN from tests.co...
from ImageScripter import * from elan import * from ImageScripter import * from elan import * from pytank.Core.SystemFunctions import Say from elan import ElanSettings from elan import * from ImageScripter import * import os print('fffff') import telnetlib PanamaxIP = "192.168.0.53" Interface_Outlet = 5 x = 0 def Pow...
import errno import os import sys from threading import Lock from shutil import copyfileobj try: import mmap except ImportError: mmap = None from whoosh.compat import BytesIO, memoryview_ from whoosh.filedb.structfile import BufferFile, StructFile from whoosh.filedb.filestore import FileStorage, StorageError ...
# -*- coding: utf-8 -*- from __future__ import absolute_import import unittest from odin.resources import ResourceOptions, build_object_graph import odin from odin.exceptions import ValidationError from .resources import Book, Library, Subscriber class Author(odin.Resource): name = odin.StringField() country...
""" Tightens up response content by removed superflous line breaks and whitespace. By Doug Van Horn ---- CHANGES ---- v1.1 - 31st May 2011 Cal Leeming [Simplicity Media Ltd] Modified regex to strip leading/trailing white space from every line, not just those with blank \n. ---- TODO ---- * Ensure whitespace isn't str...
import apiclient import base64 import pickle from django.db import models class OAuthCredentialsField(models.Field): __metaclass__ = models.SubfieldBase def db_type(self): return 'VARCHAR' def to_python(self, value): if value is None: return None if isinstance(value, apiclient.oauth.Creden...
""" Annotations. invenio_annotations --------------------------- **FIXME: Outdated documentation.** To enable the module, make sure to remove it from ``PACKAGES_EXCLUDE``, where it is placed by default. To enable Web page annotations, add the following to your templates: .. code-block:: jinja {%- from "annota...
""" An auto-completion window for IDLE, used by the AutoComplete extension """ from tkinter import * from idlelib.MultiCall import MC_SHIFT from idlelib.AutoComplete import COMPLETE_FILES, COMPLETE_ATTRIBUTES HIDE_VIRTUAL_EVENT_NAME = "<<autocompletewindow-hide>>" HIDE_SEQUENCES = ("<FocusOut>", "<ButtonPress>") KEYPR...
import rdflib from rdflib.graph import ConjunctiveGraph as Graph from rdflib import plugin from rdflib.store import Store, NO_STORE, VALID_STORE from rdflib.namespace import Namespace from rdflib.term import Literal from rdflib.term import URIRef from tempfile import mkdtemp from gstudio.models import * from objectapp....
""" Test grade calculation. """ from django.http import Http404 from django.test import TestCase from django.test.client import RequestFactory from mock import patch, MagicMock from nose.plugins.attrib import attr from opaque_keys.edx.locations import SlashSeparatedCourseKey from opaque_keys.edx.locator import CourseL...
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals) import os import unittest2 as unittest from pants.backend.codegen.tasks.protobuf_gen import calculate_genfiles, _same_contents from pants.base.validation import asser...
from __future__ import unicode_literals import warnings from django.core import management from django.test import TestCase from .models import Article class SampleTestCase(TestCase): fixtures = ['fixture1.json', 'fixture2.json'] def testClassFixtures(self): "Test cases can load fixture objects in...
from Tools.LoadPixmap import LoadPixmap from Components.Pixmap import Pixmap from Renderer import Renderer from enigma import ePixmap, eEnv from Tools.Directories import fileExists, SCOPE_SKIN_IMAGE, SCOPE_CURRENT_SKIN, resolveFilename from Components.config import * from enigma import eServiceReference, eServiceCenter...
import unittest from pylith.utils.profiling import (resourceUsage, resourceUsageString) class TestProfiling(unittest.TestCase): """Unit testing of profiling module. """ def test_resourceUsage(self): cputime, memory = resourceUsage() self.assertFalse(cputime is None) self.assertFa...
from numpy.random import random from bokeh.plotting import figure, show, output_file def mscatter(p, x, y, marker): p.scatter(x, y, marker=marker, size=15, line_color="navy", fill_color="orange", alpha=0.5) def mtext(p, x, y, text): p.text(x, y, text=[text], text_color="firebrick", t...
''' This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code ''' CSI = '\033[' def code_to_chars(code): return CSI + str(code) + 'm' class AnsiCodes(object): def __init__(self, codes): for name in dir(codes): if not nam...
"""Tests for tensorflow.python.client.graph_util.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.core.framework import attr_value_pb2 from tensorflow.core.framework import graph_pb2 from tensorflow.core.framework import node_def_pb2 from...
"""Public API for the Embedding Projector. @@ProjectorPluginAsset @@ProjectorConfig @@EmbeddingInfo @@EmbeddingMetadata @@SpriteMetadata """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from google.protobuf import text_format from tensorflow....
from ts3plugin import ts3plugin import ts3defines from PythonQt.QtGui import * from PythonQt.QtCore import * class autoChannelChatTab(ts3plugin): name = "AutoChannelChatTab" apiVersion = 21 requestAutoload = True version = "1.0.1" author = "Thomas \"PLuS\" Pathmann" description = "Automaticall...
from collections import namedtuple from collections import Sequence from .enums import * class DCForce( namedtuple( "__DCForce", ["input", # "I" or "V" for voltage and current respectively "input_range", "value", ...
""" A clone of 'free' cmdline utility. """ import psutil from psutil._compat import print_ def main(): virt = psutil.virtual_memory() swap = psutil.swap_memory() templ = "%-7s %10s %10s %10s %10s %10s %10s" print_(templ % ('', 'total', 'used', 'free', 'shared', 'buffers', 'cache')) print_(templ % ...
from oslo_policy import policy from nova.policies import base BASE_POLICY_NAME = 'os_compute_api:os-rescue' POLICY_ROOT = 'os_compute_api:os-rescue:%s' rescue_policies = [ policy.RuleDefault( name=POLICY_ROOT % 'discoverable', check_str=base.RULE_ANY), policy.RuleDefault( name=BASE_...
from django.db import models from django.contrib.auth.models import User # Create your models here. class CodeProject(models.Model): owner = models.ForeignKey(User) # owner is responsible for code projects update status = models.CharField(max_length=10) # common status of project commo...
import os import re import subprocess from .. import vcs from ..vcs import bind_to_repo, git, hg def get_unique_name(existing, initial): """Get a name either equal to initial or of the form initial_N, for some integer N, that is not in the set existing. :param existing: Set of names that must not be ch...
# -*- coding: utf-8 -*- """ Test the QgsSourceSelectProvider and QgsSourceSelectProviderRegistry classes Run with: ctest -V -R PyQgsSourceSelectProvider .. note:: 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...
"""This module represents Nepali language. For more information, see U{http://en.wikipedia.org/wiki/Nepali_language} """ import re from translate.lang import common class ne(common.Common): """This class represents Nepali.""" sentenceend = u"।!?…" sentencere = re.compile(r"""(?s) #make . also match...
from lxml import etree import conf import g from util_ import misc log = g.log.getLogger('gwis.warning') class GWIS_Warning(Exception): '''An error which should be reported to the user (flashclient).''' __slots__ = ( #'docs', 'gerrs', 'tag', ) def __init__(self, message, tag=None,...
""" :module: watchdog.utils :synopsis: Utility classes and functions. :author: <EMAIL> (Yesudeep Mangalapilly) Functions --------- .. autofunction:: has_attribute .. autofunction:: load_class .. autofunction:: load_module .. autofunction:: read_text_file Classes ------- .. autoclass:: DaemonThread :members: ...
""" Module for running a bunch of simple unit tests. Should be expanded more in the future. :author: Michael Heilman (<EMAIL>) :author: Nitin Madnani (<EMAIL>) :author: Dan Blanchard (<EMAIL>) :author: Aoife Cahill (<EMAIL>) """ from __future__ import (absolute_import, division, print_function, ...
from pysb.examples.robertson import model import numpy as np from pysb.integrate import Solver import scipy.optimize from pyDOE import * import os import sys import numdifftools as nd from matplotlib import pyplot as plt import pickle from pysb.sensitivity import Sensitivity method_list = ['Nelder-Mead', 'Powell', 'CG...
# coding: utf-8 from __future__ import unicode_literals import os.path import re from .common import InfoExtractor from ..compat import ( compat_urllib_parse, compat_urllib_request, ) from ..utils import ( ExtractorError, remove_start, ) class MonikerIE(InfoExtractor): IE_DESC = 'allmyvideos.net...
from __future__ import absolute_import import unittest import json as json import consulalerting.settings as settings import consulalerting.utilities as utilities CURRENT_STATE = json.loads("""[ { "Node": "foobar", "CheckID": "serfHealth", "Name": "Serf Health Status", "Status": "passing", "Notes": "", "Output": "", ...
import unittest import sqlite3 as sqlite def func_returntext(): return "foo" def func_returnunicode(): return u"bar" def func_returnint(): return 42 def func_returnfloat(): return 3.14 def func_returnnull(): return None def func_returnblob(): return buffer("blob") def func_raiseexception(): ...
""" Events which have to do with a user doing something with more than one course, such as enrolling in a certain number, completing a certain number, or completing a specific set of courses. """ from badges.models import CourseEventBadgesConfiguration, BadgeClass from badges.utils import requires_badges_enabled def...
"""Generate XML and HTML test reports.""" from __future__ import print_function try: from mako.runtime import Context from mako.template import Template from mako import exceptions except (ImportError): pass # Mako not installed but it is ok. import os import string import xml.etree.cElementTree as ET def...
import mimetypes import StringIO import unittest import sys from test import test_support # Tell it we don't know about external files: mimetypes.knownfiles = [] mimetypes.inited = False mimetypes._default_mime_types() class MimeTypesTestCase(unittest.TestCase): def setUp(self): self.db = mimetypes.Mime...
from openerp import models, api class SaleOrderLine(models.Model): _inherit = 'sale.order.line' @api.depends('order_id.warehouse_id.partner_id', 'route_id', 'order_id.company_id.partner_id', 'warehouse_id.partner_id') @api.one def _origin_address(sel...
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} try: import consul from requests.exceptions import ConnectionError python_consul_installed = True except ImportError: python_consul_installed = False def execute(module): ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import datetime, glob, json, logging, os, pprint import requests from iip_processing_app.lib.processor import Indexer log = logging.getLogger(__name__) indexer = Indexer() class OrphanDeleter( object ): """ Contains functions for removing orphane...
"""Mapmaker options dialog.""" import os.path import tkinter as tk from tkinter import filedialog class MapOptionsDialog(tk.Toplevel): """Dialog with options for new trekbuddy map.""" _opts = { 'tile_size': (256, 256), 'create_tar': True, 'force': False, 'filename': "", ...
from functools import partial import sys from threading import Thread try: import cPickle as pickle except: import pickle import uwsgi if uwsgi.masterpid() == 0: raise Exception( "you have to enable the uWSGI master process to use this module") spooler_functions = {} mule_functions = {} postfork...
# -*- encoding: utf-8 -*- """Classes and definitions used in parsing bank statements.""" ############################################################################## # # Copyright (C) 2015 Therp BV <http://therp.nl>. # # This program is free software: you can redistribute it and/or modify # it under the terms of t...
# -*- 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): # Removing unique constraint on 'Link_SF_Proj_Dude_FM', fields ['person', 'projec...
""" Test the `ipalib.rpc` module. """ import threading from xmlrpclib import Binary, Fault, dumps, loads, ServerProxy from tests.util import raises, assert_equal, PluginTester, DummyClass from tests.data import binary_bytes, utf8_bytes, unicode_str from ipalib.frontend import Command from ipalib.request import context...
# coding: utf-8 from django.db import models class Author(models.Model): name = models.CharField(max_length=100) age = models.IntegerField() friends = models.ManyToManyField('self', blank=True) def __unicode__(self): return self.name class Publisher(models.Model): name = models.CharFiel...
from sqlalchemy import MetaData, Table, Column, DateTime from ceilometer.openstack.common import timeutils def upgrade(migrate_engine): meta = MetaData(bind=migrate_engine) resource = Table('resource', meta, autoload=True) timestamp = Column('timestamp', DateTime) resource.drop_column(timestamp) ...
# -*- coding: utf-8 -*- from __future__ import absolute_import from datetime import timedelta from django.utils import timezone from sentry.nodestore.django.models import Node from sentry.nodestore.django.backend import DjangoNodeStorage from sentry.testutils import TestCase class DjangoNodeStorageTest(TestCase): ...
import pytest from selenium.common.exceptions import ( WebDriverException, NoSuchElementException) def test_should_find_element_by_xpath(driver, pages): pages.load("nestedElements.html") element = driver.find_element_by_name("form2") child = element.find_element_by_xpath("select") assert chil...