content stringlengths 4 20k |
|---|
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.acme import (
ModuleFailException, ACMEAccount, set_crypto_ba... |
DATE_FORMAT = 'j N Y'
DATETIME_FORMAT = "j N Y, G.i.s"
TIME_FORMAT = 'G.i.s'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd-m-Y'
SHORT_DATETIME_FORMAT = 'd-m-Y G.i.s'
FIRST_DAY_OF_WEEK = 1 #Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.o... |
# Converted from S3_Website_Bucket_With_Retain_On_Delete.template located at:
# http://aws.amazon.com/cloudformation/aws-cloudformation-templates/
from troposphere import GetAtt, Join, Output, Template
from troposphere.s3 import Bucket, PublicRead, WebsiteConfiguration
t = Template()
t.add_description(
"AWS Clo... |
from ranger.api.options import *
# Load the deault rc.conf file? If you've copied it to your configuration
# direcory, then you should deactivate this option.
load_default_rc = True
# How many columns are there, and what are their relative widths?
column_ratios = (1, 3, 4)
# Which files should be hidden? Toggle th... |
import sys
import os
import pdb
from datetime import date
sys.path.append(os.getcwd() + '/../../')
try:
from salary_calculator import settings
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized t... |
import os
import tempfile
from imposm.cache.tc import NodeDB, DeltaCoordsDB
from nose.tools import eq_, assert_almost_equal
class TestNodeDB(object):
def setup(self):
fd_, self.fname = tempfile.mkstemp('.db')
self.db = NodeDB(self.fname)
def teardown(self):
os.unlink(self.fname)
... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
DeleteScriptAction.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
********************... |
import datetime
from .base import Capability, BaseObject, StringField, UserError
from .date import DateField
__all__ = ['ChatException', 'ChatMessage', 'CapChat']
class ChatException(UserError):
"""
Exception raised when there is a problem with the chat.
"""
class ChatMessage(BaseObject):
"""
... |
"""Collection of low-level utility functions."""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.six import binary_type, text_type
from ansible.module_utils.common._collections_compat import Hashable, Mapping, Sequence
class ImmutableDict(Hashable, Ma... |
"""Weight broadcasting operations.
In `tf.losses` and `tf.metrics`, we support limited weight broadcasting. This
file includes operations for those broadcasting rules.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework imp... |
"""
The cproton module defines a java implementation of the C interface as
exposed to python via swig. This allows tests defined in python to run
against both the C and Java protocol implementations.
"""
# @todo(kgiusti) dynamically set these via filters in the pom.xml file
PN_VERSION_MAJOR = 0
PN_VERSION_MINOR = 0
f... |
"""Literal Data RFC 2440.5.9
"A Literal Data packet contains the body of a message; data that is not to be
further interpreted."
The term 'message' above does not refer to an OpenPGP message (10.2), but
rather that message which OpenPGP signed, verified, encrypted, etc..
"""
from Packet import Packet
import openpgp.s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import time
import json
from ansible.module_utils._text import to_bytes
from ansible.plugins.callback import CallbackBase
# NOTE: in Ansible 1.2 or later general logging is available without
# this plugin, just set ANS... |
"""Module containing sysbench 0.5 (and later) installation and cleanup logic.
Sysbench 0.5 contains breaking changes from previous versions. All existing
oltp benchmarks depending on older version of sysbench will break if we
install 0.5 or later for them. Therefore, it's necessary that we have a
separate installer he... |
from __future__ import absolute_import, division, print_function, unicode_literals
from .common import BaseTest, functional
from botocore.exceptions import ClientError
import json, time
class TestSqsAction(BaseTest):
@functional
def test_sqs_delete(self):
session_factory = self.replay_flight_data(
... |
import numpy
from theano.compat.six.moves import xrange
import theano
from theano.compat.python2x import Counter
from pylearn2.expr.stochastic_pool import stochastic_max_pool_bc01, weighted_max_pool_bc01
# TODO add unit tests for: differnt shape, stide, batch and channel size
def test_stochasatic_pool_samples():
... |
# -*- coding: utf-8 -*-
"""
werkzeug.debug.console
~~~~~~~~~~~~~~~~~~~~~~
Interactive console support.
:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD.
"""
import sys
import code
from types import CodeType
from werkzeug.utils import escape
from werkzeug.local... |
import base64
import json
import logging
import os
import re
import uuid
from gevent.core import EVHTTP_REQ_GET as GET
from gevent.core import EVHTTP_REQ_POST as POST
from gevent.http import HTTPServer
logger = logging.getLogger(__name__)
# Seconds after a client is guaranteed to receive an answer. We
# simply ass... |
__author__ = 'Spoony'
__version__ = 'version 0.0.1'
__license__ = 'Copyright (c) 2016 NXEZ.COM'
import RPi.GPIO as GPIO
from sakspins import SAKSPins as PINS
import entities
class SAKSHAT(object):
'''
SAKS HAT class, some useful function are declared.
'''
buzzer = None
ledrow = None
ds18b20 ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.test import TestCase
from model_mommy import mommy
from blog.models import Post
class BlogViewTests(TestCase):
def setUp(self):
self.user_password = "pass"
self.user = mommy.mak... |
import sys
import os
from common import PostProcess, update_metrics_in_report_json
from common import read_limits, check_limits_and_add_to_report_json
import numpy as np
if __name__ == '__main__':
if len(sys.argv) > 1:
mat_file_name = sys.argv[1]
if not os.path.exists(mat_file_name):
... |
# -*- encoding: utf-8 -*-
"""Test class for Reports CLI.
:Requirement: Report
:CaseAutomation: Automated
:CaseLevel: Component
:CaseComponent: SCAPPlugin
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import random
from robottelo import ssh
from robottelo.cli.base import CLIReturnCodeError
from r... |
import pika
import json
from cloudbrain.subscribers.SubscriberInterface import Subscriber
from cloudbrain.utils.metadata_info import get_metrics_names
from cloudbrain.settings import RABBITMQ_ADDRESS
class PikaSubscriber(Subscriber):
def __init__(self, device_name, device_id, rabbitmq_address, metric_name):
... |
"""A utility useful in tests of asynchronous, event-driven interfaces."""
import threading
from grpc.framework.interfaces.face import face
class Receiver(face.ResponseReceiver):
"""A utility object useful in tests of asynchronous code."""
def __init__(self):
self._condition = threading.Condition()
self... |
#!/usr/bin/python
import sys
# import nwb
import test_utils as ut
from nwb import nwb_file
from nwb import nwb_utils as utils
# creates time series without 'data' field
# TESTS softlink of TimeSeries.data
def test_softlink():
if __file__.startswith("./"):
fname1 = "s" + __file__[3:-3] + "1" + ".nwb"
... |
from cloudify import ctx
from cloudify.decorators import operation
import pynsxv.library.nsx_dlr as nsx_router
import cloudify_nsx.library.nsx_esg_dlr as cfy_dlr
import cloudify_nsx.library.nsx_common as common
@operation
def create(**kwargs):
validation_rules = {
"dlr_id": {
"required": True
... |
from __future__ import absolute_import
from __future__ import print_function
from twisted.trial import unittest
from buildbot_worker.commands import registry
from buildbot_worker.commands import shell
class Registry(unittest.TestCase):
def test_getFactory(self):
factory = registry.getFactory('shell')
... |
# coding=utf-8
import time
import re
import logging
from error import DiamondException
class Metric(object):
_METRIC_TYPES = ['COUNTER', 'GAUGE']
def __init__(self, path, value, raw_value=None, timestamp=None, precision=0,
host=None, metric_type='COUNTER', ttl=None):
"""
Cr... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from units.mock.procenv import ModuleTestCase
from ansible.module_utils.six.moves import builtins
realimport = builtins.__import__
class TestTextifyContainers(ModuleTestCase):
def test_module_utils_basic_json_dict_converters(... |
from repoman_client.subcommand import SubCommand
from repoman_client.client import RepomanClient
from repoman_client.exceptions import RepomanError, SubcommandFailure
from repoman_client.config import config
from repoman_client.utils import yes_or_no
from repoman_client import imageutils
import sys
import logging
cla... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils... |
from json import loads
from os.path import expanduser
from urllib2 import build_opener, Request
def call_api(data):
"""Send request containing the given data to the New Open Calais
The data is encoded and sent to the API using https connection.
Parameters
----------
data : str
Data to an... |
import invite
import mail_compose_message
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from __future__ import absolute_import, division
import __builtin__
import math
import random
import time
def median(x, use_float=True):
# there exist better algorithms...
y = sorted(x)
if not y:
raise ValueError('empty sequence!')
left = (len(y) - 1)//2
right = len(y)//2
sum = y[left]... |
import re
import os
import argparse
from collections import Counter
# for chess stuff
import chess
import chess.pgn
# for building graphs
import json
import networkx as nx
from networkx.readwrite import json_graph
parser = argparse.ArgumentParser()
parser.add_argument('-v', action='store_true', help='print messages'... |
'''
Parse one BSDL file at the file level.
Currently only used by parseall.py in the tools directory.
Currently only parses well enough to extract ID Code and instruction
register values. Should be fairly easy to extend.
There are a lot of crap BSDL files out there, and this parser
attempts to wade through the crap... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import markdown
from django.db import models
from django.db.models import F
from django.contrib.auth.models import User
class Post(models.Model):
STATUS_ITEMS = (
(1, '上线'),
(2, '草稿'),
(3, '删除'),
)
title = models.Ch... |
import copy
from tempest.lib.api_schema.response.compute.v2_3 import servers
list_servers = copy.deepcopy(servers.list_servers)
get_server = copy.deepcopy(servers.get_server)
get_server['response_body']['properties']['server'][
'properties'].update({'locked': {'type': 'boolean'}})
get_server['response_body']['pr... |
def getCookie(cookie_name):
JS("""
var results = document['cookie']['match'] ( '(^|;) ?' +
@{{cookie_name}} + '=([^;]*)(;|$)' );
if ( results )
return ( decodeURIComponent ( results[2] ) );
else
return null;
""")
# expires can be int or Date
def setCookie(name, value, expires, dom... |
#!/usr/bin/env python
#
# Import all necessary libraries
#
import argparse
from lcrequest import LCRequest
from operator import itemgetter
#
# Define some global constants
#
VERSION= '0.0.1'
MINIMUM_WITHDRAWAL_AMOUNT= 100
MAXIMUM_WITHDRAWAL_AMOUNT= 1000
# Lending Club API data structure keys
KEY_AVAILABLE_CASH= ... |
import unittest
import numpy as np
from Orange.data import Table, Domain, ContinuousVariable
from Orange.classification import EllipticEnvelopeLearner
class EllipticEnvelopeTest(unittest.TestCase):
def setUp(self):
np.random.seed(42)
domain = Domain((ContinuousVariable("c1"), ContinuousVariable("... |
#
# Ogg parser
# Author Julien Muchembled <jm AT jm10.no-ip.com>
#
from hachoir_parser import Parser
from hachoir_core.field import (Field, FieldSet, createOrphanField,
NullBits, Bit, Bits, Enum, Fragment, MissingField, ParserError,
UInt8, UInt16, UInt24, UInt32, UInt64,
RawBytes, String, PascalString32, N... |
'''
Created on April 18, 2011
DAO methods for secrets.
This way we generate secrets on startup and don't have to comb the code
when open sourcing it. It's a db read cost, but memcache should
amortize that cost.
@author: Raj
'''
from serverside.entities import memcache_db
from serverside.entities.passphrase import P... |
import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_9_2_4(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '9 2 4'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main() |
from org.apache.nifi.processor import Processor
from org.apache.nifi.components import ValidationResult
class AlwaysInvalid(Processor) :
def __init__(self) :
pass
def initialize(self, context) :
pass
def getRelationships(self) :
pass
def validate(self, context) :
err... |
import numpy as np
from draw import *
# total number of observations
OBS_SIZE = 10
# length of the field i.e. LxL field
L = 20
N_BATCH = 50
# ------------------------------------------------------------------ helpers
# pad a list into its final length and also turn it into a numpy array
def pad_and_numpy(lst, final_... |
__doc__ = """JuniperDeviceMap
Gather information from Juniper devices.
"""
from Products.DataCollector.plugins.CollectorPlugin import SnmpPlugin, GetMap
from Products.DataCollector.plugins.DataMaps import MultiArgs
import re
class JuniperDeviceMap(SnmpPlugin):
maptype = "JuniperDeviceMap"
# Get OSProductKey fro... |
from django.forms.widgets import Widget, HiddenInput, TextInput
from django.utils.safestring import mark_safe
class AutoCompleteWidget(Widget):
"""
Widget that presents an <input> field that can be used to search for
objects instead of a giant <select> field
You will need to include jQuery UI with au... |
"""Implementation of Gaussian mixture model (GMM) clustering using tf.Learn."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import numpy as np
from tensorflow.contrib import framework
from tensorflow.contrib.factorization.python.ops import ... |
import json
import os
from ansible.module_utils.urls import fetch_url
from ansible.module_utils._text import to_text
class Response(object):
def __init__(self, resp, info):
self.body = None
if resp:
self.body = resp.read()
self.info = info
@property
def json(self):
... |
from __future__ import unicode_literals
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http.response import HttpResponseRedirect
from django.utils.translation import ugettext as _
from django.views.generic import DetailView
from shuup.admin.utils.urls import get_model_url... |
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 ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import data_flow_ops
from tensorflow.python.ops ... |
"""
Test cases for L{twisted.protocols.haproxy.V2Parser}.
"""
from twisted.trial import unittest
from twisted.internet import address
from .._exceptions import InvalidProxyHeader
from .. import _v2parser
V2_SIGNATURE = b'\x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A'
def _makeHeaderIPv6(sig=V2_SIGNATURE, verCom=... |
import httplib as http
import urlparse
import httpretty
import mock
from addons.base.tests.base import OAuthAddonTestCaseMixin
from framework.auth import Auth
from framework.exceptions import HTTPError
from nose.tools import (assert_equal, assert_false, assert_in, assert_is_none,
assert_not_equ... |
"""
This package defines the CGS units. They are also available in the
top-level `astropy.units` namespace.
"""
from fractions import Fraction
from . import si
from .core import UnitBase, def_unit
_ns = globals()
def_unit(['cm', 'centimeter'], si.cm, namespace=_ns, prefixes=False)
g = si.g
s = si.s
C = si.C
rad ... |
from django import http
from django import template
from django.conf import settings
from django.template import loader
from django.core.cache import cache
from google.appengine.api import users
from common import api
from common import clean
from common import decorator
from common import exception
from common impor... |
from django.conf import settings
from django.contrib.auth.models import User as AuthUser
from django.core.urlresolvers import reverse
from django.test import TestCase
from django_inlines.inlines import Registry, inline_for_model, InlineInputError, registry, ModelInline
from test_inlines import UserInline
from core.mod... |
from django.contrib import admin
from moneybags import models
class AccountAdmin(admin.ModelAdmin):
list_display = ('name', 'slug', 'owner', )
search_fields = (
'name', 'owner__username', 'owner__first_name', 'owner__last_name'
)
prepopulated_fields = {'slug': ('name',)}
class TransactionAdm... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
import urllib
# ===========================================
# Module execution.
#
def main():
module = AnsibleModule(
argument_spec=dict(
token=dict(required=True... |
""" zope.interface.verify unit tests
"""
import unittest
class Test_verifyClass(unittest.TestCase):
def _callFUT(self, iface, klass):
from zope.interface.verify import verifyClass
return verifyClass(iface, klass)
def test_class_doesnt_implement(self):
from zope.interface import Inter... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
PASSLIB_AVAILABLE = False
try:
import passlib.hash
PASSLIB_AVAILABLE = True
except:
pass
from ansible.errors import AnsibleError
__all__ = ['do_encrypt']
def do_encrypt(result, encrypt, salt_size=None, salt=None):
... |
from twisted.internet import defer
from buildbot.test.util.integration import RunMasterBase
# This integration test creates a master and worker environment,
# with one builder and a shellcommand step
# meant to be a template for integration steps
class ShellMaster(RunMasterBase):
@defer.inlineCallbacks
def ... |
"""Tests for acme.jose.json_util."""
import itertools
import unittest
import mock
import six
from acme import test_util
from acme.jose import errors
from acme.jose import interfaces
from acme.jose import util
CERT = test_util.load_cert('cert.pem')
CSR = test_util.load_csr('csr.pem')
class FieldTest(unittest.Test... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
from pushbullet import PushBullet
from pushbullet.errors import InvalidKeyErro... |
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from .. import models
class UsagesOperations(object):
"""UsagesOperations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param seria... |
import pytest
from hls2dash.lib import MPDAdaptationSet
def test_init_baseclass():
obj = MPDAdaptationSet.Base('video/mp4', 'codec', 13000)
assert isinstance(obj, MPDAdaptationSet.Base)
assert len(obj.getRepresentations()) == 0
assert obj.getTimescale() == 13000
def test_init_invalid_baseclass():
... |
# -*- coding: utf-8 -*-
"""
pygments.lexers._stan_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This file contains the names of functions for Stan used by
``pygments.lexers.math.StanLexer.
:copyright: Copyright 2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
KEYWORDS = ['else', 'for', '... |
import RPi.GPIO as GPIO
import time
import sys
def bin2dec(string_num):
return str(int(string_num, 2))
data = []
GPIO.setmode(GPIO.BCM)
GPIO.setup(4,GPIO.OUT)
GPIO.output(4,GPIO.HIGH)
time.sleep(0.025)
GPIO.output(4,GPIO.LOW)
time.sleep(0.02)
GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_UP)
for i in ran... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from ..fields import * # NOQA
class Migration(migrations.Migration):
dependencies = [
('postgres_tests', '0001_setup_extensions'),
]
operations = [
migrations.CreateModel(
... |
"""Abstract Base Classes (ABCs) for collections, according to PEP 3119.
DON'T USE THIS MODULE DIRECTLY! The classes here should be imported
via collections; they are defined here only to alleviate certain
bootstrapping issues. Unit tests are in test_collections.
"""
from abc import ABCMeta, abstractmethod
import sy... |
#!/usr/bin/env python
"Makes working with XML feel like you are working with JSON"
from xml.parsers import expat
from xml.sax.saxutils import XMLGenerator
from xml.sax.xmlreader import AttributesImpl
try: # pragma no cover
from cStringIO import StringIO
except ImportError: # pragma no cover
try:
from... |
import rospy
import agent
import model
import path
import stpoint
import json
import sys
import time
# import math
from visualization_msgs.msg import Marker
from nav_msgs.msg import Path
from geometry_msgs.msg import PoseStamped
duration = 30
def print_usage():
print "Usage:\n\tpython scripts/run_ros_animator... |
"""Subclass of CloudBucket used for testing."""
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
import cloud_bucket
class MockCloudBucket(cloud_bucket.BaseCloudBucket):
"""Subclass of CloudBucket used for testing."""
def __init__(self):
"""Initializes the... |
#
# euc_jp.py: Python Unicode Codec for EUC_JP
#
# Written by Hye-Shik Chang <<EMAIL>>
#
import _codecs_jp, codecs
import _multibytecodec as mbc
codec = _codecs_jp.getcodec('euc_jp')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncoder(mbc.MultibyteIncrementalEncod... |
from django.contrib.auth.tests.auth_backends import (BackendTest,
RowlevelBackendTest, AnonymousUserBackendTest, NoAnonymousUserBackendTest,
NoBackendsTest, InActiveUserBackendTest, NoInActiveUserBackendTest)
from django.contrib.auth.tests.basic import BasicTestCase
from django.contrib.auth.tests.decorators imp... |
"""
Code to implement vector rotation by angles, and inferring gridcell angles
from coordinate points and bounds.
"""
import numpy as np
import cartopy.crs as ccrs
import iris
def _3d_xyz_from_latlon(lon, lat):
"""
Return locations of (lon, lat) in 3D space.
Args:
* lon, lat: (float array)
... |
# -*- coding: UTF-8 -*-
from Experimento import Experimento
from core.GeradorDeGrafos import GeradorDeGrafos
from core.DesenhistaDeGrafos import DesenhistaDeGrafos
from core.Tabela import Tabela
from core.utils import utils
from AlgoritmoHeuristicaDePerturbacao import AlgoritmoHeuristicaDePerturbacao
from AlgoritmoHeu... |
"""
This program get hosts informations from running arbiter daemon and
get service dependencies definition from config pack flat files then
dump services dependencies according to the config files to a json
that can be loaded in hot_dependencies_arbiter module.
servicedependencies file in pack use template host_name... |
""" Encoding Aliases Support
This module is used by the encodings package search function to
map encodings names to module names.
Note that the search function normalizes the encoding names before
doing the lookup, so the mapping will have to map normalized
encoding names to module names.
Con... |
"""
State pattern example, based on Python and Ruby examples at:
http://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/State
Description
-----------
"Objects often need to change behavior when they are in certain states.
Define an interface comprising all methods that change behavior;
interface implementation... |
from datetime import datetime, timedelta, time
from django.conf import settings
from django.http import HttpResponse
from django.contrib import admin
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.conf... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible import constants as C
from ansible import context
from ansible.playbook.task_include import TaskInclude
from ansible.plugins.callback import CallbackBase
from ansible.utils.color import colorize, hostcolor
# These va... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Project.commit_browsing_url'
db.add_column('codespeed_project', 'commit_browsing_url', sel... |
from nova.tests.functional.api_sample_tests import api_sample_base
class VersionsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
sample_dir = 'versions'
scenarios = [('', {'_test': ''})]
def test_versions_get(self):
response = self._do_get('', strip_version=True)
subs = self._get_reg... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from rest_framework.test import APITestCase
from rest_framework import status
from django.contrib.auth.models import User
from model_mommy import mommy
from shared_schema_tenants.models import Tenant, TenantSite
from shared_schema_tenants.helpers.tenants import set_current... |
from django.conf import settings
from django.core.checks.messages import Error, Warning
from django.core.checks.urls import (
E006, check_url_config, check_url_namespaces_unique, check_url_settings,
get_warning_for_invalid_pattern,
)
from django.test import SimpleTestCase
from django.test.utils import override_... |
import os
# temporarily redirect config directory to prevent matplotlib importing
# testing that for writeable directory which results in sandbox error in
# certain easy_install versions
os.environ["MPLCONFIGDIR"] = "."
DESCRIPTION = "Seaborn: statistical data visualization"
LONG_DESCRIPTION = """\
Seaborn is a librar... |
#!/usr/bin/env python3
import sys
import os
# load parent path of KicadModTree
sys.path.append(os.path.join(sys.path[0], "..", ".."))
from KicadModTree import *
def rotary_coded_switch(args):
footprint_name = args["name"]
style = args["style"]
datasheet = args["datasheet"]
thru_hole = args["thru_hol... |
import numpy as np
from numpy import array, rec, inf, nan
class Holder(object):
pass
var_results = Holder()
var_results.comment = 'VAR test data converted from vars_results.npz'
var_results.causality = array([(9.317172089406967e-08,), (0.5183914225971917,), (4.8960835385969403e-14,)],
dtype=[('causedby', ... |
"""Icelandic national registry codes made easy"""
import re
import random
from datetime import date, timedelta
__author__ = 'Jakub Owczarski'
__version__ = '0.1.3'
__license__ = 'MIT'
class Kennitala:
"""Icelandic national registry codes made easy"""
def __init__(self, kennitala):
self.kennitala = ke... |
# coding: utf-8
from fabric.api import env, local, cd, run, sudo
from fabric.operations import put
env.use_ssh_config = True
env.keepalive = 60
def tarball():
"""Create tarball for june."""
local('make static')
local('python setup.py sdist --formats=gztar', capture=False)
def upload():
"""Upload t... |
import os
import shutil
def main():
cwd = os.getcwd()
if not cwd.endswith(os.path.join('FRENSIE', 'scripts')):
print 'This script must be run in \"FRENSIE/scipts\"'
print 'Your CWD is', cwd
return 1
os.chdir('../../')
os.mkdir('frensie_build_tree')
#os.renames('FRENSIE'... |
from hcsvlab_robochef.upload.loginform import *
from hcsvlab_robochef.upload.formdecorator import *
import httplib2, urllib
class Session(object):
'''
This class manages the login session with the Plone server
'''
def __init__(self):
# Initialise header information
self.headers = {'Content-type': 'ap... |
class MotionPathButtonsPanel:
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = "Motion Paths"
bl_options = {'DEFAULT_CLOSED'}
def draw_settings(self, context, avs, mpath, bones=False):
layout = self.layout
mps = avs.motion_path
# Display Range
layo... |
EHOSTDOESNOTEXIST = 21001
EINVALIDTAG = 21002
ENAMENOTFOUND = 21003
EVIEWEXISTS = 21004
EUNKNOWNFAILOVERCONFIG = 21005
ECANTREADCONFIGFILE = 21006
ECANTWRITECONFIGFILE = 21007
EBADCREDENTIALS = 21008
ECANTREADSTATUSFILE = 21009
ENOTCUSTOMEVENTCLASS = 21010
EEVENTGENERATEFAILED = 21011
EINVALIDINPUT = 21012
EEVENTCLASSE... |
"""Read and write Vorbis comment data.
Vorbis comments are freeform key/value pairs; keys are
case-insensitive ASCII and values are Unicode strings. A key may have
multiple values.
The specification is at http://www.xiph.org/vorbis/doc/v-comment.html.
"""
import sys
from cStringIO import StringIO
import mutagen
fr... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import pytest
from units.compat import unittest
from units.compat.mock import patch, MagicMock, PropertyMock
from ansible.playbook.play_context import PlayContext
pytest.importorskip("ncclient")
PY3 = sys.version_info... |
class Group(object):
def __init__(self, parent=None):
self.id = None
self.name = None
def startElement(self, name, attrs, connection):
return None
def endElement(self, name, value, connection):
if name == 'groupId':
self.id = value
elif name == 'groupNam... |
from __future__ import absolute_import
from __future__ import print_function
from contextlib import contextmanager
from typing import (cast, Any, Callable, Dict, Generator, Iterable, Iterator, List, Mapping,
Optional, Sized, Tuple, Union, IO)
from django.core.urlresolvers import LocaleRegexURLResol... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from distutils.core import setup
from inline import __version__ as version
setup(
name='inline',
version=version,
description='embed inline C / C++ source codes in Python',
long_description=open('README.rst').read(),
author='Ryosuke Ito',
author_e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.