code stringlengths 1 199k |
|---|
import numpy as np
from numpy.testing import assert_allclose
from menpo.shape import PointCloud, mean_pointcloud, TriMesh
def test_mean_pointcloud():
points = np.array([[1, 2, 3],
[1, 1, 1]])
pcs = [PointCloud(points), PointCloud(points + 2)]
mean_pc = mean_pointcloud(pcs)
assert ... |
from exam import fixture
from django.core.urlresolvers import reverse
from sentry.models import Activity, Group
from sentry.testutils import APITestCase
class GroupNotesDetailsTest(APITestCase):
@fixture
def url(self):
return reverse('sentry-api-0-group-notes-details', kwargs={
'group_id': s... |
import time
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import TimeoutException
POLL_FREQUENCY = 0.5 # How long to sleep inbetween calls to the method
IGNORED_EXCEPTIONS = (NoSuchElementException,) # exceptions ignored during calls to the method
class WebDriverWait(ob... |
__all__ = ['Event', 'EventContainer']
from pyasm.common import Base, Container
from pyasm.web import WebContainer
from widget import *
import time, random
class Event(Base):
'''This class is a wrapper around a simple event architecture in javascript
General usage:
To add an event caller:
span = SpanWdg(... |
"""
Lets you change the color of the block you are looking at.
/paint [player] enables painting mode for the player.
With block tool selected, pick a color, then hold down sneak key
(<V> by default) to paint.
Maintainer: hompy
"""
from pyspades.server import block_action
from pyspades.common import Vertex3
from pyspade... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import os
import tarfile
import tempfile
import yaml
from distutils.version import LooseVersion
from shutil import rmtree
from ansible.errors import AnsibleError
from ansible.module_utils.urls import open_url
from an... |
"""Restricted execution facilities.
The class RExec exports methods r_exec(), r_eval(), r_execfile(), and
r_import(), which correspond roughly to the built-in operations
exec, eval(), execfile() and import, but executing the code in an
environment that only exposes those built-in operations that are
deemed safe. To th... |
"""Text formatting drivers for ureports"""
__docformat__ = "restructuredtext en"
from logilab.common.textutils import linesep
from logilab.common.ureports import BaseWriter
TITLE_UNDERLINES = ['', '=', '-', '`', '.', '~', '^']
BULLETS = ['*', '-']
class TextWriter(BaseWriter):
"""format layouts as text
(ReStruc... |
class PyVcstool(PythonPackage):
"""vcstool enables batch commands on multiple different vcs repositories.
Currently it supports git, hg, svn and bzr."""
homepage = "https://github.com/dirk-thomas/vcstool"
pypi = "vcstool/vcstool-0.2.15.tar.gz"
version('0.2.15', sha256='b1fce6fcef7b117b245a72dc8658a1... |
import ctypes
ctypes.CDLL(None).func() |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0291_realm_retention_days_not_null'),
]
operations = [
migrations.AlterField(
model_name='multiuseinvite',
name='invited_as',
field=models.Positive... |
import requests
import os
import sys
import re
import operator
if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} <INDY-URL>")
exit(1)
URL=sys.argv[1]
THREAD_NAME_PATTERN = re.compile('^\S+')
THREAD_GROUP_PATTERN = re.compile('\s+Group: \S+')
headers = {
'Accept': '*'
}
resp = requests.get(f"{URL}/api/diag/threads",... |
import os
import socket
import ssl
import mock
from oslo_config import cfg
import six.moves.urllib.request as urlrequest
import testtools
import webob
import webob.exc
from neutron.common import exceptions as exception
from neutron.db import api
from neutron.tests import base
from neutron import wsgi
CONF = cfg.CONF
TE... |
"""script to convert a mozilla .dtd UTF-8 localization format to a
gettext .po localization file using the po and dtd modules, and the
dtd2po convertor class which is in this module
You can convert back to .dtd using po2dtd.py"""
from translate.storage import po
from translate.storage import dtd
from translate.misc imp... |
"""Module for working with BigQuery results."""
import collections
import os
from flake_suppressor import data_types
from flake_suppressor import expectations
from flake_suppressor import tag_utils
from typ import expectations_parser
def AggregateResults(results):
"""Aggregates BigQuery results.
Also filters out an... |
from __future__ import division, print_function, unicode_literals
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
testinfo = "s, q"
tags = "Draw, Line"
import cocos
from cocos.director import director
from cocos import draw
import pyglet, math
class TestLayer(cocos.layer.Layer):
... |
__version__ = "1.6.4"
import logging
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger(__name__).addHandler(NullHandler()) |
from __future__ import unicode_literals
from nltk.corpus.reader.wordnet import NOUN
from nltk.corpus import wordnet
from nltk.compat import python_2_unicode_compatible
@python_2_unicode_compatible
class WordNetLemmatizer(object):
"""
WordNet Lemmatizer
Lemmatize using WordNet's built-in morphy function.
... |
from __future__ import absolute_import
class SolrString(unicode):
# The behaviour below is only really relevant for String fields rather
# than Text fields - most queryparsers will strip these characters out
# for a text field anyway.
lucene_special_chars = '+-&|!(){}[]^"~*?: \t\v\\'
def escape_for_... |
import unittest
from lib import mnemonic
from lib import old_mnemonic
class Test_NewMnemonic(unittest.TestCase):
def test_to_seed(self):
seed = mnemonic.Mnemonic.mnemonic_to_seed(mnemonic='foobar', passphrase='none')
self.assertEquals(seed.encode('hex'),
'741b72fd15effece6b... |
"""
The gntp.notifier module is provided as a simple way to send notifications
using GNTP
.. note::
This class is intended to mostly mirror the older Python bindings such
that you should be able to replace instances of the old bindings with
this class.
`Original Python bindings <http://code.google.com/p/growl/sourc... |
"""Display folders and associated actions
"""
import base64
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.template import RequestContext
from mailapp.models import FoldersToExpand
from mail_utils import ser... |
"""Starter data module"""
FRUIT = {
'Black Plum': 2.99,
'Red Plum': 2.99,
'Grenade Pluot': 1.99,
'Organic Black Plum': 3.49,
'Peach': 3.99,
'White Peach': 3.99,
'Organic Peach': 4.99,
'Anjou Pears': 1.99,
'Organic Anjou Pears': 3.49,
'Bartlett Pears': 1.99,
'Organic Bartlett ... |
from . import test_mrp_bom_by_percentage |
import sys
from testrunner import run
def _check_test_output(child):
child.expect('show tls values:')
for i in range(20):
if i != 5:
child.expect('key\[%d\]: \d+, val: %d'
% (i, i + 1 if i != 3 else 42))
def testfunc(child):
child.expect('START')
child.expect... |
"""Exports a toy linear regression inference graph.
Exports a TensorFlow graph to /tmp/half_plus_two/ based on the Exporter
format, go/tf-exporter.
This graph calculates,
y = a*x + b
where a and b are variables with a=0.5 and b=2.
Output from this program is typically used to exercise Session
loading and execution co... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from pants.backend.jvm.targets.import_jars_mixin import ImportJarsMixin
from pants.backend.jvm.tasks.ivy_task_mixin import IvyTaskMixin
from pants.backend.jvm... |
if True:
print('hello')
# "Matched"
print('goodbye')
if True:
print('hello')
# "Mismatched"
print('goodbye') |
from tempest.lib.services.identity.v2 import services_client
from tempest.tests.lib import fake_auth_provider
from tempest.tests.lib.services import base
class TestServicesClient(base.BaseServiceTest):
FAKE_SERVICE_INFO = {
"OS-KSADM:service": {
"id": "1",
"name": "test",
... |
"""Increase pool name size in TaskInstance
Revision ID: 90d1635d7b86
Revises: 2e42bb497a22
Create Date: 2021-04-05 09:37:54.848731
"""
import sqlalchemy as sa
from alembic import op
revision = '90d1635d7b86'
down_revision = '2e42bb497a22'
branch_labels = None
depends_on = None
def upgrade():
"""Apply Increase pool ... |
from flask import Flask
from flask.ext.admin import Admin, BaseView, expose
class MyView(BaseView):
@expose('/')
def index(self):
return self.render('index.html')
app = Flask(__name__)
app.debug = True
admin = Admin(app, name="Example: Quickstart3")
admin.add_view(MyView(name='Hello 1', endpoint='test1'... |
from __future__ import unicode_literals
from datetime import datetime, timedelta
from io import BytesIO
from itertools import chain
import time
from django.core.exceptions import SuspiciousOperation
from django.core.handlers.wsgi import WSGIRequest, LimitedStream
from django.http import (HttpRequest, HttpResponse, pars... |
from __future__ import absolute_import
import six
from sentry.api.serializers import Serializer, register
from sentry.models import Repository
@register(Repository)
class RepositorySerializer(Serializer):
def serialize(self, obj, attrs, user):
if obj.provider:
provider = {
'id': ... |
# --------------------------------------------------------------------------
import unittest
import subprocess
import sys
import isodate
import tempfile
import json
from datetime import date, datetime, timedelta, tzinfo
import os
from os.path import dirname, pardir, join, realpath
cwd = dirname(realpath(__file__))
log... |
from . import views |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d import proj3d
import matplotlib
N = 50
x = np.random.rand(N)
y = np.random.rand(N)
z = np.random.rand(N)
p1 = 10
p2 = 20
fig = plt.figure()
ax0 = plt.axes([0.,0.,1.,1.])
ax0.set_xlim(0,1)
ax0.set_ylim(0,... |
from lxml import etree
from verification_util import *
class VerificationGenerator(VerificationUtilBase):
def __init__(self, ip, port):
super(VerificationGenerator, self).__init__(ip, port, XmlDrv)
#end __init__
def get_collector_connection_status(self):
path = 'Snh_CollectorInfoRequest'
... |
import os
import sys
def print_and_exit(msg):
sys.stderr.write(msg + '\n')
sys.exit(1)
def usage_and_exit():
print_and_exit("Usage: ./gen_link_script.py [--help] [--dryrun] <path/to/libcxx.so> <public_libs>...")
def help_and_exit():
help_msg = \
"""Usage
gen_link_script.py [--help] [--dryrun] <path/to... |
from __future__ import unicode_literals
import datetime
import unittest
from django.utils import six
from django.utils.encoding import (
escape_uri_path, filepath_to_uri, force_bytes, force_text, iri_to_uri,
smart_text, uri_to_iri,
)
from django.utils.functional import SimpleLazyObject
from django.utils.http im... |
"""
Package generated from /Applications/Utilities/Terminal.app
"""
import aetools
Error = aetools.Error
import Standard_Suite
import Text_Suite
import Terminal_Suite
_code_to_module = {
'????' : Standard_Suite,
'????' : Text_Suite,
'trmx' : Terminal_Suite,
}
_code_to_fullname = {
'????' : ('Terminal.St... |
import logging
log = logging.getLogger("anaconda")
class InstallInterfaceBase(object):
def messageWindow(self, title, text, ty="ok", default = None,
custom_buttons=None, custom_icon=None):
raise NotImplementedError
def detailedMessageWindow(self, title, text, longText=None, ty="ok",
... |
'''
Created on November 20, 2010
@author: Dr. Rainer Hessmer
'''
import threading
import serial
from cStringIO import StringIO
import time
import rospy
def _OnLineReceived(line):
print(line)
class SerialDataGateway(object):
'''
Helper class for receiving lines from a serial port
'''
def __init__(self, port="/dev/t... |
'''
External inventory script for Scaleway
====================================
Shamelessly copied from an existing inventory script.
This script generates an inventory that Ansible can understand by making API requests to Scaleway API
Requires some python libraries, ensure to have them installed when using this script... |
"""Configuration file parser.
A configuration file consists of sections, lead by a "[section]" header,
and followed by "name: value" entries, with continuations and such in
the style of RFC 822.
Intrinsic defaults can be specified by passing them into the
ConfigParser constructor as a dictionary.
class:
ConfigParser --... |
DEBUG = False |
"""Add dag_id/state index on dag_run table
Revision ID: 127d2bf2dfa7
Revises: 5e7d17757c7a
Create Date: 2017-01-25 11:43:51.635667
"""
revision = '127d2bf2dfa7'
down_revision = '5e7d17757c7a'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_index('dag_id... |
"""Test cases for Zinnia's flags"""
from django.test import TestCase
from django.contrib.auth.tests.utils import skipIfCustomUser
from zinnia import flags
from zinnia.flags import get_user_flagger
@skipIfCustomUser
class FlagsTestCase(TestCase):
"""Test cases for zinnia.flags"""
def setUp(self):
self.cl... |
import pytest
import pandas as pd
import pandas._testing as tm
class TestDatetimeIndexFillNA:
@pytest.mark.parametrize("tz", ["US/Eastern", "Asia/Tokyo"])
def test_fillna_datetime64(self, tz):
# GH 11343
idx = pd.DatetimeIndex(["2011-01-01 09:00", pd.NaT, "2011-01-01 11:00"])
exp = pd.Da... |
import sys
OFFSET_BOOTLOADER = 0x1000
OFFSET_PARTITIONS = 0x8000
OFFSET_APPLICATION = 0x10000
files_in = [
('bootloader', OFFSET_BOOTLOADER, sys.argv[1]),
('partitions', OFFSET_PARTITIONS, sys.argv[2]),
('application', OFFSET_APPLICATION, sys.argv[3]),
]
file_out = sys.argv[4]
cur_offset = OFFSET_BOOTLOADER... |
import unittest
import subprocess
import sys
import isodate
import tempfile
import json
from datetime import date, datetime, timedelta
import os
from os.path import dirname, pardir, join, realpath
cwd = dirname(realpath(__file__))
log_level = int(os.environ.get('PythonLogLevel', 30))
tests = realpath(join(cwd, pardir, ... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
DOCUMENTATION = '''
---
module: azure_rm_virtualmachineimage_facts
version_added: "2.1"
short_d... |
from collections import OrderedDict
from django.utils.functional import cached_property
from pootle.core.delegate import config
class ConfigDict(object):
"""Assumes keys for __config__ are unique, uses last instance of key
if not
"""
def __init__(self, context):
self.context = context
@prope... |
from urllib.request import urlopen, Request
import json
TOKEN = 'Your access token here'
orgName = 'libretro'
repoName = 'RetroArch'
lines = []
def get_contributors(after=None):
global lines
headers = {'Authorization': 'bearer ' + TOKEN}
url = 'https://api.github.com/graphql'
dataStr = """{
repository(owner... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import shlex
import subprocess
import sys
import yaml
from ansible.cli import CLI
from ansible.config.manager import ConfigManager, Setting, find_ini_config_file
from ansible.errors import AnsibleError, AnsibleOptionsError... |
from . import res_users
from . import account |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import getdate, nowdate, flt
class AccountsReceivableReport(object):
def __init__(self, filters=None):
self.filters = frappe._dict(filters or {})
self.filters.report_date = getdate(self.filters.report_date or nowdate())
... |
r"""Module for pre-defined neural network models.
This module contains definitions for the following model architectures:
- `AlexNet`_
- `DenseNet`_
- `Inception V3`_
- `ResNet V1`_
- `ResNet V2`_
- `SqueezeNet`_
- `VGG`_
- `MobileNet`_
- `MobileNetV2`_
You can construct a model with random weights by calling ... |
""" Hierarchical property system for IDL AST """
import re
import sys
from idl_log import ErrOut, InfoOut, WarnOut
class IDLPropertyNode(object):
def __init__(self):
self.parents = []
self.property_map = {}
def AddParent(self, parent):
assert parent
self.parents.append(parent)
def SetProperty(self... |
from src.ui import *
from src.general import *
from src.files import *
from src.features import *
from src.dataset import *
from src.evaluation import *
import numpy
import csv
import argparse
import textwrap
from sklearn.metrics import confusion_matrix
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot a... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: sl_vm
short_description: create or cancel a virtual instance in SoftLayer
description:
- Creates or cancels SoftLayer instances. When created, optionally wa... |
"""Auto-generated file, do not edit by hand. SC metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_SC = PhoneMetadata(id='SC', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='[19]\\d{2,3}', possible_number_pattern='... |
"""Python layer for image_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.image.ops import gen_image_ops
from tensorflow.contrib.util import loader
from tensorflow.python.framework import common_shapes
from tensorflow.python.fr... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import pytest
from .conftest import MockManager
class TestMigrate(object):
config = """
tasks:
test:
mock:
- {title: 'foobar'... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import json
from itertools import chain
from ansible.module_utils._text import to_text
from ansible.module_utils.network.common.utils import to_list
from ansible.plugins.cliconf import CliconfBase
class Cliconf(CliconfBase... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = """
---
module: dellos10_command
version_added: "2.2"
author: "Senthil Kumar Ganesan (@skg-net)"
short_description: Run commands on remote devices running Dell OS10
... |
from django.test import override_settings
from bedrock.utils import expand_locale_groups
@override_settings(LANG_GROUPS={'en': ['en-US', 'en-GB']})
def test_expand_locale_groups():
assert expand_locale_groups(['de', 'fr', 'en-GB']) == ['de', 'fr', 'en-GB']
assert expand_locale_groups(['de', 'fr', 'en']) == ['de... |
from . import test_mrp_account
from . import test_bom_price
from . import test_valuation_layers |
import os
import tarfile
from contextlib import closing
from gppylib.commands.base import ExecutionError
from gppylib.commands.unix import Scp
from gppylib.operations.package import GpScp
from gppylib.operations.test.regress.test_package import GppkgTestCase, unittest, skipIfNoStandby, get_host_list, ARCHIVE_PATH, run_... |
def func():
value = "not-none"
<caret>if value is None:
print("None")
# Is not none
# If it's not none
else:
print("Not none") |
import unittest
from IECore import *
import math
class PolygonAlgoTest( unittest.TestCase ) :
def testNormal( self ) :
p = V3fVectorData( [
V3f( 0, 0, 0 ),
V3f( 1, 0, 0 ),
V3f( 1, 1, 0 ),
V3f( 0, 1, 0 )
] )
self.assertEqual( polygonNormal( p ), V3f( 0, 0, 1 ) )
p = V3fVectorData( [
V3f( 0, 0, 0 ... |
from __future__ import absolute_import
import warnings
from raven.exceptions import InvalidDsn
from raven.transport.threaded import ThreadedHTTPTransport
from raven.utils import six
from raven.utils.urlparse import parse_qsl, urlparse
ERR_UNKNOWN_SCHEME = 'Unsupported Sentry DSN scheme: {0}'
DEFAULT_TRANSPORT = Threade... |
def diff(first, second):
intersection = [k for k in first if k in second]
addition = [k for k in second if k not in first]
deletion = [k for k in first if k not in second]
return intersection, addition, deletion
first = {'lorem': 1, 'amet': 5}
second = {'ipsum': 2, 'dolor': 3, 'sit': 4}
result = diff(first, sec... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.1'}
DOCUMENTATION = '''
---
module: fortios_authentication_rule
short_description: Configure Auth... |
from __future__ import absolute_import, division, print_function
import pytest
dask = pytest.importorskip('dask')
import numpy as np
from dask.array import Array, from_array
from odo import discover
from operator import getitem
from blaze import compute, symbol
def eq(a, b):
if isinstance(a, Array):
a = a.c... |
"""
This module has all the classes and functions related to waves in optics.
**Contains**
* TWave
"""
from __future__ import print_function, division
__all__ = ['TWave']
from sympy import (sympify, pi, sin, cos, sqrt, simplify, Symbol, S, C, I,
symbols, Derivative, atan2)
from sympy.core.expr import Expr
from symp... |
from paypal.standard.forms import PayPalStandardBaseForm
from paypal.standard.ipn.models import PayPalIPN
class PayPalIPNForm(PayPalStandardBaseForm):
"""
Form used to receive and record PayPal IPN notifications.
PayPal IPN test tool:
https://developer.paypal.com/us/cgi-bin/devscr?cmd=_tools-session
... |
from neutron.db import l3_dvr_db
from neutron.plugins.vmware.extensions import servicerouter
class ServiceRouter_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin):
"""Mixin class to enable service router support."""
extra_attributes = (
l3_dvr_db.L3_NAT_with_dvr_db_mixin.extra_attributes + [{
'name'... |
from __future__ import division
import os
import math
import binascii
from hashlib import sha256
from . import der
from .curves import orderlen
from .six import PY3, int2byte, b, next
oid_ecPublicKey = (1, 2, 840, 10045, 2, 1)
encoded_oid_ecPublicKey = der.encode_oid(*oid_ecPublicKey)
def randrange(order, entropy=None)... |
"""
Posix asyncio event loop.
"""
from __future__ import unicode_literals
from ..terminal.vt100_input import InputStream
from .asyncio_base import AsyncioTimeout
from .base import EventLoop, INPUT_TIMEOUT
from .callbacks import EventLoopCallbacks
from .posix_utils import PosixStdinReader
import asyncio
import signal
__... |
from __future__ import unicode_literals, print_function, absolute_import, division, generators, nested_scopes
import sys
import logging
import ply.lex
logger = logging.getLogger(__name__)
class JsonPathLexerError(Exception):
pass
class JsonPathLexer(object):
'''
A Lexical analyzer for JsonPath.
'''
... |
int.imag
int.is_integer
float.is_int
1.0.is_integer
"".upper
r"".upper
"=".upper
a = "="
a.upper
arr = []
arr.app
list().app
[].append
arr2 = [1,2,3]
arr2.app
arr.count(1)
dic = {}
dic.c
dic2 = dict(a=1, b=2)
dic2.p
{}.popitem
dic2 = {'asdf': 3}
dic2.popitem
dic2['asdf']
set_t = {1,2}
set_t.c
set_t2 = set()
set_t2.c
tu... |
import fetchmail_server
import fetchmail_server_folder |
"""Markup templating engine."""
from itertools import chain
from genshi.core import Attrs, Markup, Namespace, Stream, StreamEventKind
from genshi.core import START, END, START_NS, END_NS, TEXT, PI, COMMENT
from genshi.input import XMLParser
from genshi.template.base import BadDirectiveError, Template, \
... |
"""
categories: Types,str
description: None as first argument for rsplit such as str.rsplit(None, n) not implemented
cause: Unknown
workaround: Unknown
"""
print("a a a".rsplit(None, 1)) |
import re
from Plugin import PluginManager
@PluginManager.registerTo("UiRequest")
class UiRequestPlugin(object):
def __init__(self, *args, **kwargs):
from Site import SiteManager
self.site_manager = SiteManager.site_manager
super(UiRequestPlugin, self).__init__(*args, **kwargs)
# Media request
def actionSiteMe... |
from __future__ import absolute_import
import os.path
HERE = os.path.dirname(__file__)
TOP = os.path.join(HERE, "..")
TOPA = os.path.abspath(TOP) |
from .backend import BackendTest
from .field_db_conversion import FieldDBConversionTest
from .field_options import FieldOptionsTest
from .filter import FilterTest
from .keys import KeysTest
from .mapreduce_input_readers import DjangoModelInputReaderTest, DjangoModelIteratorTest
from .not_return_sets import NonReturnSet... |
import setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True) |
from .pls_ import _PLS
__all__ = ['CCA']
class CCA(_PLS):
"""CCA Canonical Correlation Analysis.
CCA inherits from PLS with mode="B" and deflation_mode="canonical".
Parameters
----------
n_components : int, (default 2).
number of components to keep.
scale : boolean, (default True)
... |
"""
Logging middleware for the Swift proxy.
This serves as both the default logging implementation and an example of how
to plug in your own logging format/method.
The logging format implemented below is as follows:
client_ip remote_addr datetime request_method request_path protocol
status_int referer user_agent au... |
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_webfilter_ips_urlfilter_setting
except Imp... |
import asyncore
import email.utils
import socket
import smtpd
import smtplib
import StringIO
import sys
import time
import select
import unittest
from test import test_support
try:
import threading
except ImportError:
threading = None
HOST = test_support.HOST
def server(evt, buf, serv):
serv.listen(5)
e... |
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
sphere = vtk.vtkSphereSource()
sphere.SetPhiResolution(15... |
'''
PEXPECT LICENSE
This license is approved by the OSI and FSF as GPL-compatible.
http://opensource.org/licenses/isc-license.txt
Copyright (c) 2012, Noah Spurrier <noah@noah.org>
PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY
PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANT... |
"""Tests for stevedore.example2.fields
"""
from stevedore.example2 import fields
from stevedore.tests import utils
class TestExampleFields(utils.TestCase):
def test_simple_items(self):
f = fields.FieldList(100)
text = ''.join(f.format({'a': 'A', 'b': 'B'}))
expected = '\n'.join([
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['deprecated'],
'supported_by': 'network'}
DOCUMENTATION = """
---
module: net_vlan
version_added: "2.4"
author: "Ricardo Carrillo Cruz (... |
"""
This module extends SQLAlchemy and provides additional DDL [#]_
support.
.. [#] SQL Data Definition Language
"""
import re
import sqlalchemy
from sqlalchemy import __version__ as _sa_version
_sa_version = tuple(int(re.match("\d+", x).group(0)) for x in _sa_version.split("."))
SQLA_07 = _sa_version >= (0, 7... |
from __future__ import unicode_literals
import base64
import re
import time
from .common import InfoExtractor
from ..utils import (
struct_unpack,
remove_end,
)
def _decrypt_url(png):
encrypted_data = base64.b64decode(png)
text_index = encrypted_data.find(b'tEXt')
text_chunk = encrypted_data[text_in... |
import sys
import argparse
import ConfigParser
from provision_dns import DnsProvisioner
from requests.exceptions import ConnectionError
class DelVirtualDnsRecord(object):
def __init__(self, args_str = None):
self._args = None
if not args_str:
args_str = ' '.join(sys.argv[1:])
sel... |
"""
Key bindings, for scrolling up and down through pages.
This are separate bindings, because GNU readline doesn't have them, but
they are very useful for navigating through long multiline buffers, like in
Vi, Emacs, etc...
"""
from __future__ import unicode_literals
from prompt_toolkit.layout.utils import find_window... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.