code stringlengths 1 199k |
|---|
from __future__ import unicode_literals
from django.db import migrations
from django.utils.text import slugify
def create_slugs(apps, schema_editor):
Value = apps.get_model("product", "AttributeChoiceValue")
for value in Value.objects.all():
value.slug = slugify(value.display)
value.save()
class... |
"""
sphinxit.core.constants
~~~~~~~~~~~~~~~~~~~~~~~
Defines some Sphinx-specific constants.
:copyright: (c) 2013 by Roman Semirook.
:license: BSD, see LICENSE for more details.
"""
from collections import namedtuple
RESERVED_KEYWORDS = (
'AND',
'AS',
'ASC',
'AVG',
'BEGIN',
'B... |
"""
Provides textual descriptions for :mod:`behave.model` elements.
"""
from behave.textutil import indent
def escape_cell(cell):
"""
Escape table cell contents.
:param cell: Table cell (as unicode string).
:return: Escaped cell (as unicode string).
"""
cell = cell.replace(u'\\', u'\\\\')
c... |
import heapq
import os
import platform
import random
import signal
import subprocess
OUT_DIR = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'out'))
def list_processes_linux():
"""Returns list of tuples (pid, command) of processes running in the same out
directory as this checkout.
... |
from django.utils.translation import gettext_lazy as _
from wagtail.admin.ui.tables import Column, StatusFlagColumn, TitleColumn
from wagtail.admin.views import generic
from wagtail.admin.viewsets.model import ModelViewSet
from wagtail.core.models import Site
from wagtail.core.permissions import site_permission_policy
... |
"""Tests for Gosper's algorithm for hypergeometric summation. """
from sympy import binomial, factorial, gamma, Poly, S, simplify, sqrt, exp, log, Symbol
from sympy.abc import a, b, j, k, m, n, r, x
from sympy.concrete.gosper import gosper_normal, gosper_sum, gosper_term
def test_gosper_normal():
assert gosper_norm... |
from __future__ import print_function, absolute_import, division
import os
import shutil
from itertools import product
import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.tests.helper import assert_quantity_allclose
from astropy import units as u
from casa_formats_io import coordsys_... |
from test_support import verify, verbose, TestFailed
from string import join
from random import random, randint
SHIFT = 15
BASE = 2 ** SHIFT
MASK = BASE - 1
MAXDIGITS = 10
special = map(long, [0, 1, 2, BASE, BASE >> 1])
special.append(0x5555555555555555L)
special.append(0xaaaaaaaaaaaaaaaaL)
p2 = 4L # 0 and 1 already a... |
from django.views.generic import TemplateView
class Home( TemplateView ):
# Set the view template
template_name = 'index.html' |
"""A collection of string constants.
Public module variables:
whitespace -- a string containing all ASCII whitespace
ascii_lowercase -- a string containing all ASCII lowercase letters
ascii_uppercase -- a string containing all ASCII uppercase letters
ascii_letters -- a string containing all ASCII letters
digits -- a st... |
from base import *
DIR = "headerop_add2"
HEADERS = [("X-What-Rocks", "Cherokee does"),
("X-What-Sucks", "Failed QA tests"),
("X-What-Is-It", "A successful test")]
CONF = """
vserver!1!rule!2560!match = directory
vserver!1!rule!2560!match!directory = /%(DIR)s
vserver!1!rule!2560!handler = dirlist
"... |
"""Add theme to config
Revision ID: 58ee75910929
Revises: 1c22ceb384a7
Create Date: 2015-08-28 15:15:47.971807
"""
revision = '58ee75910929'
down_revision = '1c22ceb384a7'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.execute("INSERT INTO config (category, key, value, description) VALUES ('genera... |
'''
Exodus Add-on
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 3 of the License, or
(at your option) any later version.
This program is distributed in the hop... |
from .main import IMDB
def start():
return IMDB()
config = [{
'name': 'imdb',
'groups': [
{
'tab': 'automation',
'name': 'imdb_automation',
'label': 'IMDB',
'description': 'From any <strong>public</strong> IMDB watchlists. Url should be the RSS link.',... |
DOCUMENTATION = '''
module: systemd
author:
- "Ansible Core Team"
version_added: "2.2"
short_description: Manage services.
description:
- Controls systemd services on remote hosts.
options:
name:
required: true
description:
- Name of the service.
aliases: ['unit', 'servi... |
{
'name': 'Booths/Exhibitors Bridge',
'category': 'Marketing/Events',
'version': '1.0',
'summary': 'Event Booths, automatically create a sponsor.',
'description': """
Automatically create a sponsor when renting a booth.
""",
'depends': ['website_event_exhibitor', 'website_event_booth'],
... |
"""
flask.views
~~~~~~~~~~~
This module provides class-based views inspired by the ones in Django.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from .globals import request
http_method_funcs = frozenset(['get', 'post', 'head', 'options',
... |
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
'''
Read content from txt file.
'''
import os, re
from calibre import prepare_string_for_xml, isbytestring
from calibre.ebooks.metadata.opf2 import OPFCreator
from calibre.ebooks.conversion.prepro... |
"""
Bookmarks module.
"""
from collections import namedtuple
DEFAULT_FIELDS = [
'id',
'course_id',
'usage_id',
'block_type',
'created',
]
OPTIONAL_FIELDS = [
'display_name',
'path',
]
PathItem = namedtuple('PathItem', ['usage_key', 'display_name']) |
from __future__ import unicode_literals
import base64
import io
import itertools
import os
import time
import xml.etree.ElementTree as etree
from .common import FileDownloader
from .http import HttpFD
from ..utils import (
struct_pack,
struct_unpack,
compat_urlparse,
format_bytes,
encodeFilename,
... |
from cinder.exception import *
from cinder.i18n import _
class ProviderMultiVolumeError(CinderException):
msg_fmt = _("volume %(volume_id)s More than one provider_volume are found")
class ProviderMultiSnapshotError(CinderException):
msg_fmt = _("snapshot %(snapshot_id)s More than one provider_snapshot are found... |
"""Unit test for depstree."""
__author__ = 'nnaze@google.com (Nathan Naze)'
import unittest
import jscompiler
class JsCompilerTestCase(unittest.TestCase):
"""Unit tests for jscompiler module."""
def testGetJsCompilerArgs(self):
args = jscompiler._GetJsCompilerArgs(
'path/to/jscompiler.jar',
1.6,... |
from __future__ import print_function
import unittest
import numpy as np
from op_test import OpTest
def modified_huber_loss_forward(val):
if val < -1:
return -4. * val
elif val < 1:
return (1. - val) * (1. - val)
else:
return 0.
class TestModifiedHuberLossOp(OpTest):
def setUp(se... |
"""Support for Cisco IOS Routers."""
import logging
import re
from pexpect import pxssh
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN,
PLATFORM_SCHEMA as PARENT_PLATFORM_SCHEMA,
DeviceScanner,
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF... |
from __future__ import print_function
from pyspark.ml.feature import MaxAbsScaler
from pyspark.sql import SparkSession
if __name__ == "__main__":
spark = SparkSession\
.builder\
.appName("MaxAbsScalerExample")\
.getOrCreate()
# $example on$
dataFrame = spark.read.format("libsvm").loa... |
"""Tests for SoftmaxOp and LogSoftmaxOp."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import numpy as np
import tensorflow as tf
class SoftmaxTest(tf.test.TestCase):
def _npSoftmax(self, features, log=False):
batch_dim = 0
class_dim... |
import abc
import mock
import pytest
from addons.base.tests.utils import MockFolder
from django.utils import timezone
from framework.auth import Auth
from framework.exceptions import HTTPError
from nose.tools import (assert_equal, assert_false, assert_in, assert_is,
assert_is_none, assert_not_in... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
from nose.plugins.attrib import attr
import os
from ncclient.manager import Manager, make_device_handler
from ncclient.transport import SSHSession
from jnpr.junos import Device
from jnpr.junos.utils.fs import FS
from mock import pa... |
from django.contrib.auth.backends import ModelBackend
from django.contrib.sites.models import Site
from socialregistration.contrib.twitter.models import TwitterProfile
class TwitterAuth(ModelBackend):
def authenticate(self, twitter_id=None):
try:
return TwitterProfile.objects.get(
... |
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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 3 of the License, or
(at your option) any later version.
This pro... |
"""
***************************************************************************
SetRasterStyle.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*************************************************... |
'''
Element Software Node Operation
'''
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
DOCUMENTATION = '''
module: na_elementsw_node
short_des... |
from . import SearchBackend
import importlib
import logging
class SearchBroker(SearchBackend):
def __init__(self, config_name=None):
super(SearchBroker, self).__init__(config_name)
self._servers = {}
if self._settings is None:
return
for server in self._settings:
... |
from odoo import api, fields, models, tools
from odoo.exceptions import UserError
import os
from odoo.tools import misc
import re
CORE_COST_METHOD = [('average', u'全月一次加权平均法'),
('std',u'定额成本'),
('fifo', u'先进先出法'),
]
class ResCompany(models.Model):
_inherit... |
"""
Tests for the LTI user management functionality
"""
import string
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from django.test import TestCase
from django.test.client import RequestFactory
from mock import MagicMock, patch
import lti_provider.users as users
from l... |
"""
some unit tests to make sure sftp works well with large files.
a real actual sftp server is contacted, and a new folder is created there to
do test file operations in (so no existing files will be harmed).
"""
import os
import random
import struct
import sys
import time
import unittest
from paramiko.common import o... |
import pandas as pd
import numpy as np
import pymbar
from pymbar.testsystems.pymbar_datasets import load_gas_data, load_8proteins_data
import time
def load_oscillators(n_states, n_samples):
name = "%dx%d oscillators" % (n_states, n_samples)
O_k = np.linspace(1, 5, n_states)
k_k = np.linspace(1, 3, n_states)... |
"""
Flex compatibility tests.
@since: 0.1.0
"""
import unittest
import pyamf
from pyamf import flex, util, amf3, amf0
from pyamf.tests.util import EncoderMixIn
class ArrayCollectionTestCase(unittest.TestCase, EncoderMixIn):
"""
Tests for L{flex.ArrayCollection}
"""
amf_type = pyamf.AMF3
def setUp(se... |
""" Python Character Mapping Codec iso8859_1 generated from 'MAPPINGS/ISO8859/8859-1.TXT' with gencodec.py.
"""#"
import codecs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
ret... |
from datetime import datetime, timedelta
from gevent import spawn_later
from gevent.event import Event
from tellapart.aurproxy.audit import AuditItem
from tellapart.aurproxy.share.adjuster import ShareAdjuster
def linear(start_time, end_time, as_of):
if start_time >= as_of:
return 0.0
if end_time <= as_of:
... |
import time
import Axon
from Kamaelia.Util.Backplane import *
from Kamaelia.Util.Console import *
from Kamaelia.Chassis.Pipeline import Pipeline
class Source(Axon.ThreadedComponent.threadedcomponent):
value = 1
sleep = 1
def main(self):
while 1:
self.send(str(self.value), "outbox")
... |
"""Tests for multi_worker_util."""
from tensorflow.core.protobuf import cluster_pb2
from tensorflow.python.distribute import multi_worker_util
from tensorflow.python.eager import test
from tensorflow.python.training import server_lib
class NormalizeClusterSpecTest(test.TestCase):
def assert_same_cluster(self, lhs, rh... |
import sys
tests=[
("testExecs/testFeatures.exe","",{}),
]
longTests=[
]
if __name__=='__main__':
import sys
from rdkit import TestRunner
failed,tests = TestRunner.RunScript('test_list.py',0,1)
sys.exit(len(failed)) |
import re
import os
from autotest.client.shared import error
from virttest import virsh
from provider import libvirt_version
def run(test, params, env):
"""
Test command: virsh net-list.
The command returns list of networks.
1.Get all parameters from configuration.
2.Get current network's status(Sta... |
import re
from checkpackagelib.base import _CheckFunction
from checkpackagelib.lib import ConsecutiveEmptyLines # noqa: F401
from checkpackagelib.lib import EmptyLastLine # noqa: F401
from checkpackagelib.lib import NewlineAtEof # noqa: F401
from checkpackagelib.lib import TrailingSpace # n... |
DOCUMENTATION = """
---
module: ops_config
version_added: "2.1"
author: "Peter sprygada (@privateip)"
short_description: Manage OpenSwitch configuration using CLI
description:
- OpenSwitch configurations use a simple block indent file syntax
for segmenting configuration into sections. This module provides
an... |
from StringIO import StringIO
import os
import socket
from cloudinit import helpers
from cloudinit import util
PUPPET_CONF_PATH = '/etc/puppet/puppet.conf'
PUPPET_SSL_CERT_DIR = '/var/lib/puppet/ssl/certs/'
PUPPET_SSL_DIR = '/var/lib/puppet/ssl'
PUPPET_SSL_CERT_PATH = '/var/lib/puppet/ssl/certs/ca.pem'
def _autostart_p... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re
from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.module_utils import six
from ansible.module_utils._text import to_text
from ansible.module_utils.common._collections_compat ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}
def load_fixture(name):
path = os.path.j... |
"""
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.exception import SqlmapUnsupportedFeatureException
from plugins.generic.filesystem import Filesystem as GenericFilesystem
class Filesystem(GenericFilesystem):
def __init__(self):
... |
import config
import comm
import sys
import time
import signal
from jderobotTypes import BumperData
if __name__ == '__main__':
cfg = config.load(sys.argv[1])
jdrc= comm.init(cfg, "Test")
client = jdrc.getBumperClient("Test.Bumper")
while True:
#print("client1", end=":")
bumper = client.g... |
import unittest
from cert import test_user_agent
class Logger(object):
"""Dummy logger"""
def test_status(this, *args):
pass
class TestCert(unittest.TestCase):
def setUp(self):
self.logger = Logger()
def test_test_user_agent(self):
self.assertFalse(test_user_agent("Mozilla/5.0 (A... |
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, cint
from frappe import throw, _
from frappe.model.document import Document
class RootNotEditable(frappe.ValidationError): pass
class Account(Document):
nsm_parent_field = 'parent_account'
def onload(self):
frozen_accounts_modifier... |
from openstack_dashboard.test.integration_tests import helpers
from openstack_dashboard.test.integration_tests.regions import messages
class TestFloatingip(helpers.TestCase):
"""Checks that the user is able to allocate/release floatingip."""
def test_floatingip(self):
floatingip_page = \
sel... |
import pytest
from api.base.settings.defaults import API_BASE
from api_tests.nodes.views.test_node_institutions_list import TestNodeInstitutionList
from osf_tests.factories import DraftRegistrationFactory, AuthUserFactory
@pytest.fixture()
def user():
return AuthUserFactory()
@pytest.fixture()
def user_two():
r... |
"""
The Zuul module adds triggers that configure jobs for use with Zuul_.
To change the Zuul notification URL, set a global default::
- defaults:
name: global
zuul-url: http://127.0.0.1:8001/jenkins_endpoint
The above URL is the default.
.. _Zuul: http://ci.openstack.org/zuul/
"""
def zuul():
"""yaml: zuu... |
"""
Rename admin role from gGRC Admin to Administrator.
Create Date: 2016-06-03 12:02:09.438599
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
revision = 'c9218e757bc'
down_revision = '4d5180ab1b42'
roles_table = table(
'roles',
column('id', sa.Integer),
column('... |
"""Python AST pretty-printer.
Copyright(C) 2007, Martin Blais <blais@furius.ca>
This module exports a function that can be used to print a human-readable
version of the AST.
This code is downloaded verbatim from:
http://code.activestate.com/recipes/533146/
"""
__author__ = 'Martin Blais <blais@furius.ca>'
import sy... |
"""Starter script for Nova Metadata API."""
import sys
from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr
from nova.conductor import rpcapi as conductor_rpcapi
import nova.conf
from nova import config
from nova import objects
from nova.objects import base as objects_base
from nov... |
import math, shelve, decimal
from twisted.internet import reactor, defer
from autobahn.wamp import exportRpc, \
exportSub, \
exportPub, \
WampServerFactory, \
WampServerProtocol
class Simple:
"""
A simple calc ... |
import json
import os
import random
import shutil
import subprocess
import time
from shlex import split
from subprocess import check_call, check_output
from subprocess import CalledProcessError
from socket import gethostname
from charms import layer
from charms.layer import snap
from charms.reactive import hook
from ch... |
from ducktape.cluster.remoteaccount import RemoteCommandError
from ducktape.utils.util import wait_until
class JmxMixin(object):
"""This mixin helps existing service subclasses start JmxTool on their worker nodes and collect jmx stats.
A couple things worth noting:
- this is not a service in its own right.
... |
from __future__ import unicode_literals
def device_from_request(request):
"""
Determine's the device name from the request by first looking for an
overridding cookie, and if not found then matching the user agent.
Used at both the template level for choosing the template to load and
also at the cach... |
import unittest
import numpy as np
import pysal
import pysal.spreg as EC
from scipy import sparse
from pysal.common import RTOL
PEGP = pysal.examples.get_path
class TestBaseOLS(unittest.TestCase):
def setUp(self):
db = pysal.open(PEGP('columbus.dbf'),'r')
y = np.array(db.by_col("HOVAL"))
sel... |
class Foo(object):
def mm(self, barparam):
'''
@param barparam: this is barparam
'''
f = Foo()
f.mm(barparam=10) |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: gce_instance_template
version_added: "2.3"
short_description: c... |
"""
Build the zipped robofab + dependency distros for RoboFab.
Check out fresh copies of the code from SVN.
Compile into zips.
Write optional html page.
"""
import os, glob, time
def getRevision(url):
""" Ask svn for the revision."""
cmd = "svn info \"%s\""%url
d = os.popen(cmd)
data... |
from collections import namedtuple
from resources import (
agg,
ResourcePlugin,
SnapshotDescriptor,
SnapshotField,
)
from utils.subprocess_output import get_subprocess_output
class Processes(ResourcePlugin):
RESOURCE_KEY = "processes"
FLUSH_INTERVAL = 1 # in minutes
def describe_snapshot(se... |
'''tzinfo timezone information for Africa/Accra.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Accra(DstTzInfo):
'''Africa/Accra timezone definition. See datetime.tzinfo for details'''
zone = 'Africa/Accra'
_utc_trans... |
try:
try:
from neutronclient.neutron import client
except ImportError:
from quantumclient.quantum import client
from keystoneclient.v2_0 import client as ksclient
HAVE_DEPS = True
except ImportError:
HAVE_DEPS = False
DOCUMENTATION = '''
---
module: quantum_network
version_added: "1.... |
from osv import osv, fields
class html_view(osv.osv):
_name = 'html.view'
_columns = {
'name': fields.char('Name', size=128, required=True, select=True),
'comp_id': fields.many2one('res.company', 'Company', select=1),
'bank_ids': fields.one2many('res.partner.bank', 'partner_id', 'Banks')... |
import logging
import os
import re
import signal
import subprocess
import sys
import tempfile
from telemetry.core import platform
from telemetry.core import util
from telemetry.core.platform import profiler
from telemetry.core.platform.profiler import android_profiling_helper
from telemetry.util import support_binaries... |
"""Autogenerated file - DO NOT EDIT
If you spot a bug, please report it on the mailing list and/or change the generator."""
import os
from ....base import (CommandLine, CommandLineInputSpec, SEMLikeCommandLine,
TraitedSpec, File, Directory, traits, isdefined,
InputMultiPath, ... |
from django.contrib.auth import get_user, get_user_model
from django.contrib.auth.models import AnonymousUser, User
from django.core.exceptions import ImproperlyConfigured
from django.db import IntegrityError
from django.http import HttpRequest
from django.test import TestCase, override_settings
from django.utils impor... |
"""
Unit tests for generator_utils.py
"""
import os
import unittest
import generator_utils
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "../../.."))
TESTS_DIR = os.path.join(SCRIPT_DIR, "test_data")
class ParserTest(unittest.TestCase):
TSV_CONTENTS = [[
... |
"""
The `compat` module provides support for backwards compatibility with older
versions of Django/Python, and compatibility wrappers around optional packages.
"""
from __future__ import unicode_literals
import inspect
import django
from django.apps import apps
from django.conf import settings
from django.core.exceptio... |
from tests.unit import unittest
from httpretty import HTTPretty
import urlparse
import json
import mock
import requests
from boto.cloudsearch.search import SearchConnection, SearchServiceException
HOSTNAME = "search-demo-userdomain.us-east-1.cloudsearch.amazonaws.com"
FULL_URL = 'http://%s/2011-02-01/search' % HOSTNAME... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from tensorflow.contrib.distributions.python.ops import operator_pd_full
class OperatorPDFullTest(tf.test.TestCase):
# The only method needing checked (because it isn... |
'''
Test of the mlp/linear layer
'''
import itertools as itt
import numpy as np
from neon import NervanaObject
from neon.initializers.initializer import Uniform
from neon.layers.layer import Linear
def pytest_generate_tests(metafunc):
if metafunc.config.option.all:
bsz_rng = [16, 32, 64]
else:
b... |
import sys
import btceapi
if len(sys.argv) < 4:
print "Usage: cancel_orders.py <key file> <pair> <order type>"
print " key file - Path to a file containing key/secret/nonce data"
print " pair - A currency pair, such as btc_usd"
print " order type - Type of orders to process, either 'buy' or 'se... |
import filecmp
import os
import subprocess
import testhelper
import unittest
class TestSQLFramework(unittest.TestCase):
basedir = os.path.dirname(__file__)
script = os.path.join(basedir, '../scripts/db-seed-i18n.py')
tmpdirs = [(os.path.join(basedir, 'tmp/'))]
sqlsource = os.path.join(basedir, 'data/sql... |
"""Convenience interface to a locally spawned QGIS Server, e.g. for unit tests
.. 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 2 of the License, or
(at your option) any later ... |
from odoo.tests.common import TransactionCase
from odoo.exceptions import ValidationError
class TestHasGroup(TransactionCase):
def setUp(self):
super(TestHasGroup, self).setUp()
self.group0 = 'test_user_has_group.group0'
self.group1 = 'test_user_has_group.group1'
group0, group1 = sel... |
"""
Exposes Django utilities for consumption in the xmodule library
NOTE: This file should only be imported into 'django-safe' code, i.e. known that this code runs int the Django
runtime environment with the djangoapps in common configured to load
"""
import webpack_loader
from crum import get_current_request
def get_c... |
import random
from deap import algorithms
from deap import base
from deap import creator
from deap import tools
from deap import cTools
import sortingnetwork as sn
INPUTS = 6
def evalEvoSN(individual, dimension):
network = sn.SortingNetwork(dimension, individual)
return network.assess(), network.length, network... |
'd'
def x():
print j
j = 0
def y():
for x in []:
print x |
"""nvp_netbinding
Revision ID: 1d76643bcec4
Revises: 3cb5d900c5de
Create Date: 2013-01-15 07:36:10.024346
"""
revision = '1d76643bcec4'
down_revision = '3cb5d900c5de'
migration_for_plugins = [
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
... |
from redash.models import db, Change, AccessPermission, Query, Dashboard
from playhouse.migrate import PostgresqlMigrator, migrate
if __name__ == '__main__':
if not Change.table_exists():
Change.create_table()
if not AccessPermission.table_exists():
AccessPermission.create_table()
migrator =... |
from rollyourown import seo
from django.conf import settings
class DefaultMetadata(seo.Metadata):
""" A very basic default class for those who do not wish to write their own.
"""
title = seo.Tag(head=True, max_length=68)
keywords = seo.MetaTag()
description = seo.MetaTag(max_length=155)
... |
from __future__ import division, absolute_import, print_function
import warnings
import numpy.core.numeric as _nx
from numpy.core.numeric import (
asarray, zeros, outer, concatenate, isscalar, array, asanyarray
)
from numpy.core.fromnumeric import product, reshape
from numpy.core import vstack, atleast_3d
__all... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: tower_host
version_added: "2.3"
short_description: create, update, or destroy Ansible Tower host.
description:
- Create, update, or destroy Ansible Tower ... |
from django import forms
__all__ = ('RatingField',)
class RatingField(forms.ChoiceField):
pass |
from .views import TriggerCRUDL
urlpatterns = TriggerCRUDL().as_urlpatterns() |
ANSIBLE_METADATA = {
'status': ['preview'],
'supported_by': 'core',
'version': '1.0'
}
DOCUMENTATION = """
---
module: ios_system
version_added: "2.3"
author: "Peter Sprygada (@privateip)"
short_description: Manage the system attributes on Cisco IOS devices
description:
- This module provides declarative ... |
"""Middleware to set the request context."""
from aiohttp.web import middleware
from homeassistant.core import callback
@callback
def setup_request_context(app, context):
"""Create request context middleware for the app."""
@middleware
async def request_context_middleware(request, handler):
"""Reque... |
from os.path import dirname, abspath, join
from nose.tools import with_setup
from tests.asserts import prepare_stdout
from tests.asserts import assert_stdout_lines
from lettuce import Runner
current_dir = abspath(dirname(__file__))
join_path = lambda *x: join(current_dir, *x)
@with_setup(prepare_stdout)
def test_output... |
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import struct, sys, os
from collections import OrderedDict, defaultdict
from lxml import ... |
from django.core.management.base import CommandError
from mock import patch
from nose.plugins.attrib import attr
from openedx.core.djangoapps.content.course_overviews.management.commands import generate_course_overview
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from xmodule.modul... |
def drop_rows_by_keywords(self, keywords_values_dict):
"""
Drop the rows based on dictionary of {"keyword":"value"}(applying 'and' operation on dictionary) from column holding xml string.
Ex: keywords_values_dict -> {"SOPInstanceUID":"1.3.6.1.4.1.14519.5.2.1.7308.2101.234736319276602547946349519685", "Manuf... |
"""Project URLs for authenticated users"""
from django.conf.urls import patterns, url
from readthedocs.projects.views.private import AliasList, ProjectDashboard, ImportView
from readthedocs.projects.backends.views import ImportWizardView, ImportDemoView
urlpatterns = patterns(
# base view, flake8 complains if it is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.