code
stringlengths
1
199k
"""Label map utility functions.""" from absl import logging from six.moves import range def _validate_label_map(label_map): """Checks if a label map is valid. Args: label_map: StringIntLabelMap to validate. Raises: ValueError: if label map is invalid. """ for item in label_map.item: if item.id < 0...
"""Scrubs PII from Log Exports. This Cloud Function example is intended to redact sensitive data from logs exported to pub/sub. It will read a pub/sub message and attempt to identify PII data within the jsonPayload.message field using the dlp api. If any sensitive data has been found, it will rewrite the message with ...
import os import shutil from pychron.dvc import analysis_path, dvc_load, dvc_dump def fix_identifier( source_id, destination_id, root, repo, aliquots, steps, dest_steps=None, dest_aliquots=None, ): if dest_aliquots is None: dest_aliquots = aliquots if dest_steps is None: ...
""" Trove Command line tool """ import os import sys possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)) if os.path.exists(os.path.join(possible_topdir, 'troveclient', ...
from django.contrib import admin from fclover.activity.models import Activity admin.site.register(Activity)
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import logging import os import shutil import six.moves.urllib.parse as urllib_parse from pants.base.exceptions import TaskError from pants.fs.archive import archiver_f...
"""Audit jobs that validate all of the storage models in the datastore.""" from __future__ import annotations import collections from core.jobs import base_jobs from core.jobs import job_utils from core.jobs.io import ndb_io from core.jobs.transforms.validation import base_validation from core.jobs.transforms.validatio...
from django.core.exceptions import ValidationError from rest_framework import exceptions from rest_framework import serializers as ser from rest_framework.fields import empty from rest_framework.exceptions import ValidationError as DRFValidationError from api.base.exceptions import Conflict, JSONAPIException from api.b...
"""Test air_quality of GIOS integration.""" from datetime import timedelta import json from unittest.mock import patch from gios import ApiError from homeassistant.components.air_quality import ( ATTR_AQI, ATTR_CO, ATTR_NO2, ATTR_OZONE, ATTR_PM_2_5, ATTR_PM_10, ATTR_SO2, ) from homeassistant...
"""The Picture integration.""" from __future__ import annotations import asyncio import logging import pathlib import secrets import shutil from PIL import Image, ImageOps, UnidentifiedImageError from aiohttp import hdrs, web from aiohttp.web_request import FileField import voluptuous as vol from homeassistant.componen...
import unittest import pytest class ElementAttributeTests(unittest.TestCase): def testShouldReturnNullWhenGettingTheValueOfAnAttributeThatIsNotListed(self): self._loadSimplePage() head = self.driver.find_element_by_xpath("/html") attribute = head.get_attribute("cheese") self.assertTr...
"""Functional tests for tensor_util.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from tensorflow.python.framework import tensor_shape from tensorflow.python.framework import tensor_util from tensorflow.python....
"""Module for ETHERLIKE-MIB.""" from collections import defaultdict from switchmap.snmp.base_query import Query def get_query(): """Return this module's Query class.""" return EtherlikeQuery def init_query(snmp_object): """Return initialize and return this module's Query class.""" return EtherlikeQuery(...
""" Tests For JsonFilter. """ from oslo_serialization import jsonutils from manila.scheduler.filters import json from manila import test from manila.tests.scheduler import fakes class HostFiltersTestCase(test.TestCase): """Test case for JsonFilter.""" def setUp(self): super(HostFiltersTestCase, self).se...
from c7n_kube.actions.core import DeleteResource, PatchResource from c7n_kube.actions.labels import LabelAction from c7n_kube.provider import resources as kube_resources SHARED_ACTIONS = (DeleteResource, LabelAction, PatchResource) for action in SHARED_ACTIONS: kube_resources.subscribe(action.register_resources)
""" Class for VM tasks like spawn, snapshot, suspend, resume etc. """ import collections import copy import os import time import decorator from oslo.config import cfg from oslo.vmware import exceptions as vexc from nova.api.metadata import base as instance_metadata from nova import compute from nova.compute import pow...
import sys PY3 = sys.version_info[0] == 3 if PY3: def b(s): return s.encode("latin-1") def u(s): return s binary_type = bytes else: def b(s): return s def u(s): return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape") binary_type = str
__version__ = "0.2.1" from .storedobject import StoredObject from .ext.odmflask import FlaskStoredObject from .query.querydialect import DefaultQueryDialect as Q
import json import directory def parse_key_group_name(key_group_name = 'Group.basic'): line = key_group_name.split('.') if len(line) != 2 or not line[0] or not line[1]: raise ValueError('key_group_name not correct, please see dtsk_python_load_demo.py') name_type = line[0] name_value = line[1] ...
import os from py2neo.packages.httpstream.packages.urimagic import URI __all__ = ["NEO4J_AUTH", "NEO4J_DIST", "NEO4J_HOME", "NEO4J_URI"] NEO4J_AUTH = os.getenv("NEO4J_AUTH", None) NEO4J_DIST = os.getenv("NEO4J_DIST", "http://dist.neo4j.org/") NEO4J_HOME = os.getenv("NEO4J_HOME", ".") NEO4J_URI = URI(os.getenv("NEO4J_UR...
import os import unittest2 import mock from st2common.runners.paramiko_ssh_runner import BaseParallelSSHRunner from st2common.runners.paramiko_ssh_runner import RUNNER_HOSTS from st2common.runners.paramiko_ssh_runner import RUNNER_USERNAME from st2common.runners.paramiko_ssh_runner import RUNNER_PASSWORD from st2common...
""" Copyright 2017 Peter Urda 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 distri...
import argparse import os import re import sys import traceback from cliff import command from oslo_log import log as logging from oslo_serialization import jsonutils as json from six import moves from six.moves.urllib import parse as urlparse from tempest import clients from tempest.common import credentials_factory a...
from django.contrib import admin from blog.models import blog class blogAdmin(admin.ModelAdmin): list_display=('subject','author','content','post_time') search_fields = ('subject', 'author','content') list_filter=('post_time',) ordering = ('-post_time',) admin.site.register(blog,blogAdmin)
from marshmallow import Schema, fields, post_load from floyd.model.base import BaseModel class EnvSchema(Schema): arch = fields.Str() name = fields.Str() image = fields.Str() @post_load def make_env(self, data): return Env(**data) class Env(BaseModel): schema = EnvSchema(strict=True) ...
from django.core import management if __name__ == "__main__": management.execute_from_command_line()
import os import sys import sqlite3 import atexit import tempfile import zipimport import random import pickle class DBSystem : def __init__(self, wd) : # initialize db #print("using db") #print ("debug:", __file__) # make temporary self.workdir = wd dbpath = self.wor...
"""Model class for ash realtime.""" from builtins import object import pytz from django.contrib.gis.db import models from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ from realtime.app_settings import ASH_EVENT_ID_FORMAT, \ ASH_EVENT_REPORT_FORMAT, ASH_EVENT_TIME_F...
""" Specification written in the GR(1) fragment of Linear Temporal Logic This module contains one class, GR1Specification. A GR(1) Specification consists of propositions and formulas. The class has (private) methods for populating the 6 parts of a GR(1) formula: * Environment initial conditions * Environment safety...
"""Cloud browser template tags.""" import os from django import template from django.template import TemplateSyntaxError, Node from django.template.defaultfilters import stringfilter from cvmfs_browser.app_settings import settings register = template.Library() # pylint: disable=C0103 @register.filter @stringfilter def...
import doctest import unittest import frequency def suite(): suite = unittest.TestSuite() #suite.addTest(unittest.makeSuite(SlaveTestCase)) suite.addTest(doctest.DocTestSuite(frequency)) return suite if __name__ == '__main__': unittest.main(defaultTest='suite')
import argparse import sys import utils def ParseArgs(args): args = args[1:] parser = argparse.ArgumentParser( description='A script to write a custom dartdoc_options.yaml to a file') parser.add_argument( '--output', '-o', type=str, required=True, help='File to write') return parser.pars...
from __future__ import absolute_import, unicode_literals import collections from django import forms from django.contrib.staticfiles.templatetags.staticfiles import static from django.core.exceptions import NON_FIELD_ERRORS, ValidationError from django.forms.utils import ErrorList from django.template.loader import ren...
import os import sys import traceback sys.path.insert(0, os.path.abspath('./../')) if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testapp.settings") from django.core.management import execute_from_command_line try: execute_from_command_line(sys.argv) except Exception...
import re from html.parser import HTMLParser from wagtail.admin.rich_text.converters.contentstate_models import ( Block, ContentState, Entity, EntityRange, InlineStyleRange, ) from wagtail.admin.rich_text.converters.html_ruleset import HTMLRuleset from wagtail.core.models import Page from wagtail.co...
"""Kernel Principal Components Analysis.""" import numpy as np from scipy import linalg from scipy.sparse.linalg import eigsh from ..utils._arpack import _init_arpack_v0 from ..utils.extmath import svd_flip, _randomized_eigsh from ..utils.validation import check_is_fitted, _check_psd_eigenvalues from ..utils.deprecatio...
from __future__ import print_function from __future__ import absolute_import import OpenImageIO as oiio try: r = oiio.ROI() print ("ROI() =", r) print ("r.defined =", r.defined) r = oiio.ROI (0, 640, 100, 200) print ("ROI(0, 640, 100, 200) =", r) r = oiio.ROI (0, 640, 0, 480, 0, 1, 0, 4) pri...
from numpy import array,mean,std import pyvision as pv from pyvision.vector.PCA import PCA import unittest import os.path NORM_NONE="NONE" NORM_PCA="PCA_WHITEN" NORM_VALUE="VALUE" NORM_AUTO="AUTO" REG_NORM_NONE="NONE" REG_NORM_VALUE="VALUE" TYPE_TWOCLASS="TWOCLASS" TYPE_MULTICLASS="MULTICLASS" TYPE_REGRESSION="REGRESSI...
from gpiozero import LEDBoard, MotionSensor from gpiozero.pins.pigpio import PiGPIOFactory from gpiozero.tools import zip_values from signal import pause ips = ['192.168.1.3', '192.168.1.4', '192.168.1.5', '192.168.1.6'] remotes = [PiGPIOFactory(host=ip) for ip in ips] leds = LEDBoard(2, 3, 4, 5) # leds on this pi sen...
from decimal import Decimal from django.db import models from django.utils.translation import ugettext as _ from django.conf import settings from oscar.core.compat import AUTH_USER_MODEL from oscar.core.utils import slugify from . import bankcards class AbstractTransaction(models.Model): """ A transaction for a...
from .AutodockVina import autodock_vina __all__ = ['autodock_vina']
""" Kind of like htmlgen, only much simpler. The only important symbol that is exported is ``html``. This builds ElementTree nodes, but with some extra useful methods. (Open issue: should it use ``ElementTree`` more, and the raw ``Element`` stuff less?) You create tags with attribute access. I.e., the ``A`` anchor ta...
from django import forms from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.contrib.auth.models import User import pytz from rest_framework import fields, permissions, relations, serializers from rest_framework.exceptions import APIException from rest_framework.filte...
import os import logging import types import json import six class JsonFormatter(logging.Formatter): def format(self, record): data = { "level": record.levelno, "levelName": record.levelname, "msg": logging.Formatter.format(self, record) } if type(record.a...
class ReverseProxied(object): def __init__(self, app): self.app = app def __call__(self, environ, start_response): script_name = environ.get('HTTP_X_SCRIPT_NAME', '') if script_name: environ['SCRIPT_NAME'] = script_name path_info = environ['PATH_INFO'] ...
from collections import OrderedDict import copy import operator from functools import partial, reduce, update_wrapper import warnings from django import forms from django.conf import settings from django.contrib import messages from django.contrib.admin import widgets, helpers from django.contrib.admin.utils import (un...
def areEquallyStrong(a,b,c,d): p, q = [a, b], [c, d] return any(p[0] == q[j] and p[1] == q[j ^ 1] for j in range(2)) def main(): print(areEquallyStrong(10, 15, 15, 10)) print(areEquallyStrong(15, 10, 15, 10)) print(areEquallyStrong(15, 10, 15, 9)) if __name__ == '__main__': main()
class AuthenticationComplete(object): """ An AuthenticationComplete context object""" def __init__(self, profile=None, credentials=None, provider_name=None, provider_type=None): """Create an AuthenticationComplete object with user data"...
from __future__ import unicode_literals """assign/unassign to ToDo""" import webnotes @webnotes.whitelist() def get(args=None): """get assigned to""" if not args: args = webnotes.form_dict return webnotes.conn.sql_list("""select owner from `tabToDo` where reference_type=%(doctype)s and reference_name=%(name)s ...
''' this test suit tests functioning of mraa-gpio commands mraa-gpio list mraa-gpio set <pin> <value> mraa-gpio get <pin> ''' from oeqa.oetest import oeRuntimeTest import unittest import subprocess import os from time import sleep class MraaGpioTest(oeRuntimeTest): ''' These tests require to use BeagleBone as t...
import os import sys import logging log = logging.getLogger("main") from ete2.tools.phylobuild_lib.master_task import AlgTask from ete2.tools.phylobuild_lib.master_job import Job from ete2.tools.phylobuild_lib.utils import (read_fasta, OrderedDict, GLOBALS, CLUSTALO_CITE, pjoin) __all__ = ["Clustalo"] class Clustalo(Al...
from django.conf.urls import patterns, include, url from tastypie.api import Api from django.views.generic.base import RedirectView from calaccess_campaign_browser.api import FilerResource, FilingResource from calaccess_campaign_browser import views from calaccess_campaign_browser.views import search from django.views....
from energenie import OpenThings import os, time LOG_FILENAME = "energenie.csv" HEADINGS = 'timestamp,mfrid,prodid,sensorid,flags,switch,voltage,freq,reactive,real,apparent,current,temperature' log_file = None def trace(msg): print(str(msg)) def logMessage(msg): global log_file if log_file == None: ...
""" Impact - Controller @author: Michael Howden (michael@sahanafoundation.org) @date-created: 2010-10-12 """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: raise HTTP(404, body="Module disabled: %s" % prefix) def type(): """ RESTful CRUD con...
import chainer import chainer.functions as F from chainer import Variable class DCGANUpdater(chainer.training.updaters.StandardUpdater): def __init__(self, *args, **kwargs): self.gen, self.dis = kwargs.pop('models') super(DCGANUpdater, self).__init__(*args, **kwargs) def loss_dis(self, dis, y_fa...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('memorylane', '0006_auto_20151206_1121'), ] operations = [ migrations.AddField( model_name='memory', name='author_image', ...
""" Error-handling classes and functions """ class InternalError(Exception): "An internal (i.e. implementation) error that should halt execution" pass _errors = [] class Error(object): """ A runtime error produced by invalid or unusable input that should be handled and reported gracefully. Upon creation...
import unittest from PyFoam.Infrastructure.ServerBase import ServerBase theSuite=unittest.TestSuite()
__revision__ = "$Id$" import urllib2 from HTMLParser import HTMLParser import re import base64 import os import sys import Queue import threading import signal from invenio.config import (CFG_CACHEDIR, CFG_HEPDATA_URL, CFG_HEPDATA_PLOTSIZE, ...
import os.path class IconCache(object): """Maintain a cache of icons. If an icon is used more than once by a GUI then ensure that only one copy is created. """ def __init__(self, object_factory, qtgui_module): """Initialise the cache.""" self._object_factory = object_factory sel...
"""Checks WebKit style for text files.""" class TextProcessor(object): """Processes text lines for checking style.""" def __init__(self, file_path, handle_style_error): self.file_path = file_path self.handle_style_error = handle_style_error def process(self, lines): lines = (["// adj...
import Jokosher.Extension import gobject import dbus import dbus.service if getattr(dbus, 'version', (0,0,0)) >= (0,41,0): import dbus.glib EXTENSION_NAME = "Jokosher DBus API" EXTENSION_DESCRIPTION = "Allows other processes to call Jokosher extension API functions using DBus" EXTENSION_VERSION = "0.1" JOKOSHER_DBUS_P...
""" BibExport plugin implementing 'googlescholar' exporting method. The main function is run_export_method(jobname) defined at the end. This is what BibExport daemon calls for all the export jobs that use this exporting method. The Google Scholar exporting method produces a sitemap of all the records matching the colle...
""" CRF_neuron_vs_signal.py Testing the mean firing rate of a fiber for different signal strengths. Prints to a figure the mean firing rate for the output (ON and OFF) as a function of the different parameter values. It's similar to a CRF function. Results illustrate that - the higher the value the more the neuron spik...
a = str(raw_input("Input string: ")) a = list(a) a.reverse() a = str(a) for [ print a print type(a)
"""Simplifies working with URLs, purl module provides common URL parsing and processing""" import urlparse import os.path import gettext __trans = gettext.translation('pisi', fallback=True) _ = __trans.ugettext class URI(object): """URI class provides a URL parser and simplifies working with URLs.""" def __...
from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Components.ConfigList import ConfigListScreen from Components.ActionMap import ActionMap from Components.config import ConfigSelection, getConfigListEntry, ConfigAction from Components.ScrollLabel import ScrollLabel from Tools.Directories ...
import os import sys import pisi.uri import pisi.specfile def scanPSPEC(folder): packages = [] for root, dirs, files in os.walk(folder): if "pspec.xml" in files: packages.append(root) # dont walk into the versioned stuff if ".svn" in dirs: dirs.remove(".svn") ...
"""Unit tests for error control""" import pytest from ufl.algorithms import replace from dolfin import * from dolfin.fem.adaptivesolving import * from dolfin_utils.test import skip_in_parallel def reconstruct_refined_form(form, functions, mesh): function_mapping = {} for u in functions: w = Function(u.l...
from couchpotato.core.helpers.variable import splitString from couchpotato.core.logger import CPLog from couchpotato.core.notifications.base import Notification import pynma log = CPLog(__name__) class NotifyMyAndroid(Notification): def notify(self, message = '', data = {}, listener = None): if self.isDisab...
HOST = "postgres-10f" PORT = "5432" USER = "postgres" PASSWORD = "" DATABASE = "google" READ_PREFERENCE = "primary" COLLECTION_INPUT = "median_cpu" COLLECTION_OUTPUT = "ratio" PREFIX_COLUMN = "g_" ATTRIBUTES = ['median cpu'] SORT = ["filepath", "numline"] OPERATION_TYPE = "ALL" OUTPUT_FILE = "ratio_cpu_memory.csv"
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'core'} DOCUMENTATION = """ --- module: net_l3_interface version_added: "2.4" author: "Ricardo Carrillo Cruz (@rcarrillocruz)" short_description: Manage L3 interfaces on network devices descript...
from __future__ import print_function from xml.etree import ElementTree from collections import OrderedDict import sys, os, re index_file = sys.argv[1] dirname = os.path.dirname(os.path.realpath(__file__)) outdirname = "bindings" if not os.path.exists(os.path.join(outdirname, 'cxx/include/libsigrokcxx')): os.makedi...
import markdown2 head = """ {% extends "layout.html" %} {% block body %} """ foot = """ {% endblock %} """ f = open('about.md') html = head + markdown2.markdown(f.read(), extras=["smarty-pants"]) + foot fout = open('../templates/about.html', 'w') fout.write(html)
"base for all c/c++ programs and libraries" import os, sys, re import TaskGen, Task, Utils, preproc, Logs, Build, Options from Logs import error, debug, warn from Utils import md5 from TaskGen import taskgen, after, before, feature from Constants import * from Configure import conftest try: from cStringIO import Strin...
from gtk import events_pending, main_iteration, RESPONSE_OK import os import re import subprocess import bisect import logging from otrverwaltung.actions.baseaction import BaseAction from otrverwaltung.constants import Action, Cut_action, Status, Format, Program from otrverwaltung import fileoperations from otrverwaltu...
import mantid import os import sys path = mantid.config["pythonscripts.directories"].split(";")[0] path = os.path.join(path[:path.index("scripts")], "scripts", "FilterEvents") sys.path.append(path)
{ 'name' : 'Res Currency Priority', 'version' : '1.0', 'author' : 'ClearCorp', 'category': 'Accounting & Finance', 'description': ''' Add priority to currency ''', 'depends' : [ 'base', ], 'data' : [ 'res_currency_priority_view.xml', ...
from rdflib import ConjunctiveGraph, plugin from rdflib.store import Store from StringIO import StringIO import unittest test_data = """ @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . <http://example.org/alice> foaf:name "Alice" . <http://ex...
""" E-commerce Tab Instructor Dashboard Query Registration Code Status. """ import logging from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ from django.views.decorators.cache import cache_control from django.views.decorators.http import require_GET, require_POST from opaqu...
""" Definition of "Library" as a learning context. """ import logging from django.core.exceptions import PermissionDenied from openedx.core.djangoapps.content_libraries import api, permissions from openedx.core.djangoapps.content_libraries.library_bundle import ( LibraryBundle, bundle_uuid_for_library_key, ...
from spack import * class RSpdep(RPackage): """A collection of functions to create spatial weights matrix objects from polygon contiguities, from point patterns by distance and tessellations, for summarizing these objects, and for permitting their use in spatial data analysis, including regional aggrega...
from spack import * class Samtools(Package): """SAM Tools provide various utilities for manipulating alignments in the SAM format, including sorting, merging, indexing and generating alignments in a per-position format""" homepage = "https://www.htslib.org" url = "https://github.com/samto...
__author__ = 'wildi.markus@bluewin.ch' import sys import numpy as np from u_point.structures import Parameter from model.model_base import ModelAltAz class Model(ModelAltAz): def __init__(self,lg=None,parameters=None, fit_plus_poly=None, parameters_plus_poly=None): ModelAltAz.__init__(self,lg=lg) self.fit_plu...
import mock def patch_fake_ryu_client(): ryu_mod = mock.Mock() ryu_app_mod = ryu_mod.app ryu_app_client = ryu_app_mod.client rest_nw_id = ryu_app_mod.rest_nw_id rest_nw_id.NW_ID_EXTERNAL = '__NW_ID_EXTERNAL__' rest_nw_id.NW_ID_UNKNOWN = '__NW_ID_UNKNOWN__' return mock.patch.dict('sys.modules...
"""Test listing users. """ import datetime import logging import testscenarios from oslo.config import cfg from ceilometer.publisher import rpc from ceilometer import sample from ceilometer.tests import api as tests_api from ceilometer.tests import db as tests_db load_tests = testscenarios.load_tests_apply_scenarios LO...
from django.core.exceptions import ValidationError # noqa from django.forms.fields import * # noqa from django.forms.forms import * # noqa from django.forms import widgets from django.forms.widgets import * # noqa from horizon.forms.base import DateForm # noqa from horizon.forms.base import SelfHandlingForm # noq...
""" click ~~~~~ Click is a simple Python module that wraps the stdlib's optparse to make writing command line scripts fun. Unlike other modules, it's based around a simple API that does not come with too much magic and is composable. In case optparse ever gets removed from the stdlib, it will b...
from horizon.api import keystone from horizon.forms import ModalFormView from .forms import DownloadOpenRCForm from .tables import EndpointsTable class OpenRCView(ModalFormView): form_class = DownloadOpenRCForm template_name = 'settings/project/settings.html' def get_data(self): services = [] ...
"""Provides mailgun api to send emails.""" from __future__ import annotations import base64 import urllib from core import feconf from core import utils from typing import Dict, List, Optional, Union def send_email_to_recipients( sender_email: str, recipient_emails: List[str], subject: str, ...
''' ExpSettingsVal - Validates Experimental Settings against a set of rules known to cause the Compiler (Compiler.py) to fail if they are not followed Created on April 17, 2015 Original Author: Brian Donovan Copyright 2015 Raytheon BBN Technologies Licensed under the Apache License, Version 2.0 (the "License"); you may...
from keystoneclient import base class Policy(base.Resource): """Represents an Identity policy. Attributes: * id: a uuid that identifies the policy * blob: a policy document (blob) * type: the mime type of the policy blob """ def update(self, blob=None, type=None): kwargs ...
""" Support for Ness D8X/D16X alarm panel. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/alarm_control_panel.ness_alarm/ """ import logging import homeassistant.components.alarm_control_panel as alarm from homeassistant.components.ness_alarm import ( ...
import copy import logging from s3transfer.utils import get_callbacks logger = logging.getLogger(__name__) class Task(object): """A task associated to a TransferFuture request This is a base class for other classes to subclass from. All subclassed classes must implement the main() method. """ def __...
import time import unittest from eventlet import greenthread import mock from oslo_concurrency import processutils import paramiko import six from cinder import context from cinder import exception from cinder import ssh_utils from cinder import test from cinder import utils from cinder.volume import configuration as c...
"""PhoneNumber object definition""" from .util import UnicodeMixin, ImmutableMixin, mutating_method from .util import to_long, unicod, rpr, force_unicode class CountryCodeSource(object): """The source from which a country code is derived.""" # The country_code is derived based on a phone number with a leading "...
from merge import DataBag import CsHelper class CsGuestNetwork: def __init__(self, device, config): self.data = {} self.guest = True db = DataBag() db.setKey("guestnetwork") db.load() dbag = db.getDataBag() self.config = config if device in dbag.keys()...
''' Created on Aug 7, 2015 ''' import copy import hashlib import logging import requests from oslo_utils import encodeutils LOG = logging.getLogger(__name__) USER_AGENT = 'python-surclient' SENSITIVE_HEADERS = ('X-Auth-Token',) class SURClient(object): def __init__(self, endpoint, **kwargs): self.endpoint =...
import sys import inspect import functools import fractions from pyspider.libs.log import LogFormatter from pyspider.libs.url import quote_chinese, _build_url, _encode_params from pyspider.libs.utils import md5string, hide_me, pretty_unicode from pyspider.libs.ListIO import ListO from pyspider.libs.response import rebu...
"""Script to prepare a node for joining a cluster. """ import os import os.path import optparse import sys import logging from ganeti import cli from ganeti import constants from ganeti import errors from ganeti import pathutils from ganeti import utils from ganeti import ht from ganeti import ssh from ganeti.tools imp...