content stringlengths 4 20k |
|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('hs_access_control', '0011_auto_rename_new_fields_to_original_names'),
]
operations = [
migr... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
import pyrax
HAS_PYRAX = True
except ImportError:
HAS_PYRAX = False
def _activate_virtualenv(path):
path = os.path.expanduser(path)
activate_this = os.p... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re
from collections import MutableSequence
from io import StringIO
from ansible.errors import AnsibleError
from ansible.module_utils.six.moves import configparser
from ansible.module_utils._text import to_bytes, t... |
import unittest
from mock_function import MockFunction
class MockFunctionUnittest(unittest.TestCase):
def testMockFunction(self):
@MockFunction
def calc(a, b, mult=1):
return (a + b) * mult
self.assertTrue(*calc.CheckAndReset(0))
self.assertEqual(
(False, 'calc: expected 1 call(s), g... |
import os
import sys
import codecs
from ._compat import PY2
# If someone wants to vendor click, we want to ensure the
# correct package is discovered. Ideally we could use a
# relative import here but unfortunately Python does not
# support that.
click = sys.modules[__name__.rsplit('.', 1)[0]]
def _find_unicode_l... |
"""HTML utilities suitable for global use."""
import re
import string
from django.utils.safestring import SafeData, mark_safe
from django.utils.encoding import force_unicode
from django.utils.functional import allow_lazy
from django.utils.http import urlquote
# Configuration for urlize() function.
LEADING_PUNCTUATIO... |
"""Utilities for converting between core and contrib feature columns."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.learn.python.learn.estimators import constants
from tensorflow.contrib.learn.python.learn.estimators import mode... |
import eg
class Text(eg.TranslatableStrings):
caption = "Add Actions?"
message = (
"EventGhost can add a folder with all actions of this plugin to your "
"configuration tree. If you want to do so, select the location where "
"it should be added and press OK.\n\n"
"Otherwise pres... |
from __future__ import print_function
from bcc import BPF
import argparse
# arguments
examples = """examples:
./opensnoop # trace all open() syscalls
./opensnoop -t # include timestamps
./opensnoop -x # only show failed opens
./opensnoop -p 181 # only trace PID 181
"""
parser... |
import socket
import threading
import telnetlib
import time
from unittest import TestCase
from test import test_support
HOST = test_support.HOST
def server(evt, serv):
serv.listen(5)
evt.set()
try:
conn, addr = serv.accept()
except socket.timeout:
pass
finally:
serv.close(... |
"""Generates the appropriate build.json data for all the end2end tests."""
import collections
import yaml
TestOptions = collections.namedtuple('TestOptions', 'flaky cpu_cost')
default_test_options = TestOptions(False, 1.0)
# maps test names to options
BAD_CLIENT_TESTS = {
'cert': default_test_options._replace(c... |
"""Switch between depending on googletest or unittest."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=unused-import
# pylint: disable=g-import-not-at-top
# pylint: disable=wildcard-import
import tensorflow.python.platform
from . import ... |
# -*- coding: utf-8 -*-
"""
Unit tests for pytils' dt templatetags for Django web framework
"""
import datetime
from pytils.test.templatetags import helpers
class DtDefaultTestCase(helpers.TemplateTagTestCase):
def setUp(self):
self.date = datetime.datetime(2007, 1, 26, 15, 50)
self.date_befo... |
class LifecyclePlugin(object):
"""Base class for pre-op and post-op work on a stack.
Implementations should extend this class and override the methods.
"""
def do_pre_op(self, cnxt, stack, current_stack=None, action=None):
"""Method to be run by heat before stack operations."""
pass
... |
#### PATTERN #######################################################################################
import sys
import os
from setuptools import setup
from pattern import __version__
#---------------------------------------------------------------------------------------------------
# "python setup.py zip" will cre... |
"""Linear Estimators."""
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# 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
#
#... |
import io
import textwrap
import six
from six.moves import configparser
import sys
from pbr.tests import base
from pbr import util
class TestExtrasRequireParsingScenarios(base.BaseTestCase):
scenarios = [
('simple_extras', {
'config_text': """
[extras]
first ... |
# -*- coding: utf-8 -*-
from os import path
from gluon import *
from gluon.storage import Storage
from s3 import *
# =============================================================================
class index():
""" Custom Home Page """
def __call__(self):
request = current.request
response =... |
"""SQL Lexer"""
# This code is based on the SqlLexer in pygments.
# http://pygments.org/
# It's separated from the rest of pygments to increase performance
# and to allow some customizations.
import re
from debug_toolbar.utils.sqlparse.keywords import KEYWORDS, KEYWORDS_COMMON
from debug_toolbar.utils.sqlparse.token... |
"""
Dialog that allows user to specify a new config file section name.
Used to get new highlight theme and keybinding set names.
The 'return value' for the dialog, used two placed in configDialog.py,
is the .result attribute set in the Ok and Cancel methods.
"""
from Tkinter import *
import tkMessageBox
class GetCfgSec... |
import os
from random import sample
import numpy as np
from numpy import cos
from scipy.linalg import lstsq
from compmech.constants import CMHOME
from compmech.logger import *
def load_c0(name, funcnum, m0, n0):
path = os.path.join(CMHOME, 'conecyl', 'imperfections', 'c0',
'c0_{0}_f{1}_m{2:03d}_n{3:0... |
"""
Testing Plugins
===============
The plugin interface is well-tested enough to safely unit test your
use of its hooks with some level of confidence. However, there is also
a mixin for unittest.TestCase called PluginTester that's designed to
test plugins in their native runtime environment.
Here's a simple exampl... |
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy._lib.decorator import decorator as _decorator
__all__ = ['delaunay_plot_2d', 'convex_hull_plot_2d', 'voronoi_plot_2d']
@_decorator
def _held_figure(func, obj, ax=None, **kw):
import matplotlib.pyplot as plt
if ax... |
import pytest
from ..toposort import toposort, toposort_flatten, CyclicDependency
class TestCase(object):
def test_simple(self):
results = list(toposort({2: set([11]), 9: set([11, 8]), 10: set([11, 3]), 11: set([7, 5]), 8: set([7, 3])}))
expected = [set([3, 5, 7]), set([8, 11]), set([2, 9, 10])]
... |
from html2html import parseString
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""
This module houses the GEOS ctypes prototype functions for the
unary and binary predicate operations on geometries.
"""
from ctypes import c_char, c_char_p, c_double
from django.contrib.gis.geos.libgeos import GEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
from django.contrib.gis... |
from openerp.osv import osv
from openerp.tools.translate import _
class crm_phonecall2meeting(osv.osv_memory):
""" Phonecall to Meeting """
_name = 'crm.phonecall2meeting'
_description = 'Phonecall To Meeting'
def action_cancel(self, cr, uid, ids, context=None):
"""
Closes Phonecall t... |
"""This code sample retrieves information about all campaigns that belongs to
the customer issuing the request."""
import SOAPpy
# Provide AdWords login information.
email = 'INSERT_LOGIN_EMAIL_HERE'
password = 'INSERT_PASSWORD_HERE'
client_email = 'INSERT_CLIENT_LOGIN_EMAIL_HERE'
useragent = 'INSERT_COMPANY_NAME: A... |
#!/usr/bin/python3
# -*- coding: utf-8, vim: expandtab:ts=4 -*-
from itertools import chain
from nltk.featstruct import FeatStruct, CustomFeatureValue, UnificationFailure
from typing import Any
def update_nested_frozen_fs(fs, dictinoary):
fs = {k: v for k, v in fs.items() if k not in dictinoary.keys()}
fs.u... |
import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer.functions.connection import embed_id
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product_dict(
[{'x_data': [0, 1, 0], 'ignore_label': None... |
import sys
import os.path
from PIL import Image
# 末尾改行なしで出力する(print no \n)
def printnn(value):
sys.stdout.write(str(value))
# 画像のパスが有効であることを確認して返す
def get_img_path():
if len(sys.argv) == 2:
img_path = sys.argv[1]
if os.path.exists(img_path):
return img_path
return None
# 画像の基本... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
OutputNumber.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**************************... |
#!/usr/bin/python
# -*-coding:utf-8-*-
import time
import random
from scrapy.downloadermiddlewares.retry import RetryMiddleware #代理ip,这是固定的导入
from scrapy.downloadermiddlewares.useragent import UserAgentMiddleware
import pymongo
import logging
import utils
class TimeoutIp(RetryMiddleware):
def __init__(self,ip='')... |
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.basic import AnsibleModule
from ansible.module_utils.vmware import PyVmomi, vmware_argumen... |
"""
man2lore: Converts man page source (i.e. groff) into lore-compatible html.
This is nasty and hackish (and doesn't support lots of real groff), but is good
enough for converting fairly simple man pages.
"""
import re, os
quoteRE = re.compile('"(.*?)"')
def escape(text):
text = text.replace('<', '<').rep... |
from django.conf import settings
from django.utils.encoding import force_unicode, StrAndUnicode
from django.contrib.messages import constants, utils
LEVEL_TAGS = utils.get_level_tags()
class Message(StrAndUnicode):
"""
Represents an actual message that can be stored in any of the supported
storage class... |
from __future__ import absolute_import
from __future__ import unicode_literals
import re
try:
import urllib.parse as urlparse
except ImportError:
import urlparse as urlparse
from .html import _BaseHTMLProcessor
# If you want feedparser to allow all URL schemes, set this to ()
# List culled from Python's url... |
from __future__ import unicode_literals
import base64
import json
import re
from boto.exception import JSONResponseError
from boto.kms.exceptions import AlreadyExistsException, NotFoundException
from moto.core.responses import BaseResponse
from .models import kms_backends
reserved_aliases = [
'alias/aws/ebs',
... |
import logging, os, sys
from PySide2.QtCore import *
from PySide2.QtWidgets import *
from PySide2.QtCore import Signal
from PySide2.QtCore import Slot
from functools import partial
try:
import maya.cmds as cmds
except ImportError:
pass
import nebula_libs.fileIO as fh
logging.basicConfig()
logger = logging.getLo... |
import json
import socket
import sys
class NoobBot(object):
def __init__(self, socket, name, key):
self.socket = socket
self.name = name
self.key = key
def msg(self, msg_type, data):
self.send(json.dumps({"msgType": msg_type, "data": data}))
def send(self, msg):
... |
#!/usr/bin/env python
"""
This module runs tests against Cisco IOS devices.
setup_module: setup variables for later use.
test_disable_paging: disable paging
test_ssh_connect: verify ssh connectivity
test_send_command: send a command
test_send_command_expect: send a command
test_base_prompt: test the base prompt
test_... |
"""Classes for manipulating audio devices (currently only for Sun and SGI)"""
from warnings import warnpy3k
warnpy3k("the audiodev module has been removed in Python 3.0", stacklevel=2)
del warnpy3k
__all__ = ["error","AudioDev"]
class error(Exception):
pass
class Play_Audio_sgi:
# Private instance... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j M Y' # '25 Oct 2006'
TIME_FORMAT = 'P' # '2:30 p.m.'
DATETIME_FORMAT = 'j M Y, P' ... |
"""
* Copyright 2008 Google 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 agreed to in writing, s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.inventory import BaseInventoryPlugin, Cacheable
class InventoryModule(BaseInventoryPlugin, Cacheable):
NAME = 'test'
def populate(self, hosts):
for host in list(hosts.keys()):
se... |
from gnuradio import gr
from gnuradio import audio
from gnuradio import blocks
from gnuradio import vocoder
def build_graph():
tb = gr.top_block()
src = audio.source(8000)
src_scale = blocks.multiply_const_ff(32767)
f2s = blocks.float_to_short()
enc = vocoder.gsm_fr_encode_sp()
dec = vocoder.gs... |
from __future__ import unicode_literals
from guessit import Guess
from guessit.transfo import SingleNodeGuesser
from guessit.patterns import episode_rexps
import re
import logging
log = logging.getLogger(__name__)
def number_list(s):
l = [ int(n) for n in re.sub('[^0-9]+', ' ', s).split() ]
if len(l) == 2:
... |
"""
Helper methods for credit card processing modules.
These methods should be shared among all processor implementations,
but should NOT be imported by modules outside this package.
"""
from django.conf import settings
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
def get_p... |
"""
A package that maps incoming email to HTTP requests
Mailpost version 0.1
(C) 2010 oDesk www.oDesk.com
"""
"""
fnmatch.py - fork of original fnmatch
=====================================
.. _purpose:
Purpose of the fork
-----------------
Original fnmatch has an issue while matching escaped strings and not match
pa... |
'''
Created on Feb 22, 2013
@author: rtw
'''
import unittest
import os
import emtools.common.utils as utils
class Test(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testBasic1(self):
'''Test launchcluster and various clustercmd's against a multi node ... |
"""Setup for instrumentation host-driven tests."""
import logging
import os
import sys
import types
from pylib.host_driven import test_case
from pylib.host_driven import test_info_collection
from pylib.host_driven import test_runner
def _GetPythonFiles(root, files):
"""Returns all files from |files| that end in '... |
"""
Entry Points for Hyde Engine
"""
import imp
import os
import sys
import shutil
import thread
import threading
from collections import defaultdict
from datetime import datetime
from Queue import Queue, Empty
from threading import Thread, Event
from django.conf import settings
from django.core.management import s... |
#!/usr/bin/env python3
import sys
import math
# Three base states.
# 0, start-state, all arcs from _E phones
# 1, all arcs to _B phones (connected with 1 through <w>)
# 2, all arcs from and to _I phones
next_state=5
def print_word(word, phones, start, end, from_state, to_state):
global next_state
cur_state = ... |
"""Payload management for sending Ansible files and test content to other systems (VMs, containers)."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import atexit
import os
import stat
import tarfile
import tempfile
import time
from . import types as t
from .config import (... |
import pytest
from tests.support.asserts import assert_success
"""
Tests that WebDriver can transcend site origins.
Many modern browsers impose strict cross-origin checks,
and WebDriver should be able to transcend these.
Although an implementation detail, certain browsers
also enforce process isolation based on si... |
"""Django management command to force certificate regeneration for one user"""
import logging
import copy
from optparse import make_option
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys impo... |
import cherrypy
from cherrypy.test import helper
class SessionAuthenticateTest(helper.CPWebCase):
def setup_server():
def check(username, password):
# Dummy check_username_and_password function
if username != 'test' or password != 'password':
return 'Wrong... |
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackSahara(Plugin):
"""OpenStack Sahara"""
plugin_name = 'openstack_sahara'
profiles = ('openstack', 'openstack_controller')
option_list = []
def setup(self):
self.add_copy_spec("/etc/sahara/")
se... |
"""Takes an IDML template file and a PO file containing translations of
strings in the IDML template. It creates a new IDML file using the translations
of the PO file.
"""
from cStringIO import StringIO
from zipfile import ZIP_DEFLATED, ZipFile
import lxml.etree as etree
from translate.convert import convert
from tr... |
from ...input import RecipeSet
from ...scm import getScm, ScmTaint, ScmStatus
from ...state import BobState
from ...tty import colorize, ERROR, WARNING, EXECUTED, DEFAULT
from ...utils import removePath, processDefines
import argparse
import os
from .builder import LocalBuilder
from .state import DevelopDirOracle
__a... |
"""Test configs for less_equal."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.lite.testing.zip_test_utils import create_tensor_data
from tensorflow.lite.testing.zip_test_utils import make_zip_of_tests
from tensorf... |
"""
.. _tut_viz_epochs:
Visualize Epochs data
=====================
"""
# sphinx_gallery_thumbnail_number = 7
import os.path as op
import mne
data_path = op.join(mne.datasets.sample.data_path(), 'MEG', 'sample')
raw = mne.io.read_raw_fif(
op.join(data_path, 'sample_audvis_raw.fif'), preload=True)
raw.load_data... |
from optparse import make_option
from django.core.management.base import BaseCommand
from lizard_fewsnorm.models import FewsNormSource
from django.db import transaction
from lizard_security.models import DataSet
import logging
logger = logging.getLogger(__name__)
class Command(BaseCommand):
"""
Synchronize... |
from openerp.osv import fields, osv
class lunch_validation(osv.Model):
""" lunch validation """
_name = 'lunch.validation'
_description = 'lunch validation for order'
def confirm(self,cr,uid,ids,context=None):
return self.pool.get('lunch.order.line').confirm(cr, uid, ids, context=context) |
"A python script that converts RSS/Atom newsfeeds to email"
import codecs as _codecs
from distutils.core import setup
import os.path as _os_path
from rss2email import __version__, __url__, __author__, __email__
_this_dir = _os_path.dirname(__file__)
setup(
name='rss2email',
version=__version__,
maintai... |
import json
import datetime
import urllib.parse
import mysql.connector
from eventall2016_credentials import *
def tweet_spliter():
f = open('twitter_stream.json', 'r+')
d = f.readlines()
--f.seek(0)
count = 0
for data in d:
if count >= 700000:
data = data.strip(',')
... |
from vismach import *
import hal
import math
import sys
c = hal.component("xyzbc-trt-gui")
# table-x
c.newpin("table-x", hal.HAL_FLOAT, hal.HAL_IN)
# saddle-y
c.newpin("saddle-y", hal.HAL_FLOAT, hal.HAL_IN)
# head vertical slide
c.newpin("spindle-z", hal.HAL_FLOAT, hal.HAL_IN)
# table-x tilt-b
c.newpin("tilt-b", hal.H... |
Latin7_char_to_order_map = (
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10
253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20
252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30
253, 82... |
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_log_fortiguard_override_setting
except I... |
#!/usr/bin/env python
__author__ = 'Michael Meisinger, Seman Said'
from pyon.core.bootstrap import get_obj_registry, CFG
from pyon.core.object import IonObjectBase, IonObjectSerializer, IonObjectDeserializer
from pyon.datastore.datastore import DataStore
from pyon.datastore.couchdb.pyon_store import PyonCouchDataStor... |
from __future__ import division
# When true division is the default, get rid of this and add it to
# test_long.py instead. In the meantime, it's too obscure to try to
# trick just part of test_long into using future division.
import sys
import random
import math
import unittest
from test.test_support import run_unitt... |
import numpy as np
from scipy.sparse import issparse
from scipy.sparse import coo_matrix
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sparse import dok_matrix
from scipy.sparse import lil_matrix
from sklearn.utils.multiclass import type_of_target
from sklearn.utils.testing impor... |
"""DEPRECATED UI FUNCTIONALITY"""
# from robottelo.config import settings
# from robottelo.decorators import (
# run_in_one_thread,
# skip_if_not_set,
# stubbed,
# tier3,
# upgrade,
# )
# from robottelo.test import UITestCase
# @run_in_one_thread
# class PuppetTestCase(UITestCase):
# """Imple... |
from up2date_client import rhnserver
from up2date_client import up2dateAuth
from up2date_client import pkgUtils
from rhn.actions import packages
__rhnexport__ = [
'update']
# action version we understand
ACTION_VERSION = 2
def __getErrataInfo(errata_id):
s = rhnserver.RhnServer()
return s.errata.getErrat... |
# Some simple queue module tests, plus some failure conditions
# to ensure the Queue locks remain stable.
import queue
import time
import unittest
from test import support
threading = support.import_module('threading')
QUEUE_SIZE = 5
def qfull(q):
return q.maxsize > 0 and q.qsize() == q.maxsize
# A thread to run... |
from PyQt5 import QtCore
from src.business.configuration.constants import imager as i
class SettingsImage:
def __init__(self):
self._settings = QtCore.QSettings()
self.setup_settings()
def setup_settings(self):
self._settings = QtCore.QSettings(i.FILENAME, QtCore.QSettings.IniFormat)... |
import pytest
import time
import unittest
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoSuchFrameException
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import StaleElementReferenceException... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse_unquote,
compat_urllib_parse_unquote_plus,
)
from ..utils import (
clean_html,
ExtractorError,
)
class PlayvidIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?playvi... |
from __future__ import absolute_import
from xml.dom import minidom
from django.conf import settings
from django.contrib.sites.models import Site
from django.test import TestCase
from .models import City
class GeoFeedTest(TestCase):
urls = 'django.contrib.gis.tests.geoapp.urls'
def setUp(self):
Si... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j M Y' # '25 Oct 2006'
TIME_FORMAT = 'P' # '2:30 pm'
DATETIME_FORMAT = 'j M Y, P' #... |
"""Run a unittest testcase reporting results as Subunit.
$ python -m subunit.run mylib.tests.test_suite
"""
import sys
from subunit import TestProtocolClient, get_default_formatter
from testtools.run import (
BUFFEROUTPUT,
CATCHBREAK,
FAILFAST,
TestProgram,
USAGE_AS_MAIN,
)
class SubunitT... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ExtractNodes.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**************************... |
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.ansible_tower import tower_argument_spec, tower_auth_config, towe... |
#! /usr/bin/python
# -*- encoding: utf-8 -*-
from django import http
from django.shortcuts import render_to_response
from django.template.loader import get_template
from django.template import Context
import ho.pisa as pisa
import cStringIO as StringIO
import cgi
def index(request):
return http.HttpResponse("""
... |
import BoostBuild
t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
t.write("sleep.bat", """\
::@timeout /T %1 /NOBREAK >nul
@ping 127.0.0.1 -n 2 -w 1000 >nul
@ping 127.0.0.1 -n %1 -w 1000 >nul
@exit /B 0
""")
t.write("file.jam", """\
if $(NT)
{
SLEEP = @call sleep.bat ;
}
else
{
SLEEP = sleep ;
}
action... |
# -*- coding: utf-8 -*-
"""
werkzeug.filesystem
~~~~~~~~~~~~~~~~~~~
Various utilities for the local filesystem.
:copyright: (c) 2015 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import codecs
import sys
import warnings
# We do not trust tra... |
"""
Cells Scheduler
"""
import copy
import time
from oslo_log import log as logging
from six.moves import range
from nova.cells import filters
from nova.cells import weights
from nova import compute
from nova.compute import instance_actions
from nova.compute import vm_states
from nova import conductor
import nova.con... |
"""
Email backend that writes messages to console instead of sending them.
"""
import sys
import threading
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs):
self.stream = kwargs.pop('stream', sys.stdout)
self._lo... |
__author__ = '<EMAIL> (Eric Bidelman)'
import json
import logging
import os
import webapp2
from google.appengine.api import memcache
from google.appengine.api import urlfetch
from google.appengine.api import users
import common
import models
import settings
import http2push.http2push as http2push
def normalized_n... |
# -*- test-case-name: twisted.test.test_stdio -*-
"""
Windows-specific implementation of the L{twisted.internet.stdio} interface.
"""
import win32api
import os, msvcrt
from zope.interface import implements
from twisted.internet.interfaces import IHalfCloseableProtocol, ITransport, IAddress
from twisted.internet.int... |
"""Tests for samba.samba3."""
from samba.samba3 import (
Registry,
WinsDatabase,
IdmapDatabase,
)
from samba.samba3 import passdb
from samba.samba3 import param as s3param
from samba.tests import TestCase, TestCaseInTempDir
from samba.dcerpc.security import dom_sid
import os
for p in [ "../../../../.... |
"""Tests for convolution related functionality in tensorflow.ops.nn."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.py... |
import unittest
import numpy as np
import GPy
try:
from mpi4py import MPI
import subprocess
class MPITests(unittest.TestCase):
def test_BayesianGPLVM_MPI(self):
code = """
import numpy as np
import GPy
from mpi4py import MPI
np.random.seed(123456)
comm = MPI.COMM_WORLD
N =... |
import copy_reg
import unittest
from test import test_support
from test.pickletester import ExtensionSaver
class C:
pass
class CopyRegTestCase(unittest.TestCase):
def test_class(self):
self.assertRaises(TypeError, copy_reg.pickle,
C, None, None)
def test_noncallable_r... |
import Wolfram
import sp
import synopsis
import tt
import api_key
import json
import twitter_streaming as ts
from rosette.api import API, DocumentParameters
user_key = api_key.user_key
ros_url = api_key.ros_url
def handle_query(query):
syn_result = synopsis.wikipedia_summary(query)
#sp_result = sp.look_up(que... |
# -*- coding: utf-8 -*-
#################################################################################################
import json
import logging
import os
import time
from datetime import datetime
#################################################################################################
log = logging.get... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ExportGeometryInfo.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
********************... |
from openerp.osv import fields
from openerp.osv.orm import TransientModel
from openerp.tools.safe_eval import safe_eval
class base_config_settings(TransientModel):
_inherit = 'base.config.settings'
# Getter / Setter Section
def get_default_auth_admin_passkey_send_to_admin(
self, cr, uid, ids,... |
# -*- coding: utf-8 -*-
from urllib import urlencode
import newrelic.agent
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.safestring import mark_sa... |
import os, sys
bindir = os.path.abspath(os.path.dirname(sys.argv[0]))
libdir = bindir + "/../../lib"
sys.path.append(libdir)
import lacuna as lac
###
### This creates two clients. One must be the leader of an alliance, and the
### other should be un-allied.
###
### guild leader
leader_client = lac.clients.Member... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.