content
string
import unittest from ...utility import xl_rowcol_to_cell from ...utility import xl_rowcol_to_cell_fast class TestUtility(unittest.TestCase): """ Test xl_rowcol_to_cell() utility function. """ def test_xl_rowcol_to_cell(self): """Test xl_rowcol_to_cell()""" tests = [ # ro...
import re import subprocess def get_version(bin_name): """Get the version of an installed Kubernetes binary. :param str bin_name: Name of binary :return: 3-tuple version (maj, min, patch) Example:: >>> `get_version('kubelet') (1, 6, 0) """ cmd = '{} --version'.format(bin_na...
"""This code example creates new contacts. To determine which contacts exist, run get_all_contacts.py. Tags: ContactService.createContacts """ __author__ = 'Vincent Tsao' # Locate the client library. If module was installed via "setup.py" script, then # the following two lines are not needed. import os import sys s...
"""This code example creates a new line item to serve to video content. This feature is only available to DFP premium solution networks. To determine which line items exist, run get_all_line_items.py. To determine which orders exist, run get_all_orders.py. To create a video ad unit, run create_video_ad_unit.py. To crea...
### SQL Interface import string import time import random import math import sys, os import sqlite3 import export def cleanUpLine(line): line = string.replace(line,'\n','') line = string.replace(line,'\c','') data = string.replace(line,'\r','') data = string.replace(data,'"','') return data def f...
import github.GithubObject import github.NamedUser class StatsParticipation(github.GithubObject.NonCompletableGithubObject): """ This class represents statistics of participation. The reference can be found here http://developer.github.com/v3/repos/statistics/#get-the-weekly-commit-count-for-the-repo-owner-a...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'core'} import os try: import selinux HAVE_SELINUX = True except ImportError: HAVE_SE...
import sys import time class RPCListener(object): def __init__(self, shutdown_callback): self.shutdown_callback = shutdown_callback self.prefix = '|||| ' self.ever_failed = False self.start_time = time.time() def Log(self, message): # Display the number of milliseconds since startup. # T...
""" Tools for creating discussion content fixture data. """ from datetime import datetime import json import factory import requests from . import COMMENTS_STUB_URL class ContentFactory(factory.Factory): FACTORY_FOR = dict id = None user_id = "dummy-user-id" username = "dummy-username" course_i...
from openerp.osv import osv, fields from openerp.tools.translate import _ from openerp.addons.account.wizard.pos_box import CashBox class PosBox(CashBox): _register = False def run(self, cr, uid, ids, context=None): if not context: context = dict() active_model = context.get('act...
""" Timezone-related classes and functions. This module uses pytz when it's available and fallbacks when it isn't. """ from datetime import datetime, timedelta, tzinfo from threading import local import sys import time as _time try: import pytz except ImportError: pytz = None from django.conf import setting...
# -*- coding: utf-8 -*- #------------------------------------------------------------ # pelisalacarta - XBMC Plugin # Conector para vodbeast # http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/ #------------------------------------------------------------ import re from core import logger from core import scraper...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import sys from nose.plugins.skip import SkipTest if sys.version_info < (2, 7): raise SkipTest("F5 Ansible modules require Python >= 2.7") from ansible.module_utils.basic import AnsibleModule try: f...
import report_webkit_actions # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
from lxml import etree import webob from nova.compute import instance_types from nova.openstack.common import jsonutils from nova import test from nova.tests.api.openstack import fakes FAKE_FLAVORS = { 'flavor 1': { "flavorid": '1', "name": 'flavor 1', "memory_mb": '256', "root_gb"...
""" Testing the test sharded corpus. """ import os # For backwards compatibility with setUpClass and tearDownClass: # import sys # if sys.version_info[0] == 2 and sys.version_info[1] <= 6: # import unittest2 as unittest # else: # import unittest import unittest import random import numpy import shutil from s...
"""tools for finding the smallest eigenvalue and associated eigenvector using Rayleigh-Ritz minimization """ import numpy as np import logging from pele.transition_states import orthogopt from pele.potentials.potential import BasePotential from pele.optimize import MYLBFGS import pele.utils.rotations as rotations __...
from lifeflow.models import Entry, Flow, RecommendedSite, Author, Flow, Language from django.contrib.sites.models import Site from django.conf import settings def blog(request): def make_slug(str): return str.lower().replace(" ","-") recent = Entry.current.all()[:3] random = Entry.current.all().or...
import base64 import os import random import sys import time from datetime import datetime, timedelta try: import cPickle as pickle except ImportError: import pickle from django.conf import settings from django.core.exceptions import SuspiciousOperation from django.utils.hashcompat import md5_constructor from ...
from test_framework.mininode import * from test_framework.test_framework import DankcoinTestFramework from test_framework.util import * import time from test_framework.blocktools import create_block, create_coinbase ''' AcceptBlockTest -- test processing of unrequested blocks. Since behavior differs when receiving un...
""" This module contains all of the GEOS ctypes function prototypes. Each prototype handles the interaction between the GEOS library and Python via ctypes. """ # Coordinate sequence routines. from django.contrib.gis.geos.prototypes.coordseq import (create_cs, get_cs, # NOQA cs_clone, cs_getordinate, cs_setordi...
from django.utils.translation import ugettext_lazy JP_PREFECTURES = ( ('hokkaido', ugettext_lazy('Hokkaido'),), ('aomori', ugettext_lazy('Aomori'),), ('iwate', ugettext_lazy('Iwate'),), ('miyagi', ugettext_lazy('Miyagi'),), ('akita', ugettext_lazy('Akita'),), ('yamagata', ugettext_lazy('Yamagat...
from flask import render_template, request from sprb import sprb from classes.signed_request import SignedRequest import json #import ipdb import os from sforce_custom.partner import SforcePartnerClient # load WSDL declaration file sf = SforcePartnerClient('sprb/partner.wsdl') @sprb.route('/canvas', methods=['POST'...
"""Request body validating middleware for OpenStack Identity resources.""" import functools import inspect from keystone.common.validation import validators from keystone import exception from keystone.i18n import _ def validated(request_body_schema, resource_to_validate): """Register a schema to validate a res...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} import fnmatch import traceback from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.ovirt import ( check_sdk, create_connection, get_dict_o...
import sys class LocalClasses(dict): def add(self, cls): self[cls.__name__] = cls class Config(object): """ This is pretty much used exclusively for the 'jsonclass' functionality... set use_jsonclass to False to turn it off. You can change serialize_method and ignore_attribute, or use ...
import panya import time import serial directions = {'forward': 'w', 'reverse': 's', 'left': 'a', 'right': 'd'} ser = None def init(): global ser try: ser = serial.Serial('/dev/ttyUSB0', 9600) return True except: return False def endit(): global ser ser.close() ser = N...
from Screens.InfoBar import InfoBar from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Components.ActionMap import ActionMap from Components.ConfigList import ConfigListScreen from Components.Label import Label from Components.Sources.StaticText import StaticText from Components.config imp...
"""Compare the speed of downloading URLs sequentially vs. using futures.""" import functools import time import timeit import sys try: from urllib2 import urlopen except ImportError: from urllib.request import urlopen from concurrent.futures import (as_completed, ThreadPoolExecutor, ...
# ======================================= # twilio module support methods # import urllib def post_twilio_api(module, account_sid, auth_token, msg, from_number, to_number, media_url=None): URI = "https://api.twilio.com/2010-04-01/Accounts/%s/Messages.json" \ % (account_sid,) AGENT ...
"""Let's Encrypt compatibility test interfaces""" import zope.interface import letsencrypt.interfaces # pylint: disable=no-self-argument,no-method-argument class IPluginProxy(zope.interface.Interface): """Wraps a Let's Encrypt plugin""" http_port = zope.interface.Attribute( "The port to connect to o...
from weboob.capabilities.geolocip import CapGeolocIp, IpLocation from weboob.tools.backend import Module from weboob.browser.browsers import Browser from weboob.tools.json import json __all__ = ['FreegeoipModule'] class FreegeoipModule(Module, CapGeolocIp): NAME = 'freegeoip' MAINTAINER = u'Julien Veyssier'...
"""Support for scaled softplus, a smoothed version of ReLU.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import function from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops from tens...
"""$_memeq, $_strlen, $_streq, $_regex""" import gdb import re class _MemEq(gdb.Function): """$_memeq - compare bytes of memory Usage: $_memeq(a, b, len) Returns: True if len bytes at a and b compare equally. """ def __init__(self): super(_MemEq, self).__init__("_memeq") def invoke(self, a, b, lengt...
from extensions.interactions import base class CodeRepl(base.BaseInteraction): """Interaction that allows programs to be input.""" name = 'Code Editor' description = 'Allows learners to enter code and get it evaluated.' display_mode = base.DISPLAY_MODE_SUPPLEMENTAL is_trainable = True _depend...
""" Tests for analytics.csvs """ from django.test import TestCase from nose.tools import raises from analytics.csvs import create_csv_response, format_dictlist, format_instances class TestAnalyticsCSVS(TestCase): """ Test analytics rendering of csv files.""" def test_create_csv_response_nodata(self): ...
import math import sys import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab from subprocess import call from scipy.stats import norm # proc = call("ls *.dat",shell=True) # datetime = "170123_2033_" datetime = sys.argv[1]+"_" gasTempDataIn = np.genfromtxt(datetime+"gasTempData.dat",usecols...
"""Text formatting drivers for ureports""" from __future__ import print_function from pylint.reporters.ureports import BaseWriter TITLE_UNDERLINES = [u'', u'=', u'-', u'`', u'.', u'~', u'^'] BULLETS = [u'*', u'-'] class TextWriter(BaseWriter): """format layouts as text (ReStructured inspiration but not tot...
#!/usr/bin/env python3 # # test_codecencodings_cn.py # Codec encoding tests for PRC encodings. # from test import support from test import test_multibytecodec_support import unittest class Test_GB2312(test_multibytecodec_support.TestBase, unittest.TestCase): encoding = 'gb2312' tstring = test_multibytecodec...
"""Embeds Chrome user data files in C++ code.""" import optparse import os import sys import chrome_paths import cpp_source sys.path.insert(0, os.path.join(chrome_paths.GetSrc(), 'build', 'util')) import lastchange def main(): parser = optparse.OptionParser() parser.add_option('', '--version-file') parser.ad...
import socket from django.core.mail import mail_admins, mail_managers, send_mail from django.core.management.base import BaseCommand from django.utils import timezone class Command(BaseCommand): help = "Sends a test email to the email addresses specified as arguments." missing_args_message = "You must specif...
""" 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. The configuration sets the Xcode SYMRO...
from django import forms from django.contrib.auth.hashers import make_password from django.contrib.auth.models import User from django.forms import ModelForm from models import UserProfile class UserForm(ModelForm): password = forms.CharField(widget=forms.PasswordInput) confirm_password = forms.CharField(wid...
from __future__ import division from PySide.QtCore import * from PySide.QtGui import * from datamodel import DataModel import sys,re,csv,copy,operator class ParseDlg(QDialog): def __init__(self, filename, parent=None): super(ParseDlg, self).__init__(parent) self.filename = filename...
#------------------------------------------------------------------------ # RECHERCHE DU CHEMIN LE PLUS RAPIDE ENTRE 2 POINTS A ET B #------------------------------------------------------------------------ #------------------------------------------------------------------------ # PACKAGES from scipy import optimize ...
"""Utility class for multipart UserData scripts.""" import os import gzip from email import encoders from email.mime.text import MIMEText from email.mime.base import MIMEBase from email.mime.multipart import MIMEMultipart class MultipartUserData: """ Combine different types of user-data scripts into a single...
import pytest import numina.exceptions import numina.core.recipes from ..validator import validate from ..validator import only_positive from ..validator import as_list from ..validator import range_validator class RecipeIO(object): def __init__(self, valid=True): self.valid = valid self.was_call...
import os from django.conf import settings from django.core.cache import get_cache from django.core.cache.backends.db import BaseDatabaseCache from django.core.exceptions import ImproperlyConfigured from django.core.management import call_command from django.db.backends.sqlite3.creation import DatabaseCreation class S...
"""Generate and work with PEP 425 Compatibility Tags.""" import sys try: import sysconfig except ImportError: # pragma nocover # Python < 2.7 import distutils.sysconfig as sysconfig import distutils.util def get_abbr_impl(): """Return abbreviated implementation name.""" if hasattr(sys, 'pypy_ve...
"""Script to configure the node daemon. """ import os import os.path import optparse import sys import logging import OpenSSL from cStringIO import StringIO from ganeti import cli from ganeti import constants from ganeti import errors from ganeti import pathutils from ganeti import utils from ganeti import serialize...
# load projection and helper functions import numpy as np import skymapper as skm def getCatalog(size=10000, survey=None): # dummy catalog: uniform on sphere # Marsaglia (1972) xyz = np.random.normal(size=(size, 3)) r = np.sqrt((xyz**2).sum(axis=1)) dec = np.arccos(xyz[:,2]/r) / skm.DEG2RAD - 90 ...
from GUIComponent import GUIComponent from config import KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS, ConfigElement, ConfigText, ConfigPassword from Components.ActionMap import NumberActionMap, ActionMap from enigma import eListbox,...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import taiga.base.db.models.fields class Migration(migrations.Migration): dependencies = [ ('projects', '0015_auto_20141230_1212'), ] operations = [ migrations.CreateModel( ...
import gpodder from gpodder import config, dbsqlite, extensions, model, util class Core(object): def __init__(self, config_class=config.Config, database_class=dbsqlite.Database, model_class=model.Model): # Initialize the gPodder home directory uti...
import gdb def signal_stop_handler (event): if (isinstance (event, gdb.StopEvent)): print "event type: stop" if (isinstance (event, gdb.SignalEvent)): print "stop reason: signal" print "stop signal: %s" % (event.stop_signal) if ( event.inferior_thread is not None) : ...
""" robotparser.py Copyright (C) 2000 Bastian Kleineidam You can choose between two licenses when using this package: 1) GNU GPLv2 2) PSF license for Python 2.2 The robots.txt Exclusion Protocol is implemented as specified in http://www.robotstxt.org/norobots-rfc.txt """ import collections ...
#!/usr/bin/env python # # test_multibytecodec_support.py # Common Unittest Routines for CJK codecs # import codecs import os import re import sys import unittest from httplib import HTTPException from test import test_support from StringIO import StringIO class TestBase: encoding = '' # codec name ...
from ansible.runner.return_data import ReturnData class ActionModule(object): def __init__(self, runner): self.runner = runner def run(self, conn, tmp, module_name, module_args, inject, complex_args=None, **kwargs): ''' transfer the given module name, plus the async module, then run it ''' ...
from __future__ import absolute_import import logging import sys import textwrap from pip.basecommand import Command, SUCCESS from pip.download import PipXmlrpcTransport from pip.index import PyPI from pip.utils import get_terminal_size from pip.utils.logging import indent_log from pip.exceptions import CommandError ...
"""Jobs for statistics views.""" from __future__ import absolute_import # pylint: disable=import-only-modules from __future__ import unicode_literals # pylint: disable=import-only-modules import ast from core import jobs from core.domain import calculation_registry from core.domain import exp_fetchers from core.do...
# -*- coding: utf-8 -*- """ *************************************************************************** SetRasterStyle.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ************************...
import numpy from scipy import linalg import theano from hmc import HMC_sampler def sampler_on_nd_gaussian(sampler_cls, burnin, n_samples, dim=10): batchsize = 3 rng = numpy.random.RandomState(123) # Define a covariance and mu for a gaussian mu = numpy.array(rng.rand(dim) * 10, dtype=theano.config....
# -*- coding: utf-8 -*- """Test config.""" #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ import os.path as op from textwrap import dedent from pytest import fixture from traitlets import Float...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'loopwidget.ui' # # Created by: PyQt5 UI code generator 5.12.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_LoopWidget(object): def setupUi(self, LoopWidget): Loo...
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} import json import collections # COMMON CODE FOR MIGRATION import re from ansible.module_utils.basic import get_exception from ansible.module_utils.netcfg import NetworkConfig, ConfigLine...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: ucs_org short_description: Manages UCS Organizations for UC...
"""Tests python protocol buffers against the golden message. Note that the golden messages exercise every known field type, thus this test ends up exercising and verifying nearly all of the parsing and serialization code in the whole library. TODO(kenton): Merge with wire_format_test? It doesn't make a whole lot of...
# -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User import requests import chardet from utils import redis_conn, q, get_whoosh_ix ''' primary means whether the article is the first similar article added ''' class Article(models.Model): original_url = models.CharF...
#!/usr/bin/env python import argparse import json import conan.conanrepo.conanrepo as conanrepo from subprocess import call def decorated_print(string): print("*" * 60) print('* ' + string) print("*" * 60) def get_login_credentials(config_file, section): try: conan_repo_config = conanrep...
notes = [ [1, -1, 0, 1, 0, -1], [-1, 0, 1, -1, 1, 1], [1, 1, 1, 1, -1, -1], [1, 1, 0, 0, 1, -1], [1, -1, 1, 1, -1, 0]] nb_gens = 5 nb_films = 6 prenoms = ['Alice', 'Bob', 'Charles', 'Daisy', 'Everett'] films = ['007', 'Batman 1', 'Shrek 2', 'Toy Story 3', 'Star Wars 4', 'Twilight 5'] NB_VOISINS = 3 ...
""" Player's health bar TODO: DOC """ # STDLIB import math import random import itertools import sys import thread import time import pygame # GLOBALS from globalvals import * # Base class from entity import Entity class HealthBar(Entity): HEALTH_MAX = SHIP_HEALTH_MAX def __init__(self, x = 0, y = 0, r = 0, g...
import collections import os import sys import time import threading from itertools import chain from ansible import constants as C from ansible.cache.base import BaseCacheModule try: import memcache except ImportError: print 'python-memcached is required for the memcached fact cache' sys.exit(1) class ...
""" Swiss-specific Form helpers """ from __future__ import absolute_import, unicode_literals import re from django.contrib.localflavor.ch.ch_states import STATE_CHOICES from django.core.validators import EMPTY_VALUES from django.forms import ValidationError from django.forms.fields import Field, RegexField, Select f...
from openerp.osv import osv class confirm_statement_line(osv.osv_memory): _name = 'confirm.statement.line' _description = 'Confirm selected statement lines' def confirm_lines(self, cr, uid, ids, context): line_ids = context['active_ids'] line_obj = self.pool.get('account.bank.statement.lin...
from __future__ import absolute_import from kombu import Connection, Exchange, Queue from .case import Case, Mock class SimpleBase(Case): abstract = True def Queue(self, name, *args, **kwargs): q = name if not isinstance(q, Queue): q = self.__class__.__name__ if name...
# -*- coding: utf-8 -*- """ pygments.scanner ~~~~~~~~~~~~~~~~ This library implements a regex based scanner. Some languages like Pascal are easy to parse but have some keywords that depend on the context. Because of this it's impossible to lex that just by using a regular expression lexer like ...
# -*- coding: utf-8 -*- """Deparsing Routines""" import sys, tempfile from StringIO import StringIO from hashlib import sha1 from uncompyle6.semantics.linemap import code_deparse_with_map from uncompyle6.semantics.fragments import ( deparsed_find, code_deparse) import pyficache # FIXME remap filename to a short na...
# -*- 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 'Order.city' db.alter_column(u'djangocms_product_order'...
""" 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 = _ISO8601_TIME_FORMAT_S...
""" Tests for our customized marshmallow Schema """ from __future__ import (absolute_import, division, print_function, unicode_literals) try: from builtins import * # pylint: disable=unused-wildcard-import,redefined-builtin,wildcard-import except ImportError: import sys print("WARNING: Cannot Load builtins...
#!/usr/bin/env python3 # This parser gets all real time interconnection flows from the # Central American Electrical Interconnection System (SIEPAC). import arrow import pandas as pd url = 'http://www.enteoperador.org/newsite/flash/data.csv' def read_data(): """ Reads csv data from the url. Returns a p...
from __future__ import absolute_import import pickle import datetime from django.db import models from django.test import TestCase from .models import Group, Event, Happening, Container, M2MModel class PickleabilityTestCase(TestCase): def setUp(self): Happening.objects.create() # make sure the defaults...
import json from keystoneclient.v3 import client as keystoneclient from zaqarclient.queues.v1 import client as zaqarclient from heat_integrationtests.functional import functional_base class ZaqarWaitConditionTest(functional_base.FunctionalTestsBase): template = ''' heat_template_version: "2013-05-23" resources...
import logging import time from django.core.cache import get_cache, cache from sentry.conf import settings if settings.CACHE_BACKEND != 'default': cache = get_cache(settings.CACHE_BACKEND) # NOQA _cache = cache logger = logging.getLogger(__name__) class UnableToGetLock(Exception): pass class Lock(obj...
#!/usr/bin/python import unittest import random from config import * KICKSTART_FILE = """ # Kickstart file automatically generated by anaconda. install nfs --server=shell.boston.redhat.com --dir=/mnt/redhat/iso/f7-64 lang en_US.UTF-8 keyboard us xconfig --startxonboot network --device eth0 --bootproto dhcp --hostna...
"""OpenElex Api base wrapper""" from future import standard_library standard_library.install_aliases() from collections import OrderedDict from urllib.parse import urljoin import requests API_BASE_URL = "http://openelections.net/api/v1/" BASE_PARAMS = ['format=json', 'limit=0'] def get(base_url=API_BASE_URL, resource...
""" A series of tests to establish that the command-line bash completion works. """ import os import sys import unittest from django.apps import apps from django.core.management import ManagementUtility from django.test.utils import captured_stdout class BashCompletionTests(unittest.TestCase): """ Testing th...
from PyQt4.QtCore import * from PyQt4.QtGui import * import ftools_utils from qgis.core import * from random import * from math import * from ui_frmRegPoints import Ui_Dialog class Dialog(QDialog, Ui_Dialog): def __init__(self, iface): QDialog.__init__(self, iface.mainWindow()) self.iface = iface ...
import headphones.logger import itertools import os import re from configobj import ConfigObj def bool_int(value): """ Casts a config value into a 0 or 1 """ if isinstance(value, basestring): if value.lower() in ('', '0', 'false', 'f', 'no', 'n', 'off'): value = 0 return int(bo...
"""Loading unittests.""" import os import re import sys import traceback import types from functools import cmp_to_key as _CmpToKey from fnmatch import fnmatch from . import case, suite __unittest = True # what about .pyc or .pyo (etc) # we would need to avoid loading the same tests multiple times # from '.py', '....
from django.core.urlresolvers import reverse from django import template from django.utils.translation import ugettext_lazy as _ from horizon import tables from openstack_dashboard import api def get_fixed_ips(port): template_name = 'project/networks/ports/_port_ips.html' context = {"ips": port.fixed_ips} ...
""" Display code blocks in collapsible sections when outputting to HTML. Usage ----- This directive takes a heading to use for the collapsible code block:: .. collapsible-code-block:: python :heading: Some Code from __future__ import print_function print("Hello, Bokeh!") Options ------...
# everything to do with the rubies import pyglet import settings import entity import utils from utils import Vec2d, Point, Rect class Obstacle(entity.Entity): """ In case we want more than one type? """ IMAGE = settings.ANVIL_IMAGE def collided(self, game): game.die() class InfiniteHei...
# # Project: # glideinWMS # # File Version: # $Id: condorMonitor.py,v 1.10.8.1.2.2.6.1 2010/09/22 03:08:53 sfiligoi Exp $ # # Description: # This module implements classes to query the condor daemons # and manipulate the results # Please notice that it also converts \" into " # # Igor Sfiligoi (Aug 30th 20...
from __future__ import absolute_import from __future__ import print_function import warnings from subprocess import Popen, PIPE, STDOUT from os import rename import numpy as np from scipy.interpolate import interp2d, griddata from .material import Material, material_property from . import eos from .tools import co...
# Regex test suite and benchmark suite v1.5a2 # The 3 possible outcomes for each pattern [SUCCEED, FAIL, SYNTAX_ERROR] = range(3) # Benchmark suite (needs expansion) # # The benchmark suite does not test correctness, just speed. The # first element of each tuple is the regex pattern; the second is a # string to matc...
"""Utilities for with-statement contexts. See PEP 343.""" import sys from collections import deque from functools import wraps __all__ = ["contextmanager", "closing", "ContextDecorator", "ExitStack"] class ContextDecorator(object): "A base class or mixin that enables context managers to work as decorators." ...
# -*- coding: utf-8 -*- from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import unittest from app import create_app from app.database import db import app.logic as logic import app.models as models class PackageClass...
from __future__ import unicode_literals import webnotes, json import webnotes.model.doc import webnotes.utils @webnotes.whitelist() def getdoc(doctype, name, user=None): """ Loads a doclist for a given document. This method is called directly from the client. Requries "doctype", "name" as form variables. Will also...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django import forms from django.contrib import admin from django.contrib.auth.admin import UserAdmin as AuthUserAdmin from django.contrib.auth.forms import UserChangeForm, UserCreationForm from .models import User class MyUserChan...