content
stringlengths
4
20k
"""YAML utility functions.""" import logging import os import sys import fnmatch from collections import OrderedDict from typing import Union, List, Dict import yaml try: import keyring except ImportError: keyring = None try: import credstash # pylint: disable=import-error except ImportError: credsta...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json from ansible.compat.tests.mock import patch from ansible.modules.network.ios import ios_system from .ios_module import TestIosModule, load_fixture, set_module_args class TestIosSystemModule(TestIosModule): modul...
#!/usr/bin/env python # Capstone Python bindings, by Nguyen Anh Quynnh <<EMAIL>> from __future__ import print_function from capstone import * import binascii from test import to_x, to_hex, to_x_32 X86_CODE32 = b"\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00\x00\x91\x92" RANDOM_CODE = b"\xed\x00\x00\x00\x00\x1a\x...
from __future__ import absolute_import from collections import Mapping, MutableMapping try: from threading import RLock except ImportError: # Platform-specific: No threads available class RLock: def __enter__(self): pass def __exit__(self, exc_type, exc_value, traceback): ...
from __future__ import unicode_literals import os import re from .common import InfoExtractor from ..compat import ( compat_urllib_parse_unquote, compat_urllib_parse_unquote_plus, compat_urllib_parse_urlparse, compat_urllib_request, ) from ..utils import ( ExtractorError, str_to_int, ) from .....
import logging import socket import struct logger = logging.getLogger('Artnet') class ArtNet(): packet_counter = 1 dmxdata = [0, 0] def __init__(self, smarthome, artnet_net, artnet_subnet, artnet_universe, ip, port): self.s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.net = in...
""" Helper methods for operations related to the management of volumes, and storage repositories """ import abc import re import sys if sys.platform == 'win32': import _winreg import wmi from oslo_log import log as logging from nova import block_device from nova.i18n import _LI from nova.virt import driver ...
"""Add record metadata indices.""" from __future__ import absolute_import, division, print_function from alembic import op # revision identifiers, used by Alembic. revision = 'cb9f81e8251c' down_revision = 'fddb3cfe7a9c' branch_labels = () depends_on = None def upgrade(): """Upgrade database.""" op.execute...
""" ================================================== Plot the decision boundaries of a VotingClassifier ================================================== Plot the decision boundaries of a `VotingClassifier` for two features of the Iris dataset. Plot the class probabilities of the first sample in a toy dataset pred...
from distutils.command.build_ext import build_ext as _du_build_ext try: # Attempt to use Pyrex for building extensions, if available from Pyrex.Distutils.build_ext import build_ext as _build_ext except ImportError: _build_ext = _du_build_ext import os, sys from distutils.file_util import copy_file from set...
""" Tests creation and deletion of links between e.g. Projects & Datasets etc. """ import omero from omero.rtypes import rstring from omeroweb.testlib import IWebTest from omeroweb.testlib import _csrf_post_response, _get_response from omeroweb.testlib import _csrf_delete_response import json from time import sleep ...
""" Part of Cosmos by OpenGenus Foundation """ # stack class class Stack: def __init__(self): self.items = [] # check if the stack is empty def isEmpty(self): return self.items == [] # push item into the stack def push(self, item): self.items.append(item) # pop item f...
import datetime from .creation import DatabaseCreation from ..utils import appid, have_appserver, on_production_server from djangotoolbox.db.base import NonrelDatabaseFeatures, \ NonrelDatabaseOperations, NonrelDatabaseWrapper, NonrelDatabaseClient, \ NonrelDatabaseValidation, NonrelDatabaseIntrospection import...
from openerp.osv import fields, osv import os.path class IrAttachment(osv.Model): """ Update partner to add a field about notification preferences """ _name = "ir.attachment" _inherit = 'ir.attachment' _fileext_to_type = { '7z': 'archive', 'aac': 'audio', 'ace': 'archive', ...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.module_utils.six.moves import shlex_quote from ansible.plugins.shell import ShellBase class ShellModule(ShellBase): # Common shell filenames that this plugin handles. # Note: sh is the default shell plugin ...
import sqlite3 # execute, fetchone, fetchall, commit import os.path # path.isfile timeout = 15 nonce_table = 'nonce' output_table = 'output' def create_nonce_db(): new_nonce_db = sqlite3.connect('auth/nonce.sqlite') new_nonce_db.execute('CREATE TABLE IF NOT EXISTS nonce (current_nonce INTEGER)' ) new_no...
"""Test result object""" import sys import traceback import unittest from StringIO import StringIO from unittest2 import util from unittest2.compatibility import wraps __unittest = True def failfast(method): @wraps(method) def inner(self, *args, **kw): if getattr(self, 'failfast', False): ...
import os import sys def Main(argv): """This is like 'env -i', but it uses a whitelist of env variables to allow through to the command being run. It attempts to strip off Xcode-added values from PATH. """ # Note: An attempt was made to do something like: env -i bash -lc '[command]' # but that fails to se...
import logging from django.utils.translation import ugettext_lazy as _ import horizon from openstack_dashboard.api import neutron from openstack_dashboard.dashboards.project import dashboard LOG = logging.getLogger(__name__) class LoadBalancer(horizon.Panel): name = _("Load Balancers") slug = "loadbalance...
# -*- coding: utf-8 -*- """ This class was borrowed from HyperSpyUI https://github.com/vidartf/hyperspyUI Created on Tue Nov 04 16:04:17 2014 @author: Vidar Tonaas Fauske """ try: from qtconsole.rich_jupyter_widget import RichJupyterWidget from qtconsole.inprocess import QtInProcessKernelManager except Impor...
from __future__ import unicode_literals, division, absolute_import from builtins import * # noqa pylint: disable=unused-import, redefined-builtin import logging from collections import defaultdict from flexget import plugin from flexget.event import event from flexget.plugins.filter.seen import FilterSeen log = log...
GNUPG=True; GNUPG_MODULE=True; import sys; import tarfile; import commands; import os; import getpass; import shutil; try: import gnupg; except ImportError, e: GNUPG_MODULE=False; GNUPG=False; class browserAccelerator: __supportedBrowsers={"chromium": ("--user-data-dir=%s", ".config/chromium"), "chromium-browse...
"""Test that we don't leak txs to inbound peers that we haven't yet announced to""" from test_framework.messages import msg_getdata, CInv, MSG_TX from test_framework.p2p import p2p_lock, P2PDataStore from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, ) fr...
from openerp.osv import fields, osv from openerp.tools.translate import _ from openerp import SUPERUSER_ID class crm_lead_forward_to_partner(osv.TransientModel): """ Forward info history to partners. """ _name = 'crm.lead.channel.interested' _columns = { 'interested': fields.boolean('Interested by...
"""This module provides methods for parsing raw memory data""" import collections import re from decimal import Decimal import perun.profile.convert as convert import perun.collect.memory.syscalls as syscalls __author__ = "Radim Podola" PATTERN_WORD = re.compile(r"(\w+|[?])") PATTERN_TIME = re.compile(r"\d+([,.]\d*...
"""Utilities for RPC Framework's Face interface.""" import collections # stream is referenced from specification in this module. from grpc.framework.common import cardinality from grpc.framework.common import style from grpc.framework.foundation import stream # pylint: disable=unused-import from grpc.framework.inter...
#!/usr/bin/env python """Adds whitelisted Friends and Sends Snaps to Story Usage: updateStory.py -u <username> [-p <password> -d <tmpdir> -sv] WHITELIST Options: -h Show usage -u=<username> Username -p=<password> Password(optional, will promp if ommitted) -d=<tmpdir> Wher...
""" >>> from test_pointer_adoption_ext import * >>> num_a_instances() 0 >>> a = create('dynamically allocated') >>> num_a_instances() 1 >>> a.content() 'dynamically allocated' >>> innards = a.get_inner() >>> innards.change('with an exposed reference') >>> a.content() 'with an exposed reference' # The a instance sh...
from .._compat import xrange from ._ffi import ffi, lib from .gibaseinfo import GIBaseInfo, GIInfoType from .gitypeinfo import GITypeInfo from .giarginfo import GITransfer, GIArgInfo class GICallableInfo(GIBaseInfo): def get_return_type(self): return GITypeInfo(lib.g_callable_info_get_return_type(self._p...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type # --- # The paramiko transport is provided because many distributions, in particular EL6 and before # do not support ControlPersist in their SSH implementations. This is needed on the Ansible # control machine to be reasonably eff...
lgpl3_header = ''' // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, you can redistribute it and/...
import unittest from conans.test.utils.tools import TestClient from conans.paths import CONANINFO from conans.util.files import load import os class OptionsTest(unittest.TestCase): def general_scope_options_test_package_test(self): client = TestClient() conanfile = """from conans import ConanFile...
from compiled_file_system import CompiledFileSystem from docs_server_utils import StringIdentity from file_system import FileNotFoundError from future import Future from path_util import ToDirectory class ChainedCompiledFileSystem(object): '''A CompiledFileSystem implementation that fetches data from a chain of p...
#! /usr/bin/env python # coding: utf-8 """ ############################################################################## # Description : This module reads the I/P document and prints # # # Meaningful unique words # # # Count of occurance in the document and # # # Number of senses ...
import sqlalchemy as sa from buildbot.util import sautils def upgrade(migrate_engine): # build_data without the 'length' column has never been released, so we don't care about # correct values there. metadata = sa.MetaData() metadata.bind = migrate_engine build_data_table = sautils.Table('build_d...
from typing import Mapping, Union, Any, Iterable, NewType, Sequence, Tuple, List import itertools import attr from boyleworkflow.util import id_property from boyleworkflow.storage import Storage, Digest from boyleworkflow.loc import Loc, check_valid_loc, normalize_loc @attr.s(auto_attribs=True, frozen=True) class R...
# -*- coding: utf-8 -*- from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class Author(models.Mode...
from tests.unit import AWSMockServiceTestCase from boto.s3.connection import S3Connection from boto.s3.bucket import Bucket from boto.s3.lifecycle import Rule, Lifecycle, Transition class TestS3LifeCycle(AWSMockServiceTestCase): connection_class = S3Connection def default_body(self): return """ ...
from softwarecenter.utils import UnimplementedError class InstallBackend(object): def __init__(self): self.pending_transactions = {} self.pending_purchases = [] def upgrade(self, pkgname, appname, iconname, addons_install=[], addons_remove=[], metadata=None): pass def remove(self, ...
# -*- coding: utf-8 -*- import os, chardet import unittest from transifex.txcommon.tests.base import BaseTestCase from transifex.languages.models import Language from transifex.resources.models import * from transifex.resources.formats.mozillaproperties import MozillaPropertiesHandler from transifex.addons.suggestio...
import util from srmetadata import open_file, close, get_min_blk_size_wrapper, \ file_read_wrapper, file_write_wrapper LVM_MAX_NAME_LEN = 127 class JournalerException(util.SMException): pass class Journaler: """Simple journaler that uses LVM namespace for persistent "storage". A journal is a id-value...
from __future__ import absolute_import, print_function import itertools import os import site import sys import uuid from pkg_resources import ( DistributionNotFound, Environment, Requirement, WorkingSet, find_distributions ) from .common import die, open_zip, safe_mkdir, safe_rmtree from .interp...
import json from django.contrib.postgres import lookups from django.contrib.postgres.forms import SimpleArrayField from django.contrib.postgres.validators import ArrayMaxLengthValidator from django.core import checks, exceptions from django.db.models import Field, IntegerField, Transform from django.db.models.lookups ...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.errors import AnsibleError from ansible.module_utils.six import string_types from ansible.plugins.lookup import LookupBase from ansible.utils.listify import listify_lookup_plugin_terms class LookupModule(LookupBase):...
"""Miscellaneous utilities.""" __all__ = [ 'collapse_rfc2231_value', 'decode_params', 'decode_rfc2231', 'encode_rfc2231', 'formataddr', 'formatdate', 'format_datetime', 'getaddresses', 'make_msgid', 'mktime_tz', 'parseaddr', 'parsedate', 'parsedate_tz', 'parsedat...
from django.core.management.base import BaseCommand, CommandError from SimpleLogger.models import SimpleWusnData import serial, traceback, re, datetime, pytz RE_STRING = r"^#\[(?P<p_number>\d+)\]\[(?P<node_id>\d+)\]\s+D(?P<y>\d+)\/(?P<m>\d+)\/(?P<d>\d+)\s+t(?P<hour>\d+)\:(?P<minute>\d+)\s+W(?P<water>\d+)\s+T(?P<temp>...
"""_mysql_exceptions: Exception classes for _mysql and MySQLdb. These classes are dictated by the DB API v2.0: http://www.python.org/topics/database/DatabaseAPI-2.0.html """ try: from exceptions import Exception, StandardError, Warning except ImportError: # Python 3 StandardError = Exception class ...
import dns.exception import dns.rdata import dns.tokenizer class HINFO(dns.rdata.Rdata): """HINFO record @ivar cpu: the CPU type @type cpu: string @ivar os: the OS type @type os: string @see: RFC 1035""" __slots__ = ['cpu', 'os'] def __init__(self, rdclass, rdtype, cpu, os): ...
LANG_INFO = { 'ar': { 'bidi': True, 'code': 'ar', 'name': 'Arabic', 'name_local': u'\u0627\u0644\u0639\u0631\u0628\u064a\u0651\u0629', }, 'az': { 'bidi': True, 'code': 'az', 'name': 'Azerbaijani', 'name_local': u'az\u0259rbaycan dili', }, ...
from __future__ import unicode_literals import tempfile import subprocess import pymongo import shutil import time import sys from camomile import Camomile URL = 'http://localhost:3000' CLIENT = Camomile(URL, debug=False) MONGO_DIR = None MONGO_PROCESS = None NODE_PROCESS = None ROOT_USERNAME = 'root' ROOT_PASSWO...
# -*- coding: utf-8 -*- import logging # Copyright 2010 Dirk Holtwick, holtwick.it # # 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 # # Unle...
# -*- coding: utf-8 -*- import pprint from datetime import datetime class BaseResponse(dict): class assertRaises: def __init__(self, expected, expected_regexp=None): self.expected = expected self.failureException = AssertionError self.expected_regexp = expected_regex...
import json import logging from ..cipher.Cipher import Cipher logger = logging.getLogger(__name__) class Serialize(): def __init__(self): pass def serialize(self, content_obj): ''' encode content_obj to string ,then encrypt the string. for example: content_obj = {'a'...
"""Provides an interface for working with multiple event files.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import threading import six from tensorflow.python.platform import gfile from tensorflow.python.platform import tf_logging as logg...
# coding: utf-8 """ webencodings.x_user_defined ~~~~~~~~~~~~~~~~~~~~~~~~~~~ An implementation of the x-user-defined encoding. :copyright: Copyright 2012 by Simon Sapin :license: BSD, see LICENSE for details. """ from __future__ import unicode_literals import codecs ### Codec APIs class Code...
#!/usr/bin/env python # comp_file_lines.py # # Python script to count number of exact matching lines between two files, no edit distance # 2014-09-07 Dan Ellis <EMAIL> import sys verbose = False onefile = False if len(sys.argv) == 2: # Special case: if a single file, compare the first ws-separated field with r...
from __future__ import print_function import json import struct import re import base64 import httplib import sys settings = {} class BitcoinRPC: def __init__(self, host, port, username, password): authpair = "%s:%s" % (username, password) self.authhdr = "Basic %s" % (base64.b64encode(authpair)) self.conn = ht...
# Useful reading is: # https://zulip.readthedocs.io/en/latest/subsystems/html-css.html#front-end-build-process import os from typing import Optional from django.conf import settings from django.contrib.staticfiles.storage import ManifestStaticFilesStorage if settings.DEBUG: from django.contrib.staticfiles.finder...
import pyjd from pyjamas.ui.RootPanel import RootPanel from pyjamas.ui.HTML import HTML from pyjamas.ui.Label import Label from pyjamas.ui.Button import Button from pyjamas.ui.HorizontalPanel import HorizontalPanel from pyjamas.ui.AbsolutePanel import AbsolutePanel from pyjamas.ui.ScrollPanel import ScrollPanel from p...
from django import http from django.db import models from django.contrib.databrowse.datastructures import EasyModel from django.contrib.databrowse.sites import DatabrowsePlugin from django.shortcuts import render_to_response from django.utils.text import capfirst from django.utils.encoding import force_unicode from dja...
#!/usr/bin/python3 """ Open Concordance by Antoine Chesnais. A simple corpus processing tool. Copyright (C) 2014 Antoine Chesnais 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,...
import sys from distutils.core import setup def get_extensions(): if "--no-compile" in sys.argv: return [] from Cython.Build import cythonize return cythonize("cqlshlib/copyutil.py") setup( name="cassandra-pylib", description="Cassandra Python Libraries", packages=["cqlshlib"], e...
"""The tests for the cover platform.""" from homeassistant.components.cover import ( SERVICE_CLOSE_COVER, SERVICE_OPEN_COVER, intent as cover_intent, ) from homeassistant.helpers import intent from tests.common import async_mock_service async def test_open_cover_intent(hass): """Test HassOpenCover i...
# This is not a standalone Python script, but a build declaration file # to be read by bin/make.py. Please run bin/make.py --help. import os from comake.settings import settings settings.arch = os.getenv('COLINUX_HOST_ARCH') if not settings.arch: settings.arch = 'i386' print "Target architecture not specifie...
from webiopi.devices.bus import Bus, I2C_Bus from webiopi.utils.types import toint from webiopi.utils.logger import debug import ctypes from ctypes import c_ubyte, c_uint MCPDLL = None class I2C_MCP2221_WINDLL(I2C_Bus): def __init__(self, slave, speed=100000, dev="windll:", dllpath="", dllname="MCP2221DLL-UM_x86"...
microcode = ''' def macroop MOVDDUP_XMM_XMM { movfp xmmh, xmmlm, dataSize=8 movfp xmml, xmmlm, dataSize=8 }; def macroop MOVDDUP_XMM_M { ldfp xmml, seg, sib, disp, dataSize=8 movfp xmmh, xmml, dataSize=8 }; def macroop MOVDDUP_XMM_P { rdip t7 ldfp xmml, seg, riprel, disp, dataSize=8 movfp ...
import os import platform import socket from abc import ABCMeta, abstractmethod from copy import deepcopy from ..wptcommandline import require_arg # noqa: F401 here = os.path.split(__file__)[0] def inherit(super_module, child_globals, product_name): super_wptrunner = super_module.__wptrunner__ child_global...
#!/usr/bin/env python import os, time, pexpect, sys def getProcessResults(cmd, timeLimit=20): """ executes 'cmd' as a child process and returns the child's output, the duration of execution, and the process exit status. Aborts if child process does not generate output for 'timeLimit' seconds. """ output =...
"""Base for PAD plugins.""" from __future__ import absolute_import from builtins import tuple from builtins import object try: from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker except ImportError: create_engine = None sessionmaker = None from collections import defaultdict...
"""A "Test Server Spawner" that handles killing/stopping per-test test servers. It's used to accept requests from the device to spawn and kill instances of the chrome test server on the host. """ import BaseHTTPServer import json import logging import os import select import struct import subprocess import sys import...
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin class ActiveMq(Plugin, DebianPlugin): """ActiveMQ message broker """ plugin_name = 'activemq' profiles = ('openshift',) packages = ('activemq', 'activemq-core') files = ('/var/log/activemq',) def setup(self): ...
import unittest import tuned.monitors.base class MockMonitor(tuned.monitors.base.Monitor): @classmethod def _init_available_devices(cls): cls._available_devices = set(["a", "b"]) @classmethod def update(cls): for device in ["a", "b"]: cls._load.setdefault(device, 0) cls._load[device] += 1 class Monitor...
# -*- encoding: utf-8 -*- from abjad.tools import markuptools from abjad.tools import scoretools from abjad.tools.handlertools.ArticulationHandler import ArticulationHandler class RepeatedMarkupHandler(ArticulationHandler): r'''Repeated markup handler. ''' ### CLASS ATTRIBUTES ### __slots__ = ( ...
""" Tests for dit.pid.imin. """ import pytest from dit.pid.measures.imin import PID_WB from dit.pid.distributions import bivariates, trivariates def test_pid_wb1(): """ Test imin on a generic distribution. """ d = bivariates['prob. 1'] pid = PID_WB(d, ((0,), (1,)), (2,)) assert pid[((0,), (1...
from __future__ import print_function from w3lib.url import is_url from scrapy.commands import ScrapyCommand from scrapy.http import Request from scrapy.exceptions import UsageError from scrapy.utils.spider import spidercls_for_request, DefaultSpider class Command(ScrapyCommand): requires_project = False de...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} class Etherstub(object): def __init__(self, module): self.module = module self.name = module.params['name'] self.temporary = module.params['temporary...
import sys from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import SJISDistributionAnalysis from .jpcntx import SJISContextAnalysis from .mbcssm import SJISSMModel from . import constants class SJISProber(MultiByteCharSetProber): def __i...
from telemetry.core import possible_app class PossibleBrowser(possible_app.PossibleApp): """A browser that can be controlled. Call Create() to launch the browser and begin manipulating it.. """ def __init__(self, browser_type, target_os, supports_tab_control): super(PossibleBrowser, self).__init__(app_t...
from __future__ import print_function import json import struct import re import base64 import httplib import sys settings = {} class BitcoinRPC: def __init__(self, host, port, username, password): authpair = "%s:%s" % (username, password) self.authhdr = "Basic %s" % (base64.b64encode(authpair)) self.conn = ht...
"""Base and helper classes for Google RESTful APIs.""" __all__ = ['add_sync_methods'] import logging import os import random import time from . import api_utils try: from google.appengine.api import app_identity from google.appengine.ext import ndb except ImportError: from google.appengine.api import app_...
import openerp.tests.common as test_common from openerp import fields class TestProcurementGroup(test_common.TransactionCase): def test_sourced_by_no_po(self): """ Test it creates only one Procurement Group if not sourced Procurement Group will be named after sale's name """ so_l...
#!/usr/bin/env python """System cron flows tests.""" from absl import app from grr_response_core import config from grr_response_core.lib import rdfvalue from grr_response_core.lib.rdfvalues import client_stats as rdf_client_stats from grr_response_core.lib.rdfvalues import stats as rdf_stats from grr_response_server...
from decimal import Decimal from sys import float_info from unittest import TestCase from django.utils.numberformat import format as nformat class TestNumberFormat(TestCase): def test_format_number(self): self.assertEqual(nformat(1234, '.'), '1234') self.assertEqual(nformat(1234.2, '.'), '1234.2...
from flask import g from flask.ext.restplus import Namespace, reqparse, marshal from app.api.attendees import TICKET from app.api.microlocations import MICROLOCATION from app.api.sessions import SESSION from app.api.speakers import SPEAKER from app.api.sponsors import SPONSOR from app.api.tracks import TRACK from app....
""" Illustris Simulation: Public Data Release. groupcat.py: File I/O related to the FoF and Subfind group catalogs. """ from os.path import isfile import numpy as np import h5py def gcPath(basePath,snapNum,chunkNum=0): """ Return absolute path to a group catalog HDF5 file (modify as needed). """ gcPa...
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...
# -*- coding: utf-8 -*- """ requests.exceptions ~~~~~~~~~~~~~~~~~~~ This module contains the set of Requests' exceptions. """ class RequestException(RuntimeError): """There was an ambiguous exception that occurred while handling your request.""" class HTTPError(RequestException): """An HTTP error occ...
from django import http from django.core.urlresolvers import reverse from mox import IsA from openstack_dashboard import api from openstack_dashboard.test import helpers as test INDEX_URL = reverse('horizon:settings:apipassword:index') class ApiPasswordTests(test.TestCase): @test.create_stubs({api.keystone: ...
from gi.repository import Gtk import os.path from . import gglobals from .gtk_extras import optionTable from . import plugin_loader, plugin class PreferencesGui (plugin_loader.Pluggable): """The glue between our preferences dialog UI and our prefs modules. Instead of "connecting", as would be normal with pygt...
"""Batch updates / deletes of storage buckets / blobs. See: https://cloud.google.com/storage/docs/json_api/v1/how-tos/batch """ from email.encoders import encode_noop from email.generator import Generator from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from email.parse...
"""Factory methods to convert supported input files to supported translatable files.""" import os #from translate.convert import prop2po, po2prop, odf2xliff, xliff2odf __all__ = ['converters', 'UnknownExtensionError', 'UnsupportedConversionError'] # Turn into property to support lazy loading of things? converters...
"""Routine to "compile" a .py file to a .pyc (or .pyo) file. This module has intimate knowledge of the format of .pyc files. """ import __builtin__ import imp import marshal import os import sys import traceback MAGIC = imp.get_magic() __all__ = ["compile", "main", "PyCompileError"] class PyCompileError(Exception...
################################ # EvoMan FrameWork - V1.0 2016 # # <EMAIL> # ################################ import sys import numpy import random import Base from Base.SpriteConstants import * from Base.SpriteDefinition import * from sensors import Sensors tilemap = 'evoman/map4.tmx' timeexpire = 1000 # game...
import os, sys, codecs, shutil, filecmp, subprocess # the template_dir is the path where this file lives on disk template_dir = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename)) def ensure_dev_path(debug=True): rc = subprocess.call(["xcode-select", "-print-path"], stdout=open(os.devnull, 'w'), st...
import datetime from umit.icm.agent.gui.dashboard.timeline.Calendar import CalendarManager from umit.icm.agent.gui.dashboard.timeline.Calendar import months from umit.icm.agent.gui.dashboard.timeline.Calendar import monthname from umit.icm.agent.gui.dashboard.timeline.Calendar import startup_calendar_opts from umi...
""" A Python "serializer". Doesn't do much serializing per se -- just converts to and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for other serializers. """ from __future__ import unicode_literals from django.apps import apps from django.conf import settings from django.core.serialize...
from boto.compat import json class OptionStatus(dict): """ Presents a combination of status field (defined below) which are accessed as attributes and option values which are stored in the native Python dictionary. In this class, the option values are merged from a JSON object that is stored as t...
from openerp.osv import fields, osv from openerp.tools.translate import _ class sale_make_invoice(osv.osv_memory): _name = "sale.make.invoice" _description = "Sales Make Invoice" _columns = { 'grouped': fields.boolean('Group the invoices', help='Check the box to group the invoices for the same cust...
""" The :mod:`sklearn.kernel_approximation` module implements several approximate kernel feature maps base on Fourier transforms. """ # # License: BSD 3 clause import warnings import numpy as np import scipy.sparse as sp from scipy.linalg import svd from .base import BaseEstimator from .base import TransformerMixin...
import itertools import functools import numpy as np from numpy.linalg import norm, inv def gcd(a, b): """Calculate the greatest common divisor of a and b""" while b: a, b = b, a%b return a class MillerIndex(np.ndarray): """ Representation of a three of four index Miller direction or plan...