content
stringlengths
4
20k
import json import uuid from django.core import exceptions, serializers from django.db import IntegrityError, models from django.test import ( SimpleTestCase, TestCase, TransactionTestCase, skipUnlessDBFeature, ) from .models import ( NullableUUIDModel, PrimaryKeyUUIDModel, RelatedToUUIDModel, UUIDGrandchild,...
import os import json from urlparse import urlparse def update(data): conf = read() conf.update(data) return save(data) def read(): conf = dict() for k, v in os.environ.items(): if k.startswith('REALMS_'): conf[k[7:]] = v loc = get_path() if loc: with open(...
""" ============================================================== Compute coherence in source space using a MNE inverse solution ============================================================== This example computes the coherence between a seed in the left auditory cortex and the rest of the brain based on single-trial...
import crm_lead_report import crm_partner_report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
""" Support import export formats.""" from __future__ import absolute_import as _abs import numpy as np from .... import symbol from .... import ndarray as nd from ....base import string_types from ._import_helper import _convert_map as convert_map class GraphProto(object): # pylint: disable=too-few-public-methods ...
CAMERA_MODE_PHOTO2 = 100 CAMERA_MODE_PHOTO = 0 CAMERA_MODE_FACE_BEAUTY = 1 CAMERA_MODE_PANORAMA = 2 CAMERA_MODE_SELF_WIDEVIEW = 3 CAMERA_MODE_SCENE_FRAME = 4 CAMERA_MODE_GESTURE_SHOT = 5 CAMERA_MODE_LIVE_PHOTO = 6 CAMERA_MODE_VIDEO = 7 CAMERA_MODE_PROFESSIONAL = 8 CAMERA_MODE_NIGHTSHOT = 9 CAMERA_MODE_PIP = 10 CAMERA_M...
import requests from .Backup import Backup from .BackupContainer import BackupContainer from .Bridge import Bridge from .BridgeCreate import BridgeCreate from .BridgeCreateSetting import BridgeCreateSetting from .CPUInfo import CPUInfo from .CPUStats import CPUStats from .CloudInit import CloudInit from .Cluster impo...
import six from yaql.language import specs from yaql.language import yaqltypes from murano.common import engine from murano.dsl import constants from murano.dsl import dsl from murano.dsl import helpers from murano.dsl import yaql_integration class MockContextManager(engine.ContextManager): def __init__(self): ...
# -*- coding: utf-8 -*- """ zine.utils.datastructures ~~~~~~~~~~~~~~~~~~~~~~~~~ Various data structures. :copyright: (c) 2010 by the Zine Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from itertools import izip, imap from copy import deepcopy class _Missing...
#----------------------------------------------------------------------------- # class used to store graded responses to CAPA questions # # Used by responsetypes and capa_problem class CorrectMap(object): """ Stores map between answer_id and response evaluation result for each question in a capa problem. ...
""" Spaces specific to the RNN framework, specifically the SequenceSpace """ from __future__ import print_function from functools import wraps import numpy as np from theano import scan, config from theano import tensor from theano.tensor import TensorType from pylearn2 import space from pylearn2.space import Conv2DS...
from pyvows import Vows, expect from thumbor.point import FocalPoint @Vows.batch class FocalPointVows(Vows.Context): class DefaultAlignmentPercentages(Vows.Context): def topic(self): return FocalPoint.ALIGNMENT_PERCENTAGES def should_have_left_alignment_of_0(self, topic): ...
#! /usr/bin/env python import sys, os import ddlib # DeepDive python utility ARR_DELIM = '~^~' # Load keyword dictionaries using ddlib, for domain-specific features # Words in "married" dictionary are indicative of marriage # Words in "non_married" dictionary are indicative of non_marriage BASE_DIR = os.path.dir...
from collections import OrderedDict import logging from django.utils.http import urlencode from django.utils.translation import ugettext_lazy as _ import six from horizon import exceptions from novaclient import exceptions as nova_exception from openstack_dashboard import api LOG = logging.getLogger(__name__) CON...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division, print_function __all__ = ["results"] import os import triangle import numpy as np import cPickle as pickle import matplotlib.pyplot as pl def results(fn): model, sampler = pickle.load(open(fn, "rb")) mu = np.median(model.f) ...
{ 'name': 'Aeroo Reports - Print Screen Addon', 'version': '1.2', 'category': 'Generic Modules/Aeroo Reporting', 'description': """ Replaces original OpenERP's "Printscreen List" report. This report produces ODF spreadsheet file (ods) with all fields visible on the view. This is useful report for rapid ...
class Event(object): '''Represent events from the console.''' def __init__(self, console, input): pass def __repr__(self): '''Display an event for debugging.''' if self.type in ['KeyPress', 'KeyRelease']: chr=self.char if ord(chr)<ord("A"): chr...
"Functions that help with dynamically creating decorators for views." try: from functools import wraps, update_wrapper, WRAPPER_ASSIGNMENTS except ImportError: from django.utils.functional import wraps, update_wrapper, WRAPPER_ASSIGNMENTS # Python 2.4 fallback. class classonlymethod(classmethod): def __g...
from spack import * class Gasnet(AutotoolsPackage): """GASNet is a language-independent, low-level networking layer that provides network-independent, high-performance communication primitives tailored for implementing parallel global address space SPMD languages and libraries such as UPC, Co...
from smart.cache import PackageInfo, Loader from smart.backends.rpm.base import * from smart import * import posixpath import locale import rpm import os from xml.parsers import expat BYTESPERPKG = 3000 class RPMRedCarpetPackageInfo(PackageInfo): def __init__(self, package, loader, info): PackageInfo.__...
import sys from SimpleXMLRPCServer import SimpleXMLRPCServer from remoteserver import announce_port class SimpleServer(SimpleXMLRPCServer): def __init__(self, port=8270, port_file=None): SimpleXMLRPCServer.__init__(self, ('127.0.0.1', int(port))) self.register_function(self.get_keyword_names) ...
# -*- coding: utf-8 -*- """Scripts for aggregating recently added logs by action type; pushes results to the specified project. """ import bson import datetime from cStringIO import StringIO import pymongo from framework.mongo import database from website import models from website.app import app, init_app from sc...
"""Define the ``Feed`` class for handling a list of feeds """ import codecs as _codecs import collections as _collections import os as _os import json as _json import pickle as _pickle import sys as _sys from . import LOG as _LOG from . import config as _config from . import error as _error from . import feed as _fee...
# coding: utf-8 from __future__ import absolute_import import re from typing import Any, Dict # NOQA from ruamel.yaml.error import * # NOQA from ruamel.yaml.nodes import * # NOQA from ruamel.yaml.compat import string_types __all__ = ['BaseResolver', 'Res...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('usage', '0003_pagehit_summarized'), ]...
from functools import partial from collections import namedtuple from .exception import NoConnectorUnitError __all__ = ['Backend'] class BackendRegistry(object): """ Hold a set of backends """ def __init__(self): self.backends = set() def register_backend(self, backend): """ Register an ...
"""Test the wallet accounts properly when there are cloned transactions with malleated scriptsigs.""" from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * class TxnMallTest(BitcoinTestFramework): def __init__(self): super().__init__() self.num_nodes = 4...
""" WSGI config for mysite project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` s...
###################################################################### # This file should be kept compatible with Python 2.3, see PEP 291. # ###################################################################### import sys, os # find_library(name) returns the pathname of a library, or None. if os.name == "nt": ...
from optparse import make_option from django.core.management.base import BaseCommand from django.utils.six.moves import input from treeherder.model.models import Datasource, Repository class Command(BaseCommand): help = ("Populate the datasource table and" "create the connected databases") opti...
Latin5_BulgarianCharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 2...
# -*- coding: utf-8 -*- """ plugins/elevations.py - Show distribution of found caches by elevation. Copyright (C) 2010 Petr Morávek This file is part of Pyggs. Pyggs is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the...
""" Provides classes for managing the content unit manifest. The manifest is a json encoded file that defines content units associated with repository. The units themselves are stored in a separate json encoded file. For performance reasons, the unit files are compressed. """ import os import gzip import errno from...
# -*- coding: utf-8 -*- """ *************************************************************************** SpatialIndex.py --------------------- Date : January 2016 Copyright : (C) 2016 by Alexander Bruy Email : alexander dot bruy at gmail dot com ************...
from django.core.exceptions import MultipleObjectsReturned from django.core.management.base import BaseCommand from optparse import OptionParser, make_option from poll.models import Poll, Response, ResponseCategory from education.models import EmisReporter from script.models import ScriptSession, Script from rapidsms_...
from django.conf import settings from django.contrib.auth import REDIRECT_FIELD_NAME from django.contrib.auth.views import redirect_to_login from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.utils import six from django.utils.encoding import force_text class AccessMixin(object): ...
""" Locking functionality when launching things from the command line. Uses a pidfile. This prevents multiple identical workflows to be launched simultaneously. """ from __future__ import print_function import hashlib import os from luigi import six def getpcmd(pid): """ Returns command of process. :pa...
from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import compat_str from ..utils import ( int_or_none, parse_age_limit, ) class BreakIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?(?P<site>break|screenjunkies)\.com/video/(?P<display_id>[^/]+?)(?:-(?P...
__author__ = 'Rick Dean' __doc__ = ' ' #Created by Rick on 2017-03-19. import re import csv type_map = dict(byte=int, int=int, long=int, float=float, double=float) var_info = [] names = [] for line in open('2002FemPreg.dct'): match = re.search( r'_column\(([^)]*)\)', line) if match: start = int(match.group(1...
import analytic_journal import analytic_balance import inverted_analytic_balance import cost_ledger import quantity_cost_ledger # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
from odoo import models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" def _partner_names_order_selection(self): options = super(ResConfigSettings, self)._partner_names_order_selection() new_labels = { "last_first": "Lastname SecondLastname Firstn...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Date : 2017/10/18 17:08 # @Author : xxc727xxc (<EMAIL>) # @Version : 1.0.0 import asyncio import logging.config from aiohttp import web import core.orm.orm as orm from biz.controller.middlewares import auth_factory, log_factory, response_factory from config import...
""" Copyright 2015 Rackspace 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 writing, software dist...
# Double Bucklin party list (Webster-based) import numpy as np from scipy.optimize import bisect lcr_names = ["Left", "Center", "Right"] lcr = np.array([ [10, 5, 0], [0, 5, 10], [6, 10, 0], [0, 10, 5] ]) lcr_weights = [3, 3, 1, 1] # https://en.wikipedia.org/wiki/Webster/Sainte-Lagu%C3%AB_method sainte_seats = ...
""" ============== Array indexing ============== Array indexing refers to any use of the square brackets ([]) to index array values. There are many options to indexing, which give numpy indexing great power, but with power comes some complexity and the potential for confusion. This section is just an overview of the v...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from collections import MutableMapping from ansible.utils.vars import merge_hash class AggregateStats: ''' holds stats about per-host activity during playbook runs ''' def __init__(self): self.processed = {} ...
import os import re from time import sleep from framework.templates import TermineterModuleOptical from framework.utilities import StringGenerator class BruteForce: def __init__(self, dictionary_path=None): if dictionary_path == None: self.dictionary = None else: self.dictionary = open(dictionary_path, 'r'...
# An object oriented approach to geometric problems with convex sets. # Convex sets can be used as Variables. import cvxpy as cvx import cvxpy.lin_ops.lin_utils as lu import numpy.linalg as la class ConvexSet(cvx.Variable): # elem - a Variable representing an element of the set. # constr_func - a function tha...
#!/usr/bin/python """ Generate the big keycodes table for virkeys. It read keymaps.csv from stdin and put the generated code to stdout. Please keep keymaps.csv be exactly the same as: http://git.gnome.org/browse/gtk-vnc/plain/src/keymaps.csv. If anything inconsistent happens, please change this file instead of keymap...
import os import sys from functools import wraps from testconfig import dsn try: import unittest2 unittest = unittest2 except ImportError: import unittest unittest2 = None if hasattr(unittest, 'skipIf'): skip = unittest.skip skipIf = unittest.skipIf else: import warnings def skipIf(c...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import time import twisted from twisted.internet.utils import getProcessOutputAndValue from twisted.python import versions from twisted.trial import unittest from buildbot.scripts import ...
"""Support for BT Smart Hub (Sometimes referred to as BT Home Hub 6).""" from collections import namedtuple import logging from btsmarthub_devicelist import BTSmartHub import voluptuous as vol from homeassistant.components.device_tracker import ( DOMAIN, PLATFORM_SCHEMA, DeviceScanner, ) from homeassistan...
"""Common layers used in the sparse transformer.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools from tensor2tensor.layers import common_layers import tensorflow.compat.v1 as tf from state_of_sparsity.sparse_transformer.layers import co...
from __future__ import unicode_literals import frappe out = frappe.response from frappe.utils import cint import frappe.defaults def get_sql_tables(q): if q.find('WHERE') != -1: tl = q.split('FROM')[1].split('WHERE')[0].split(',') elif q.find('GROUP BY') != -1: tl = q.split('FROM')[1].split('GROUP BY')[0].spli...
from socket import * from optparse import OptionParser import sys print "[*********************************************************************]" print "[* *]" print "[* BigAnt Server PreAuth Remote SEH Overflow (0day) *]" print "[* ...
import cgi import getpass import mimetypes import os import re import shutil import sys import tempfile from pip.backwardcompat import (md5, copytree, xmlrpclib, urllib, urllib2, urlparse, string_types, HTTPError) from pip.exceptions import InstallationError from pip.util import (splitex...
#!/usr/local/bin/python """ This script converts a subset of SVG into an HTML imagemap Note *subset*. It only handles <path> elements, for which it only pays attention to the M and L commands. Futher, it only notices the "translate" transform. It was written to generate the examples in the documentation f...
"""Email address parsing code. Lifted directly from rfc822.py. This should eventually be rewritten. """ __all__ = [ 'mktime_tz', 'parsedate', 'parsedate_tz', 'quote', ] import time, calendar SPACE = ' ' EMPTYSTRING = '' COMMASPACE = ', ' # Parse a date field _monthnames = ['jan', 'feb', 'mar',...
#!/usr/bin/env python import argparse import contextlib import copy import csv import json import urllib2 import urlparse import uuid from datetime import date def is_url(file_path_or_url): return urlparse.urlparse(file_path_or_url).scheme != '' @contextlib.contextmanager def open_file_path_or_url(file_path_or_...
#!@PYTHON@ # mass-link.py # USAGE: mass-link.py [--prepend-suffix SUFFIX] symbolic | hard SOURCEDIR DESTDIR FILES # # create hard or symbolic links to SOURCEDIR/FILES in DESTDIR # # If symbolic or hard links are not provided by the operating system, # copies will be made instead. However, if the operating syste...
#!/usr/bin/env python3 import json import logging from multiprocessing import Process, Queue, current_process from collections import OrderedDict from copy import copy import numpy as np import click from params import load_params logging.basicConfig(level=logging.INFO, format="%(asctime)s - %...
# this makes ctypes friendlier (for me, anyways) from ctypes import * ## page permissions PAGE_EXECUTE = 0x10 PAGE_EXECUTE_READ = 0x20 PAGE_EXECUTE_READWRITE = 0x40 PAGE_EXECUTE_WRITECOPY = 0x80 PAGE_NOACCESS = 0x01 PAGE_READONLY = 0x02 PAGE_READWRITE = 0x04 PAGE_WRITECOPY = 0x08 PAGE_GUARD = 0x100 PAGE_NOCACHE = 0x20...
""" ============================ Classifier Chain ============================ Example of using classifier chain on a multilabel dataset. For this example we will use the `yeast <https://www.openml.org/d/40597>`_ dataset which contains 2417 datapoints each with 103 features and 14 possible labels. Each data point has ...
# -*- coding: utf-8 -*- """ One variant of the Fermat test that cannot be fooled is called the Miller-Rabin test (Miller 1976; Rabin 1980). This starts from an alternate form of Fermat's Little Theorem, which states that if n is a prime number and a is any positive integer less than n, then a raised to the (n - 1)st po...
class Message(object): message = '' message_args = () def __init__(self, filename, lineno): self.filename = filename self.lineno = lineno def __str__(self): return '%s:%s: %s' % (self.filename, self.lineno, self.message % self.message_args) class UnusedImport(Message): mess...
""" Using nipype with persistence and lazy recomputation but without explicit name-steps pipeline: getting back scope in command-line based programming. Change directory to provide relative paths for doctests >>> import os >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) >>> datadir = os.path...
__author__ = ('Christian Osendorfer, <EMAIL>;' 'Justin S Bayer, <EMAIL>' 'SUN Yi, <EMAIL>') from scipy import random, outer, zeros, ones from pybrain.datasets import SupervisedDataSet, UnsupervisedDataSet from pybrain.supervised.trainers import Trainer from pybrain.utilities import abstrac...
import wizard #import pooler import locale import time from openerp.tools.translate import _ account_form = '''<?xml version="1.0"?> <form string="Select parent account"> <field name="account_list" colspan="4"/> </form>''' account_fields = { 'account_list': {'string':'Account', 'type':'many2many', 'relation':...
__doc__ = """ gyptest.py -- test runner for GYP tests. """ import os import optparse import subprocess import sys class CommandRunner: """ Executor class for commands, including "commands" implemented by Python functions. """ verbose = True active = True def __init__(self, dictionary={}): self.subs...
"""Profiling support for unit and performance tests. These are special purpose profiling methods which operate in a more fine-grained way than nose's profiling plugin. """ import os import sys from .util import gc_collect from . import config import pstats import collections import contextlib try: import cProfi...
''' @author: jnaous ''' from django.db import models from expedient.clearinghouse.aggregate.models import Aggregate from expedient.common.extendable.models import Extendable from expedient.clearinghouse.slice.models import Slice from expedient.common.utils.validators import asciiValidator from datetime import datetime ...
import asyncore import base64 import email from email.parser import Parser from email.header import decode_header import re import signal import smtpd import threading import time from addresses import decodeAddress from debug import logger from helper_sql import sqlExecute from helper_threading import StoppableThread...
from conans import ConanFile, CMake, tools, ConfigureEnvironment import os import shutil class ProtobufConan(ConanFile): name = "Protobuf" version = "2.6.1" url = "https://github.com/memsharded/conan-protobuf.git" license = "https://github.com/google/protobuf/blob/v2.6.1/LICENSE" requires = "zlib/...
Token = None Lexer = None Parser = None TokenStream = None ATNConfigSet = None ParserRulecontext = None PredicateTransition = None BufferedTokenStream = None class UnsupportedOperationException(Exception): def __init__(self, msg:str): super().__init__(msg) class IllegalStateException(Exception): def...
from pymatgen.core.spectrum import Spectrum import numpy as np """ This module defines classes to represent all xas """ __author__ = "Chen Zheng" __copyright__ = "Copyright 2012, The Materials Project" __version__ = "2.0" __maintainer__ = "Chen Zheng" __email__ = "<EMAIL>" __date__ = "Aug 9, 2017" class XANES(Spect...
from django.conf import settings from django.contrib.sites.models import Site from django.core.mail import EmailMessage from django.core.management.base import BaseCommand from django.template.loader import render_to_string from ...models import Survey, WaitingListEntry class Command(BaseCommand): help = "Email...
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..compat import ( compat_urllib_parse_urlparse, compat_parse_qs, ) from ..utils import ( clean_html, remove_start, ) class Varzesh3IE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?video\.varzesh3\.c...
"""support local id Revision ID: 52783a36bd67 Revises: fe637dc3f042 Create Date: 2016-04-26 21:40:40.244196 """ from alembic import op import sqlalchemy as sa from neutron.db import migration # revision identifiers, used by Alembic. revision = '52783a36bd67' down_revision = 'fe637dc3f042' # milestone identifier,...
from cms.models import Page, Title from django.contrib import admin from django.contrib.admin.options import csrf_protect_m from django.core.exceptions import PermissionDenied from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect class ExtensionAdmin(admin.ModelAdmin): pass c...
import numpy as np from skimage._shared.testing import assert_array_equal from skimage._shared.testing import assert_almost_equal, assert_warns from skimage import data from skimage import img_as_float from skimage import draw from skimage.color import rgb2gray from skimage.morphology import octagon from skimage._share...
import warnings from functools import wraps from django.conf import settings from django.core.urlresolvers import reverse from django.http import Http404 from social.utils import setting_name, module_member from social.exceptions import MissingBackend from social.strategies.utils import get_strategy from social.back...
"""Tk user interface implementation for namebench.""" __author__ = '<EMAIL> (Thomas Stromberg)' import datetime import os import Queue import sys import threading import tkFont # Wildcard imports are evil. from Tkinter import * import tkMessageBox import traceback import addr_util import base_ui import conn_quality ...
import math import numpy as np import bayesopt def quad(x,mu): return ((np.asarray(x) - mu)**2).mean() def func(x): #print "x", x #~ target = np.ones(len(x))*0.3 target = np.arange(1,1+len(x)) target2 = np.ones(len(x))*10 #print "target", target e = quad(x,target) return e # Initializ...
from openerp.osv import osv from openerp.tools.translate import _ class pos_open_statement(osv.osv_memory): _name = 'pos.open.statement' _description = 'Open Statements' def open_statement(self, cr, uid, ids, context=None): """ Open the statements @param self: The object ...
# -*- coding: utf-8 -*- """ shared.log ~~~~~~~~~~ AmvTek attend to take control of twisted logging :copyright: (c) 2012 by sc AmvTek srl :email: <EMAIL> """ import sys from logging import DEBUG,INFO,WARNING,ERROR,FATAL from zope.interface import implements from twisted.python import context, lo...
# -*- coding: utf-8 -*- """ jinja2.testsuite.loader ~~~~~~~~~~~~~~~~~~~~~~~ Test the loaders. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import os import sys import tempfile import shutil import unittest from jinja2.testsuite import JinjaTestCase, dic...
import base64 from StringIO import StringIO from io import BytesIO from openerp.osv import osv, fields class base_import_module(osv.TransientModel): """ Import Module """ _name = "base.import.module" _description = "Import Module" _columns = { 'module_file': fields.binary('Module .ZIP file', r...
# find.py - Find and Replace import win32con, win32api import win32ui from pywin.mfc import dialog import afxres from pywin.framework import scriptutils FOUND_NOTHING=0 FOUND_NORMAL=1 FOUND_LOOPED_BACK=2 FOUND_NEXT_FILE=3 class SearchParams: def __init__(self, other=None): if other is None: self.__dict__['findT...
# -*- coding: utf-8 -*- """ werkzeug.urls ~~~~~~~~~~~~~ This module implements various URL related functions. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import urlparse from werkzeug._internal import _decode_unicode fr...
"""Tests for stream module.""" import unittest import set_sys_path # Update sys.path to locate mod_pywebsocket module. from mod_pywebsocket import common from mod_pywebsocket import stream class StreamTest(unittest.TestCase): """A unittest for stream module.""" def test_create_header(self): # mo...
# An implementation of Dartmouth BASIC (1964) # import sys sys.path.insert(0,"../..") if sys.version_info[0] >= 3: raw_input = input import logging logging.basicConfig( level = logging.INFO, filename = "parselog.txt", filemode = "w" ) log = logging.getLogger() import basiclex import basparse import ...
"""Bridges between the `asyncio` module and Tornado IOLoop. This is a work in progress and interfaces are subject to change. To test: python3.4 -m tornado.test.runtests --ioloop=tornado.platform.asyncio.AsyncIOLoop python3.4 -m tornado.test.runtests --ioloop=tornado.platform.asyncio.AsyncIOMainLoop (the tests log a f...
import copy def identityConversion(value, _keys): return value class DictObj(dict): """Dictionary that allows attribute-like access to its elements. Attributes are read-only.""" def __getattr__(self, name): if name == '__deepcopy__': return super(DictObj, self).__getattribute__("__deepcopy__") ...
""" Tests for Management commands of comprehensive theming. """ from django.test import TestCase from django.core.management import call_command, CommandError from openedx.core.djangoapps.theming.helpers import get_themes from openedx.core.djangoapps.theming.management.commands.compile_sass import Command class Test...
import threading import pooler from datetime import datetime import time from osv import osv, fields class unpaid_wizard(osv.osv_memory): _name = 'unpaid.wizard' _description = 'Set and account payment as unpaid' _columns = { 'date':fields.date('Date', required=True), 'expenses':fields.boo...
import mock from oslo_config import cfg from oslo_serialization import jsonutils from oslo_utils import timeutils import requests from nova import objects from nova.scheduler.filters import trusted_filter from nova import test from nova.tests.unit.scheduler import fakes CONF = cfg.CONF class AttestationServiceTestC...
class Request(object): def __init__(self, connection=None): self.connection = connection self.request_id = '' def __repr__(self): return 'Request:%s' % self.request_id def startElement(self, name, attrs, connection): return None def endElement(self, name, value, connec...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: win_reg_stat version_added: "2.3" short_description: Get information about Windows registry keys description: - Like M(win_file), M(win_reg_stat) w...
import sys import textwrap from svc.egg import PythonEgg from svc.utils import issequence class HelpManager(PythonEgg): def __init__(self, manager, extractors, screenWidth=80): self._manager = manager self._extractors = extractors self._ex_help = [e.helpForOptions for e in extractors] ...
import pythoncom from win32com.shell import shell, shellcon import win32api, os class InternetShortcut: def __init__( self ): self._base = pythoncom.CoCreateInstance( shell.CLSID_InternetShortcut, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IUniformResourceLocator ) def load( self, filename ): # Get ...