content
stringlengths
4
20k
import os from units.modules.utils import ModuleTestCase, set_module_args from units.compat.mock import patch from units.compat.mock import Mock from ansible.module_utils.basic import AnsibleModule from ansible.modules.system.java_keystore import create_jks, cert_changed, ArgumentSpec class TestCreateJavaKeystore(Mo...
from gevent import monkey, wsgi monkey.patch_all() import logging import bottle from droppy.command import Subcommand from .server import ServerFarm log = logging.getLogger("droppy.server") class ServerSubcommand(Subcommand): def __init__(self): Subcommand.__init__(self, "server", "Run the server") ...
#!/usr/bin/env python # Capstone Python bindings, by Nguyen Anh Quynnh <<EMAIL>> from __future__ import print_function from capstone import * X86_CODE16 = b"\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00" X86_CODE32 = b"\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00" X86_CODE64 = b"\x55\x48\x8b\x05\xb8\x13\x00\x...
""" Adjacency matrix and incidence matrix of graphs. """ # Copyright (C) 2004-2013 by # Aric Hagberg <<EMAIL>> # Dan Schult <<EMAIL>> # Pieter Swart <<EMAIL>> # All rights reserved. # BSD license. import networkx as nx __author__ = "\n".join(['Aric Hagberg (<EMAIL>)', 'Pieter S...
import pytest from fixtures.application import Application import json import os.path import importlib import jsonpickle from fixtures.db import DbFixture fixture = None web_config = None def load_config(file): global web_config if web_config is None: config_file = os.path.join(os.path.dirname(os.pat...
import pandas as pd from bokeh.sampledata.glucose import data from bokeh.plotting import figure, show, output_file, vplot output_file("glucose.html", title="glucose.py example") TOOLS = "pan,wheel_zoom,box_zoom,reset,save" p1 = figure(x_axis_type="datetime", tools=TOOLS) p1.line(data.index, data['glucose'], color=...
import uno import string import unohelper import xmlrpclib from com.sun.star.task import XJobExecutor if __name__<>"package": from lib.gui import * from lib.error import ErrorDialog from lib.functions import * from lib.logreport import * from lib.rpc import * from Change import * database="t...
"""app.py -- Stores singleton objects. App.py is a respository for high-level singleton objects. Most of these objects get set in startup.py, but some get set in frontend code as well. """ # handles high-level control of Miro controller = None # list of active renderers renderers = [] # donation manager singleton ...
from unittest import TestCase import simplejson.encoder CASES = [ (u'/\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\x08\x0c\n\r\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?', '"/\\\\\\"\\ucafe\\ubabe\\uab98\\ufcde\\ubcda\\uef4a\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?"'), (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0...
""" Main program for the child process run by L{twisted.test.test_stdio.StandardInputOutputTestCase.test_loseConnection} to test that ITransport.loseConnection() works for process transports. """ import sys from twisted.internet.error import ConnectionDone from twisted.internet import stdio, protocol from twisted.pyt...
"""Storage container abstraction. """ # pylint: disable=W0232,R0201 # W0232, since we use these as singletons rather than object holding # data # R0201, for the same reason # TODO: FileStorage initialised with paths whereas the others not import logging from ganeti import errors from ganeti import constants from...
trysizes = [ 1, 48, 64, 512, 1440, 1448, 1500, 1505, 4096, 4192, 32767, 65495 ] from XmTestLib import * rc = 0 # Test creates 1 domain, which requires 2 ips: 1 for the domains and 1 for # aliases on dom0 if xmtest_netconf.canRunNetTest(2) == False: SKIP("Don't have enough free configured IPs to run...
""" This program is not to be executed from the command line. It is exec'd by mpdroot to verify the version of python before executing a 'regular' mpd pgm, e.g. mpdallexit. """ from sys import version, exit if version[0] == '1' and version[1] == '.': print "mpdchkpyver: your python version must be >= 2.2 ;" ...
import cgt from cgt import core class EasyCustomOp(core.Op): """ Will provide an easier method to define a custom Op, where you just have to create one class and write the numerical forward and backpropagation methods currently broken / untested """ return_type = "byval" def __init__(self, ...
# !/usr/bin/python # -*- coding: utf-8 -*- import threading import urllib import sqlite3 import sys import os from pyquery import PyQuery as pq reload(sys) sys.setdefaultencoding('utf-8') num = 1 tmp_num = num headers = { "User-Agent" : "Mozilla/5.3 (X11; U; FreeBSD i386; en-US; rv:1.8.1.14) Gecko/2008060...
from warnings import warn from six import string_types, iteritems from ..manipulation import delete_model_genes, undelete_model_genes from ..manipulation.delete import find_gene_knockout_reactions from ..solvers import solver_dict, get_solver_name try: import scipy except ImportError: moma = None else: fr...
# For the Dev VM environment, we use the same settings as the # sample prod_settings.py file, with a few exceptions. from .prod_settings_template import * import os LOCAL_UPLOADS_DIR = 'var/uploads' # Default to subdomains disabled in development until we can update # the development documentation to make sense with s...
import socket import SocketServer from . import compression from . import constants def _StatusQuery(peer, query): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) code = sock.connect_ex((peer.address, constants.STATUS_PORT)) if code != 0: # TODO(jkummerow): disconnect (after 3 failures?) retur...
"""Functions for generating random numbers.""" # Source inspired by code by Yesudeep Mangalapilly <<EMAIL>> import os from rsa import common, transform from rsa._compat import byte def read_random_bits(nbits): """Reads 'nbits' random bits. If nbits isn't a whole number of bytes, an extra byte will be appe...
import account_asset import account_asset_invoice import wizard import report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
import datetime import time from django.utils.tzinfo import LocalTimezone from django.utils.translation import ungettext, ugettext def timesince(d, now=None): """ Takes two datetime objects and returns the time between d and now as a nicely formatted string, e.g. "10 minutes". If d occurs after now, ...
"""Finds Xcode installations, optionally switching to a desired version. Usage: ./find_xcode.py -j /tmp/out.json -v 6.0.1 Finds Xcode 6.0.1 and switches to it. Writes a summary to /tmp/out.json that includes the Xcode installations that were found, the Xcode version that was active before running this script,...
"""Support for Arlo Alarm Control Panels.""" import logging import voluptuous as vol from homeassistant.components.alarm_control_panel import ( PLATFORM_SCHEMA, AlarmControlPanelEntity, ) from homeassistant.components.alarm_control_panel.const import ( SUPPORT_ALARM_ARM_AWAY, SUPPORT_ALARM_ARM_HOME, ...
"""Context: context for security/db session.""" import copy import datetime from debtcollector import removals from oslo_context import context as oslo_context from oslo_log import log as logging from neutron.db import api as db_api from neutron import policy LOG = logging.getLogger(__name__) class ContextBase(o...
import logging import pprint import sys from django.core.management.base import BaseCommand from desktop import conf from desktop.lib.daemon_utils import drop_privileges_if_necessary from django.utils.translation import ugettext as _ CPSERVER_HELP = r""" Run Hue using the CherryPy WSGI server. """ CPSERVER_OPTIO...
from . import ServiceBase from ..exceptions import DownloadFailedError from ..language import Language, language_set from ..subtitles import ResultSubtitle from ..utils import get_keywords from ..videos import Episode, Movie from bs4 import BeautifulSoup import guessit import logging import re from subliminal.subtitles...
""" Used to store data definitions for E3 experiments and related tables and log files. As new experiments are initiated the data definition over different storage mediums can be matained using the `experiment` hash """ __author__ = "ryan faulkner" __date__ = "18/11/2012" __license__ = "GPL (version 2 or ...
import logging.config import os import sys from pydantic import BaseSettings from sportorg.common.version import Version class Env(BaseSettings): DEBUG: bool = False class Config: env_file = '.env' NAME = 'SportOrg' VERSION = Version(1, 5, 0, 0, 'v') def is_executable(): return hasattr(sys,...
import logging from lib import common from lib import media from lib import scenefactory import sfml from thirdparty.pitweener.src import PiTweener as pytweener class TAGlobalVariableException(Exception): pass class TAAttrIsNotScene(Exception): pass class Director: """Objeto principal del juego. Aquí es dond...
import os.path import sys IS_JYTHON = sys.platform.find('java') != -1 try: this_file_name = __file__ except NameError: # stupid jython. plain old __file__ isnt working for some reason import test_runfiles #@UnresolvedImport - importing the module itself this_file_name = test_runfiles.__file__ desir...
''' 3c_angle_usage.py ========================= AIM: Plots the diagonistic angle usage of the PST in SALSA. Requires the monitor_angle_usage=True in 1_compute_<p>.py and log_all_data = .true. in straylight_<orbit_id>_<p>/CODE/parameter. INPUT: files: - <orbit_id>_misc/orbits.dat - <orbit_id>_flux/angles_<orbit_n...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'certified'} import traceback from ansible.module_utils.basic import AnsibleModule from ansible.module_ut...
import os from Cookie import SimpleCookie, CookieError from pprint import pformat from urllib import urlencode from urlparse import urljoin try: # The mod_python version is more efficient, so try importing it first. from mod_python.util import parse_qsl except ImportError: from cgi import parse_qsl from dj...
#!/opt/datadog-agent/embedded/bin/python """ A Python Statsd implementation with some datadog special sauce. """ # set up logging before importing any other components from config import initialize_logging # noqa initialize_logging('dogstatsd') from utils.proxy import set_no_proxy_settings # noqa set_no_proxy_sett...
"""Unit test for Google Test's --gtest_list_tests flag. A user can ask Google Test to list all tests by specifying the --gtest_list_tests flag. This script tests such functionality by invoking googletest-list-tests-unittest_ (a program written with Google Test) the command line flags. """ import re import gtest_test...
# -*- coding: utf-8 -*- # pylint: disable=missing-docstring from __future__ import ( absolute_import, division, print_function, unicode_literals) import os from celery.schedules import crontab from readthedocs.core.settings import Settings try: import readthedocsext # noqa ext = True except ImportErr...
from taskflow.patterns import ordered_workflow class Workflow(ordered_workflow.Workflow): """A linear chain of *independent* tasks that can be applied as one unit or rolled back as one unit.""" def __init__(self, name, tolerant=False, parents=None): super(Workflow, self).__init__(name, toleran...
# -*- coding: utf-8 -*- from __future__ import generators import py import sys saferepr = py.io.saferepr class TestSafeRepr: def test_simple_repr(self): assert saferepr(1) == '1' assert saferepr(None) == 'None' def test_maxsize(self): s = saferepr('x'*50, maxsize=25) assert l...
{ 'name': 'Add State field to Project Stages', 'version': '8.0.1.1.0', 'category': 'Project Management', 'summary': 'Restore State attribute removed from Project Stages in 8.0', 'author': "Daniel Reis,Odoo Community Association (OCA)", 'website': 'https://github.com/OCA/project-service', 'li...
#!/usr/bin/env python """ Import data for Package/Sources files from .deb and .dsc files @copyright: 2011 Torsten Werner <<EMAIL>> @copyright: 2011 Mark Hymers <<EMAIL>> @license: GNU General Public License version 2 or later """ ################################################################################ # This ...
#!/usr/bin/env python2 # vim: set fileencoding=utf8 import os import sys import requests import urlparse import re import argparse import random import select ############################################################ # wget exit status wget_es = { 0: "No problems occurred.", 2: "User interference.", 1<...
import re import mock import six from six.moves import http_client import unittest2 from apitools.base.py import credentials_lib from apitools.base.py import util def CreateUriValidator(uri_regexp, content=''): def CheckUri(uri, headers=None): if 'X-Google-Metadata-Request' not in headers: r...
from __future__ import absolute_import import numpy as np from ..models import FactorRange, DataRange1d, Range1d, BoxSelectTool from ..plotting import figure from .plotting import make_continuous_bar_source, make_categorical_bar_source class CrossFilterPlugin(object): """An adapter class between CrossFilter a...
import functools import Gaffer import GafferArnold def __shaderMetadata( plug, name ) : return Gaffer.Metadata.value( plug.node()["__shader"].descendant( plug.relativeName( plug.node() ) ), name ) Gaffer.Metadata.registerNode( GafferArnold.ArnoldMeshLight, "description", """ Turns mesh primitives into Arnold...
from __future__ import absolute_import from operator import attrgetter from django.contrib.contenttypes.models import ContentType from django.contrib.sessions.backends.db import SessionStore from django.db.models import Count from django.db.models.loading import cache from django.test import TestCase from django.test...
import threading from django.conf import settings from django.test.client import RequestFactory from django.core.urlresolvers import reverse as django_reverse from django.utils.translation.trans_real import parse_accept_lang_header # Thread-local storage for URL prefixes. Access with (get|set)_url_prefix. _locals = ...
from tests import BaseTestCase from redash.models import AlertSubscription, Alert, db class TestAlertResourceGet(BaseTestCase): def test_returns_200_if_allowed(self): alert = self.factory.create_alert() rv = self.make_request('get', "/api/alerts/{}".format(alert.id)) self.assertEqual(rv.s...
# -*- coding: utf-8 -*- import re from module.plugins.internal.MultiHook import MultiHook class LinkdecrypterComHook(MultiHook): __name__ = "LinkdecrypterComHook" __type__ = "hook" __version__ = "1.07" __status__ = "testing" __config__ = [("activated" , "bool" , "Activa...
"""Tests for cartesian.py""" from sympy import S, Interval, symbols, I, DiracDelta, exp, sqrt, pi from sympy.physics.quantum import qapply, represent, L2, Dagger from sympy.physics.quantum import Commutator, hbar from sympy.physics.quantum.cartesian import ( XOp, YOp, ZOp, PxOp, X, Y, Z, Px, XKet, XBra, PxKet, Px...
""" Helper functions for testing. .. versionadded:: 1.2.0 :: clean_orphaned_pyc - delete *.pyc files without corresponding *.py is_pyflakes_available - checks if pyflakes is available is_pep8_available - checks if pep8 is available stylistic_issues - checks for PEP8 and other stylistic issues pyflakes_is...
""" First run `python3 zipout.py` to create your output zipfile `output.zip` and output directory `./output` Then run: python3 check.py It will print out a score of all your outputs that matched the testcases with a reference output file (typically `./references/dev/*.out`). In some cases the output is supposed ...
"""Generate local manifest in an Android repository. This is used to generate a local manifest in an Android repository. The purpose of the generated manifest is to remove the set of projects that exist under a certain path. """ from optparse import OptionParser import os import xml.etree.ElementTree as ET def creat...
#!/usr/bin/python import sys import time import os import string import StringIO sys.path.insert(0, "python") import libxml2 # Memory debug specific libxml2.debugMemory(1) debug = 0 quiet = 1 # # the testsuite description # CONF=os.path.join(os.path.dirname(__file__), "test/relaxng/testsuite.xml") LOG="check-relaxng-...
from wtforms.validators import ValidationError from wtforms.fields import HiddenField __all__ = ('CSRFTokenField', 'CSRF') class CSRFTokenField(HiddenField): """ A subclass of HiddenField designed for sending the CSRF token that is used for most CSRF protection schemes. Notably different from a norm...
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( xpath_text, xpath_element, int_or_none, parse_duration, ) class HBOBaseIE(InfoExtractor): _FORMATS_INFO = { '1920': { 'width': 1280, 'height':...
# coding: utf-8 from __future__ import unicode_literals import re import hashlib from .common import InfoExtractor from ..utils import ( ExtractorError, unified_strdate, ) class WatIE(InfoExtractor): _VALID_URL = r'http://www\.wat\.tv/video/(?P<display_id>.*)-(?P<short_id>.*?)_.*?\.html' IE_NAME = '...
#!/usr/bin/env python # # Base class for a GUI Application using Tk # from __future__ import generators, print_function, unicode_literals import sys if sys.version_info[0] < 3: str = unicode import Tkinter as tkinter import tkMessageBox as messagebox else: import tkinter import tkinter.messagebox as...
"""Tests for summary V1 tensor op.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import six from tensorflow.core.framework import summary_pb2 from tensorflow.python.framework import constant_op from tensorflow.python.framework impor...
"""Utilities for extracting common archive formats""" import zipfile import tarfile import os import shutil import posixpath import contextlib from distutils.errors import DistutilsError from pkg_resources import ensure_directory, ContextualZipFile __all__ = [ "unpack_archive", "unpack_zipfile", "unpack_tarfile"...
import os from lucene import \ FSDirectory, Document, Field, IndexWriter, SimpleAnalyzer, System class VerboseIndexing(object): def main(cls, argv): vi = VerboseIndexing() vi.index() def index(self): dirPath = os.path.join(System.getProperty("java.io.tmpdir", "tmp"), ...
from units.compat import unittest from oneview_module_loader import FcNetworkFactsModule from hpe_test_utils import FactsParamsTestCase ERROR_MSG = 'Fake message error' PARAMS_GET_ALL = dict( config='config.json', name=None ) PARAMS_GET_BY_NAME = dict( config='config.json', name="Test FC Network" ) ...
import logging import unittest from retrying import retry import google.cloud.logging import test_util class TestStandardLogging(unittest.TestCase): def __init__(self, url, methodName='runTest'): self._url = url + test_util.STANDARD_LOGGING_ENDPOINT super(TestStandardLogging, self).__init__() ...
""" Provides basic unmarshaller classes. """ from logging import getLogger from suds import * from suds.umx import * from suds.umx.core import Core class Basic(Core): """ A object builder (unmarshaller). """ def process(self, node): """ Process an object graph representation ...
from __future__ import unicode_literals from django.contrib.gis import feeds from .models import City class TestGeoRSS1(feeds.Feed): link = '/city/' title = 'Test GeoDjango Cities' def items(self): return City.objects.all() def item_link(self, item): return '/city/%s/' % item.pk ...
# -*- coding: utf-8 -*- from .jsregexp import Exec import re DIGS = set('0123456789') WHITE = u"\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF" def replacement_template(rep, source, span, npar): """Takes t...
"""Descriptor properties are more "auxiliary" properties that exist as configurational elements, but don't participate as actively in the load/persist ORM loop. """ from sqlalchemy.orm.interfaces import \ MapperProperty, PropComparator, StrategizedProperty from sqlalchemy.orm.mapper import _none_set from sqlalche...
try: from setuptools import setup except ImportError: from distutils.core import setup setup(name='closure_linter', version='2.3.5', description='Closure Linter', license='Apache', author='The Closure Linter Authors', author_email='<EMAIL>', url='http://code.google.com/p/clo...
""" @author: Jamie Levy (gleeda) @license: GNU General Public License 2.0 @contact: <EMAIL> @organization: Volatility Foundation """ import volatility.plugins.taskmods as taskmods from volatility.renderers import TreeGrid from volatility.renderers.basic import Address class JobLinks(taskmods.DllList):...
from __future__ import (absolute_import, division, print_function, unicode_literals) import testcommon import backtrader as bt import backtrader.indicators as btind chkdatas = 1 chkvals = [ ['4054.187922', '3648.549000', '3592.979190'], ] chkmin = 31 chkind = btind.KAMA def test_run(ma...
""" `GrammarLexer` is compatible with Pygments lexers and can be used to highlight the input using a regular grammar with token annotations. """ from __future__ import unicode_literals from prompt_toolkit.document import Document from prompt_toolkit.layout.lexers import Lexer from prompt_toolkit.layout.utils import spl...
"""Describe a CryptoKeyVersion.""" from googlecloudsdk.api_lib.cloudkms import base as cloudkms_base from googlecloudsdk.calliope import base from googlecloudsdk.command_lib.kms import flags class Describe(base.DescribeCommand): """Get metadata for a given CryptoKeyVersion. Returns metadata for the given Crypto...
from pyglet.gl import * from pyglet import font from plot_object import PlotObject from util import strided_range, billboard_matrix from util import get_direction_vectors from util import dot_product, vec_sub, vec_mag from sympy.core.basic import S class PlotAxes(PlotObject): def __init__(self, *args, **kwargs):...
import gdb.printing class MpxBound128Printer: """Adds size field to a mpx __gdb_builtin_type_bound128 type.""" def __init__ (self, val): self.val = val def to_string (self): upper = self.val["ubound"] lower = self.val["lbound"] size = (long) ((upper) - (lower)) if...
"""Fixer for sys.exc_{type, value, traceback} sys.exc_type -> sys.exc_info()[0] sys.exc_value -> sys.exc_info()[1] sys.exc_traceback -> sys.exc_info()[2] """ # By Jeff Balogh and Benjamin Peterson # Local imports from .. import fixer_base from ..fixer_util import Attr, Call, Name, Number, Subscript, Node, syms clas...
#!/usr/bin/env python # -- Content-Encoding: UTF-8 -- """ Pelix remote services: Abstract RPC implementation :author: Thomas Calmant :copyright: Copyright 2016, Thomas Calmant :license: Apache License 2.0 :version: 0.6.4 .. Copyright 2016 Thomas Calmant Licensed under the Apache License, Version 2.0 (the "L...
import json import logging import os import pyes import pytz import re import sys from datetime import datetime from datetime import timedelta from configlib import getConfig, OptionParser from logging.handlers import SysLogHandler from dateutil.parser import parse from hashlib import md5 logger = logging.getLogger(sy...
#-------------------------------------------------------------------------- # Scrapy Settings #-------------------------------------------------------------------------- BOT_NAME = 'scrapy_spider' SPIDER_MODULES = ['frontera.tests.scrapy_spider.spiders'] NEWSPIDER_MODULE = 'frontera.tests.scrapy_spider.spiders' HTTPC...
"""Contains the logic for `aq show switch --all`.""" from sqlalchemy.orm import joinedload, subqueryload, contains_eager, undefer from aquilon.worker.broker import BrokerCommand # pylint: disable=W0611 from aquilon.aqdb.model import Switch, DnsRecord, DnsDomain, Fqdn class CommandShowSwitchAll(BrokerCommand): ...
"""Various utilities used by XenServer plugins.""" try: import cPickle as pickle except ImportError: import pickle import errno import logging import os import shutil import signal import subprocess import tempfile import XenAPIPlugin LOG = logging.getLogger(__name__) CHUNK_SIZE = 8192 class CommandNotFou...
# coding: utf-8 """ tests.test_analysers.test_ast ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2014 by Daniel Neuhäuser and Contributors :license: BSD, see LICENSE.rst for details """ import textwrap from io import BytesIO import pytest from pyalysis.analysers import ASTAnalyser from pyalysis.warnings i...
from django.conf import settings from django.contrib.flatpages.models import FlatPage from django.contrib.sites.models import get_current_site from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect from django.shortcuts import get_object_or_404 from django.template import loader, RequestContext fr...
""" altgraph.GraphAlgo - Graph algorithms ===================================== """ from altgraph import GraphError def dijkstra(graph, start, end=None): """ Dijkstra's algorithm for shortest paths `David Eppstein, UC Irvine, 4 April 2002 <http://www.ics.uci.edu/~eppstein/161/python/>`_ `Pyt...
from django import forms from django.utils.translation import ugettext as _ from django.contrib.auth import get_user_model from invitations.adapters import get_invitations_adapter from invitations.exceptions import AlreadyInvited, AlreadyAccepted, UserRegisteredEmail from invitations.utils import get_invitation_...
# Tests for rich comparisons import unittest from test import test_support import operator class Number: def __init__(self, x): self.x = x def __lt__(self, other): return self.x < other def __le__(self, other): return self.x <= other def __eq__(self, other): return...
"""Hook to allow user-specified customization code to run. As a policy, Python doesn't run user-specified code on startup of Python programs (interactive sessions execute the script specified in the PYTHONSTARTUP environment variable if it exists). However, some programs or sites may find it convenient to allow users...
"""Coordinator to help multiple threads stop when requested.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import contextlib import sys import threading import time import six from tensorflow.python.framework import errors from tensorflow.python.platf...
from django.http import Http404 from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.shortcuts import get_object_or_404 #from django import VERSION from .models import Person, PersonCategory from mezzanine.conf import settings from mezzanine.generic.models ...
''' WARNING: deprecated module. API defined in this module has been deprecated in version 0.5 will likely be removed at 0.6. ''' import warnings from markupsafe import Markup from flask import url_for from .compat import deprecated warnings.warn('Deprecated module widget', category=DeprecationWarning) class Widg...
import os import sys class WebKitFinder(object): def __init__(self, filesystem): self._filesystem = filesystem self._dirsep = filesystem.sep self._sys_path = sys.path self._env_path = os.environ['PATH'].split(os.pathsep) self._webkit_base = None self._chromium_base ...
"""Kazoo Interfaces .. versionchanged:: 1.4 The classes in this module used to be interface declarations based on `zope.interface.Interface`. They were converted to normal classes and now serve as documentation only. """ # public API class IHandler(object): """A Callback Handler for Zookeeper comp...
# -*- coding: utf-8 -*- """ its.py ~~~~~ System environment flags. """ import sys import struct # ------- # Pythons # ------- # Syntax sugar. _ver = sys.version_info #: Python 2.x? py2 = (_ver[0] == 2) #: Python 3.x? py3 = (_ver[0] == 3) #: Python 3.0.x py30 = (py3 and _ver[1] == 0) #: Python 3.1.x py31 = (py...
# -*- coding: utf-8 -*- # ProjectEuler/src/python/problem426.py # # Box-ball system # =============== # Published on Saturday, 4th May 2013, 07:00 pm # # Consider an infinite row of boxes. Some of the boxes contain a ball. For # example, an initial configuration of 2 consecutive occupied boxes followed by # 2 empty bo...
from __future__ import unicode_literals import json import operator import re from .utils import ( ExtractorError, ) _OPERATORS = [ ('|', operator.or_), ('^', operator.xor), ('&', operator.and_), ('>>', operator.rshift), ('<<', operator.lshift), ('-', operator.sub), ('+', operator.add...
import gdata.base.service import gdata.service try: from xml.etree import ElementTree except ImportError: from elementtree import ElementTree import atom import gdata.base # Demonstrates queries to the itemtypes feed for specified locale. gb_client = gdata.base.service.GBaseService() locale = raw_input('Please en...
""" ============= Miscellaneous ============= IEEE 754 Floating Point Special Values -------------------------------------- Special values defined in numpy: nan, inf, NaNs can be used as a poor-man's mask (if you don't care what the original value was) Note: cannot use equality to test NaNs. E.g.: :: >>> myarr = ...
''' Created on Nov 11, 2014 @author: alucard ''' import vtk from SceneObject import SceneObject class MenuItem(SceneObject): def __init__(self, renderer, screenDistance, width, height, parent, name, image, callbackObject = None, callbackFunction = None): #renderer.AddObserver("LeftButtonPr...
"""Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle regression (:ref:`least_angle_regression`) The input data is mostly low rank but is a fat infinite tail. """ from __future__ import print_function import gc import sys from time import time import six import numpy as np from sklearn.linea...
import datetime from twisted.internet import reactor from twisted.internet.defer import inlineCallbacks from autobahn.twisted.wamp import ApplicationSession class Component(ApplicationSession): """ An application component using the time service. """ @inlineCallbacks def onJoin(self, details): ...
import pytest from webdriver import error from tests.support.asserts import assert_success def execute_script(session, script, args=None): if args is None: args = [] body = {"script": script, "args": args} return session.transport.send( "POST", "/session/{session_id}/execute/sync".forma...
import argparse import csv from tables import parameters from .. import pairs from ..db import FragmentsDb from ..frozen import FrozenSimilarityMatrix from ..hdf5 import SimilarityMatrix def make_similarities_parser(subparsers): """Creates a parser for similarities sub commands Args: subparsers (arg...