code stringlengths 1 199k |
|---|
"""Definitions for basic types using in serving.
"""
import json
from common import string_utils
PORTABLE_EXTS_SET = [".glm", ".glb", ".glc"]
class DbFlags(object):
"""Database binary properties that are being packed as bit-fields.
Constants used for setting/masking corresponding bits in db_table.db_flags
field i... |
"""
This simple application creates errors
"""
def error_app(environ, start_response):
environ['errorapp.item'] = 1
raise_error()
def raise_error():
if 1 == 1:
raise Exception('This is an exception')
else:
do_stuff()
def make_error_app(global_conf):
return error_app |
"""Test that SBFrame::FindValue finds things but does not duplicate the entire variables list"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class SBFrameFindValueTestCase(TestBase):
mydir = TestB... |
"""Tests for contrib.losses.python.losses.loss_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
class AbsoluteDifferenceLossTest(tf.test.TestCase):
def setUp(self):
self._predictions = tf.constant([4, 8,... |
"""Import KIT / NYU data to fif file.
example usage: $ mne kit2fiff --input input.sqd --output output.fif
Use without arguments to invoke GUI: $ mne kt2fiff
"""
import sys
import mne
from mne.io import read_raw_kit
from mne.utils import ETSContext
def run():
from mne.commands.utils import get_optparser
parser... |
"""
=============================================================================
t-SNE: The effect of various perplexity values on the shape
=============================================================================
An illustration of t-SNE on the two concentric circles and the S-curve
datasets for different perple... |
from __future__ import absolute_import
import re
from twisted.internet import reactor
from twisted.internet.defer import Deferred
from twisted.trial import unittest
from scrapy.contrib.downloadermiddleware.robotstxt import RobotsTxtMiddleware
from scrapy.exceptions import IgnoreRequest, NotConfigured
from scrapy.http i... |
import json
from django.contrib.gis.db.models.fields import BaseSpatialField
from django.contrib.gis.db.models.functions import Distance
from django.contrib.gis.db.models.lookups import DistanceLookupBase, GISLookup
from django.contrib.gis.gdal import GDALRaster
from django.contrib.gis.geos import GEOSGeometry
from dja... |
from index import *
from io.dataset import load, save
try:
from io.hdf5_dataset import load_range
except:
pass |
import os
import gzip
import io
import hashlib
import subprocess
from six import text_type, BytesIO
from cactus.utils.helpers import checksum
class FakeTime:
"""
Monkey-patch gzip.time to avoid changing files every time we deploy them.
"""
def time(self):
return 1111111111.111
def compressString... |
import asrl_splines
import numpy
import scipy.interpolate.fitpack as fp
import sys
import unittest
class TestSplinesVsFitpack(unittest.TestCase):
def test_new_uniform_cubic1(self):
# create the knot and control point vectors
knots = numpy.array([-2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0])
... |
"""
The arraypad module contains a group of functions to pad values onto the edges
of an n-dimensional array.
"""
import numpy as np
from numpy.core.overrides import array_function_dispatch
from numpy.lib.index_tricks import ndindex
__all__ = ['pad']
def _round_if_needed(arr, dtype):
"""
Rounds arr inplace if d... |
"""Test BIP68 implementation."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.blocktools import *
SEQUENCE_LOCKTIME_DISABLE_FLAG = (1<<31)
SEQUENCE_LOCKTIME_TYPE_FLAG = (1<<22) # this means use time (0 means height)
SEQUENCE_LOCKTIME_GRANULARITY = ... |
import os
import os.path
import re
def search_file(path, search_strings):
buf=b""
line_nb=0
try:
with open(path, 'rb') as f:
for line in f:
line=line.lower()
for s in search_strings:
start=0
while True:
i=line.find(s.lower(), start)
if i==-1:
break
start=i+1
yiel... |
from __future__ import nested_scopes # Backward compat for 2.1
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers import BaseHandler, BaseCGIHandler
from wsgiref import util
from wsgiref.validate import validator
from wsgiref.simple... |
from dynamic_reconfigure.parameter_generator_catkin import double_t, bool_t
def add_generic_localplanner_params(gen):
# velocities
gen.add("max_trans_vel", double_t, 0, "The absolute value of the maximum translational velocity for the robot in m/s", 0.55, 0)
gen.add("min_trans_vel", double_t, 0, "The absolu... |
from buildbot.util import service
from buildbot.worker.manager import WorkerManager
class MachineManager(service.BuildbotServiceManager):
reconfig_priority = WorkerManager.reconfig_priority + 1
name = 'MachineManager'
managed_services_name = 'machines'
config_attr = 'machines'
@property
def mach... |
from portage.tests import TestCase
from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase
class VirtualSlotResolverTestCase(TestCase):
def testLicenseMaskedVirtualSlotUpdate(self):
ebuilds = {
"dev-java/oracle-jdk-bin-1.7.0" : {"SLOT": "1.7", "LICENSE": "TEST"},
"d... |
from Screens.Screen import Screen
from Plugins.Plugin import PluginDescriptor
from Components.SystemInfo import SystemInfo
from Components.ConfigList import ConfigListScreen
from Components.config import getConfigListEntry, config, ConfigBoolean, ConfigNothing
from Components.Label import Label
from Components.Sources.... |
"""Disk And Execution MONitor (Daemon)
Default daemon behaviors (they can be modified):
1.) Ignore SIGHUP signals.
2.) Default current working directory to the "/" directory.
3.) Set the current file creation mode mask to 0.
4.) Close all open files (0 to [SC_OPEN_MAX or 256]).
5.) Redirect standard I/O ... |
import orange
data = orange.ExampleTable("../datasets/iris")
for meth in [data.toNumeric, data.toNumarray, data.toNumpy]:
try:
a, c, w = meth()
print type(a), type(c), type(w)
print a.shape, c.shape
print a[:5]
print c[:5]
print "\n\n"
except:
print "Call ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.collector import BaseFactCollector
from ansible.module_utils.facts.other.facter import FacterFactCollector
from ansible.module_utils.facts.other.ohai imp... |
{
'name': 'Event Exhibitors',
'category': 'Marketing/Events',
'sequence': 1004,
'version': '1.1',
'summary': 'Event: manage sponsors and exhibitors',
'website': 'https://www.odoo.com/app/events',
'description': "",
'depends': [
'website_event',
'website_jitsi',
],
... |
from django.test import RequestFactory, override_settings
from bedrock.utils import views
def test_variation_template_view():
rf = RequestFactory()
view = views.VariationTemplateView(template_context_variations=["b"], template_name_variations=["b", "c"], template_name="mozorg/book.html")
req = rf.get("/", d... |
"""Support for KNX/IP binary sensors."""
import voluptuous as vol
from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA, BinarySensorDevice)
from homeassistant.const import CONF_ADDRESS, CONF_DEVICE_CLASS, CONF_NAME
from homeassistant.core import callback
import homeassistant.helpers.config_validatio... |
from __future__ import unicode_literals
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from django.utils import translation
from django.utils.safestring import mark_safe
from ..utils import setup
class I18nTagTests(SimpleTestCase):
libraries = {
'custom': 'template_te... |
import win32api
import win32con
from threading import Timer
from pywinauto.win32_hooks import Hook
from pywinauto.win32_hooks import KeyboardEvent
from pywinauto.win32_hooks import MouseEvent
def on_timer():
"""Callback by timer out"""
win32api.PostThreadMessage(main_thread_id, win32con.WM_QUIT, 0, 0);
def on_e... |
"""Self-test suite for Crypto.Hash.SHA256"""
import unittest
from Crypto.Util.py3compat import *
class LargeSHA256Test(unittest.TestCase):
def runTest(self):
"""SHA256: 512/520 MiB test"""
from Crypto.Hash import SHA256
zeros = bchr(0x00) * (1024*1024)
h = SHA256.new(zeros)
f... |
import os
import time
from django.conf import settings
locale_settings_map = {
'locale_timezone': { 'key': 'TIME_ZONE',
'deserialize_func': str },
'locale_language_code': 'LANGUAGE_CODE',
'locale_date_format': 'DATE_FORMAT',
'locale_dateti... |
__doc__ = """
IPython -- An enhanced Interactive Python
=========================================
A Python shell with automatic history (input and output), dynamic object
introspection, easier configuration, command completion, access to the system
shell and more.
IPython can also be embedded in running programs. See E... |
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
from django.core.files import File
def forwards(apps, schema_editor):
"""Add default modes"""
BadgeImageConfiguration = apps.get_model("certificates", "BadgeImageConfiguration")
objects = BadgeI... |
import logging
import datetime
import decimal
import pytz
from ipware.ip import get_ip
from django.db.models import Q
from django.conf import settings
from django.contrib.auth.models import Group
from django.shortcuts import redirect
from django.http import (
HttpResponse, HttpResponseRedirect, HttpResponseNotFound... |
from __future__ import unicode_literals
import json
import re
import calendar
import datetime
from .common import InfoExtractor
from ..utils import (
HEADRequest,
unified_strdate,
ExtractorError,
strip_jsonp,
int_or_none,
float_or_none,
determine_ext,
remove_end,
)
class ORFTVthekIE(Info... |
"""Scalar summaries and TensorFlow operations to create them.
A scalar summary stores a single floating-point value, as a rank-0 tensor.
NOTE: This module is in beta, and its API is subject to change, but the
data that it stores to disk will be supported forever.
"""
from __future__ import absolute_import
from __future... |
"""Support for an exposed aREST RESTful API of a device."""
import logging
import requests
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
from homeassistant.const import (CONF_NAME, CONF_RESOURCE)
import homeassistant.helpers.config_validation as cv
_LOGGER = loggin... |
"""DB support for service types
Revision ID: 48b6f43f7471
Revises: 5a875d0e5c
Create Date: 2013-01-07 13:47:29.093160
"""
revision = '48b6f43f7471'
down_revision = '5a875d0e5c'
migration_for_plugins = [
'*'
]
from alembic import op
import sqlalchemy as sa
from quantum.db import migration
def upgrade(active_plugin=N... |
"""Cache library.
Supported configuration options:
`default_backend`: Name of the cache backend to use.
`key_namespace`: Namespace under which keys will be created.
"""
from six.moves.urllib import parse
from stevedore import driver
def _get_oslo_configs():
"""Returns the oslo config options to register."""
# N... |
"""Create a "virtual" Python installation
"""
__version__ = "1.8.2" # following best practices
virtualenv_version = __version__ # legacy, again
import base64
import sys
import os
import codecs
import optparse
import re
import shutil
import logging
import tempfile
import zlib
import errno
import glob
import distutils.... |
import functools
from keystone.catalog import controllers
from keystone.common import json_home
from keystone.common import router
from keystone.common import wsgi
build_resource_relation = functools.partial(
json_home.build_v3_extension_resource_relation,
extension_name='OS-EP-FILTER', extension_version='1.0')... |
import os
import stat
import fnmatch
import re
asFile = fnmatch.translate('*.as')
def checkdir(d, prefix):
map = dict()
for f in os.listdir(d):
if re.match(asFile, f):
map[f[0:len(f)-3]] = 1
for f in os.listdir(d):
path = d + os.sep + f
fileStats = os.stat(path)
i... |
import urllib2
import urllib
url = 'http://www.someserver.com/cgi-bin/register.cgi'
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
values = {'name':'Micheal Frood',
'location':'Northampton',
'language':'Python'
}
headers = {'User-Agent':user_agent}
data = urllib.urlencode(va... |
from esp import neopixel_write
class NeoPixel:
ORDER = (1, 0, 2, 3)
def __init__(self, pin, n, bpp=3, timing=1):
self.pin = pin
self.n = n
self.bpp = bpp
self.buf = bytearray(n * bpp)
self.pin.init(pin.OUT)
self.timing = timing
def __setitem__(self, index, val... |
from .Generator import Generator
from .DataProvider import *
from . import Markdown |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import date_diff
def execute(filters=None, consolidated = False):
data, columns = DelayedItemReport(filters).run()
return data, columns
class DelayedItemReport(object):
def __init__(self, filters=None):
self.filters = frap... |
from osv import osv
class payment_order(osv.osv):
_inherit = 'payment.order'
def get_wizard(self,mode):
if mode == 'dta':
return 'l10n_ch', 'action_dta_create'
return super(payment_order,self).get_wizard(mode)
payment_order() |
import unittest
import tempfile
from history import History
try:
True, False
except NameError:
(True, False) = (1, 0)
class MockConsole:
def replaceRow(self, text):
self.text = text
def inLastLine(self):
return True
class HistoryTestCase(unittest.TestCase):
def setUp(self):
... |
"""Tests for DecodePngOp."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import image... |
from neutron.api import extensions
from neutron.api.v2 import attributes
from neutron.common import exceptions as n_exc
NETWORK_TYPE = 'provider:network_type'
PHYSICAL_NETWORK = 'provider:physical_network'
SEGMENTATION_ID = 'provider:segmentation_id'
EXTENDED_ATTRIBUTES_2_0 = {
'networks': {
NETWORK_TYPE: {... |
import datetime
import uuid
from oslo_serialization import jsonutils
from oslo_utils import netutils
from oslo_utils import timeutils
import routes
import six
from six.moves import range
import webob
import webob.dec
import webob.request
from nova.api import auth as api_auth
from nova.api import openstack as openstack_... |
import collections
import logging
import threading
import time
import pytest
from kafka.vendor import six
from kafka.conn import ConnectionStates
from kafka.consumer.group import KafkaConsumer
from kafka.coordinator.base import MemberState
from kafka.structs import TopicPartition
from test.testutil import env_kafka_ver... |
"""Renames *.py.park files to *.py."""
import os
import sys
def main():
"""Drives the main script behavior."""
script_dir = os.path.dirname(os.path.realpath(__file__))
for filename in os.listdir(script_dir):
basename, extension = os.path.splitext(filename)
if basename.startswith("Test") and ... |
"""Test cases for Zinnia's url_shortener"""
import warnings
from django.test import TestCase
from django.test.utils import override_settings
from zinnia.url_shortener import get_url_shortener
from zinnia import url_shortener as us_settings
from zinnia.url_shortener.backends import default
class URLShortenerTestCase(Tes... |
'''tzinfo timezone information for America/Fortaleza.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Fortaleza(DstTzInfo):
'''America/Fortaleza timezone definition. See datetime.tzinfo for details'''
zone = 'America/Fortal... |
'''tzinfo timezone information for Europe/Istanbul.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Istanbul(DstTzInfo):
'''Europe/Istanbul timezone definition. See datetime.tzinfo for details'''
zone = 'Europe/Istanbul'
... |
"""
***************************************************************************
aspect.py
---------------------
Date : October 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*******************************************... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
author: "Joris Weijters (@molekuul)"
module: aix_inittab
short_description: Manages the inittab on AIX.
description:
- Manages the inittab on AIX.
versio... |
from oslo_log import log as logging
import testtools
from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import config
from tempest.scenario import manager
from tempest import test
CONF = config.CONF
LOG = logging.getLogger(__name__)
class TestNetworkAdvancedServerOps(manager.Net... |
from six import BytesIO
from posixpath import join as pjoin
from os import path as osp
import os
import shutil
import pytest
from ibis.filesystems import HDFS
from ibis.compat import unittest
from ibis.impala.tests.common import IbisTestEnv
import ibis.compat as compat
import ibis.util as util
import ibis
ENV = IbisTes... |
numerals = {
0: "zero",
1: "one",
2: "two",
3: "three",
4: "four",
5: "five",
6: "six",
7: "seven",
8: "eight",
9: "nine",
10: "ten",
11: "eleven",
12: "twelve",
13: "thirteen",
14: "fourteen",
15: "fifteen",
16: "sixteen",
17: "seventeen",
18:... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: cnos_save
author: "Anil Kumar Muraleedharan (@amuraleedhar)"
... |
from __future__ import print_function, division
from ok import *
import zipfile,re,sys
sys.dont_write_bytecode = True
"""
Can handing raw strings, files, zip files.
Assumes if lines end in ',' then that line continues to the next.
Also assumes first line is column names.
The function `FROM` returns iterators that can h... |
"""Tests for tensorflow.python.framework.ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.framework import test_util
from tensor... |
"""
Dummy mocking module for numpy.
When numpy is not avaialbe we will import this module as graphlab.deps.numpy,
and set HAS_NUMPY to false. All methods that access numpy should check the HAS_NUMPY
flag, therefore, attributes/class/methods in this module should never be actually used.
"""
'''
Copyright (C) 2015 Dato, ... |
"""Execute the tests for rabema.
The golden test outputs are generated by the script generate_outputs.sh.
You have to give the root paths to the source and the binaries as arguments to
the program. These are the paths to the directory that contains the 'projects'
directory.
Usage: run_tests.py SOURCE_ROOT_PATH BINARY... |
"""
Basic test for the openfiles module
"""
import unittest
from tempfile import TemporaryDirectory
from shutil import copyfile
from i3pystatus import openfiles
class OpenfilesTest(unittest.TestCase):
def test_openfiles(self):
"""
Test output of open files
"""
# copy file-nr so we ha... |
from blur.Stone import *
from blur.Classes import *
from blur.Freezer import *
from PyQt4.QtCore import *
from PyQt4.QtSql import *
import traceback, os
class SshViewerPlugin(HostViewerPlugin):
def __init__(self):
HostViewerPlugin.__init__(self)
def name(self):
return QString("ssh")
def icon... |
from __future__ import (absolute_import, division)
__metaclass__ = type
from ansible.plugins.callback import CallbackBase
class CallbackModule(CallbackBase):
'''
This is the default callback interface, which simply prints messages
to stdout when new callback events are received.
'''
CALLBACK_VERSION... |
from PyQt4.QtCore import Qt, QObject, SIGNAL
from core.data.FormFillValues import FormFillValues
from core.data.FormFillPatterns import FormFillPatterns
import re
class FormFiller(QObject):
def __init__(self, framework, parent = None):
QObject.__init__(self, parent)
self.framework = framework
... |
from cinder.common import config
import cinder.openstack.common.importutils as import_utils
CONF = config.CONF
API = import_utils.import_class(CONF.volume_api_class) |
"""
The :mod:`sklearn.pipeline` module implements utilities to build a composite
estimator, as a chain of transforms and estimators.
"""
from collections import defaultdict
import numpy as np
from scipy import sparse
from .base import BaseEstimator, TransformerMixin
from .externals.joblib import Parallel, delayed
from ... |
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.... |
"""
Each store has slightly different semantics wrt draft v published. XML doesn't officially recognize draft
but does hold it in a subdir. Old mongo has a virtual but not physical draft for every unit in published state.
Split mongo has a physical for every unit in every state.
Given that, here's a table of semantics ... |
import os
from ajenti.com import *
from ajenti.utils import *
from ajenti import apis
class CentOSServiceManager(Plugin):
implements(apis.services.IServiceManager)
platform = ['centos', 'fedora', 'mandriva']
def list_all(self):
r = []
for s in shell('chkconfig --list').split('\n'):
... |
import copy
from nova.compute import api as compute_api
from nova import db
from nova.tests import fake_instance_actions
from nova.tests.integrated.v3 import api_sample_base
from nova.tests import utils as test_utils
class InstanceActionsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
extension_name = 'os-inst... |
def generator2():
for i in range(5):
yield i
def generator():
print('start') # break here
yield from generator2() # step 1
print('end') # step 2
if __name__ == '__main__':
for i in generator(): # generator return
print(i)
print('TEST SUCEEDED!') # step 3 |
__revision__ = "$Id$"
## Description: function Move_to_Done
## This function move the current working directory to the
## /done directory and compress it
## Author: T.Baron
## PARAMETERS: -
import os
import re
import time
import subprocess
import shutil
from inveni... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
class ModuleDocFragment(object):
DOCUMENTATION = r'''
options:
display_skipped_hosts:
name: Show skipped hosts
description: "Toggle to control displaying skipped task/host results in a task"
typ... |
import copy
from sahara.conductor import manager
from sahara.tests.unit import base
class ConductorManagerTestCase(base.SaharaWithDbTestCase):
def __init__(self, *args, **kwargs):
"""List of check callables could be specified.
All return values from callables will be stored in setUp and checked
... |
from django.contrib import admin
from shipping.modules.tieredweight.models import Carrier, WeightTier, Zone, ZoneTranslation
from shipping.modules.tieredweight.forms import CarrierAdminForm, ZoneAdminForm
class WeightTierInline(admin.TabularInline):
model = WeightTier
class ZoneTranslationInline(admin.TabularInline... |
from supybot.test import *
class LaterTestCase(PluginTestCase):
plugins = ('Later',)
def testLaterWorksTwice(self):
self.assertNotError('later tell foo bar')
self.assertNotError('later tell foo baz')
def testLaterRemove(self):
self.assertNotError('later tell foo 1')
self.asse... |
import argparse
import json
from ipalib import api, errors
from six import u
def initialize():
'''
This function initializes the FreeIPA/IPA API. This function requires
no arguments. A kerberos key must be present in the users keyring in
order for this to work.
'''
api.bootstrap(context='cli')
... |
import sys
def setup(core, object):
object.setStringAttribute('required_faction', 'Imperial')
object.setStringAttribute('armor_category', '@obj_attr_n:armor_battle')
object.setIntAttribute('cat_armor_standard_protection.kinetic', 5608)
object.setIntAttribute('cat_armor_standard_protection.energy', 5608)
object.set... |
"""
Copyright 2015 Reverb Technologies, Inc.
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 ag... |
"""
Builds out filesystem trees/data based on the object tree.
This is the code behind 'cobbler sync'.
Copyright 2006-2009, Red Hat, Inc and Others
Michael DeHaan <michael.dehaan AT gmail>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as publis... |
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
import json
import urllib
import urlparse
import threading
from logging import getLogger
logger = getLogger(__name__)
class MockXQueueRequestHandler(BaseHTTPRequestHandler):
'''
A handler for XQueue POST requests.
'''
protocol = "HTTP/1.0"
... |
'''
flask.ext.login
---------------
This module provides user session management for Flask. It lets you log
your users in and out in a database-independent manner.
:copyright: (c) 2011 by Matthew Frazier.
:license: MIT/X11, see LICENSE for more details.
'''
__version_info__ = ('0', '2', '9')
__v... |
"""Invenio Bibliographic Tasklet Example.
Demonstrates BibTaskLet <-> BibTask <-> BibSched connectivity
"""
import sys
import time
from invenio.legacy.bibsched.bibtask import write_message, task_set_option, \
task_get_option, task_update_progress, task_has_option, \
task_get_task_param, task_sleep_now_i... |
ANSIBLE_METADATA = {'status': ['deprecated'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: quantum_subnet
deprecated: Deprecated in 2.0. Use M(os_subnet) instead.
version_added: "1.2"
short_description: Add/remove subnet from a network
descriptio... |
import re
from robot.utils import format_time
from .loggerhelper import Message
class StdoutLogSplitter(object):
"""Splits messages logged through stdout (or stderr) into Message objects"""
_split_from_levels = re.compile('^(?:\*'
'(TRACE|DEBUG|INFO|HTML|WARN|ERROR)'
... |
from subprocess import call
from os import path
import hitchpostgres
import hitchselenium
import hitchpython
import hitchserve
import hitchredis
import hitchtest
import hitchsmtp
PROJECT_DIRECTORY = path.abspath(path.join(path.dirname(__file__), '..'))
class ExecutionEngine(hitchtest.ExecutionEngine):
"""Engine for... |
from vtk import *
database = vtkSQLDatabase.CreateFromURL("mysql://enron@vizdb.srn.sandia.gov:3306/enron")
database.Open("enron")
edge_query = database.GetQueryInstance()
edge_query.SetQuery("select sendID, recvID, weight from email_arcs")
vertex_query = database.GetQueryInstance()
vertex_query.SetQuery("select firstNa... |
"""Utilities for working with threads and ``Futures``.
``Futures`` are a pattern for concurrent programming introduced in
Python 3.2 in the `concurrent.futures` package (this package has also
been backported to older versions of Python and can be installed with
``pip install futures``). Tornado will use `concurrent.fu... |
class Base:
"""Class docstring."""
class Sub(Base):
def __in<the_ref>it__(self):
pass |
"""SCons.Tool.dvi
Common DVI Builder definition for various other Tool modules that use it.
"""
__revision__ = "src/engine/SCons/Tool/dvi.py 4043 2009/02/23 09:06:45 scons"
import SCons.Builder
import SCons.Tool
DVIBuilder = None
def generate(env):
try:
env['BUILDERS']['DVI']
except KeyError:
gl... |
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community',
}
DOCUMENTATION = '''
---
module: nxos_pim_rp_address
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages configuration of an PIM static RP address instance.
description:
- ... |
from __future__ import with_statement
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
import os
import re
ANNOTATION_RE = re.compile("#[\s]*?(TODO|FIXME|HACK|XXX)[\s:]?(.+)")
class Command(BaseCommand):
help = 'Show all annotations like TODO, FIXME, HACK or XXX in ... |
from neutron.objects.qos import policy
_QOS_POLICY_CLS = policy.QosPolicy
_VALID_CLS = (
_QOS_POLICY_CLS,
)
_VALID_TYPES = [cls.obj_name() for cls in _VALID_CLS]
QOS_POLICY = _QOS_POLICY_CLS.obj_name()
_TYPE_TO_CLS_MAP = {
QOS_POLICY: _QOS_POLICY_CLS,
}
def get_resource_type(resource_cls):
if not resource_c... |
"""
WSGI config for evewspace project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re
import time
import glob
from ansible.plugins.action.dellos6 import ActionModule as _ActionModule
from ansible.module_utils._text import to_text
from ansible.module_utils.six.moves.urllib.parse import urlsplit
fro... |
from nova.rootwrap import filters
filterlist = [
# This line was patched by Puppet
filters.CommandFilter("/usr/bin/virsh", "root"),
# nova/virt/disk/mount.py: 'kpartx', '-a', device
# nova/virt/disk/mount.py: 'kpartx', '-d', device
filters.CommandFilter("/sbin/kpartx", "root"),
# nova/virt/disk/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.