content
string
from django import template register = template.Library() @register.filter def get_rank(page, loop_counter): """ Calculates the player rank from current page and loop index. :param page: Current page number :param loop_counter: Loop index :return: rank """ rank = page.start_index() + loop...
from __future__ import division from dolfin import * import numpy import pprint # Gnuplot related functions ################################################################################ # discontinuous piecewise linear output def gnuplot_dg1(file, mesh, fun): file = open(file, 'w+') i = 0 for myCell in cells(m...
""" Task description (in Estonian): 3. Arvude mood (5p) Kirjuta funktsioon mood, mis võtab argumendiks täisarvujärjendi ja tagastab arvu, mida leidub järjendis kõige rohkem (ehk moodi). Kui selliseid arve on mitu, siis tuleb tagastada neist vähim. Näide: mood([-10, 17, 13, 17, -10, 21]) peab tagastama -10. """ fr...
""" Tests for select_related() ``select_related()`` follows all relationships and pre-caches any foreign key values so that complex trees can be fetched in a single query. However, this isn't always a good idea, so the ``depth`` argument control how many "levels" the select-related behavior will traverse. """ from dj...
"""distutils.cygwinccompiler Provides the CygwinCCompiler class, a subclass of UnixCCompiler that handles the Cygwin port of the GNU C compiler to Windows. It also contains the Mingw32CCompiler class which handles the mingw32 port of GCC (same as cygwin in no-cygwin mode). """ # problems: # # * if you use a msvc com...
import re from config.queues import all_queue_names from model.activeworkitems import ActiveWorkItems from model.workitems import WorkItems class Queue(object): def __init__(self, name): assert(name in all_queue_names) self._name = name @classmethod def queue_with_name(cls, queue_name): ...
class Generator(object): def __init__(self, cmakeName, buildDir='build', sourceDir='..', binDir='bin'): self.cmakeName = cmakeName self.buildDir = buildDir self.sourceDir = sourceDir self.binDir = binDir def getBuildDir(self, target): return self.buildDir def getBinDir(self, target=''): return s...
import pickle import sys import logbook from logbook.helpers import iteritems, xrange, u import pytest def test_basic_logging(active_handler, logger): logger.warn('This is a warning. Nice hah?') assert active_handler.has_warning('This is a warning. Nice hah?') assert active_handler.formatted_records ...
#!/usr/bin/env python import unittest from coloredcoinlib import (ColorSet, ColorDataBuilderManager, AidedColorDataBuilder, ThinColorData) from ngcccbase.deterministic import DWalletAddressManager from ngcccbase.pwallet import PersistentWallet from ngcccbase.txcons import BasicTxSpec, Inv...
# -*- coding: utf-8 -*- from flask import render_template, current_app from wtforms import * from flask.ext.wtf import Form from flask_mail import Message from application import mail from common.utils import get_signer from accounts.models import User class LoginForm(Form): user = None username = TextFiel...
import tkinter as tk import tkinter.ttk import tkinter.simpledialog import tkinter.messagebox import tkinter.filedialog class SeqLibApplyDialog(tkinter.simpledialog.Dialog): """ Confirmation dialog box for applying FASTQ filtering options to selected SeqLibs from the Treeview. """ def __init__(se...
""" Copyright 2013 Shine Wang 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 distrib...
from heatclient.v1 import resource_types from heatclient.v1 import services from heatclient.v1 import stacks from openstack_dashboard.test.test_data import utils # A slightly hacked up copy of a sample cloudformation template for testing. TEMPLATE = """ { "AWSTemplateFormatVersion": "2010-09-09", "Description": "AWS...
# coding: utf-8 """ 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, so...
import pygameui as ui from osci import gdata, res, client from ige.ospace.Const import * import ige, string class NewMessageDlg: def __init__(self, app): self.app = app self.createUI() def display(self, caller, objID, objType, forum, msgID = None): self.caller = caller self.msgSpec = gdata.mailboxSpec[objT...
from odoo.tests import common import zipfile import StringIO class TestPrototypeModuleExport(common.TransactionCase): def setUp(self): super(TestPrototypeModuleExport, self).setUp() self.main_model = self.env['module_prototyper.module.export'] self.prototype_model = self.env['module_protot...
import io import os from pathlib import Path import subprocess import sys import textwrap import time import pytest import pandas as pd import pandas._testing as tm import pandas.io.common as icom @pytest.mark.parametrize( "obj", [ pd.DataFrame( 100 * [[0.123456, 0.234567, 0.567567], [1...
import sys import codecs import datetime from pyphabricatordb import * from sqlalchemy.orm import sessionmaker def create_session(): DBSession = sessionmaker() return DBSession() def get_user(session, phid): return session.query(user.User).filter(user.User.phid == phid).first() def create_task_range_summ...
# -*- coding:utf-8 -*- from __future__ import ( absolute_import, division, print_function, with_statement, ) from collections import defaultdict from datetime import datetime import functools import time from bson.objectid import ObjectId from turbo.log import model_log from turbo.util import escape a...
# -*- coding: utf-8 -*- from __future__ import print_function import ast import copy import logging from collections import OrderedDict from time import time from lxml import html from lxml import etree from odoo import api, models, tools from odoo.tools.safe_eval import assert_valid_codeobj, _BUILTINS, _SAFE_OPCODES...
""" Linear bearing cage. """ from __future__ import absolute_import #Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module. import __init__ from fabmetheus_utilities.geometry.creation import extrude from fabmetheus_...
import unittest import uuid from airflow.providers.amazon.aws.hooks.kinesis import AwsFirehoseHook try: from moto import mock_kinesis except ImportError: mock_kinesis = None class TestAwsFirehoseHook(unittest.TestCase): @unittest.skipIf(mock_kinesis is None, 'mock_kinesis package not present') @mock...
""" Tests stringify functions used in xmodule html """ from nose.tools import assert_equals # pylint: disable=no-name-in-module from lxml import etree from xmodule.stringify import stringify_children def test_stringify(): text = 'Hi <div x="foo">there <span>Bruce</span><b>!</b></div>' html = '''<html a="b" f...
# -*- coding: utf-8 -*- import re from books.karelians.extraction.extractors.baseExtractor import BaseExtractor from books.karelians.extraction.extractionExceptions import * from books.karelians.extraction.extractors.dateExtractor import DateExtractor from shared import textUtils from books.karelians.extractionkeys im...
import os.path, sys, os, getopt import subprocess from xml.dom.minidom import parse, parseString import xml.dom import re import string class XacroException(Exception): pass def isnumber(x): return hasattr(x, '__int__') #import roslib; roslib.load_manifest('xacro') #import roslib.substitution_args def eval_exten...
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2019 Fortinet, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Lic...
""" This module houses ctypes interfaces for GDAL objects. The following GDAL objects are supported: CoordTransform: Used for coordinate transformations from one spatial reference system to another. Driver: Wraps an OGR data source driver. DataSource: Wrapper for the OGR data source object, supports OGR-su...
from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'd F Y' TIME_FORMAT = 'H:i' DATETIME_FORMAT = 'j. F Y H:i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j. F' SHORT_DATE_FORMAT = 'j.m...
#!/usr/bin/env python """ Here is a tool which I have been using to debug libc startup code where I didn't find gdb very helpful. It single steps the process and prints each instruction pointer address. To go faster, it allows a number of syscalls to run before starting single-stepping. It's possible to pipe the addre...
from typing import List, Type from andreas.db.database import db from andreas.db.model import Model from andreas.models.event import Event from andreas.models.keypair import KeyPair from andreas.models.post import Post from andreas.models.relations import PostPostRelation, UserPostRelation from andreas.models.server i...
# -*- encoding: utf8 -*- """Tests for distutils.command.register.""" import os import unittest import getpass import urllib2 import warnings from test.test_support import check_warnings, run_unittest from distutils.command import register as register_module from distutils.command.register import register from distuti...
from docutils.parsers.rst import Directive, directives from docutils import nodes from string import upper class configurationblock(nodes.General, nodes.Element): pass class ConfigurationBlock(Directive): has_content = True required_arguments = 0 optional_arguments = 0 final_argument_whitespace = ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from django.http import HttpResponse from django.views.generic import TemplateView from django.views.generic.detail import BaseDetailView from django.views.generic.detail import SingleObjectTemplateResponseMixin def response_mimetype(request): if "applicat...
"""Utils.py - Utilities for ruffus pipelines ============================================ Reference --------- """ import inspect import sys def isTest(): """return True if the pipeline is run in a "testing" mode. This method checks if ``-is-test`` has been given as a command line option. """ re...
import os, sys path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise "can't find...
"""Generic web element related code. Module attributes: Group: Enum for different kinds of groups. SELECTORS: CSS selectors for different groups of elements. FILTERS: A dictionary of filter functions for the modes. The filter for "links" filters javascript:-links and a-tags withou...
import json from openstack_dashboard.api import heat from openstack_dashboard.dashboards.project.stacks import mappings from openstack_dashboard.dashboards.project.stacks import sro class Stack(object): pass def d3_data(request, stack_id=''): try: stack = heat.stack_get(request, stack_id) exce...
import os import sys def is_active(): return True def get_name(): return "OSX" def can_build(): if (sys.platform == "darwin" or os.environ.has_key("OSXCROSS_ROOT")): return True return False def get_opts(): return [ ('force_64_bits','Force 64 bits binary','no'), ('osxcross_sdk','OSXCross SDK v...
from nose.tools import * import networkx as nx class TestTreeRecognition(object): graph = nx.Graph multigraph = nx.MultiGraph def setUp(self): self.T1 = self.graph() self.T2 = self.graph() self.T2.add_node(1) self.T3 = self.graph() self.T3.add_nodes_from(range(...
from datetime import datetime import itertools from oslo_log import log as logging import oslo_messaging from oslo_utils import uuidutils from neutron.common import constants from neutron.common import rpc as n_rpc from neutron.common import topics from neutron.i18n import _LW LOG = logging.getLogger(__name__) de...
""" This is the main ``urlconf`` for Mezzanine - it sets up patterns for all the various Mezzanine apps, third-party apps like Grappelli and filebrowser. """ from django.conf.urls.defaults import patterns, include from django.contrib import admin from django.contrib.admin.sites import NotRegistered from django.http im...
""" Mapping of bare metal node states. Setting the node `power_state` is handled by the conductor's power synchronization thread. Based on the power state retrieved from the driver for the node, the state is set to POWER_ON or POWER_OFF, accordingly. Should this fail, the `power_state` value is left unchanged, and the...
import copy import os import pytest import great_expectations as ge from great_expectations.core.util import nested_update from great_expectations.dataset.util import check_sql_engine_dialect from great_expectations.util import ( filter_properties_dict, get_currently_executing_function_call_arguments, lin...
# -*- coding: utf-8 -*- """ Qt5's inputhook support function Author: Christian Boos """ #----------------------------------------------------------------------------- # Copyright (C) 2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, d...
# # -*- coding: utf-8 -*- # import logging # from unittest import TestCase # # from auxlib import logz # from auxlib.path import PackageFile, find_file_in_site_packages, open_package_file # # log = logging.getLogger(__name__) # # # class PackageFileTests(TestCase): # # @classmethod # def setUpClass(cls): # ...
''' gpgetconfig -- obtain gp_configuration Usage: gpgetconfig [-f] [-u user] -d master_data_directory -f : if necessary, force start up and shutdown of DB to obtain configuration Exit: 0 - no error 1 - misc error 2 - unable to connect to database ''' import os, sys os.putenv('PGHOST', '') os.putenv("P...
"Utilities for loading models and the modules that contain them." from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils.datastructures import SortedDict from django.utils.importlib import import_module from django.utils.module_loading import module_has_submodule im...
import unittest import os import dataProcessingFunctions # This class tests if all necessary folders exist class testFolderExistence (unittest.TestCase): # Folder InitialData def test_FolderInitialData(self): res = True self.assertEqual(res, os.path.isdir("/srv/DataProcessing/InitialData")) ...
from south.db import db from south.v2 import SchemaMigration from zinnia.migrations import user_name from zinnia.migrations import user_table from zinnia.migrations import user_orm_label from zinnia.migrations import user_model_label class Migration(SchemaMigration): def forwards(self, orm): # Changing ...
from django import http from django.contrib import messages from django.core.urlresolvers import reverse from django_openstack import api from django_openstack.tests.view_tests import base from glance.common import exception as glance_exception from openstackx.api import exceptions as api_exceptions from novaclient imp...
"""OpenSSL/M2Crypto 3DES implementation.""" from .cryptomath import * from .tripledes import * if m2cryptoLoaded: def new(key, mode, IV): return OpenSSL_TripleDES(key, mode, IV) class OpenSSL_TripleDES(TripleDES): def __init__(self, key, mode, IV): TripleDES.__init__(self, key, ...
#!/usr/bin/env python __author__ = 'greg' from sklearn.cluster import DBSCAN from sklearn.cluster import AffinityPropagation import numpy as np import matplotlib.pyplot as plt import csv import sys import os import pymongo import matplotlib.cbook as cbook import cPickle as pickle import shutil import urllib import math...
# grouprise settings file # see https://docs.djangoproject.com/en/2.1/ref/settings/ import os import subprocess from stadt.settings.default import * from grouprise.core.assets import add_javascript_reference, add_javascript_inline, add_csp_directive, add_meta # see https://www.miniwebtool.com/django-secret-key-genera...
import sys import optparse import numpy as np import h5py from tt_log import logger import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt DEF_OUTPUT = 'productivity.png' def main (): logger.debug("%s starting" % sys.argv[0]) opt, args = getParms() infile_name = args[0] infile = h...
import os from subprocess import check_call from pi.dist import read_script def publish(execute=True, verbose=False, script_name='setup.py'): dist = read_script(script_name) name = dist.get_name() version = dist.get_version() if os.path.exists('README.md'): print 'Converting README.md to reSt...
from java.awt import Color, Dimension from javax.swing import JWindow, JTextArea, JScrollPane __author__ = "Don Coleman <<EMAIL>>" __cvsid__ = "$Id: tip.py,v 1.3 2003/05/01 03:43:53 dcoleman Exp $" class Tip(JWindow): """ Window which provides the user with information about the method. For Python, this s...
"""Support for SCSGate lights.""" import logging from scsgate.tasks import ToggleStatusTask import voluptuous as vol from homeassistant.components.light import PLATFORM_SCHEMA, LightEntity from homeassistant.const import ATTR_ENTITY_ID, ATTR_STATE, CONF_DEVICES, CONF_NAME import homeassistant.helpers.config_validatio...
""" Generate docs for examples. """ import os from types import ModuleType from flexx import ui, app THIS_DIR = os.path.dirname(os.path.abspath(__file__)) DOC_DIR = os.path.abspath(os.path.join(THIS_DIR, '..')) EXAMPLES_DIR = os.path.abspath(os.path.join(DOC_DIR, '..', 'examples')) OUTPUT_DIR = os.path.join(DOC_DIR,...
import mock from webob import exc from senlin.api.common import util from senlin.api.common import wsgi from senlin.common import context from senlin.common import policy from senlin.tests.unit.common import base class TestGetAllowedParams(base.SenlinTestCase): def setUp(self): super(TestGetAllowedParams...
import urllib2 from telemetry.core import tab from telemetry.core import util from telemetry.core.backends.chrome import inspector_backend_list class TabListBackend(inspector_backend_list.InspectorBackendList): """A dynamic sequence of tab.Tabs in UI order.""" def __init__(self, browser_backend): super(TabL...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django import forms from neutron.models import Word from .models import AlternateData class AlternateDataForm(forms.ModelForm): word = forms.CharField() class Meta: model = AlternateData fields = '__all__' def __init__(self, *args, **...
# Factories are self documenting # pylint: disable=missing-docstring import factory from uuid import uuid4 from django.core.files.base import ContentFile from factory.django import DjangoModelFactory, ImageField from student.models import LinkedInAddToProfileConfiguration from certificates.models import ( Generat...
from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * class ImportPrunedFundsTest(BitcoinTestFramework): def __init__(self): super().__init__() self.setup_clean_chain = True self.num_nodes = 2 def setup_network(self, split=False): se...
from __future__ import with_statement import datetime import time import sickbeard from sickbeard import db, logger, common, exceptions, helpers from sickbeard import generic_queue from sickbeard import search from sickbeard import ui BACKLOG_SEARCH = 10 RSS_SEARCH = 20 MANUAL_SEARCH = 30 class Searc...
# -*- coding: utf-8 -*- """Tests for vcfpy.header """ import sys import vcfpy from vcfpy import header import pytest def test_header_field_info(): """Test the builtin functions of the FieldInfo class""" info1 = header.FieldInfo("Integer", 1, "Some description") info2 = header.FieldInfo("Integer", 1, "S...
#!/usr/bin/env python '''Test that an empty document doesn't break. ''' __docformat__ = 'restructuredtext' __noninteractive = True import unittest from pyglet import gl from pyglet import graphics from pyglet.text import document from pyglet.text import layout from pyglet import window class TestWindow(window.Win...
"""Interface for accessing all other services.""" __author__ = '<EMAIL> (Stan Grinberg)' import datetime import os import pickle import warnings from adspygoogle.common import PYXML from adspygoogle.common import SanityCheck from adspygoogle.common import Utils from adspygoogle.common.Errors import ValidationError ...
from openerp.addons.mail.tests.common import TestMail from openerp.exceptions import AccessError from openerp.osv.orm import except_orm from openerp.tools.misc import mute_logger class test_portal(TestMail): @classmethod def setUpClass(cls): super(test_portal, cls).setUpClass() cr, uid = cls....
from argparse import ArgumentParser from typing import Any, List from zerver.lib.actions import ( bulk_add_subscriptions, bulk_remove_subscriptions, do_deactivate_stream, ) from zerver.lib.cache import cache_delete_many, to_dict_cache_key_id from zerver.lib.management import ZulipBaseCommand from zerver.mo...
import unittest2 import openerp.tests.common as common class test_ir_values(common.TransactionCase): def test_00(self): # Create some default value for some (non-existing) model, for all users. ir_values = self.registry('ir.values') # use the old API ir_values.set(self.cr, self.u...
from __future__ import print_function from operator import itemgetter import re import logging logger = logging.getLogger(__name__) error = logger.error warn = logger.warn info = logger.info debug = logger.debug from partycrasher.bucket import Buckets, Bucket, TopMatch from partycrasher.threshold import Threshold fr...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['deprecated'], 'supported_by': 'community'} from ansible.module_utils.common.removed import removed_module if __name__ == '__main__...
from openerp import models, api class event_confirm(models.TransientModel): """Event Confirmation""" _name = "event.confirm" @api.multi def confirm(self): events = self.env['event.event'].browse(self._context.get('event_ids', [])) events.do_confirm() return {'type': 'ir.action...
import argparse import configparser import os import re import stat class TemplateFragment: def __init__(self, tpl_global, context, verbatim, expr): self.context = context self.verbatim = verbatim self.expr = expr self.tpl_global = tpl_global self.subst = "" def __appen...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import traceback from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.ec2 import ( AWSRetry, connect_to_aws, ec2_argument_spec, get_aws_...
from sklearn.decomposition import (PCA, DictionaryLearning, MiniBatchDictionaryLearning) from .common import Benchmark, Estimator, Transformer from .datasets import _olivetti_faces_dataset, _mnist_dataset from .utils import make_pca_scorers, make_dict_learning_scorers class PCABenc...
""" Unit tests for `iris.aux_factory.AuxCoordFactory`. """ # Import iris.tests first so that some things can be initialised before # importing anything else. import iris.tests as tests import numpy as np import iris from iris._lazy_data import as_lazy_data, is_lazy_data from iris.aux_factory import AuxCoordFactory ...
""" Test cases for catalog_integrations command. """ from django.test import TestCase from django.core.management import call_command, CommandError from openedx.core.djangoapps.catalog.models import CatalogIntegration from openedx.core.djangoapps.catalog.tests.mixins import CatalogIntegrationMixin class TestCreateCa...
import discord from discord.ext import commands from __main__ import send_cmd_help import os from .utils.dataIO import dataIO from .utils import checks import re import aiohttp import json from .utils.chat_formatting import pagify import asyncio __author__ = "Sebastian Winkler <<EMAIL>>" __version__ = "1.0" class Mir...
r"""Train a ConvNet on MNIST using K-FAC. Multi tower training mode. See `convnet.train_mnist_multitower` for details. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from absl import flags import tensorflow as tf from tensorflow.contrib.kfac.example...
import sys, glob from optparse import OptionParser parser = OptionParser() parser.add_option('--genpydir', type='string', dest='genpydir', default='gen-py') options, args = parser.parse_args() del sys.argv[1:] # clean up hack so unittest doesn't complain sys.path.insert(0, options.genpydir) sys.path.insert(0, glob.glob...
from openstack_dashboard.dashboards.project.images_and_snapshots \ .images import forms class AdminCreateImageForm(forms.CreateImageForm): pass class AdminUpdateImageForm(forms.UpdateImageForm): pass
# encoding: utf-8 from waflib import Options, Logs, Errors from waflib.Configure import conf import re def addWebsocketOptions(self, opt): opt.add_option('--without-websocket', action='store_false', default=True, dest='with_websocket', help='Disable WebSocket face support') ...
import glob import re import os import itertools import networkx as nx def CxlConversion (file): # get the concepts, linking phrases, and connections concepts = {} linking_phrases = {} connections = [] concepts_linked = [] for line in f: if "concept id="...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: win_robocopy version_added: "2.2" short_description: Synchronizes the contents of two directories using Robocopy. description: - Synchronizes ...
import time import testing as T class PushTemplateTest(T.TemplateTestCase): authenticated = True push_page = 'push.html' push_status_page = 'push-status.html' accepting_push_sections = ['blessed', 'verified', 'staged', 'added', 'pickme', 'requested'] now = time.time() basic_push = { ...
# -*- coding: utf-8 -*- import re from module.plugins.internal.Hoster import Hoster class PornhubCom(Hoster): __name__ = "PornhubCom" __type__ = "hoster" __version__ = "0.55" __status__ = "testing" __pattern__ = r'http://(?:www\.)?pornhub\.com/view_video\.php\?viewkey=\w+' __config__...
"""Helpers for listening to events.""" import functools as ft from homeassistant.helpers.sun import get_astral_event_next from ..core import HomeAssistant, callback from ..const import ( ATTR_NOW, EVENT_STATE_CHANGED, EVENT_TIME_CHANGED, MATCH_ALL) from ..util import dt as dt_util from ..util.async import run_call...
# -*- coding: utf-8 -*- """ Various dependencies that are required for file-metadata which need some special handling. """ from __future__ import (division, absolute_import, unicode_literals, print_function) import ctypes.util import hashlib import os import subprocess import sys from distutil...
import asyncio import os import struct import logging import random import cmd import argparse from urllib.parse import urlparse from collections import defaultdict from ipaddress import ip_address from datetime import datetime, timedelta from version import __version__ class ServerError(Exception): pass class Ud...
# coding=utf-8 """ Openstack swift collector. #### Dependencies * swift-dispersion-report commandline tool (for dispersion report) if using this, make sure swift.conf and dispersion.conf are readable by diamond also get an idea of the runtime of a swift-dispersion-report call and make sure the collect inte...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: bigip_monitor_http short_description: Manages F5 BIG-IP LTM...
import numpy as np from ..io import BaseRaw from ..utils import _validate_type, warn, logger, verbose @verbose def realign_raw(raw, other, t_raw, t_other, verbose=None): """Realign two simultaneous recordings. Due to clock drift, recordings at a given same sample rate made by two separate devices simult...
from testtools.tests.helpers import FullStackRunTest class TestMatchersInterface(object): run_tests_with = FullStackRunTest def test_matches_match(self): matcher = self.matches_matcher matches = self.matches_matches mismatches = self.matches_mismatches for candidate in matche...
from __future__ import print_function import gdbremote_testcase from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase): mydir = TestBase.compute_mydir(__file__) def vCont_supports_...
import mxnet as mx def batchnorm(net, gamma=None, beta=None, eps=0.001, momentum=0.9, fix_gamma=False, use_global_stats=False, output_mean_var=False, name=None): if gamma is not None and beta is not Non...
from django.contrib.auth.models import User from rest_framework import mixins from rest_framework import generics from rest_framework import renderers from rest_framework import permissions from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response from...
from nova.api.openstack import common class ViewBuilder(common.ViewBuilder): _collection_name = "flavors" def basic(self, request, flavor): return { "flavor": { "id": flavor["flavorid"], "name": flavor["name"], "links": self._get_links(requ...
"""Support for the Swedish weather institute weather service.""" from homeassistant.config_entries import ConfigEntry from homeassistant.core import Config, HomeAssistant # Have to import for config_flow to work even if they are not used here from .config_flow import smhi_locations # noqa: F401 from .const import DOM...
from odoo import fields, models class StockInvoiceOnshipping(models.TransientModel): _inherit = "stock.invoice.onshipping" def _build_invoice_values_from_pickings(self, pickings): """ Build dict to create a new invoice from given pickings :param pickings: stock.picking recordset ...