content stringlengths 4 20k |
|---|
import logging
from airflow.hooks.hive_hooks import HiveCliHook, HiveMetastoreHook
from airflow.hooks.druid_hook import DruidHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class HiveToDruidTransfer(BaseOperator):
"""
Moves data from Hive to Druid, [del]note t... |
import inspect
import pprint
from bigml.util import cast, NUMERIC
from bigml.predicate import TM_FULL_TERM, TM_ALL
from bigml.cluster import parse_terms, parse_items
from bigml.logistic import LogisticRegression, balance_input
from bigml.modelfields import get_unique_terms
COPYRIGHT = """\
# -*- coding: utf-8 -*-
#... |
from __future__ import unicode_literals, division, absolute_import
from flexget import options
from flexget.db_schema import reset_schema, plugin_schemas
from flexget.event import event
from flexget.logger import console
from flexget.manager import Base, Session
def do_cli(manager, options):
with manager.acquire... |
"""Gather metrics on specific processes.
"""
from collections import defaultdict
from collections import namedtuple
import monasca_agent.collector.checks as checks
from monasca_agent.common.psutil_wrapper import psutil
ProcessStruct = namedtuple("Process", "name pid username cmdline")
class ProcessCheck(checks.Age... |
"""
fields
======
Definitions of custom fields for marshmallow schema.
"""
from marshmallow import fields
class TypedDict(fields.Field):
"""Typed dict field."""
def __init__(self, key_field, nested_field, *args, **kwargs):
super().__init__(*args, **kwargs)
self.key_field = key_field
... |
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2010 Task Coach developers <<EMAIL>>
Task Coach 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 License, or
(at your option) ... |
'''
Created on 4 aug. 2012
Copyright: Jev Kuznetsov
License: BSD
a module for downloading historic data from IB
'''
import ib
import pandas
from ib.ext.Contract import Contract
from ib.opt import ibConnection, message
from time import sleep
import tradingWithPython.lib.logger as logger
from pandas impor... |
"""The io module provides the Python interfaces to stream handling. The
builtin open function is defined in this module.
At the top of the I/O hierarchy is the abstract base class IOBase. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; impl... |
"""Suite Help Indexing Tool Suite: Special events that just the Help Indexing Tool supports.
Level 0, version 0
Generated from /Developer/Applications/Apple Help Indexing Tool.app
AETE/AEUT resource version 1/1, language 0, script 0
"""
import aetools
import MacOS
_code = 'HIT '
class Help_Indexing_Tool_Suite_Event... |
import sys
from datetime import date, timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase
from django.utils import unittest... |
from uber.common import *
import shutil
import pytest
from sideboard.tests import patch_session
try:
TEST_DB_FILE = c.TEST_DB_FILE
except AttributeError:
TEST_DB_FILE = '/tmp/uber.db'
deadline_not_reached = localized_now() + timedelta(days=1)
deadline_has_passed = localized_now() - timedelta(days=1)
def ... |
try: # Python 3
import http.client as httplib
except ImportError: # Python 2
import httplib
import json
import re
import base64
try :
import http.client as httplib
except ImportError:
import httplib
import sys
import struct
from binascii import hexlify, unhexlify
settings = {}
##### Switch endian-ness... |
'''
Random balanced network (alpha synapses) connected with NEST
------------------------------------------------------------
This script simulates an excitatory and an inhibitory population on
the basis of the network used in
Brunel N, Dynamics of Sparsely Connected Networks of Excitatory and
Inhibitory Spiking Neur... |
from neutron.openstack.common import jsonutils
from neutron.plugins.ml2 import db
from neutron.plugins.ml2 import driver_api as api
class MechanismDriverContext(object):
"""MechanismDriver context base class."""
def __init__(self, plugin, plugin_context):
self._plugin = plugin
# This temporari... |
import bpy
from bpy.props import *
from .. events import propertyChanged
from .. base_types.socket import AnimationNodeSocket
from .. utils.nodes import newNodeAtCursor, invokeTranslation
class BooleanSocket(bpy.types.NodeSocket, AnimationNodeSocket):
bl_idname = "an_BooleanSocket"
bl_label = "Boolean Socket"
... |
# encoding: utf-8
"""
@author: donald, ouwj
@position: donald-elementary
@file: utils.py
@time: 2017/4/25 11:16
"""
from PIL import Image
from os.path import join
import numpy as np
def save_samples(dataset, np_imgs, img_path, cur_epoch, n_img):
if dataset == 'MNIST' or dataset == 'CELEBA':
save_samples... |
#! /usr/bin/python
#############################################################
# This tool is used to generate the Platinum documentation #
#############################################################
import os
import sys
import subprocess
import shutil
import zipfile
import tarfile
#############################... |
# -*- coding: utf-8 -*-
try:
import simplejson as json
except ImportError:
import json
import logging
import pprint
import werkzeug
from openerp import http, SUPERUSER_ID
from openerp.http import request
_logger = logging.getLogger(__name__)
class BuckarooController(http.Controller):
_return_url = '/pa... |
"""distutils.command.clean
Implements the Distutils 'clean' command."""
# contributed by Bastian Kleineidam <<EMAIL>>, added 2000-03-18
__revision__ = "$Id$"
import os
from distutils.core import Command
from distutils.dir_util import remove_tree
from distutils import log
class clean(Command):
description = "c... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
from mock import ANY
from ansible.module_utils.network.fortios.fortios import FortiOSHandler
try:
from ansible.modules.network.fortios import fortios_system_ipv6_neighbor_cache
except Import... |
################################################################################
##
## Verifying that Python can support user-specified handling of the first line
## of the file as either headers (1), to-be-guessed (0), or data (-1).
##
################################################################################
im... |
"""Tests various Layer subclasses have correct outputs with mixed precision."""
from absl.testing import parameterized
import numpy as np
from tensorflow.python.compat import v2_compat
from tensorflow.python.distribute import mirrored_strategy
from tensorflow.python.eager import context
from tensorflow.python.framewo... |
# -*- coding: utf-8 -*-
import tempfile
from six import integer_types
from mock import patch, Mock
from unittest import TestCase
from termius.core.models.terminal import (
Host, SshConfig, Identity, SshKey, Group
)
from termius.core.exceptions import DoesNotExistException
from termius.core.storage.strategies import... |
"""
The Topology module is the root of an object model composed of entities
like switches, hosts, links, etc. This object model is populated by other
modules. For example, openflow.topology populates the topology object
with OpenFlow switches.
Note that this means that you often want to invoke something like:
$ .... |
"""
========================================
Plot multi-class SGD on the iris dataset
========================================
Plot decision surface of multi-class SGD on iris dataset.
The hyperplanes corresponding to the three one-versus-all (OVA) classifiers
are represented by the dashed lines.
"""
print(__doc__)
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import copy
from ansible import constants as C
from ansible.module_utils._text import to_text
from ansible.module_utils.connection import Connection
from ansible.plugins.action.network import ActionModule as ActionNetwo... |
#!/usr/bin/env python
import sys
import re
import getopt
import json
from feed_maker_util import IO
def main():
url_prefix = "http://m.post.naver.com"
link = ""
title = ""
num_of_recent_feeds = 1000
optlist, args = getopt.getopt(sys.argv[1:], "n:")
for o, a in optlist:
if o == '-n':
... |
""" The node type for a trait list. """
# Enthought library imports.
from traits.api import Any, Str
# Local imports.
from node_type import NodeType
class TraitListNodeType(NodeType):
""" The node type for a trait list. """
#### 'TraitListNodeType' interface ########################################
#... |
"""
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... |
import warnings
import numpy as np
import numpy.ma as ma
from scipy import sparse
from scipy import stats
from ..base import BaseEstimator, TransformerMixin
from ..utils import check_array
from ..utils.fixes import astype
from ..utils.sparsefuncs import _get_median
from ..utils.validation import check_is_fitted
from ... |
from unittest import TestCase
from mock import Mock
from subprocess import PIPE
import leptoid.deploy as deploy
from leptoid.service_queue import ServiceQueue
class TestDeploy(TestCase):
def test_build_kbs_command(self):
""" Test whether deploy._build_kbs_command() builds the KBS call
correctly.
"""
# Setti... |
__author__ = 'mickeypash'
from django.conf.urls import patterns, url
from survey import views
urlpatterns = patterns('',
url(r'^demographicssurvey/(?P<country>[A-Z]{2})/$', views.view_demographics_survey),
(r'^searchefficacysurvey/$', views.view_search_efficacy_survey),
... |
from gnuradio import gr, gr_unittest, digital, blocks
class test_cma_equalizer_fir(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
def tearDown(self):
self.tb = None
def transform(self, src_data):
SRC = blocks.vector_source_c(src_data, False)
EQU = digital.cma_equalizer... |
import typing
from pydantic import BaseModel, Field
class TemperatureModuleLiveData(BaseModel):
"""Temperature Module live data"""
currentTemp: float = \
Field(...,
description="The current temperature of the module")
targetTemp: typing.Optional[float] = \
Field(...,
... |
"""Work in progress. It works, but needs documentation and some cleaning.
A plugin that automatically ties split deposit-in-transit transactions.
usage: beansoup.plugins.deposit_in_transit [--dit_component NAME]
[--auto_open] [--same_day_merge]
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
js_to_json,
remove_end,
)
class SBSIE(InfoExtractor):
IE_DESC = 'sbs.com.au'
_VALID_URL = r'https?://(?:www\.)?sbs\.com\.au/ondemand/video/(?:single/)?(?P<id>[0-9]+)'
... |
import errno
import maas_common
class MissingModuleError(maas_common.MaaSException):
pass
def get_value(path):
try:
with open(path) as f:
value = f.read()
except IOError as e:
if e.errno == errno.ENOENT:
msg = ('Unable to read "%s", the appropriate kernel module ... |
import event
import wizard
import report
import res_partner |
from invenio_checker.models import CheckerReporter
from invenio_workflows.api import start_delayed
from sqlalchemy.orm.exc import NoResultFound
class WorkflowReporter(object):
def __init__(self, rule_name):
try:
self.reporter = CheckerReporter.query.filter_by(rule_name=rule_name).one()
... |
"""
Tests for L{twisted.web.vhost}.
"""
from twisted.internet.defer import gatherResults
from twisted.trial.unittest import TestCase
from twisted.web.http import NOT_FOUND
from twisted.web.static import Data
from twisted.web.vhost import NameVirtualHost
from twisted.web.test.test_web import DummyRequest
from twisted.w... |
import urllib
from random import random
from time import time
from os.path import join
from swift import gettext_ as _
import hashlib
from eventlet import sleep, Timeout
from eventlet.greenpool import GreenPool
from swift.common.daemon import Daemon
from swift.common.internal_client import InternalClient
from swift.c... |
import datetime
import logging
import sys
from django.core.files.storage import default_storage
from django.core.files.base import ContentFile
from django.utils import timezone
from django.conf import settings
from django.utils.translation import ugettext as _
from djmail.template_mail import MagicMailBuilder, Inlin... |
"""
This library contains a set of facilities for constructing and applying
:class:`~revscoring.Model` s to MediaWiki revisions. This library
eases the training and testing of Machine Learning-based scoring
strategies.
* See the :ref:`API reference <api-reference>` for detailed information.
Key Features
------------
... |
from __future__ import division
import numpy as np
np.set_printoptions(precision=3, suppress=True)
from vehicle_core.config import thrusters_config as tc
from vehicle_core.model import thruster_model as tm
from vehicle_core.model import throttle_model as th
import rospy
import roslib
roslib.load_manifest('vehicle_c... |
"""
=================
Terminal writer
=================
"""
__author__ = "Andr\xe9 Malo"
__docformat__ = "restructuredtext en"
import sys as _sys
class _INFO(dict):
""" Terminal info dict """
def __init__(self):
""" Initialization """
dict.__init__(self, {
'NORMAL': '',
... |
"""Base text widgets for statusbar."""
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QLabel, QSizePolicy
from PyQt5.QtGui import QPainter
from qutebrowser.utils import qtutils, utils
class TextBase(QLabel):
"""A text in the statusbar.
Unlike QLabel, the text will get elided.
Eliding is loos... |
'''
Copyright (c) 2012 Jorge Hernandez - Melendez
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 License, or
(at your option) any later version.
This program is distributed... |
import sqlalchemy as sql
from sqlalchemy.orm import sessionmaker
from keystone.common.sql import migration_helpers
def rename_with_constraints(meta, legacy_project_table_name,
new_project_table_name,
legacy_user_project_membership_table_name,
... |
import test.test_support, unittest
import os, popen2, subprocess, sys
def test_isatty(label, thingy):
os_isatty = os.isatty(thingy.fileno())
thingy_isatty = thingy.isatty()
if 'in' in label: expected = stdin_isatty
elif 'out' in label: expected = stdout_isatty
elif 'err' in label: expected = stderr... |
import warnings
from functools import partial
def saveit(func):
"""A decorator that caches the return value of a function"""
name = '_' + func.__name__
def _wrapper(self, *args, **kwds):
if not hasattr(self, name):
setattr(self, name, func(self, *args, **kwds))
return getattr(s... |
import os.path as osp
import time
import joblib
import numpy as np
import tensorflow as tf
from baselines import logger
from baselines.common import set_global_seeds, explained_variance
from baselines.acktr.utils import discount_with_dones
from baselines.acktr.utils import Scheduler, find_trainable_variables
from bas... |
def recurrence_memo(initial):
"""
Memo decorator for sequences defined by recurrence
See usage examples e.g. in the specfun/combinatorial module
"""
cache = initial
def decorator(f):
def g(n):
L = len(cache)
if n <= L - 1:
return cache[n]
... |
import subprocess;
import re;
import json;
import sys;
import os;
ALLOWED_PORTS = "ABCDEFGH";
ALLOWED_FUNCTIONS = {}
CLASSES = {}
NAMES = {}
for i in range(1, 3):
ALLOWED_FUNCTIONS["DAC"+str(i)+"_OUT"] = "JSH_DAC|JSH_DAC_CH"+str(i);
ALLOWED_FUNCTIONS["DAC_OUT"+str(i)] = "JSH_DAC|JSH_DAC_CH"+str(i);
ALLOWED_FUNCT... |
# -*- encoding: utf-8 -*-
from django.core.management.base import BaseCommand
from django.apps import apps
# from reversion import revisions as reversion
from reversion.models import Version
from reversion.errors import RegistrationError
class Command(BaseCommand):
help = "Count reversion records for each mode... |
def to_unicode(obj, encoding="utf-8"):
if obj is None:
return u''
elif isinstance(obj, basestring):
if isinstance(obj, unicode):
return obj
elif isinstance(obj, str):
return unicode(obj, encoding)
return unicode(obj)
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-... |
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import string
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOW
def dependencies():
pass
def tamper(payload, **kwargs):
"""
Double url-encodes al... |
import os
import sys
if hasattr(sys, 'version_info'):
# Python 2 - Use the platform-wide ConfigParser
import ConfigParser
else:
# Python 1.5.2 - use the internal copy
import _ConfigParser
ConfigParser = _ConfigParser
InterpolationError = ConfigParser.InterpolationError
class ClientConfigParser(Con... |
import frappe, erpnext
import json
from frappe import _
from frappe.utils import flt
from erpnext.setup.doctype.setup_progress.setup_progress import update_domain_actions, get_domain_actions_state
@frappe.whitelist()
def set_sales_target(args_data):
args = json.loads(args_data)
defaults = frappe.defaults.get_defaul... |
"""doit CLI (command line interface)"""
import os
import sys
import traceback
from collections import defaultdict
from configparser import ConfigParser
from .version import VERSION
from .plugin import PluginDict
from .exceptions import InvalidDodoFile, InvalidCommand, InvalidTask
from .cmdparse import CmdParseError
f... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
HAVE_DNS=False
try:
import dns.resolver
from dns.exception import DNSException
HAVE_DNS=True
except ImportError:
pass
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
# =======... |
class ModuleDocFragment(object):
# Standard CNOS documentation fragment
DOCUMENTATION = '''
options:
outputfile:
description:
- This specifies the file path where the output of each command
execution is saved. Each command that is specified in the merged
templat... |
BASIC_METRICS = {
'cpu.extra': {
's_type' : 'delta',
'unit' : 'millisecond',
'rollup' : 'summation',
'entity' : ['VirtualMachine']
},
'cpu.ready': {
's_type' : 'delta',
'unit' : 'millisecond',
'rollup' : 's... |
#saks
from bs4 import BeautifulSoup
import urllib2
import sys
from urlparse import urljoin
#import lxml
sys.path.append("/Users/fcolombo/Documents/gilt");
import defaultparser
import crawler
#import html5lib
class SaksCrawler:
def getProductParser(self):
def findBrand(soup):
brandTag = soup.find('h1', class_... |
import time
import logging
from openerp import fields, models, api, exceptions, _
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT as DT_FORMAT
from openerp.addons.purchase import purchase
_logger = logging.getLogger(__name__)
class ShipmentPlan(models.Model):
_name = "shipment.plan"
_inherit = ['mai... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.contrib.python.checks.tasks.checkstyle.plugin_test_base import \
CheckstylePluginTestBase
from pants.contrib.python.checks.tasks.checkstyle.pyflakes... |
import sys
import os
import random
import numpy as np
import matplotlib.pyplot as plt
import math
import time
import itertools
import shutil
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
from torch.nn.utils import clip_grad_norm
import tree as tr
from utils i... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
US_RATINGS,
)
class PBSIE(InfoExtractor):
_VALID_URL = r'''(?x)https?://
(?:
# Direct video URL
video\.pbs\.org/(?:viralplayer|video)/(?P<id>[0-9]+)/? |
# Art... |
from __future__ import unicode_literals
"""
Execute Patch Files
To run directly
python lib/wnf.py patch patch1, patch2 etc
python lib/wnf.py patch -f patch1, patch2 etc
where patch1, patch2 is module name
"""
import frappe, os, frappe.permissions
class PatchError(Exception): pass
def run_all():
"""run all pe... |
from unittest import TestCase
from decimal import Decimal
import logging
import unittest
from supplychainpy import model_inventory
from supplychainpy._helpers._pickle_config import deserialise_config
from supplychainpy.bi._recommendation_state_machine import SkuMachine
from supplychainpy.bi._recommendations import ... |
"""
Urls of Studio.
"""
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib.admin import autodiscover as django_autodiscover
from django.utils.translation import ugettext_lazy as _
from edx_api_doc_tools import make_docs_urls
from ra... |
#
#
__all__ = ['get_flinalg_funcs']
# The following ensures that possibly missing flavor (C or Fortran) is
# replaced with the available one. If none is available, exception
# is raised at the first attempt to use the resources.
try:
from . import _flinalg
except ImportError:
_flinalg = None
# from numpy.d... |
"""Duplicate Delete"""
import argparse, collections, colorama, datetime, enum, filecmp, os, string, sys, time, winshell
TITLE = "Duplicate Delete"
VERSION = "0.6"
VERBOSE = False
class Mode(enum.Enum): plain = 0; grouped = 1; gazillion = 2
MIN_WIDTH = 9+0+3 # intro + directory + ellipsis
MAX_WIDTH = os.get_terminal_s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from units.compat.mock import patch, MagicMock
from units.mock.loader import DictDataLoader
from ansible.release import __version__
from ansible.parsing import vault
from ansible import cli
cla... |
"""Utilities for writing test involving spectral_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.platform import test
def _use_eigen_kernels():
use_eigen_kernels = False # Eigen... |
# -*- coding: utf-8 -*-
import json
import time
import logging
import functools
import httplib as http
from urllib2 import unquote
import bleach
from flask import request
from modularodm import Q
from framework.auth.decorators import collect_auth
from framework.auth.decorators import must_be_logged_in
from website ... |
# -*- coding: utf-8 -*-
import random
from openerp import SUPERUSER_ID
from openerp.osv import osv, orm, fields
from openerp.addons.web.http import request
class payment_transaction(orm.Model):
_inherit = 'payment.transaction'
_columns = {
# link with the sale order
'sale_order_id': fields.ma... |
import unittest
import requests_mock
from streamlink import Streamlink
from streamlink.plugins.rtpplay import RTPPlay
from streamlink.stream import HLSStream
from tests.plugins import PluginCanHandleUrl
from tests.resources import text
class TestPluginCanHandleUrlRTPPlay(PluginCanHandleUrl):
__plugin__ = RTPPla... |
# -*- coding: utf-8 -*-
from collections import Iterator
from .models import GitHubCore
from requests.compat import urlparse, urlencode
class GitHubIterator(GitHubCore, Iterator):
"""The :class:`GitHubIterator` class powers all of the iter_* methods."""
def __init__(self, count, url, cls, session, params=None... |
from __future__ import unicode_literals
from __future__ import print_function
import logging
import requests
import utilities
from bson.objectid import ObjectId
def query_cliff(sentence, host, port):
"""
Takes a sentence from a news article, passes it to the CLIFF geoloc... |
from jupyter_core.paths import jupyter_data_dir
import subprocess
import os
import errno
import stat
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False
# Generate a self-signed certificate
if 'GEN_CERT' in os.environ:
dir_name = jupyter_data_dir()
pem_file = o... |
'''
Created on May 5, 2013
Copyright: Jev Kuznetsov
License: BSD
Program to log tick events to a file
example usage:
> python ib_logQuotes.py SPY,VXX,XLE
start with -v option to show all incoming events
'''
import argparse # command line argument parser
import datetime as dt # dat... |
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
from django.core import urlresolvers
from rest.views.blocks.base import ( BlockSSDataTables, ResourceBlockAction,
CREATE_PDF, CREATE_HTML, SENDME_PDF, SENDPROD_PDF,
VIEW_AS_HTML
)
from consts import CREATE, EDIT, EDIT_MULTIPLE, VIEW
... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
def core(module):
revision = module.params['revision']
args = []
module.run_command_environ_update = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C')
if revision == '... |
from oslo_config import cfg
from nova.compute import task_states
from nova.compute import vm_states
from nova import objects
from nova.virt import block_device as driver_block_device
imagecache_opts = [
cfg.IntOpt('image_cache_manager_interval',
default=2400,
help='Number of seconds ... |
from __future__ import division, absolute_import, print_function
'''
>>> p = np.poly1d([1.,2,3])
>>> p
poly1d([ 1., 2., 3.])
>>> print(p)
2
1 x + 2 x + 3
>>> q = np.poly1d([3.,2,1])
>>> q
poly1d([ 3., 2., 1.])
>>> print(q)
2
3 x + 2 x + 1
>>> print(np.poly1d([1.89999+2j, -3j, -5.12345678, 2+1j]))
... |
"""Tools/Database Processing/Extract Event Descriptions from Event Data"""
#-------------------------------------------------------------------------
#
# python modules
#
#-------------------------------------------------------------------------
#----------------------------------------------------------------------... |
import pygatt
import time
def tempConvert(rawTemp):
SCALE_LSB = 0.03125
# mask to fill in leading ones after bitshift if number is negative
mask = 0xc000 if rawTemp > 0x7fff else 0x0000
# right-shift by two and fill in leading ones if necessary
t = rawTemp >> 2 | mask
# convert to negative numb... |
""" Obtain results from csv and extrapolate to CBS & FCI limit."""
import sys
import numpy as np
import pandas as pd
import statsmodels.api as sm
np.set_printoptions(precision=12)
def printCorrelationEnergy(statsResult):
coefs = statsResult.params.values
stdevs = statsResult.bse
print('Correlation Energ... |
from builtins import chr
from collections import OrderedDict
import unicodecsv as csv
from tempfile import NamedTemporaryFile
import MySQLdb
from airflow.hooks.hive_hooks import HiveCliHook
from airflow.hooks.mysql_hook import MySqlHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply... |
# -*- coding: utf-8 -*-
"""
markupsafe
~~~~~~~~~~
Implements a Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import re
from itertools import imap
__all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent']
_striptags_re = re.compile... |
import tkinter
import Pmw
class ScrolledField(Pmw.MegaWidget):
def __init__(self, parent = None, **kw):
# Define the megawidget options.
INITOPT = Pmw.INITOPT
optiondefs = (
('labelmargin', 0, INITOPT),
('labelpos', None, INITOPT),
... |
import json
from django.core.management.base import BaseCommand
from 臺灣言語平臺.正規化團隊模型 import 正規化sheet表
from django.conf import settings
class Command(BaseCommand):
help = '加sheet的json'
def add_arguments(self, parser):
parser.add_argument(
'服務帳戶json',
type=str,
hel... |
#! /usr/bin/env python
""" Script to validate YAML file(s) against a YAML schema file """
from __future__ import print_function
import argparse
import os
import sys
try:
import yaml
except:
print("Failed to import yaml.")
print("You may need to install it with 'sudo pip install pyyaml'")
print("")
... |
"""Tests servicers sending OK status without having read all requests.
This is a regression test of https://github.com/grpc/grpc/issues/6891.
"""
import enum
import unittest
import six
import grpc
from tests.unit import test_common
from tests.unit.framework.common import test_constants
_RPC_METHOD = '/serffice/Me... |
import sys
import functools
import os
import itertools
import weakref
import atexit
import threading # we want threading to install it's
# cleanup function before multiprocessing does
from subprocess import _args_from_interpreter_flags
from multiprocessing.process import current_process,... |
import os
import osutil
import util
import _winreg
def systemrcpath():
'''return default os-specific hgrc search path'''
rcpath = []
filename = util.executablepath()
# Use mercurial.ini found in directory with hg.exe
progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
if os.path.i... |
"""
gettext for openstack-common modules.
Usual usage in an openstack.common module:
from neutron.openstack.common.gettextutils import _
"""
import copy
import functools
import gettext
import locale
from logging import handlers
import os
from babel import localedata
import six
_AVAILABLE_LANGUAGES = {}
# FIXM... |
import base64
import hashlib
import random
import string
from django.contrib.auth.hashers import BasePasswordHasher
class DummyPasswordHasher(BasePasswordHasher):
algorithm = "dummy"
def encode(self, password, salt, iterations=None):
return password
class SSHAPasswordLDAPHasher(BasePasswordHasher)... |
"""Completion view for statusbar command section.
Defines a CompletionView which uses CompletionFiterModel and CompletionModel
subclasses to provide completions.
"""
from PyQt5.QtWidgets import QStyle, QTreeView, QSizePolicy
from PyQt5.QtCore import (pyqtSlot, pyqtSignal, Qt, QItemSelectionModel,
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import binascii
from collections import defaultdict
try:
from pysnmp.entity.rfc3413.on... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.