content
string
import pytest import random import redis from distutils.version import StrictVersion from redis.connection import parse_url from unittest.mock import Mock from urllib.parse import urlparse # redis 6 release candidates report a version number of 5.9.x. Use this # constant for skip_if decorators as a placeholder until ...
""" Adhocracy catalog extensions.""" from substanced.catalog import Keyword from adhocracy_core.catalog.adhocracy import AdhocracyCatalogIndexes from adhocracy_core.interfaces import IResource from adhocracy_core.utils import get_sheet_field from adhocracy_mercator.sheets.mercator import IMercatorSubResources from adh...
#! /usr/bin/env python # Remote python server. # Execute Python commands remotely and send output back. # WARNING: This version has a gaping security hole -- it accepts requests # from any host on the Internet! import sys from socket import * import StringIO import traceback PORT = 4127 BUFSIZE = 1024 def main(): ...
import re from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.http import Request, FormRequest, HtmlResponse from scrapy.utils.response import get_base_url from scrapy.utils.url import urljoin_rfc from productloader import load_product from scrapy.http import FormRequest cl...
'''Arsenal login page.''' # Copyright 2015 CityGrid Media, LLC # # 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 ...
import platform import unittest import swift_build_support.host as sbs_host class HostTestCase(unittest.TestCase): def test_system_memory(self): # We make sure that we get an integer back. If we get an integer back, # we know that we at least were able to get some sort of information # f...
import logging import time from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.webdriver.common import utils from selenium.webdriver.remote.command import Command from selenium.webdriver.remote.remote_connection import RemoteConnection from selenium.webdriver.firefox.firefox_b...
"""Non orthogonal point plotting.""" from __future__ import division import numpy as N from ..compat import czip from .. import qtall as qt4 from .. import document from .. import datasets from .. import setting from .. import utils from . import pickable from .nonorthgraph import NonOrthGraph, FillBrush from .widg...
"""Heuristic polynomial GCD algorithm (HEUGCD). """ from __future__ import print_function, division from sympy.core.compatibility import range from .polyerrors import HeuristicGCDFailed HEU_GCD_MAX = 6 def heugcd(f, g): """ Heuristic polynomial GCD in ``Z[X]``. Given univariate polynomials ``f`` and ``g...
__author__ = '<EMAIL> (Jeff Scudder)' import base64 class BasicAuth(object): """Sets the Authorization header as defined in RFC1945""" def __init__(self, user_id, password): self.basic_cookie = base64.encodestring( '%s:%s' % (user_id, password)).strip() def modify_request(self, http_request): ...
data = ( 'Cheng ', # 0x00 'Tiao ', # 0x01 'Zhi ', # 0x02 'Cui ', # 0x03 'Mei ', # 0x04 'Xie ', # 0x05 'Cui ', # 0x06 'Xie ', # 0x07 'Mo ', # 0x08 'Mai ', # 0x09 'Ji ', # 0x0a 'Obiyaakasu ', # 0x0b '[?] ', # 0x0c 'Kuai ', # 0x0d 'Sa ', # 0x0e 'Zang ', # 0x0f 'Qi ', # 0x...
import sys import os import unittest from cStringIO import StringIO from types import ListType from email.test.test_email import TestEmailBase from test.test_support import TestSkipped, run_unittest import email from email import __file__ as testfile from email.iterators import _structure def openfile(filename): ...
"""A library for integrating Python's builtin ``ssl`` library with CherryPy. The ssl module must be importable for SSL functionality. To use this module, set ``CherryPyWSGIServer.ssl_adapter`` to an instance of ``BuiltinSSLAdapter``. """ try: import ssl except ImportError: ssl = None try: from _pyio imp...
"""Nearest Neighbors graph functions""" # # License: BSD 3 clause (C) INRIA, University of Amsterdam import warnings from .base import KNeighborsMixin, RadiusNeighborsMixin from .unsupervised import NearestNeighbors def _check_params(X, metric, p, metric_params): """Check the validity of the input parameters""...
import contextlib import operator from neutron.db import api as db from neutron.plugins.ryu.common import config # noqa from neutron.plugins.ryu.db import api_v2 as db_api_v2 from neutron.tests.unit import test_db_plugin as test_plugin class RyuDBTest(test_plugin.NeutronDbPluginV2TestCase): @staticmethod de...
""" L{URLPath}, a representation of a URL. """ from __future__ import division, absolute_import from twisted.python.compat import ( nativeString, unicode, urllib_parse as urlparse, urlunquote, urlquote ) from hyperlink import URL as _URL _allascii = b"".join([chr(x).encode('ascii') for x in range(1, 128)]) def...
from m5.params import * from m5.proxy import * from Device import BasicPioDevice from X86IntPin import X86IntSourcePin class Cmos(BasicPioDevice): type = 'Cmos' cxx_class='X86ISA::Cmos' time = Param.Time('01/01/2012', "System time to use ('Now' for actual time)") pio_latency = Param.Latency('1n...
"""Ansible integration test infrastructure.""" from __future__ import absolute_import, print_function import contextlib import os import shutil import tempfile from lib.target import ( analyze_integration_target_dependencies, walk_integration_targets, ) from lib.config import ( NetworkIntegrationConfig,...
''' Fetches some urls using aiohttp. Also serves as a minimum example of using aiohttp. Good examples: https://www.enterprisecarshare.com/robots.txt -- 302 redir lacking Location: raises RuntimeError ''' import sys from traceback import print_exc import asyncio import aiohttp import aiohttp.connector async def m...
from __future__ import print_function from django.test.runner import DiscoverRunner from zerver.lib.cache import bounce_key_prefix_for_testing from zerver.views.messages import get_sqlalchemy_connection import os import time import traceback import unittest def slow(expected_run_time, slowness_reason): ''' T...
import unittest2 from openerp.tools import misc class test_countingstream(unittest2.TestCase): def test_empty_stream(self): s = misc.CountingStream(iter([])) self.assertEqual(s.index, -1) self.assertIsNone(next(s, None)) self.assertEqual(s.index, 0) def test_single(self): ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} def main(): module = AnsibleModule( argument_spec=dict( name=dict(r...
""" urllib3 - Thread-safe connection pooling and re-using. """ __author__ = 'Andrey Petrov (<EMAIL>)' __license__ = 'MIT' __version__ = 'dev' from .connectionpool import ( HTTPConnectionPool, HTTPSConnectionPool, connection_from_url ) from . import exceptions from .filepost import encode_multipart_formd...
# coding=utf-8 """ InaSAFE Disaster risk assessment tool developed by AusAid - **Exception Classes.** Custom exception classes for the IS application. Contact : <EMAIL> .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as publishe...
"""Tests for metrics.classification.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.metrics.python.metrics import classification from tensorflow.python.framework import dtypes from tensorflow.python.ops import array_ops from tens...
#!/usr/bin/env python def strlen(a,b): if len(a)<len(b): return -1; elif len(a)>len(b): return 1; else: return 0; def getcommon_prefix(a,b): if a==b: return b; if a[:-1]==b[:-1]: return a[:-1]; else: return "" fil = file("iana_tld.h") left = fil.read().split("(") out=[] for i in range(1,len(left)): ...
"""Gradients for operators defined in tensor_array_ops.py.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import ops from tensorflow.python.ops import tensor_array_ops # TODO(b/31222613): These ops may be differentiable,...
"""Event tracker backend that saves events to a python logger.""" from __future__ import absolute_import import json import logging from django.conf import settings from track.backends import BaseBackend from track.utils import DateTimeJSONEncoder log = logging.getLogger('track.backends.logger') application_log = ...
# django imports from django.db import models from django.conf import settings from django.contrib.auth.models import Group from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.utils.translation import ugettext_lazy as _ # permissions i...
from .common import Benchmark, TYPES1, get_squares import numpy as np class AddReduce(Benchmark): def setup(self): self.squares = get_squares().values() def time_axis_0(self): [np.add.reduce(a, axis=0) for a in self.squares] def time_axis_1(self): [np.add.reduce(a, axis=1) for a...
import requests, re, os, csv from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from lxml import html import socks, socket from collections import OrderedDict from queue import Queue from threading import Thread ...
"""SCons.Tool.BitKeeper.py Tool-specific initialization for the BitKeeper source code control system. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001 - 2014 The SCons Foundation # # Pe...
import pytest from bigchaindb.models import Transaction BLOCKS_ENDPOINT = '/api/v1/blocks/' @pytest.mark.bdb @pytest.mark.usefixtures('inputs') def test_get_block_endpoint(b, client): tx = Transaction.create([b.me], [([b.me], 1)]) tx = tx.sign([b.me_private]) block = b.create_block([tx]) b.write_bl...
"""HMAC (Keyed-Hashing for Message Authentication) Python module. Implements the HMAC algorithm as described by RFC 2104. """ import warnings as _warnings trans_5C = "".join ([chr (x ^ 0x5C) for x in xrange(256)]) trans_36 = "".join ([chr (x ^ 0x36) for x in xrange(256)]) # The size of the digests returned by HMAC ...
from __future__ import unicode_literals from django import forms from django.db.models import Q from django.utils.translation import ugettext_lazy as _ from shuup.admin.form_part import FormPart, TemplatedFormDef from shuup.core.models import ContactGroup, Shop from shuup.customer_group_pricing.models import CgpPrice...
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import division, absolute_import, print_function import sys import numpy as np from numpy.testing import * from numpy.compat import sixu class TestArrayRepr(object): def test_nan_inf(self): x = np.array([np.nan, np.inf]) assert_equal(repr(x...
"""Implementation of JSONDecoder """ import re import sys import struct from simplejson.scanner import make_scanner try: from simplejson._speedups import scanstring as c_scanstring except ImportError: c_scanstring = None __all__ = ['JSONDecoder'] FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL def _floatconst...
import uuid import httpretty from keystoneclient.tests.v3 import utils from keystoneclient.v3 import projects class ProjectTests(utils.TestCase, utils.CrudTests): def setUp(self): super(ProjectTests, self).setUp() self.key = 'project' self.collection_key = 'projects' self.model =...
''' Runs various chrome tests through asan_test.py. Most of this code is copied from ../valgrind/chrome_tests.py. TODO(glider): put common functions to a standalone module. ''' import glob import logging import optparse import os import stat import sys import logging_utils import path_utils import common import asa...
# -*- coding: utf-8 -*- """ pygments.filters ~~~~~~~~~~~~~~~~ Module containing filter lookup functions and default filters. :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.token import String, Comment, Ke...
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2018 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...
unites = { 0: '', 1:'un', 2:'deux', 3:'trois', 4:'quatre', 5:'cinq', 6:'six', 7:'sept', 8:'huit', 9:'neuf', 10:'dix', 11:'onze', 12:'douze', 13:'treize', 14:'quatorze', 15:'quinze', 16:'seize', 21:'vingt et un', 31:'trente et un', 41:'quarante et un', 51:'cinquante et un', 61:'soixante et un', 71:'septa...
"""The tests for the calendar component.""" from datetime import timedelta from homeassistant.bootstrap import async_setup_component import homeassistant.util.dt as dt_util async def test_events_http_api(hass, hass_client): """Test the calendar demo view.""" await async_setup_component(hass, "calendar", {"ca...
import os import glob import pandas import bisect from .MooseDataFrame import MooseDataFrame from . import message class VectorPostprocessorReader(object): """ A Reader for MOOSE VectorPostprocessor data. Args: pattern[str]: A pattern of files (for use with glob) for loading. MOOSE outputs Ve...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import pytest 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.compat.tests import unittest from ans...
import os import sys import shutil import django django.setup() # dashboard from main.models import Job, SIP # archivematicaCommon from custom_handlers import get_script_logger from databaseFunctions import createSIP if __name__ == '__main__': logger = get_script_logger("archivematica.mcp.client.generateDIPFromA...
"""Handle version information related to Visual Stuio.""" import errno import os import re import subprocess import sys import gyp import glob class VisualStudioVersion(object): """Information regarding a version of Visual Studio.""" def __init__(self, short_name, description, solution_version, p...
import functools import sympy class Model: """ A model organizes symbols, expressions and replacements rules by name. Example: #!python >>> model = Model() >>> model.add_symbols('y', 'x', 'm', 'b') >>> y, m, x, b = model.get_symbols('y', 'x', 'm', 'b') >>> model.ex...
"""Test Local Media Source.""" import ast import pytest from homeassistant.components import media_source from homeassistant.components.media_source import const from homeassistant.components.media_source.models import PlayMedia from homeassistant.components.netatmo import DATA_CAMERAS, DATA_EVENTS, DOMAIN from homea...
# Script for building the _ssl and _hashlib modules for Windows. # Uses Perl to setup the OpenSSL environment correctly # and build OpenSSL, then invokes a simple nmake session # for the actual _ssl.pyd and _hashlib.pyd DLLs. # THEORETICALLY, you can: # * Unpack the latest SSL release one level above your main Python ...
"""Utility to re-use variables created on first device on subsequent devices.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import re _VARIABLE_UNIQUIFYING_REGEX = re.compile(r"_\d/") _VARIABLE_UNIQUIFYING_REGEX_AT_END = re.compile(r"_\d$") def _can...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import json import time import traceback from distutils.version import LooseVersion try: ...
from datetime import datetime import logging import pandas as pd import sys from airflow import configuration, settings from airflow.jobs import SchedulerJob from airflow.models import DagBag, DagModel, DagRun, TaskInstance from airflow.utils.state import State SUBDIR = 'scripts/perf/dags' DAG_IDS = ['perf_dag_1', 'p...
"""This module has supporting functions for the caching logic used in world.py. Each cache class should implement the standard container type interface (__getitem__ and __setitem__), as well as provide a "hits" and "misses" attribute. """ import functools import logging import cPickle class LRUCache(object): """...
"""Base classes for worker pools. """ import logging import threading import heapq import itertools from ganeti import compat from ganeti import errors _TERMINATE = object() _DEFAULT_PRIORITY = 0 class DeferTask(Exception): """Special exception class to defer a task. This class can be raised by L{BaseWorker...
import sys #compatibility try: input = raw_input except NameError: pass class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' colors = { 'GREEN': bcolors.OKGRE...
"""Test the secrets module. As most of the functions in secrets are thin wrappers around functions defined elsewhere, we don't need to test them exhaustively. """ from ..pep506 import secrets import unittest import string # For Python 2/3 compatibility. try: unicode except NameError: # Python 3. unicode...
class StatusInfo(object): """ Describes a status message. """ def __init__(self, status_type=None, normal=None, status=None, message=None): self.status_type = status_type self.normal = normal self.status = status self.message = message def __repr__(self): re...
''' This script will delete dependences from *.vcp files. After using this script, next time when you will try to save project, you will have wait until 'Visual Tools' will rebuild all dependencies and this process might take HUGE amount of time Author : Viktor Voroshylo ''' __version__='$Revision$'[11:-2] import sys...
from nova.compute import arch from nova.compute import hv_type from nova.compute import vm_mode from nova import objects from nova.tests.unit.objects import test_objects spec_dict = { 'arch': arch.I686, 'hv_type': hv_type.KVM, 'vm_mode': vm_mode.HVM } spec_list = [ arch.I686, hv_type.KVM, vm_...
from django.conf import settings from django.utils.six.moves.urllib.parse import urlparse from wagtail.wagtailcore.models import Page class BadRequestError(Exception): pass class URLPath(object): """ This class represents a URL path that should be converted to a full URL. It is used when the domai...
""" PLN Deduction Example Demonstrates how to run the example in deduction_agent.py when when interacting with PLN from a standalone Python environment for development or testing purposes. The normal use case is to run the example from the CogServer, for which you should use deduction_agent.py instead. """ from __fut...
from django.db import models from django.template.defaultfilters import default # Create your models here. class Membresia(models.Model): MODALIDAD_CHOICES=( #('D','Diario'), ('M','Mensual'), #('S','Semestral'), #('A','Anual'), ) STATE_CHOICES=( ('A','Activo'), ...
import copy import mock import testtools from nova import test from nova.tests.functional import api_samples_test_base class TestCompareResult(test.NoDBTestCase): """Provide test coverage for result comparison logic in functional tests. _compare_result two types of comparisons, template data and sample...
import argparse import json parser = argparse.ArgumentParser(description="Diff between two runs of performance tests.") parser.add_argument("file1", help="the first output json from runner") parser.add_argument("file2", help="the second output json from runner") args = parser.parse_args() def load_data(filename): ...
from __future__ import print_function, absolute_import import os import signal import sys import netlib.version import netlib.version_check from . import version, cmdline from .proxy import process_proxy_options, ProxyServerError from .proxy.server import DummyServer, ProxyServer def assert_utf8_env(): spec = "" ...
import os import shutil import threading import time import traceback from lib.FileManager.FM import REQUEST_DELAY from lib.FileManager.WebDavConnection import WebDavConnection from lib.FileManager.workers.baseWorkerCustomer import BaseWorkerCustomer class MoveFromWebDav(BaseWorkerCustomer): def __init__(self, s...
""" This module adds shared support for generic cloud modules In order to use this module, include it as part of a custom module as shown below. from ansible.module_utils.cloud import * The 'cloud' module provides the following common classes: * CloudRetry - The base class to be used by other cloud prov...
""" Asynchronous unit testing framework. Trial extends Python's builtin C{unittest} to provide support for asynchronous tests. Maintainer: Jonathan Lange Trial strives to be compatible with other Python xUnit testing frameworks. "Compatibility" is a difficult things to define. In practice, it means that: - L{twist...
# -*- coding: utf-8 -*- from __future__ import with_statement import binascii import re import Crypto.Cipher.AES from module.plugins.captcha.SolveMedia import SolveMedia from module.plugins.internal.Captcha import Captcha from module.plugins.internal.Crypter import Crypter from module.plugins.internal.misc import fs...
import unittest from django.test import TestCase from data_aggregator.cache import DataAggregatorGCSCache class TestDataAggregatorGCSCache(TestCase): def test_get_cache_expiration_time(self): cache = DataAggregatorGCSCache() # valid urls self.assertEqual( cache.get_cache_expir...
# Natural Language Toolkit # String Comparison Module """ String Comparison Module. Author: Tiago Tresoldi <<EMAIL>> Based on previous work by Qi Xiao Yang, Sung Sam Yuan, Li Zhao, Lu Chun, and Sung Peng. """ def stringcomp (fx, fy): """ Return a number within C{0.0} and C{1.0} indicating the similarity betw...
import json import logging import sys from django.conf import settings from django.core.validators import ValidationError, validate_email from django.views.decorators.csrf import requires_csrf_token from django.views.defaults import server_error from django.http import (Http404, HttpResponse, HttpResponseNotAllowed, ...
# encoding: utf-8 from __future__ import unicode_literals import re import itertools from .common import InfoExtractor from ..compat import ( compat_str, compat_urlparse, compat_urllib_parse, ) from ..utils import ( ExtractorError, int_or_none, unified_strdate, ) class SoundcloudIE(InfoExtra...
import base64 import calendar import datetime import re import unicodedata import warnings from binascii import Error as BinasciiError from email.utils import formatdate from urllib.parse import ( ParseResult, SplitResult, _coerce_args, _splitnetloc, _splitparams, quote, quote_plus, scheme_chars, unquote, unquo...
import binascii import struct from django.forms import ValidationError from .const import ( GDAL_TO_POSTGIS, GDAL_TO_STRUCT, POSTGIS_HEADER_STRUCTURE, POSTGIS_TO_GDAL, STRUCT_SIZE, ) def pack(structure, data): """ Pack data into hex string with little endian format. """ return binascii.hexli...
from __future__ import print_function # Assuming you are using the mock library to ... mock things try: from unittest import mock from unittest.mock import call, MagicMock # In Python 3, mock is built-in from io import StringIO except ImportError: import mock from mock import call, MagicMock # Pyt...
from . import exclusions from .. import schema, event from . import config __all__ = 'Table', 'Column', table_options = {} def Table(*args, **kw): """A schema.Table wrapper/hook for dialect-specific tweaks.""" test_opts = dict([(k, kw.pop(k)) for k in kw.keys() if k.startswith('test_'...
# -*- coding: Cp1251 -*- ############################################################################### # ''' ''' __author__ = "Oleg Noga" __date__ = "$Date: 2005/12/07 19:53:53 $" __version__ = "$Revision: 1.2 $" # $Source: D:/HOME/cvs/toolib/wx/util/ControlHost.py,v $ ###############################################...
""" Bound attributes are attributes that are bound to a specific class and a specific name. In SQLObject a typical example is a column object, which knows its name and class. A bound attribute should define a method ``__addtoclass__(added_class, name)`` (attributes without this method will simply be treated as normal...
"""Numpy based CPU backend for PyCBC Array """ from __future__ import absolute_import import numpy as _np from pycbc.types.array import common_kind, complex128, float64 from . import aligned as _algn from scipy.linalg import blas from weave import inline from pycbc.opt import omp_libs, omp_flags from pycbc import WEAVE...
"""Autoencoder model for training on spectrograms.""" from magenta.contrib import training as contrib_training from magenta.models.nsynth import utils import numpy as np import tensorflow.compat.v1 as tf import tf_slim as slim def get_hparams(config_name): """Set hyperparameters. Args: config_name: Name of c...
from __future__ import absolute_import from google.cloud.monitoring_v3 import types from google.cloud.monitoring_v3.gapic import alert_policy_service_client from google.cloud.monitoring_v3.gapic import enums from google.cloud.monitoring_v3.gapic import group_service_client from google.cloud.monitoring_v3.gapic import ...
#!/usr/bin/env python3 import requests import sys def get_all(): page_num = 1 price_data = '' while True: req = requests.get("http://coinbase.com/api/v1/prices/historical?page="+str(page_num)) if req.status_code == 200: price_data += '\n' + req.text else: pr...
from django.contrib import admin from import_export import resources from import_export.admin import ImportExportModelAdmin from import_export.admin import ImportExportActionModelAdmin from gda.models import Questionnaire, Question, Choice, Answer ## Questionnaires # Class to import and export Questionnaire class Qu...
from django.contrib.staticfiles.testing import StaticLiveServerTestCase from selenium import webdriver from django.contrib.auth.models import User class TestLogin(StaticLiveServerTestCase): def setUp(self): self.username = 'alice' self.email = '<EMAIL>' self.password = 'test' User.o...
# This file provides common utility functions for the test suite. from clang.cindex import Cursor from clang.cindex import TranslationUnit def get_tu(source, lang='c', all_warnings=False, flags=[]): """Obtain a translation unit from source and language. By default, the translation unit is created from source...
""" Configuration modules for pyflag. PyFlag is a complex package and requires a flexible configuration system. The following are the requirements of the configuration system: 1) Configuration must be available from a number of sources: - Autoconf must be able to set things like the python path (in case pyfl...
# -*- coding: utf-8 -*- """ Separate module to handle vocabulary expansions. The L{cache} module takes care of caching vocabulary graphs; the L{process} module takes care of the expansion itself. @organization: U{World Wide Web Consortium<http://www.w3.org>} @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan...
# encoding: utf-8 import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): for survey_user in orm['survey.SurveyUser'].objects.all(): assert survey_user.user.count() <= 1, survey_user.global...
import unittest import plistlib import os import datetime from test import support # This test data was generated through Cocoa's NSDictionary class TESTDATA = b"""<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" \ "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist ver...
import os import shutil import sys import tempfile import types import uuid from collections import defaultdict from mozlog import reader from mozlog import structuredlog import expected import manifestupdate import testloader import wptmanifest import wpttest from vcs import git manifest = None # Module that will b...
from collections import defaultdict from datetime import timedelta from sqlalchemy import func from sqlalchemy.orm import load_only from ichnaea.models import ( ApiKey, OCIDCell, ) from ichnaea import util class ApiKeyLimits(object): def __init__(self, task, session): self.task = task s...
""" This module contains generic widgets for use on web pages. A widget typically represents an input, and includes functionality for parsing and validating data. """ import time, os, datetime from mod_python import apache import andp.view.web class Widget(object): """ Abstract base class for all widget...
""" Check that all of the certs on all service endpoints validate. """ import unittest from tests.integration import ServiceCertVerificationTest import boto.cloudformation class CloudFormationCertVerificationTest(unittest.TestCase, ServiceCertVerificationTest): cloudformation = True regions = boto.cloudform...
from django.contrib.auth.backends import ModelBackend from ..utils import get_user_model from .utils import filter_users_by_email from .app_settings import AuthenticationMethod from . import app_settings class AuthenticationBackend(ModelBackend): def authenticate(self, **credentials): ret = None ...
''' Name: Sebastian Lloret Recitation TA: Brennan Mcconnell Assignment #: 8 ''' # Used to properly break the file into rows import csv def CreateDictionary(fileName): slangDictionary = {} # With just ensures a resource is cleaned even if exceptions are thrown. # I had to use "rU" for universal n...
import re import webob from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova import compute from nova import exception from nova.openstack.common.gettextutils import _ authorize = extensions.extension_authorizer('compute', 'console_output') class ConsoleOutputController(wsgi.Contr...
from django.conf.urls import patterns, include, url from django.views.generic import TemplateView, RedirectView from django.conf import settings #from django.views.generic.simple import redirect_to, direct_to_template from django.shortcuts import render,redirect urlpatterns = patterns('core.views.main_views', url(...
"""This file contains the default (English) substitutions for the PyAIML kernel. These substitutions may be overridden by using the Kernel.loadSubs(filename) method. The filename specified should refer to a Windows-style INI file with the following format: # lines that start with '#' are comments # The 'gen...