content string |
|---|
#!/usr/bin/python
"""Interface to OpenShift oc command"""
import os
import shlex
import shutil
import subprocess
from ansible.module_utils.basic import AnsibleModule
ADDITIONAL_PATH_LOOKUPS = ['/usr/local/bin', os.path.expanduser('~/bin')]
def locate_oc_binary():
"""Find and return oc binary file"""
# htt... |
from p2ner.base.ControlMessage import ControlMessage, trap_sent,probe_all,BaseControlMessage
from p2ner.base.Consts import MessageCodes as MSG
from construct import Container
class ValidateNeighboursMessage(ControlMessage):
type = "subsidmessage"
code = MSG.VALIDATE_NEIGHS_SUB
ack = True
def trigger(s... |
# coding=utf-8
"""InaSAFE Disaster risk tool by Australian Aid - Parameter definition for
Flood Vector on Building QGIS IF
Contact : <EMAIL>
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software F... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
import time
import ujson
import datetime
import requests
from lib3.decorator.safe_run import safe_run_wrap
# App Config
# XXX: https://stackoverflow.com/questions/3536... |
import os
from telemetry.core import util
from telemetry.testing import tab_test_case
class MemoryCacheHTTPServerTest(tab_test_case.TabTestCase):
def setUp(self):
super(MemoryCacheHTTPServerTest, self).setUp()
self._test_filename = 'bear.webm'
_test_file = os.path.join(util.GetUnittestDataDir(), 'bear... |
from . import exclusions
from .. import schema, event
from . import config
__all__ = 'Table', 'Column',
table_options = {}
def Table(*args, **kw):
"""A schema.Table wrapper/hook for dialect-specific tweaks."""
test_opts = dict([(k, kw.pop(k)) for k in list(kw)
if k.startswith('test_')... |
from uuid import UUID
FINAL_STATUSES = ('ACTIVE', 'ERROR')
VOLUME_STATUS = ('available', 'attaching', 'creating', 'deleting', 'in-use',
'error', 'error_deleting')
CLB_ALGORITHMS = ['RANDOM', 'LEAST_CONNECTIONS', 'ROUND_ROBIN',
'WEIGHTED_LEAST_CONNECTIONS', 'WEIGHTED_ROUND_ROBIN']
C... |
"""
Unit tests for cloning a course between the same and different module stores.
"""
import json
from unittest.mock import Mock, patch
from django.conf import settings
from opaque_keys.edx.locator import CourseLocator
from cms.djangoapps.contentstore.tasks import rerun_course
from cms.djangoapps.contentstore.tests... |
import email.utils
import mimetypes
from .packages import six
def guess_content_type(filename, default='application/octet-stream'):
"""
Guess the "Content-Type" of a file.
:param filename:
The filename to guess the "Content-Type" of using :mod:`mimetypes`.
:param default:
If no "Cont... |
"""utilities for generating and formatting literal Python code."""
import re, string
from StringIO import StringIO
from mako import exceptions
class PythonPrinter(object):
def __init__(self, stream):
# indentation counter
self.indent = 0
# a stack storing information about why we incremen... |
import uuid
from vnc_api.vnc_api import *
from instance_manager import InstanceManager
from config_db import (
VirtualMachineSM,
VirtualMachineInterfaceSM,
ServiceApplianceSetSM,
ServiceApplianceSM,
PhysicalInterfaceSM,
ServiceInstanceSM,
PortTupleSM)
from cfgm_common import svc_info
class... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import itertools
import os
import os.path
import sys
import argparse
import logging
def cartesian_product(dicts):
return (dict(zip(dicts, x)) for x in itertools.product(*dicts.values()))
def summary(configuration):
kvs = sorted([(k, v) for k, v in configurati... |
from collections import defaultdict
from nltk.internals import Counter
class FStructure(dict):
def safeappend(self, key, item):
"""
Append 'item' to the list at 'key'. If no list exists for 'key', then
construct one.
"""
if key not in self:
self[key] = []
... |
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
colors = [0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF00FF, 0x00FFFF]
LedPinRed = 11
LedPinGreen = 12
LedPinBlue = 13
def setup(Rpin, Gpin, Bpin):
global pins
global p_R, p_G, p_B
pins = {'pin_R': Rpin, 'pin_G': Gpin, 'pin_B': Bpin}
GPIO.setmode(GPIO.BOARD... |
"""
>>> import numpy.core as nx
>>> import numpy.lib.ufunclike as U
Test fix:
>>> a = nx.array([[1.0, 1.1, 1.5, 1.8], [-1.0, -1.1, -1.5, -1.8]])
>>> U.fix(a)
array([[ 1., 1., 1., 1.],
[-1., -1., -1., -1.]])
>>> y = nx.zeros(a.shape, float)
>>> U.fix(a, y)
array([[ 1., 1., 1., 1.],
[-1., -1., -1., -... |
"""Tests for local response normalization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.ops impo... |
from __future__ import absolute_import, division, unicode_literals
try:
from collections import OrderedDict
except ImportError:
try:
from ordereddict import OrderedDict
except ImportError:
OrderedDict = dict
import gettext
_ = gettext.gettext
import re
from pip._vendor.six import text_typ... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'chart_column03.xlsx'
... |
import logging
import six
from grab.spider.base import Spider
from grab.spider.error import SpiderInternalError
from grab.util.config import build_root_config, build_spider_config
SPIDER_REGISTRY = {}
logger = logging.getLogger('grab.util.module')
def build_spider_registry(config):
SPIDER_REGISTRY.clear()
... |
#coding=utf-8
import uuid
import redis
"""
003, 将 0001 题生成的 200 个激活码(或者优惠券)保存到 **Redis** 非关系型数据库中.
"""
def get_redis_instance(host='localhost', port=6379):
return redis.StrictRedis(host=host, port=port)
def generate_activation_code(count):
code_list = []
for i in xrange(count):
code = str(uui... |
# -*- coding: utf-8 -*-
"""
===============================================================================
Script 'mne logo'
===============================================================================
This script makes the logo for MNE.
"""
# @author: drmccloy
# Created on Mon Jul 20 11:28:16 2015
# License: BSD ... |
import array
import mock
import six
from nova import exception
from nova.keymgr import key
from nova.tests.unit.volume.encryptors import test_base
from nova.volume.encryptors import cryptsetup
def fake__get_key(context):
raw = array.array('B', ('0' * 64).decode('hex')).tolist()
symmetric_key = key.Symmetri... |
# -*- coding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.web.http import request
from openerp.addons.website.models.website import unslug
from openerp.tools.translate import _
import werkzeug.urls
class WebsiteMembership(http.Controller):
_references_per_pa... |
import mock
from nova.tests.unit.virt.hyperv import test_networkutils
from nova.virt.hyperv import networkutilsv2
class NetworkUtilsV2TestCase(test_networkutils.NetworkUtilsTestCase):
"""Unit tests for the Hyper-V NetworkUtilsV2 class."""
_MSVM_VIRTUAL_SWITCH = 'Msvm_VirtualEthernetSwitch'
def setUp(se... |
"""
Image Tag
---------
This implements a Liquid-style image tag for Pelican,
based on the liquid img tag which is based on the octopress image tag [1]_
Syntax
------
{% b64img [class name(s)] [http[s]:/]/path/to/image [width [height]] [title text | "title text" ["alt text"]] %}
Examples
--------
{% b64img /images/ni... |
import os
from importlib import import_module
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from django.utils._os import upath
from django.utils.module_loading import module_has_submodule
MODELS_MODULE_NAME = 'models'
class AppConfig(object):
"""
Class representing a Django ap... |
import unittest
from robot.parsing import TestCaseFile
from robot.parsing.model import TestCaseTable
from robot.utils import ET, ETSource, StringIO
from robot.utils.asserts import assert_equal
def create_test_case_file():
data = TestCaseFile(source='foo.txt')
table = TestCaseTable(data)
data.testcase_tab... |
"""Auxiliary module for testing gflags.py.
The purpose of this module is to define a few flags, and declare some
other flags as being important. We want to make sure the unit tests
for gflags.py involve more than one module.
"""
__author__ = '<EMAIL> (Alex Salcianu)'
__pychecker__ = 'no-local' # for unittest
impo... |
"""Invenio-Records is a metadata storage module."""
import os
from setuptools import find_packages, setup
readme = open('README.rst').read()
history = open('CHANGES.rst').read()
tests_require = [
'check-manifest>=0.25',
'coverage>=4.0',
'isort>=4.2.2',
'mock>=1.0.0',
'pydocstyle>=1.0.0',
'p... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ProcessingToolbox.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*********************... |
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django.utils.cache import patch_vary_headers
from django.utils.decorators import available_attrs
def vary_on_headers(*headers):
"""
A view decorator that adds the specified heade... |
import re
import sys
from django.utils import six
from django.utils.six.moves import html_parser as _html_parser
current_version = sys.version_info
use_workaround = current_version < (2, 7, 3)
try:
HTMLParseError = _html_parser.HTMLParseError
except AttributeError:
# create a dummy class for Python 3.5+ whe... |
"""
~~~~~~~~~~~~~~~~~~~~~~
Tests for Data Molding
~~~~~~~~~~~~~~~~~~~~~~
"""
from monk.compat import text_type as t
from monk import manipulation
def test_normalize_to_list():
f = manipulation.normalize_to_list
assert [1] == f(1)
assert [1] == f([1])
def test_normalize_list_of_dicts():
f = manipula... |
# -*- coding: utf-8 -*-
import importlib
from math import sqrt
import psycopg2
import psycopg2.extras
from izumin import config
if config.IS_PRODUCTION_ENVIRONMENT:
db = importlib.import_module("izumin.db")
else:
db = importlib.import_module("izumin.db_local")
def is_prime(x):
"""
引数が素数であればTrue、そうで... |
# -*- coding: utf-8 -*-
"""
default config file
:copyright: 20160204 by <EMAIL>
"""
#from __future__ import unicode_literals
import sys
PY3=sys.version>"3"
from os.path import dirname, abspath, expanduser, join as joinpath
import json
import logging
logger = logging.getLogger(__name__)
config_default = {
... |
import sys
if sys.version >= '3':
long = int
unicode = str
import py4j.protocol
from py4j.protocol import Py4JJavaError
from py4j.java_gateway import JavaObject
from py4j.java_collections import JavaArray, JavaList
from pyspark import RDD, SparkContext
from pyspark.serializers import PickleSerializer, AutoBat... |
_check_webgl_supported_script = """
(function () {
var c = document.createElement('canvas');
var gl = c.getContext('webgl');
if (gl == null) {
gl = c.getContext("experimental-webgl");
if (gl == null) {
return false;
}
}
return true;
})();
"""
class BrowserInfo(object):
"""A wrapper around... |
"""Unit test file for perspective_api_function.main.py."""
import unittest
from perspective_api_function import main
class TestPerspectiveAPIFunction(unittest.TestCase):
"""Tests the logic in perspective_api_function module."""
def test_format_api_result(self):
"""Test for get_api_result"""
... |
"""
Exception classes - Subclassing allows you to check for specific errors
"""
import base64
import xml.sax
from boto import handler
from boto.resultset import ResultSet
class BotoClientError(StandardError):
"""
General Boto Client error (error accessing AWS)
"""
def __init__(self, reason, *args):
... |
import os, re, sys, glob
from subprocess import Popen, PIPE
Import('env')
def call(cmd, silent=True):
stdin, stderr = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE).communicate()
if not stderr:
return stdin.strip()
elif not silent:
print stderr
def run_2to3(*args,**kwargs):
call('2... |
"""Support for Ubiquiti mFi sensors."""
import logging
from mficlient.client import FailedToLogin, MFiClient
import requests
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_PORT,
CONF_SSL,
CONF_US... |
from __future__ import print_function, unicode_literals
import json
from utils.protocol import Socket as sock
from funchain import AsyncCall
import traceback
tracker = {}
cid = 0
def receiver(body):
asc = tracker.get(body['cid'], None)
if asc:
del tracker[body['cid']]
asc.fire_callback(body['... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
################################################################################
# Documentation
################################################################################
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
import urllib
from django.contrib.auth.models import User
from django.utils.encoding import smart_str
from django.db import models
from django.conf import settings
from django.contrib.sites.models import Site
#######################################################################
#
# "Monkey-pathcing is bad, but co... |
# Test the runpy module
import unittest
import os
import os.path
import sys
import re
import tempfile
from test.test_support import verbose, run_unittest, forget
from test.script_helper import (temp_dir, make_script, compile_script,
make_pkg, make_zip_script, make_zip_pkg)
from runpy i... |
data = (
'Yao ', # 0x00
'Yu ', # 0x01
'Chong ', # 0x02
'Xi ', # 0x03
'Xi ', # 0x04
'Jiu ', # 0x05
'Yu ', # 0x06
'Yu ', # 0x07
'Xing ', # 0x08
'Ju ', # 0x09
'Jiu ', # 0x0a
'Xin ', # 0x0b
'She ', # 0x0c
'She ', # 0x0d
'Yadoru ', # 0x0e
'Jiu ', # 0x0f
'Shi ', # 0x10
'Tan ... |
"""
Exception classes - Subclassing allows you to check for specific errors
"""
import base64
import xml.sax
import boto
from boto import handler
from boto.compat import json, StandardError
from boto.resultset import ResultSet
class BotoClientError(StandardError):
"""
General Boto Client error (error access... |
#!/usr/bin/env python
__all__ = ['ehow_download']
from ..common import *
def ehow_download(url, output_dir = '.', merge = True, info_only = False):
assert re.search(r'http://www.ehow.com/video_', url), "URL you entered is not supported"
html = get_html(url)
contentid = r1(r'<meta name="contentid" scheme="DMINS... |
import glob
from pkg_resources import yield_lines
from setuptools import find_packages
from setuptools import setup
from paasta_tools import __version__
def get_install_requires():
with open("requirements-minimal.txt", "r") as f:
minimal_reqs = list(yield_lines(f.read()))
return minimal_reqs
setu... |
# -*- coding: utf-8 -*-
"""
pygments.formatters.terminal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for terminal output with ANSI sequences.
:copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
from pyg... |
from wagtail.wagtailimages.models import get_image_model
from wagtail.wagtailimages.formats import get_image_format
class ImageEmbedHandler(object):
"""
ImageEmbedHandler will be invoked whenever we encounter an element in HTML content
with an attribute of data-embedtype="image". The resulting element in ... |
"""General floating point formatting functions.
Functions:
fix(x, digits_behind)
sci(x, digits_behind)
Each takes a number or a string and a number of digits as arguments.
Parameters:
x: number to be formatted; or a string resembling a number
digits_behind: number of digits behind the decimal point
"""
f... |
"""GLib main loop integration using libdbus-glib."""
__all__ = ('DBusGMainLoop', 'threads_init')
from _dbus_glib_bindings import DBusGMainLoop, gthreads_init
_dbus_gthreads_initialized = False
def threads_init():
"""Initialize threads in dbus-glib, if this has not already been done.
This must be called befo... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
try:
import pyrax
HAS_PYRAX = True
except ImportError:
HAS_PYRAX = False
def rax_keypair(module, name, public_key, state):
changed = False
cs = pyrax.cloudservers
... |
"""Support for Xiaomi aqara binary sensors."""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.xiaomi_aqara import (PY_XIAOMI_GATEWAY,
XiaomiDevice)
from homeassistant.core import callback
from homeass... |
"""
Generate artificial datasets
"""
import numpy
from nupic.data.file import File
def createFirstOrderModel(numCategories=5, alpha=0.5):
categoryList = ['cat%02d' % i for i in range(numCategories)]
initProbability = numpy.ones(numCategories)/numCategories
transitionTable = numpy.random.dirichlet(al... |
from __future__ import absolute_import
from __future__ import print_function
from .._abstract.abstract import BaseRenderer
import json
########################################################################
class SimpleRenderer(BaseRenderer):
""" A simple renderer is a renderer that uses one symbol only. The type... |
"""Support for launching graphs and executing operations.
See the @{$python/client} guide.
@@Session
@@InteractiveSession
@@get_default_session
@@OpError
@@CancelledError
@@UnknownError
@@InvalidArgumentError
@@DeadlineExceededError
@@NotFoundError
@@AlreadyExistsError
@@PermissionDeniedError
@@UnauthenticatedError
@... |
from __future__ import unicode_literals
import calendar
import datetime
import re
import sys
try:
from urllib import parse as urllib_parse
except ImportError: # Python 2
import urllib as urllib_parse
import urlparse
urllib_parse.urlparse = urlparse.urlparse
from email.utils import formatdate
fro... |
from b2.util import is_iterable
from .utility import to_seq
def difference (b, a):
""" Returns the elements of B that are not in A.
"""
assert is_iterable(b)
assert is_iterable(a)
result = []
for element in b:
if not element in a:
result.append (element)
... |
"""
=====================================================================
kvmsg - key-value message class for example applications
Author: Min RK <<EMAIL>>
"""
import struct # for packing integers
import sys
from uuid import uuid4
import zmq
# zmq.jsonapi ensures bytes, instead of unicode:
import zmq.utils.jsonapi ... |
"""This module is used to find files used by run-webkit-tests and
perftestrunner. It exposes one public function - find() - which takes
an optional list of paths, optional set of skipped directories and optional
filter callback.
If a list is passed in, the returned list of files is constrained to those
found under the... |
#! /usr/bin/env python
# Change the #! line occurring in Python scripts. The new interpreter
# pathname must be given with a -i option.
#
# Command line arguments are files or directories to be processed.
# Directories are searched recursively for files whose name looks
# like a python module.
# Symbolic links are al... |
from __future__ import absolute_import, print_function
import numpy as np
from scipy.optimize import minimize
from scipy.stats import norm
def logistic_prob(X, w):
""" MAP (Bayes point) logistic regression probability with overflow prevention via exponent truncation
Parameters
----------
X : array-lik... |
"""Provide functionality to stream HLS."""
from aiohttp import web
from homeassistant.core import callback
from homeassistant.util.dt import utcnow
from .const import FORMAT_CONTENT_TYPE
from .core import StreamView, StreamOutput, PROVIDERS
@callback
def async_setup_hls(hass):
"""Set up api endpoints."""
ha... |
from __future__ import unicode_literals
import binascii
import unittest
from unittest import skipUnless
from django.contrib.gis.geos import (
HAS_GEOS, GEOSGeometry, WKBReader, WKBWriter, WKTReader, WKTWriter,
)
from django.utils.six import memoryview
@skipUnless(HAS_GEOS, "Geos is required.")
class GEOSIOTest(... |
from msrest.serialization import Model
class WinRMListener(Model):
"""Describes Protocol and thumbprint of Windows Remote Management listener.
:param protocol: The Protocol used by the WinRM listener. Http and Https
are supported. Possible values include: 'Http', 'Https'
:type protocol: str or :clas... |
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from oscar.apps.dashboard.orders.views import (
OrderListView as CoreOrderListView, OrderDetailView as CoreOrderDetailView
)
from osc... |
import matplotlib.colors
import numpy as np
from mantid.plots.datafunctions import get_matrix_2d_ragged, get_normalize_by_bin_width
from mantid.plots.mantidimage import MantidImage
from mantid.api import MatrixWorkspace
MAX_HISTOGRAMS = 5000
class SamplingImage(MantidImage):
def __init__(self,
... |
"""
This module provides a pool manager that uses Google App Engine's
`URLFetch Service <https://cloud.google.com/appengine/docs/python/urlfetch>`_.
Example usage::
from urllib3 import PoolManager
from urllib3.contrib.appengine import AppEngineManager, is_appengine_sandbox
if is_appengine_sandbox():
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
class VarsModule(object):
"""
Loads variables for groups and/or hosts
"""
def __init__(self, inventory):
""" constructor """
self.inventory = inventory
self.inventory_basedir = inventory.... |
#!/usr/bin/env python
"""
NAME:
sparser.py
SYNOPSIS:
sparser.py [options] filename
DESCRIPTION:
The sparser.py script is a Specified PARSER. It is unique (as far as I can
tell) because it doesn't care about the delimiter(s). The user specifies
what is expected, and the order, for ... |
from __future__ import unicode_literals
from nose.tools import assert_raises
import datetime
import boto
import boto3
from boto.exception import EC2ResponseError
from botocore.exceptions import ClientError
import pytz
import sure # noqa
from moto import mock_ec2, mock_ec2_deprecated
from moto.backends import get_mod... |
from spack import *
class PyCsvkit(PythonPackage):
"""A library of utilities for working with CSV, the king of tabular file
formats"""
homepage = 'http://csvkit.rtfd.org/'
url = "https://pypi.io/packages/source/c/csvkit/csvkit-0.9.1.tar.gz"
version('1.0.4', sha256='1353a383531bee191820edfb8... |
#! /usr/bin/env python
from __future__ import division
# System imports
from distutils.util import get_platform
from math import sqrt
import os
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = Type... |
"""wrapper for libmpq"""
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope th... |
from django.conf import settings
from django.db.models import Count
from django.shortcuts import get_object_or_404
from rest_framework import status
from rest_framework.decorators import action
from rest_framework.exceptions import PermissionDenied
from rest_framework.response import Response
from extras.api.views imp... |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 13 10:31:13 2014
NTII Demo - Quellencodierung - Auswirkungen auf Spektrum des Sendesignals
Systemmodell: Quelle --> QPSK --> Pulsformung
@author: Michael Schwall
"""
from __future__ import division
import numpy as np
import matplotlib.pylab as plt
import scipy.signal a... |
from dbfread import DBF
class SPARKSReader:
"""These objects can be used to read SPARKS formatted files. SPARKS uses
the dBase format for data storage
For more information on SPARKS see
http://www2.isis.org/support/SPARKS/Pages/home.aspx
For more information on dBase see https://en.wikipedia.org... |
from relevance import Relevance
from processor import Processor
# EOF |
import pytest
import logging
import os
import subprocess
import tempfile
from dtest import Tester
from shutil import rmtree
since = pytest.mark.since
logger = logging.getLogger(__name__)
@since('4.0')
class TestFQLTool(Tester):
"""
Makes sure fqltool replay and fqltool compare work
@jira_ticket CASSANDR... |
import unittest
from pyutil.assertutil import _assert
from pyutil import strutil
class Teststrutil(unittest.TestCase):
def test_short_input(self):
self.failUnless(strutil.pop_trailing_newlines("\r\n") == "")
self.failUnless(strutil.pop_trailing_newlines("\r") == "")
self.failUnless(strutil... |
from django.apps import apps
from django.test import TestCase
from misago.core import migrationutils
from misago.core.models import CacheVersion
class CacheBusterUtilsTests(TestCase):
def test_cachebuster_register_cache(self):
"""
cachebuster_register_cache registers cache on migration successful... |
# -*- coding: utf-8 -*-
'''
================================================================================
This confidential and proprietary software may be used only
as authorized by a licensing agreement from Thumb o'Cat Inc.
In the event of publication, the following notice is applicable:
Copyright (C... |
#!/usr/bin/env python
""" toggle between two images by pressing "t"
The basic idea is to load two images (they can be different shapes) and plot
them to the same axes with hold "on". Then, toggle the visible property of
them using keypress event handling
If you want two images with different shapes to be plotted wit... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import json
from ansible.module_utils._text import to_text, to_bytes
from ansible.plugins.terminal import TerminalBase
from ansible.errors import AnsibleConnectionFailure
class TerminalModule(TerminalBase):
termin... |
r"""Support for regular expressions (RE).
This module provides regular expression matching operations similar to
those found in Perl. It supports both 8-bit and Unicode strings; both
the pattern and the strings being processed can contain null bytes and
characters outside the US ASCII range.
Regular expressions can ... |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.fixers
~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 0.5
This module includes various helpers that fix bugs in web servers. They may
be necessary for some versions of a buggy web server but not others. We try
to stay updated with the status of the bug... |
"""Jython bug with cell variables and yield"""
from __future__ import generators
def single_closure_single_value():
value = 0
a_closure = lambda : value
yield a_closure()
yield a_closure()
def single_closure_multiple_values():
value = 0
a_closure = lambda : value
yield a_closure()
valu... |
import discord
from discord.ext import commands
import sqlite3
from cogs.utils import errors
from ast import literal_eval
import re
import datetime
import aiohttp
from urllib.parse import parse_qs
from lxml import etree
# Google functions are copied from RoboDanny, accessed on April 6, 2017. https://github.... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SagaAlgorithmProvider.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************... |
#!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
import os
import sys
OUT_CPP="qt/bitcoinstrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' for... |
"""Tests to ensure ClusterResolvers are usable via the old contrib path."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.cluster_resolver import SimpleClusterResolver
from tensorflow.contrib.cluster_resolver.python.training import... |
from hpp.corbaserver.rbprm.rbprmbuilder import Builder
from hpp.corbaserver.rbprm.rbprmfullbody import FullBody
from hpp.gepetto import Viewer
import time
from hpp.corbaserver.rbprm.tools.cwc_trajectory_helper import step, clean,stats, saveAllData, play_traj
from hpp.gepetto import PathPlayer
def act(i, numOptim = 0... |
import time
from datetime import timedelta
class Metrics(object):
def __init__(self, bot):
self.bot = bot
self.start_time = time.time()
self.dust = {'start': None, 'latest': None}
self.xp = {'start': None, 'latest': None}
self.distance = {'start': None, 'latest': None}
... |
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 = r'j \d\e F \d\e Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = r'j \d\e F \d\e Y à\s H:i'
YEAR_MONTH_FORMAT = r'F \d\e Y'
MONTH_DAY_FORMAT = ... |
import getpass
import os
import unittest
from io import BytesIO, StringIO, TextIOWrapper
from unittest import mock
from test import support
try:
import termios
except ImportError:
termios = None
try:
import pwd
except ImportError:
pwd = None
@mock.patch('os.environ')
class GetpassGetuserTest(unittest.... |
# -*- coding: utf-8 -*-
"""
==========================
Bipartite Graph Algorithms
==========================
"""
# Copyright (C) 2013-2015 by
# Aric Hagberg <<EMAIL>>
# Dan Schult <<EMAIL>>
# Pieter Swart <<EMAIL>>
# All rights reserved.
# BSD license.
import networkx as nx
__author__ = """\n""".join(... |
import ocl
import camvtk
import time
import vtk
import datetime
import math
import random
import numpy as np
import gc
def drawVertex(myscreen, p, vertexColor, rad=1):
myscreen.addActor( camvtk.Sphere( center=(p.x,p.y,p.z), radius=rad, color=vertexColor ) )
def drawEdge(myscreen, e, edgeColor=camvtk.yellow):
... |
from __future__ import with_statement
from OpenGL.GL import *
import numpy as np
import cmgl
import Log
from Texture import Texture
from PIL import Image
from constants import *
#stump: the last few stubs of DummyAmanith.py are inlined here since this
# is the only place in the whole program that uses it now that we... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.