code stringlengths 1 199k |
|---|
from os.path import abspath
from unittest import TestCase
import mock
from preggy import expect
from thumbor.detectors.profile_detector import Detector
class ProfileDetectorTestCase(TestCase):
def test_detector_uses_proper_cascade(self):
cascade = './tests/fixtures/haarcascade_profileface.xml'
ctx =... |
"""Tests for fixes module."""
from __future__ import absolute_import, unicode_literals
from pywikibot import fixes
from tests import unittest, join_data_path
from tests.aspects import TestCase
class TestFixes(TestCase):
"""Test the fixes module."""
net = False
def setUp(self):
"""Backup the current ... |
__all__ = ['SimpleCheckinWdg']
from pyasm.common import Environment, jsonloads, jsondumps, Common
from pyasm.biz import Project
from pyasm.web import SpanWdg, DivWdg, FloatDivWdg, Table, WidgetSettings, HtmlElement
from tactic.ui.common import BaseRefreshWdg
from pyasm.widget import IconWdg, RadioWdg
from tactic.ui.wid... |
"""
Compatibility library for Python 2.4 up through Python 3.
"""
import os
import sys
ENCODING = sys.getdefaultencoding()
PY2 = sys.version_info[0] == 2
if PY2:
import commands
from ConfigParser import NoOptionError
from ConfigParser import RawConfigParser
from StringIO import StringIO
import xmlrp... |
import sys
def check_version():
version_tuple = sys.version_info
version = version_tuple[0] * 100 + version_tuple[1]
if version < 203:
print "Python >= 2.3 required. You are using:", sys.version
print """
Visit http://www.python.org and download a more recent version of
Python.
You should i... |
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import string, sys
from numpy import *
from numpy.random import shuffle, randint
from numpy.linalg import inv, det
def read_alist_file(filename):
"""
This function reads in an alist file and creates the
c... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import sys
from jinja2 import Undefined as j2undefined
from ansible import constants as C
from ansible.inventory.host import Host
from ansible.template import Templar
STATIC_VARS = [
'inventory_hostname', 'inven... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pootle_app', '0008_allow_blank_directory_name_and_parent'),
]
operations = [
migrations.AlterField(
model_name='directory',
name=... |
'''OpenGL extension EXT.texture_storage
This module customises the behaviour of the
OpenGL.raw.GLES2.EXT.texture_storage to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/EXT/texture_storage.txt
'''
from OpenGL import platform, consta... |
r"""Removes parts of a graph that are only needed for training.
There are several common transformations that can be applied to GraphDefs
created to train a model, that help reduce the amount of computation needed when
the network is used only for inference. These include:
- Removing training-only operations like chec... |
"""Import a TF v1-style SavedModel when executing eagerly."""
import functools
from tensorflow.python.eager import context
from tensorflow.python.eager import lift_to_graph
from tensorflow.python.eager import wrap_function
from tensorflow.python.framework import composite_tensor
from tensorflow.python.framework import ... |
"""Feed Entity Manager Sensor support for GeoNet NZ Quakes Feeds."""
import logging
from typing import Optional
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from homeassistant.util import dt
from .const impo... |
import numpy as np
import matplotlib.pylab as pl
def entropy(p):
"""calculate the entropy"""
h = -p * np.log2(p) - (1 - p) * np.log2(1 - p)
return h
x = np.linspace(0.01, 0.99, 100)
y = entropy(x)
pl.plot(x, y)
pl.xlabel('p(X=1)')
pl.ylabel('H(X)')
pl.savefig('bernoulliEntropyFig.png')
pl.show() |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: mso_schema_site_bd_l3out
short_description: Manage site-local ... |
"""
Test mail checking.
"""
from tests import need_network
from . import MailTest
class TestMailGood (MailTest):
"""
Test mailto: link checking.
"""
@need_network
def test_good_mail (self):
# some good mailto addrs
url = self.norm(u"mailto:Dude <calvin@users.sourceforge.net> , "\
... |
from __future__ import print_function
from distutils.version import LooseVersion
import getopt
import glob
import os
import signal
import subprocess
import sys
import time
__version__ = '0.7'
doctypes = ('document', 'graphics', 'presentation', 'spreadsheet')
global convertor, office, ooproc, product
ooproc = None
uno =... |
from UserDict import DictMixin
from bx.misc.binary_file import BinaryFileReader, BinaryFileWriter
import numpy
import sys
def cdbhash( s ):
return reduce( lambda h, c: (((h << 5) + h) ^ ord(c)) & 0xffffffffL, s, 5381 )
class FileCDBDict( DictMixin ):
"""
For accessing a CDB structure on disk. Read only. Cur... |
'''
This class stores global settings for the GUI
@author Kyriakos Zarifis
'''
class Settings():
def __init__(self, parent):
self.node_id_size = 2
self.current_topo_layout = "random"
def set_node_id_size_small(self):
self.node_id_size = 1
def set_node_id_size_normal(self):
se... |
r"""
**************************************************
espressopp.integrator.BerendsenBarostatAnisotropic
**************************************************
This is the Berendsen barostat implementation according to the original paper [Berendsen84]_.
If Berendsen barostat is defined (as a property of integrator) then ... |
class Prop(object):
"""
>>> p = Prop()
>>> p.prop
GETTING 'None'
>>> p.prop = 1
SETTING '1' (previously: 'None')
>>> p.prop
GETTING '1'
1
>>> p.prop = 2
SETTING '2' (previously: '1')
>>> p.prop
GETTING '2'
2
>>> del p.prop
DELETING '2'
>>> p.prop
G... |
import unittest
import apply_edits
def _FindPHB(filepath):
return apply_edits._FindPrimaryHeaderBasename(filepath)
class FindPrimaryHeaderBasenameTest(unittest.TestCase):
def testNoOpOnHeader(self):
self.assertIsNone(_FindPHB('bar.h'))
self.assertIsNone(_FindPHB('foo/bar.h'))
def testStripDirectories(self... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('entry_trace')
def on_entry_action(entry, act=None, task=None, reason=None,... |
""" Clears tag fields in media files."""
from __future__ import (division, absolute_import, print_function,
unicode_literals)
import re
from beets.plugins import BeetsPlugin
from beets.mediafile import MediaFile
from beets.importer import action
from beets.util import confit
__author__ = 'baobab... |
"""
Storage for optical spectral line information.
"""
from __future__ import print_function
import numpy as np
def hydrogen(nu,nl, vacuum=True):
"""
Compute the rest wavelength of Hydrogen recombination lines in angstroms
"""
rydberg = 10973731.6 # m^-1
protontoelectron = 1836.15266 # ratio
lva... |
def run():
from django.test.client import Client
c = Client()
pages = [
'/',
'/about/',
'/profiles/',
'/blog/',
'/invitations/',
'/notices/',
'/messages/',
'/announcements/',
'/tweets/',
'/tribes/',
'/robots.txt',
... |
from vic import lib as vic_lib
def test_initialize_parameters():
assert vic_lib.initialize_parameters() is None
assert vic_lib.param.LAPSE_RATE == -0.0065 |
import gnuradio
from gnuradio import gr
from gnuradio import blocks as grblocks
import sys
if __name__ == '__main__':
duration = float(sys.argv[1])
tb = gr.top_block()
src0 = gr.null_source(8)
src1 = gr.null_source(8)
addr01 = grblocks.add_cc()
src2 = gr.null_source(8)
src3 = gr.null_source(... |
import glob,os
files=glob.glob("*")
print files
for f in files:
os.rename(f,f.replace(".ipt","")) |
"""
InaSAFE Disaster risk assessment tool developed by AusAid - **Paragraph.**
Contact : ole.moller.nielsen@gmail.com
.. 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 Foundation; either version... |
from . import pos_config
from . import pos_order
from . import coupon
from . import coupon_program
from . import barcode_rule |
{
'name': 'Google Analytics',
'version': '1.0',
'category': 'Tools',
'complexity': "easy",
'description': """
Google Analytics.
=================
Collects web application usage with Google Analytics.
""",
'author': 'OpenERP SA',
'website': 'https://www.odoo.com/page/website-builder',
... |
"""CLI for storage, version v1."""
import code
import os
import platform
import sys
from apitools.base.protorpclite import message_types
from apitools.base.protorpclite import messages
from google.apputils import appcommands
import gflags as flags
import apitools.base.py as apitools_base
from apitools.base.py import cl... |
r"""Simple transfer learning with Inception v3 or Mobilenet models.
With support for TensorBoard.
This example shows how to take a Inception v3 or Mobilenet model trained on
ImageNet images, and train a new top layer that can recognize other classes of
images.
The top layer receives as input a 2048-dimensional vector (... |
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 = 'fit_to_pages05.xlsx'
... |
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 = 'optimize01.xlsx'
tes... |
from __future__ import absolute_import, division, print_function
from datashape import DataShape, Record, Fixed, Var, CType, String, JSON
from jinja2 import Template
json_comment_templ = Template("""<font style="font-size:x-small"> # <a href="{{base_url}}?r=data.json">JSON</a></font>
""")
datashape_outer_templ = Templa... |
from __future__ import absolute_import
from __future__ import unicode_literals
import pickle
import sys
from functools import wraps
from io import StringIO, BytesIO
from kombu import version_info_t
from kombu import utils
from kombu.utils.text import version_string_as_tuple
from kombu.five import string_t
from kombu.te... |
'''tzinfo timezone information for Canada/Mountain.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Mountain(DstTzInfo):
'''Canada/Mountain timezone definition. See datetime.tzinfo for details'''
zone = 'Canada/Mountain'
... |
'''
This decoder stacks on top of the 'i2c' PD and decodes the Texas Instruments
TCA6408A 8-bit I²C I/O expander protocol.
'''
from .pd import Decoder |
"""
:class:`~xblock.field_data.FieldData` subclasses used by the LMS
"""
from xblock.field_data import ReadOnlyFieldData, SplitFieldData
from xblock.fields import Scope
class LmsFieldData(SplitFieldData):
"""
A :class:`~xblock.field_data.FieldData` that
reads all UserScope.ONE and UserScope.ALL fields from ... |
"""
my simple module
"""
def func2():
"""
func2 function
"""
print 'executing the simple func2'
if __name__ == '__main__':
print 'main of simple module' |
"""Common Met Office Data class used by both sensor and entity."""
class MetOfficeData:
"""Data structure for MetOffice weather and forecast."""
def __init__(self, now, forecast, site):
"""Initialize the data object."""
self.now = now
self.forecast = forecast
self.site = site |
"""Jobs for recommendations."""
import ast
from core import jobs
from core.domain import exp_services
from core.domain import recommendations_services
from core.domain import rights_manager
from core.platform import models
(exp_models, recommendations_models,) = models.Registry.import_models([
models.NAMES.explorat... |
import multiprocessing
import optparse
import os
import posixpath
import sys
import urllib2
import buildbot_common
import build_version
import generate_make
import parse_dsc
from build_paths import SDK_SRC_DIR, OUT_DIR, SDK_RESOURCE_DIR
from build_paths import GSTORE
from generate_index import LandingPage
sys.path.appe... |
"""Test for the ee.image module."""
import json
import unittest
import ee
from ee import apitestcase
class ImageTestCase(apitestcase.ApiTestCase):
def testConstructors(self):
"""Verifies that constructors understand valid parameters."""
from_constant = ee.Image(1)
self.assertEquals(ee.ApiFunction.lookup('... |
from twisted.internet.defer import Deferred
def out(s): print s
d = Deferred()
d.addCallbacks(out, out)
d.callback('First result')
d.errback(Exception('First error'))
print 'Finished' |
"""empty message
Revision ID: 531a00c3d139
Revises: c5fe28ec7139
Create Date: 2016-08-11 19:24:59.067000
"""
revision = '531a00c3d139'
down_revision = 'c5fe28ec7139'
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
def upgrade():
### commands auto generated by Alembic - please adjust! ###
... |
''' fit best estimate of magnetometer offsets from ArduCopter flashlog
using the algorithm from Bill Premerlani
'''
import sys
from optparse import OptionParser
parser = OptionParser("magfit_flashlog.py [options]")
parser.add_option("--verbose", action='store_true', default=False, help="verbose offset output")
parser.a... |
"""
Demo fan platform that has a fake fan.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
from homeassistant.components.fan import (SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH,
FanEntity, SUPPORT_SET_SPEED,
... |
from tastypie import fields
from tastypie.constants import ALL, ALL_WITH_RELATIONS
from pydotorg.resources import GenericResource, OnlyPublishedAuthorization
from .models import OS, Release, ReleaseFile
from pages.api import PageResource
class OSResource(GenericResource):
class Meta(GenericResource.Meta):
q... |
import os, os.path, sys, time
def read_whole_file(filename):
f = open(filename, 'r')
try:
return f.readlines()
finally:
f.close()
def list():
"""List physical block devices from /sys"""
all = os.listdir("/sys/block")
def is_physical_device(dev):
sys = os.path.join("/sys/... |
from django.core.urlresolvers import reverse # noqa
from django.utils.translation import ugettext_lazy as _ # noqa
from horizon import exceptions
from horizon import tabs
from openstack_dashboard.api import cinder
class OverviewTab(tabs.Tab):
name = _("Overview")
slug = "overview"
template_name = ("projec... |
from pyspark.streaming import StreamingListener
from pyspark.testing.streamingutils import PySparkStreamingTestCase
class StreamingListenerTests(PySparkStreamingTestCase):
duration = .5
class BatchInfoCollector(StreamingListener):
def __init__(self):
super(StreamingListener, self).__init__()... |
"""Parallel util function."""
import logging
import os
from . import get_config
from .utils import logger, verbose, warn, ProgressBar
from .utils.check import int_like
from .fixes import _get_args
if 'MNE_FORCE_SERIAL' in os.environ:
_force_serial = True
else:
_force_serial = None
@verbose
def parallel_func(fun... |
"""
Run this example with:
mpirun -np 2 python examples/mpi.py
"""
from __future__ import print_function
import sys
import numpy as np
import emcee
from emcee.utils import MPIPool
def lnprob(x):
return -0.5 * np.sum(x ** 2)
pool = MPIPool()
if not pool.is_master():
# Wait for instructions from the master proces... |
import time
from datetime import date
from datetime import datetime
from datetime import timedelta
from dateutil import relativedelta
from openerp import api, tools
from openerp.osv import fields, osv
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
from openerp.tools.safe_eval import... |
from hudson import *
import pprint
BASE_URL = "http://hudson.activeeon.com/"
def get_most_failing_tests(job):
first = job.get_first_build_number()
last = job.get_last_build_number()
for i in range(first, last):
build = job.get_build(i)
test_report = build.get_test_report()
print bui... |
import numpy as np
from scipy import linalg
from sklearn.decomposition import (NMF, ProjectedGradientNMF,
non_negative_factorization)
from sklearn.decomposition import nmf # For testing internals
from scipy.sparse import csc_matrix
from sklearn.utils.testing import assert_true
from ... |
import unittest
import mock
import numpy
import chainer
from chainer import cuda
import chainer.functions as F
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.utils import type_check
class TestFunction(unittest.TestCase):
def _get_method(self, prefix, gpu... |
from __future__ import absolute_import, print_function, unicode_literals
from django.test import TestCase
from kolibri.core.templatetags import kolibri_tags
class KolibriTagNavigationTestCase(TestCase):
def test_navigation_tag(self):
self.assertTrue(
len(list(kolibri_tags.kolibri_main_navigation... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.1'}
DOCUMENTATION = '''
---
module: fortios_switch_controller_system
short_description: Configure... |
"""Test allocating asset ids from the server.
"""
__author__ = ['matt@emailscrubbed.com (Matt Tracy)']
from viewfinder.backend.base import util
from viewfinder.backend.db.user import User
from viewfinder.backend.www.test import service_base_test
class AllocateIdsTestCase(service_base_test.ServiceBaseTestCase):
def se... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.platform import googletest
from tensorflow.python.summary.impl import gcs
from tensorflow.python.summary.impl import gcs_file_loader
class GCSFileLoaderTest(tf.test... |
from __future__ import print_function
import os
import pyrax
pyrax.set_setting("identity_type", "rackspace")
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyrax.set_credential_file(creds_file)
clb = pyrax.cloud_loadbalancers
node = clb.Node(address="10.1.1.1", port=80, condition="DISABLED")
print("N... |
import struct
import sys
import json
import io
import itertools as it
from readmdir import Tag, MetadataPair
def main(args):
superblock = None
gstate = b'\0\0\0\0\0\0\0\0\0\0\0\0'
dirs = []
mdirs = []
corrupted = []
cycle = False
with open(args.disk, 'rb') as f:
tail = (args.block1, ... |
import abc
import functools
import os
from oslo_log import log as logging
from oslo_utils import importutils
import six
import webob.dec
import webob.exc
import nova.api.openstack
from nova.api.openstack import wsgi
from nova import exception
from nova.i18n import _
from nova.i18n import _LE
from nova.i18n import _LW
i... |
"""Z-Wave workarounds."""
from . import const
FIBARO = 0x010F
GE = 0x0063
PHILIO = 0x013C
SOMFY = 0x0047
WENZHOU = 0x0118
VIZIA = 0x001D
GE_FAN_CONTROLLER_12730 = 0x3034
GE_FAN_CONTROLLER_14287 = 0x3131
JASCO_FAN_CONTROLLER_14314 = 0x3138
PHILIO_SLIM_SENSOR = 0x0002
PHILIO_3_IN_1_SENSOR_GEN_4 = 0x000D
PHILIO_PAN07 = 0x... |
import sqlalchemy as sql
def upgrade(migrate_engine):
meta = sql.MetaData()
meta.bind = migrate_engine
idp_table = sql.Table(
'identity_provider',
meta,
sql.Column('id', sql.String(64), primary_key=True),
sql.Column('enabled', sql.Boolean, nullable=False),
sql.Column(... |
"""
Script to generate contributor and pull request lists
This script generates contributor and pull request lists for release
changelogs using Github v3 protocol. Use requires an authentication token in
order to have sufficient bandwidth, you can get one following the directions at
`<https://help.github.com/articles/c... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('appliances', '0033_merge'),
]
operations = [
migrations.AddField(
model_name='provider',
name='allow_renaming',
field... |
import unittest
import sqlite3 as sqlite
def func_returntext():
return "foo"
def func_returnunicode():
return u"bar"
def func_returnint():
return 42
def func_returnfloat():
return 3.14
def func_returnnull():
return None
def func_returnblob():
return buffer("blob")
def func_returnlonglong():
... |
"""
Factories for Bookmark models.
"""
import factory
from factory.django import DjangoModelFactory
from functools import partial
from student.tests.factories import UserFactory
from opaque_keys.edx.locator import CourseLocator
from ..models import Bookmark, XBlockCache
COURSE_KEY = CourseLocator(u'edX', u'test_course'... |
from abc import ABCMeta, abstractmethod
import m5
from m5.objects import *
from m5.proxy import *
m5.util.addToPath('../configs/')
from common.Benchmarks import SysConfig
from common import FSConfig
from common.Caches import *
from base_config import *
class LinuxX86SystemBuilder(object):
"""Mix-in that implements ... |
from django.test import TestCase, override_settings
@override_settings(
TEMPLATE_CONTEXT_PROCESSORS=('django.core.context_processors.static',),
STATIC_URL='/path/to/static/media/',
)
class ShortcutTests(TestCase):
urls = 'view_tests.generic_urls'
def test_render_to_response(self):
response = sel... |
"""
Regression tests for the Test Client, especially the customized assertions.
"""
from __future__ import unicode_literals
import datetime
import itertools
import os
from django.contrib.auth.models import User
from django.contrib.auth.signals import user_logged_in, user_logged_out
from django.core.urlresolvers import ... |
import netaddr
from oslo.config import cfg
from nova import db
from nova import exception
from nova import objects
from nova.objects import base as obj_base
from nova.objects import fields
from nova import utils
network_opts = [
cfg.BoolOpt('share_dhcp_address',
default=False,
help='... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: netapp_e_auth
short_description: NetApp E-Series set or update ... |
from doc.gallery import *
def test_parse_docstring_info():
assert 'error' in parse_docstring_info("No Docstring")
assert 'error' in parse_docstring_info("'''No Docstring Title'''")
assert 'error' in parse_docstring_info(
"'''No Sentence\n======\nPeriods'''"
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'}
DOCUMENTATION = '''
---
module: sysctl
short_description: Manage entries in sysctl.conf.
des... |
def test_diff():
assert "actual" == "expected" |
"""Tests for fractional average pool operation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.ops imp... |
import unittest
import uuid
from airflow.contrib.hooks.aws_firehose_hook import AwsFirehoseHook
try:
from moto import mock_kinesis
except ImportError:
mock_kinesis = None
class TestAwsFirehoseHook(unittest.TestCase):
@unittest.skipIf(mock_kinesis is None, 'mock_kinesis package not present')
@mock_kinesi... |
from vispy import gloo, app, keys
VERT_SHADER = """
attribute vec2 a_position;
void main (void)
{
gl_Position = vec4(a_position, 0.0, 1.0);
}
"""
FRAG_SHADER = """
uniform vec2 u_resolution;
uniform float u_global_time;
// --- Your function here ---
float function( float x )
{
float d = 3.0 - 2.0*(1.0+cos(u_glo... |
import idaapi
def hotkey_pressed():
print("hotkey pressed!")
try:
hotkey_ctx
if idaapi.del_hotkey(hotkey_ctx):
print("Hotkey unregistered!")
del hotkey_ctx
else:
print("Failed to delete hotkey!")
except:
hotkey_ctx = idaapi.add_hotkey("Shift-A", hotkey_pressed)
if hotkey_... |
from openerp.tests.common import TransactionCase
class TestDeadMansSwitchClient(TransactionCase):
def test_dead_mans_switch_client(self):
# test unconfigured case
self.env['ir.config_parameter'].search([
('key', '=', 'dead_mans_switch_client.url')]).unlink()
self.env['dead.mans.s... |
import unittest
import warnings
from django.utils.deprecation import RemovedInDjango20Warning
with warnings.catch_warnings():
warnings.filterwarnings(
'ignore', 'django.utils.checksums will be removed in Django 2.0.',
RemovedInDjango20Warning)
from django.utils import checksums
class TestUtilsCh... |
"""
LLDB Formatters for LLVM data types.
Load into LLDB with 'command script import /path/to/lldbDataFormatters.py'
"""
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('type category define -e llvm -l c++')
debugger.HandleCommand('type synthetic add -w llvm '
'... |
'''
>>> from injected_ext import *
>>> X(3,5).value() - (3+5)
0
>>> X(a=3,b=5,c=7).value() - (3*5*7)
0
>>> X().value()
1000
'''
def run(args = None):
import sys
import doctest
if args is not None:
sys.argv = args
return doctest.testmod(sys.modules.get(__name__))
if __name__ == '__main__':
pr... |
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_system_replacemsg_image
except ImportError... |
from django.test import TestCase
from django.core.exceptions import ValidationError
class ValidationTestCase(TestCase):
def assertFailsValidation(self, clean, failed_fields):
self.assertRaises(ValidationError, clean)
try:
clean()
except ValidationError, e:
self.assert... |
"""
Dependency:
`git-remote-bzr` from https://github.com/felipec/git-remote-bzr
must be in the `$PATH`.
"""
from __future__ import absolute_import, print_function
import argparse
import os
import subprocess
from contextlib import contextmanager
from pkg_resources import resource_string
import yaml
@contextmanag... |
"""
test utils
"""
from nose.plugins.attrib import attr
from ccx.models import ( # pylint: disable=import-error
CcxMembership,
CcxFutureMembership,
)
from ccx.tests.factories import ( # pylint: disable=import-error
CcxFactory,
CcxMembershipFactory,
CcxFutureMembershipFactory,
)
from student.roles ... |
import shutil
import datetime
import optparse
import stat
from tuf.repository_tool import *
import tuf.util
parser = optparse.OptionParser()
parser.add_option("-c","--consistent-snapshot", action='store_true', dest="consistent_snapshot",
help="Generate consistent snapshot", default=False)
(options, args) = parser.... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from library.mo... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = """
---
module: elasticache_parameter_group
short_description: Manage cache security groups in Amazon Elasticache.
description:
- Manage cache security groups in A... |
from __future__ import division, absolute_import, print_function
import sys
import numpy as np
from numpy.core.test_rational import rational
from numpy.testing import (
TestCase, run_module_suite, assert_, assert_equal, assert_raises,
dec
)
def assert_dtype_equal(a, b):
assert_equal(a, b)
assert_equal(h... |
"""
Storage backend for course import and export.
"""
from __future__ import absolute_import
from django.conf import settings
from django.core.files.storage import get_storage_class
from storages.backends.s3boto import S3BotoStorage
from storages.utils import setting
class ImportExportS3Storage(S3BotoStorage): # pylin... |
"""Backend which can generate charts using the Google Chart API."""
from google.appengine._internal.graphy import line_chart
from google.appengine._internal.graphy import bar_chart
from google.appengine._internal.graphy import pie_chart
from google.appengine._internal.graphy.backends.google_chart_api import encoders
de... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "saleor.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
import sys, os
extensions = []
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'Slybot'
copyright = u'2013, Scrapy team'
version = '0.9'
release = '0.9'
exclude_patterns = ['_build']
pygments_style = 'sphinx'
html_theme = 'default'
html_static_path = ['_static']
htmlhelp_basename ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.