content string |
|---|
#!/usr/bin/env python
"""
Combine coverage data from multiple jobs, keeping the data only from the most recent attempt from each job.
Coverage artifacts must be named using the format: "Coverage $(System.JobAttempt) {StableUniqueNameForEachJob}"
The recommended coverage artifact name format is: Coverage $(System.JobAtt... |
#!/usr/bin/env python
import bisect
import QtCore
import rospy
import rospkg
from python_qt_binding.QtCore import Qt, QObject, QAbstractItemModel
from vigir_pluginlib_msgs.msg import PluginState, PluginDescription
# Tree Model for Plugins
class PluginTreeModel(QtCore.QAbstractItemModel):
def __init__(self, ... |
# Canvas wrapper component for Pyjamas
# Ported by Willie Gollino from Canvas component for GWT - Originally by Alexei Sokolov http://gwt.components.googlepages.com/
#
# Canvas API reference:
# http://developer.apple.com/documentation/AppleApplications/Reference/SafariJSRef/Classes/Canvas.html#//apple_ref/js/Canvas.cle... |
test = {
'name': 'Problem 9',
'points': 4,
'suites': [
{
'cases': [
{
'code': r"""
>>> # QueenAnt Placement
>>> queen = ants.QueenAnt()
>>> impostor = ants.QueenAnt()
>>> front_ant, back_ant = ants.ThrowerAnt(), ants.ThrowerAnt()
>>> tu... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='ContentType',
fields=[
('id', models.AutoField(... |
from __future__ import absolute_import
import base64
import typing as tp
from selenium.common.exceptions import WebDriverException
from applitools.core import EyesScreenshot, EyesError, Point, Region, OutOfBoundsError
from applitools.utils import image_utils
from applitools.selenium import eyes_selenium_utils
from a... |
# -*- coding: utf-8 -*-
'''Public section, including homepage and signup.'''
from flask import (Blueprint, request, render_template, flash, url_for,
redirect, session, jsonify, redirect, request, current_app,
abort)
from flask.ext.login import login_user, login_required, logout_u... |
""" Handlers related to data production.
"""
from collections import OrderedDict
import cStringIO
from datetime import datetime
import json
from dateutil import parser
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg
import tornado.web
from status.util import dthandler, Saf... |
# BlockStore: a helper class that keeps a map of blocks and implements
# helper functions for responding to getheaders and getdata,
# and for constructing a getheaders message
#
from mininode import *
import dbm
class BlockStore(object):
def __init__(self, datadir):
self.blockDB = ... |
# <headingcell level=1>
# *corpkit*: a Python-based toolkit for working with parsed linguistic corpora
# <headingcell level=2>
# <markdowncell>
# [Daniel McDonald](mailto:<EMAIL>?Subject=corpkit)**
#---------------------------
# <markdowncell>
# <br>
# > **SUMMARY:** This *IPython Notebook* shows you how to use `corp... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from copy import deepcopy
from functools import partial
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.common.utils import remove_... |
from nose.tools import *
import networkx as nx
from networkx.testing import *
def test_union_all_attributes():
g = nx.Graph()
g.add_node(0, x=4)
g.add_node(1, x=5)
g.add_edge(0, 1, size=5)
g.graph['name'] = 'g'
h = g.copy()
h.graph['name'] = 'h'
h.graph['attr'] = 'attr'
h.node[0]['... |
import BoostBuild
from string import find
t = BoostBuild.Tester(pass_toolset=0)
t.write("core-dependency-helpers", """
rule hdrrule
{
INCLUDES $(1) : $(2) ;
}
actions copy
{
cp $(>) $(<)
}
""")
code = """include core-dependency-helpers ;
DEPENDS all : a ;
DEPENDS a : b ;
actions create-b
{
echo '#include <... |
"""Monte Carlo model averaging for dropout networks."""
from neuralnet import *
from trainer import *
import glob
import sys
import random
def ExtractRepresentations(model_file, train_op_file, layernames,
base_output_dir, memory = '100M', k=10):
LockGPU()
model = util.ReadModel(model_fil... |
from sympy.mpmath.calculus import ODE_step_euler, ODE_step_rk4, odeint, arange
from sympy.mpmath import odefun, cos, sin, mpf, sinc, mp
solvers = [ODE_step_euler, ODE_step_rk4]
def test_ode1():
"""
Let's solve:
x'' + w**2 * x = 0
i.e. x1 = x, x2 = x1':
x1' = x2
x2' = -x1
"""
def de... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible.errors import AnsibleParserError
from ansible.parsing.dataloader import DataLoader
from ansible.module_utils._text import to_bytes, to_text
class DictDataLoader(DataLoader):
def __init__(self, file_ma... |
from openerp.osv import fields, osv
from openerp.tools.sql import drop_view_if_exists
from openerp.addons.decimal_precision import decimal_precision as dp
class res_country(osv.osv):
_name = 'res.country'
_inherit = 'res.country'
_columns = {
'intrastat': fields.boolean('Intrastat member'),
}
... |
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.common i... |
def main():
module = AnsibleModule(
argument_spec = dict()
)
cmd = ["/usr/bin/env", "ohai"]
rc, out, err = module.run_command(cmd, check_rc=True)
module.exit_json(**json.loads(out))
# import module snippets
from ansible.module_utils.basic import *
main() |
'''
Canvas stress
=============
This example tests the performance of our Graphics engine by drawing large
numbers of small squares. You should see a black canvas with buttons and a
label at the bottom. Pressing the buttons adds small colored squares to the
canvas.
'''
from kivy.uix.button import Button
from kivy.ui... |
from unittest import TestCase
from seecr.test import CallTrace
from seecr.test.portnumbergenerator import PortNumberGenerator
from socket import socket, AF_INET, SOCK_DGRAM
from subprocess import Popen, PIPE
from weightless.udp import Acceptor
class UdpAcceptorTest(TestCase):
def testStartListening(self):
... |
import logging
import re
from webkitpy.common.checkout.diff_parser import DiffParser
from webkitpy.common.system.executive import Executive
from webkitpy.common.system.filesystem import FileSystem
from webkitpy.common.checkout.scm.detection import SCMDetector
_log = logging.getLogger(__name__)
class PatchReader(ob... |
"""Shared Models Unit Tests."""
__author__ = '<EMAIL> (Lindsey Simon)'
import unittest
import logging
from google.appengine.ext import db
from django.test.client import Client
from django import http
import urls
import settings
from base import decorators
class TestDecorators(unittest.TestCase):
def setUp(sel... |
"""Environment dictionary - support structures"""
class _AttributeDict(dict):
"""
Dictionary subclass enabling attribute lookup/assignment of keys/values.
For example::
>>> m = _AttributeDict({'foo': 'bar'})
>>> m.foo
'bar'
>>> m.foo = 'not bar'
>>> m['foo']
... |
'''
CheckBox
========
.. versionadded:: 1.4.0
.. image:: images/checkbox.png
:align: right
:class:`CheckBox` is a specific two-state button that can be either checked or
unchecked. If the CheckBox is in a Group, it becomes a Radio button.
As with the :class:`~kivy.uix.togglebutton.ToggleButton`, only one Radio b... |
from __future__ import division
import numpy
from chainer.training import extension
class PolynomialShift(extension.Extension):
"""Trainer extension to polynomially shift an optimizer attribute.
This extension polynomially decreases the specified attribute of the
optimizer. The typical use case is a p... |
import pecan
from designate.openstack.common import log as logging
from designate.api.v2.controllers import rest
from designate.api.v2.views.extensions import reports as reports_view
LOG = logging.getLogger(__name__)
class TenantsController(rest.RestController):
_view = reports_view.TenantsView()
@pecan.e... |
"""Optimizer ops for use in layers and tf.learn."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
from tensorflow.contrib import framework as contrib_framework
from tensorflow.python.framework import constant_op
from tensorflow.python.framewor... |
from openerp.osv import osv, fields
class account_bank_statement(osv.osv):
_inherit = 'account.bank.statement'
_columns = {
'coda_note': fields.text('CODA Notes'),
}
class account_bank_statement_line(osv.osv):
_inherit = 'account.bank.statement.line'
_columns = {
'coda_account_num... |
from __future__ import print_function
__author__ = 'Tom Schaul, <EMAIL>'
from .handling import XMLHandling
# those imports are necessary for the eval() commands to find the right classes
import pybrain #@UnusedImport
from scipy import array #@UnusedImport
try:
import arac.pybrainbridge #@UnusedImport
except I... |
import datetime
import os
os.environ["DJANGO_SETTINGS_MODULE"] = "pootle.settings"
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from pootle_statistics.models import ScoreLog
class Command(BaseCommand):
help = "Refresh score"
def add_arguments(self, par... |
# -*- coding: utf-8 -*-
#
# six documentation build configuration file
import os
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like ... |
#!/usr/local/sal/Python.framework/Versions/3.8/bin/python3
import sys
import sal
sys.path.append('/usr/local/munki')
from munkilib import munkicommon
PREFS_TO_GET = (
'ManagedInstallDir',
'SoftwareRepoURL',
'ClientIdentifier',
'LogFile',
'LoggingLevel',
'LogToSyslog',
'InstallAppleSoftw... |
"""
Cisco Spark platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.ciscospark/
"""
import logging
import voluptuous as vol
from homeassistant.components.notify import (
PLATFORM_SCHEMA, BaseNotificationService, ATT... |
"""
libcollect.py
Provides the LibCollect class, used for collecting the various libraries
your script uses for delivery as a self-contained distribution package.
Author: Eli Bendersky (http://eli.thegreenplace.net)
License: Same as Python
Motivation:
Imagine that you've written a script that uses several librarie... |
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext as _
#historico das respostas das questoes
class AnsweredQuestionsHistoric(models.Model):
discipline = models.ForeignKey('Discipline', related_name=_('Discipline'), verbose_name=_(u"Discipline"))
lesso... |
{
"name": "Sale Order Types",
"version": "8.0.1.0.1",
"category": "Sales Management",
"author": "OdooMRP team, "
"Grupo Vermon, "
"AvanzOSC, "
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
"Odoo Community Association (OCA)",
"website": "http://w... |
from keen import scoped_keys
from keen.tests.base_test_case import BaseTestCase
class ScopedKeyTests(BaseTestCase):
api_key = "24077ACBCB198BAAA2110EDDB673282F8E34909FD823A15C55A6253A664BE368"
bad_api_key = "24077ACBCB198BAAA2110EDDB673282F8E34909FD823A15C55A6253A664BE369"
old_api_key = "ab428324dbdbcfe74... |
import os
import random
import string
import subprocess
import re
from rootpy import asrootpy
from rootpy.plotting import Graph
def gen_random_name():
"""Generate a random name for temp hists"""
return ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(25))
def get_est_dirs(sums, co... |
import os
import sys
import unittest
from branch_utility import BranchUtility, ChannelInfo
from fake_url_fetcher import FakeUrlFetcher
from object_store_creator import ObjectStoreCreator
from test_util import Server2Path
class BranchUtilityTest(unittest.TestCase):
def setUp(self):
self._branch_util = BranchUt... |
def main(request, response):
import simplejson as json
f = file('config.json')
source = f.read()
s = json.JSONDecoder().decode(source)
url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1])
_CSP = "font-src " + url1
response.headers.set("Content-Security-Policy", _CSP)
response.... |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
... |
# coding: utf-8
from __future__ import unicode_literals
import re
import os.path
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
url_basename,
remove_start,
)
class DemocracynowIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?democracynow\.org/(?P<id>[^\?... |
"""Reference implementation for Bech32 and segwit addresses."""
import unittest
CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"
def bech32_polymod(values):
"""Internal function that computes the Bech32 checksum."""
generator = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3]
chk = 1
for valu... |
"""Tests for summary ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import six
import tensorflow as tf
from tensorflow.python.framework import tensor_util
class SummaryOpsTest(tf.test.TestCase):
def _SummarySingleValue(self,... |
from .. import bar
from . import base
class TextBox(base._TextBox):
"""
A flexible textbox that can be updated from bound keys, scripts and
qsh.
"""
defaults = [
("font", "Arial", "Text font"),
("fontsize", None, "Font pixel size. Calculated if None."),
("fontshadow... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from units.compat.mock import patch
from ansible.modules.network.edgeswitch import edgeswitch_vlan
from ansible.modules.network.edgeswitch.edgeswitch_vlan import parse_vlan_brief, parse_interfaces_switchport
from units... |
import os
import tempfile
from subprocess import CalledProcessError
import pytest
import pkgpanda.util
from pkgpanda import UserManagement
from pkgpanda.exceptions import ValidationError
PathSeparator = '/' # Currently same for both windows and linux. Constant may vary in near future by platform
def test_remove_f... |
from unittest import TestCase
import requests, os
from openarticlegauge import config, models
######################################################################################
# Set these variables/imports and the test case will use them to perform some general
# tests on your provider code
# import your plugin... |
from corpus import *
import cherrypy
import sys
import shelve
import json
class CorpEdit(object):
def index(self):
cherrypy.response.headers['Content-Type']= 'text/html'
f = open('static/corpedit.html')
html = f.read()
f.close()
return html
def corpedit_js(self):
... |
ALPHA = 'alpha'
ARMV6 = 'armv6'
ARMV7 = 'armv7l'
ARMV7B = 'armv7b'
AARCH64 = 'aarch64'
CRIS = 'cris'
I686 = 'i686'
IA64 = 'ia64'
LM32 = 'lm32'
M68K = 'm68k'
MICROBLAZE = 'microblaze'
MICROBLAZEEL = 'microblazeel'
MIPS = 'mips'
MIPSEL = 'mipsel'
MIPS64 = 'mips64'
MIPS64EL = 'mips64el'
OPENRISC = 'openrisc'
PARISC = '... |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... |
import ctypes
import os
import platform
import subprocess
import sys
import time
from telemetry.core import os_version as os_version_module
from telemetry import decorators
from telemetry.internal.platform import posix_platform_backend
from telemetry.internal.platform.power_monitor import powermetrics_power_monitor
fr... |
"""
Specifying ordering
Specify default ordering for a model using the ``ordering`` attribute, which
should be a list or tuple of field names. This tells Django how to order
``QuerySet`` results.
If a field name in ``ordering`` starts with a hyphen, that field will be
ordered in descending order. Otherwise, it'll be ... |
"""Tests of commerce utilities."""
from django.conf import settings
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
from mock import patch
from waffle.testutils import override_switch
from commerce.models import CommerceConfiguration
from c... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from backtrader import date2num
import backtrader.feed as feed
class BlazeData(feed.DataBase):
'''
Support for `Blaze <blaze.pydata.org>`_ ``Data`` objects.
Only numeric indices to columns are su... |
from .constants import eStart, eError, eItsMe
# BIG5
BIG5_cls = (
1,1,1,1,1,1,1,1, # 00 - 07 #allow 0x00 as legal value
1,1,1,1,1,1,0,0, # 08 - 0f
1,1,1,1,1,1,1,1, # 10 - 17
1,1,1,0,1,1,1,1, # 18 - 1f
1,1,1,1,1,1,1,1, # 20 - 27
1,1,1,1,1,1,1,1, # 28 - 2f
1,1,1,1,1,1,1,1, # 30 - 3... |
import os
import mock
import unittest
from telemetry.internal import forwarders
from telemetry.internal.platform import network_controller_backend
from telemetry.util import wpr_modes
DEFAULT_PORTS = forwarders.PortSet(http=1111, https=2222, dns=3333)
FORWARDER_HOST_IP = '123.321.123.321'
EXPECTED_WPR_CA_CERT_PATH =... |
#!/usr/bin/python
import daemon
import web
import sys
import os
port=8081
header = '<html><body><a href="/car/list">List</a> | <a href="/car/set">Set</a> | <a href="/goodbye">Terminate Server</a><br/>'
footer = '</body></html>'
class hello:
def GET(self):
return header + footer
class car_list:
def GET(self)... |
import os
import re
import shlex
import subprocess
from SCons.Scanner import FindPathDirs
from SCons.Script import Action, Builder
def exists(env):
return env.Detect('cython')
def generate(env):
env.Tool('python')
env.SetDefault(CYTHONPATH=[])
env['BUILDERS']['Cython'] = Builder(
action=A... |
# The test system uses this to override settings in settings.py and
# settings_local.py with settings appropriate for testing.
import os
ES_LIVE_INDEXING = False
ES_INDEX_PREFIX = 'sumotest'
ES_INDEXES = {
'default': 'test-default',
'non-critical': 'test-non-critical',
'metrics': 'test-metrics',
}
ES_WRITE... |
from .pls_ import _PLS
__all__ = ['CCA']
class CCA(_PLS):
"""CCA Canonical Correlation Analysis.
CCA inherits from PLS with mode="B" and deflation_mode="canonical".
Read more in the :ref:`User Guide <cross_decomposition>`.
Parameters
----------
n_components : int, (default 2).
numb... |
from migrate import ForeignKeyConstraint
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import Index
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import String
from sqlalchemy import Table
from sqlalchemy import Text
def upgrade(migrate_engine):
met... |
import collections
import testtools
from glanceclient import exc
FakeResponse = collections.namedtuple('HTTPResponse', ['status'])
class TestHTTPExceptions(testtools.TestCase):
def test_from_response(self):
"""exc.from_response should return instance of an HTTP exception."""
out = exc.from_resp... |
# -*- coding: utf-8 -*-
import commands
import logging
import simplejson
import os
import os.path
import io
import base64
import openerp
import time
import random
import math
import md5
import openerp.addons.hw_proxy.controllers.main as hw_proxy
import pickle
import re
import subprocess
import traceback
from threading ... |
# -*- coding: utf-8 -*-
"""
jinja2.loaders
~~~~~~~~~~~~~~
Jinja loader classes.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import weakref
from types import ModuleType
from os import path
from hashlib import sha1
from jinja2.excepti... |
import string
import random
import threading
from time import sleep
from plugins.plugin import Plugin
from plugins.browserprofiler import BrowserProfiler
class BrowserSniper(BrowserProfiler, Plugin):
name = "BrowserSniper"
optname = "browsersniper"
desc = "Performs drive-by attacks on cli... |
{
'name': 'Automated Translations through Gengo API',
'version': '0.1',
'category': 'Tools',
'description': """
Automated Translations through Gengo API
========================================
This module will install passive scheduler job for automated translations
using the Gengo API. To activate i... |
"""\
A library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
"""
import os, urlparse, urllib, types
import handler
import xmlreader
try:
_StringTypes = [types.StringType, types.UnicodeType]
except AttributeError:
_StringTypes = [types.StringTyp... |
"""Picasa Web Albums uses the georss and gml namespaces for
elements defined in the GeoRSS and Geography Markup Language specifications.
Specifically, Picasa Web Albums uses the following elements:
georss:where
gml:Point
gml:pos
http://code.google.com/apis/picasaweb/reference.html#georss_reference
Picasa Web Albu... |
"""Unit test for the gtest_xml_output module"""
__author__ = '<EMAIL> (Sean Mcafee)'
import errno
import os
import sys
from xml.dom import minidom, Node
import gtest_test_utils
import gtest_xml_test_utils
GTEST_OUTPUT_FLAG = "--gtest_output"
GTEST_DEFAULT_OUTPUT_FILE = "test_detail.xml"
GTEST_PROGRAM_NAME ... |
#!/usr/bin/env python
#
# test_codecencodings_kr.py
# Codec encoding tests for ROK encodings.
#
from test import test_support
from test import test_multibytecodec_support
import unittest
class Test_CP949(test_multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'cp949'
tstring = test_multibytecod... |
from __future__ import unicode_literals
import logging
import logging.config # needed when logging_config doesn't start with logging.config
from copy import copy
from django.conf import settings
from django.core import mail
from django.core.mail import get_connection
from django.core.management.color import color_st... |
import mock
from oslo_utils import timeutils
from nova import db
from nova import exception
from nova.objects import aggregate
from nova.tests.unit import fake_notifier
from nova.tests.unit.objects import test_objects
NOW = timeutils.utcnow().replace(microsecond=0)
fake_aggregate = {
'created_at': NOW,
'upda... |
from pynicotine.pluginsystem import BasePlugin
def enable(plugins):
global PLUGIN
PLUGIN = Plugin(plugins)
def disable(plugins):
global PLUGIN
PLUGIN = None
class Plugin(BasePlugin):
__name__ = "Plugin Debugger"
__version__ = "2009-05-27r00"
__author__ = "quinox"
__desc__ = """Plug... |
#! /usr/bin/env python
import random, os.path
#import basic pygame modules
import pygame
from pygame.locals import *
#see if we can load more than standard BMP
if not pygame.image.get_extended():
raise SystemExit("Sorry, extended image module required")
#game constants
MAX_SHOTS = 2 #most player bull... |
#!/bin/python
# -*- coding: utf-8 -*-
# Email: <EMAIL>
import reversion
from django.contrib import admin
from django.core.urlresolvers import reverse
from models import (Arch, Author, CheckProgress, Distro, DistroTemplate, Event,
FileLog, Git, GroupOwner, GroupTaskTemplate, GroupTemplate,
... |
"""
Views related to content libraries.
A content library is a structure containing XBlocks which can be re-used in the
multiple courses.
"""
from __future__ import absolute_import
import logging
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.exceptions imp... |
"""Package contenant l'éditeur 'matedit'.
Si des redéfinitions de contexte-éditeur standard doivent être faites, elles
seront placées dans ce package
Note importante : ce package contient la définition d'un éditeur, mais
celui-ci peut très bien être étendu par d'autres modules. Au quel cas,
les extensions n'apparaîtr... |
"""API over the keystone service.
"""
from django.conf import settings
import django.http
from django.views import generic
from openstack_dashboard import api
from openstack_dashboard.api.rest import urls
from openstack_dashboard.api.rest import utils as rest_utils
@urls.register
class Version(generic.View):
""... |
import account
import l10n_multilang
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""SSH connection.
Connect to a remote host via SSH and execute a command on the host.
"""
import sys, os, re, subprocess
from bup import helpers, path
def connect(rhost, port, subcmd):
"""Connect to 'rhost' and execute the bup subcommand 'subcmd' on it."""
assert(not re.search(r'[^\w-]', subcmd))
nicedir... |
from .base import TestBase
from ..disassembler import Disassembler, Option_UseMarkup
class TestDisassembler(TestBase):
def test_instantiate(self):
Disassembler('i686-apple-darwin9')
def test_basic(self):
sequence = '\x67\xe3\x81' # jcxz -127
triple = 'i686-apple-darwin9'
dis... |
class HealthCheck(object):
"""
Represents an EC2 Access Point Health Check. See
:ref:`elb-configuring-a-health-check` for a walkthrough on configuring
load balancer health checks.
"""
def __init__(self, access_point=None, interval=30, target=None,
healthy_threshold=3, timeout=5,... |
from __future__ import division, absolute_import, print_function
import locale
import numpy as np
from numpy.testing import (
run_module_suite, assert_, assert_equal, dec, assert_raises,
assert_array_equal, TestCase, temppath,
)
from numpy.compat import sixu
from test_print import in_foreign_locale
longdoubl... |
"""
An Enso plugin that makes the 'evaluate' command available.
"""
# ----------------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------------
from enso.commands import CommandManager, CommandObject
from enso.utils import... |
import time
from psycopg2 import OperationalError
from openerp import SUPERUSER_ID
from openerp.osv import fields, osv
import openerp.addons.decimal_precision as dp
from openerp.tools.translate import _
import openerp
PROCUREMENT_PRIORITIES = [('0', 'Not urgent'), ('1', 'Normal'), ('2', 'Urgent'), ('3', 'Very Urgent'... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
int_or_none,
qualities,
determine_ext,
)
class SunPornoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?sunporno\.com/videos/(?P<id>\d+)'
_TEST = {
'url': 'ht... |
# -*- coding: utf-8 -*-
"""
pygments.styles.colorful
~~~~~~~~~~~~~~~~~~~~~~~~
A colorful style, inspired by CodeRay.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keyword, ... |
""" interactive debugging with PDB, the Python Debugger. """
from __future__ import absolute_import
import pdb
import sys
import pytest
def pytest_addoption(parser):
group = parser.getgroup("general")
group._addoption('--pdb',
action="store_true", dest="usepdb", default=False,
h... |
"""Tests for methods in gadget registry."""
__author__ = 'Michael Anuzis'
import os
from core.domain import gadget_registry
from core.tests import test_utils
from extensions.gadgets import base
import feconf
class GadgetRegistryUnitTests(test_utils.GenericTestBase):
"""Test for the gadget registry."""
def... |
# -*- coding: utf-8 -*-
"""Tests for the permissions module."""
import unittest
from nose.tools import * # PEP8 asserts
from website.util import permissions
def test_expand_permissions():
result = permissions.expand_permissions('admin')
assert_equal(result, ['read', 'write', 'admin'])
result2 = permiss... |
import mock
from oslo_serialization import jsonutils
import requests
from neutron.plugins.oneconvergence.lib import config # noqa
from neutron.plugins.oneconvergence.lib import plugin_helper as client
from neutron.tests import base
class TestPluginHelper(base.BaseTestCase):
def setUp(self):
super(TestPl... |
import os
from key import Key
from boto.file.simpleresultset import SimpleResultSet
from boto.s3.bucketlistresultset import BucketListResultSet
class Bucket(object):
def __init__(self, name, contained_key):
"""Instantiate an anonymous file-based Bucket around a single key.
"""
self.name = n... |
from synnefo.db import models
from snf_django.lib.api import faults
from synnefo.api.util import get_image_dict, get_vm
from synnefo.plankton import backend
from synnefo.cyclades_settings import cyclades_services, BASE_HOST
from synnefo.lib import join_urls
from synnefo.lib.services import get_service_path
def get_vo... |
"""Registration facilities for DOM. This module should not be used
directly. Instead, the functions getDOMImplementation and
registerDOMImplementation should be imported from xml.dom."""
# This is a list of well-known implementations. Well-known names
# should be published by posting to <EMAIL>, and are
# subsequentl... |
"""Estimator: High level tools for working with models."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=unused-import,line-too-long,wildcard-import
from tensorflow.python.estimator.canned.baseline import BaselineClassifier
from tensorfl... |
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = """
options:
host:
description:
- Specifies the DNS host name or address for connecting to the remote
device over the specified transport. The value of host is used as
the destination address f... |
import json
import zlib
from tests.sampledata import SampleData
from treeherder.etl.perf_data_adapters import TalosDataAdapter
def test_adapt_and_load():
talos_perf_data = SampleData.get_talos_perf_data()
tda = TalosDataAdapter()
result_count = 0
for datum in talos_perf_data:
datum = {
... |
try:
import pyrax
HAS_PYRAX = True
except ImportError:
HAS_PYRAX = False
def _activate_virtualenv(path):
path = os.path.expanduser(path)
activate_this = os.path.join(path, 'bin', 'activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
def _get_node(lb, node_id=None, address... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.