content stringlengths 4 20k |
|---|
#
# test cases for related fields, etc.
#
import unittest
from openerp.osv import fields
from openerp.tests import common
class TestRelatedField(common.TransactionCase):
def setUp(self):
super(TestRelatedField, self).setUp()
self.partner = self.registry('res.partner')
self.company = self.... |
import pytest
from pytest_pootle.factories import StoreDBFactory
from pootle_format.models import Format
from pootle_store.constants import FUZZY, TRANSLATED
from pootle_store.models import Unit
@pytest.mark.django_db
def test_mozlang_update(tp0):
mozlang = Format.objects.get(name="lang")
tp0.project.filety... |
import contextlib
import mock
from nova import test
from nova.tests.virt.vmwareapi import stubs
from nova.virt.vmwareapi import driver
from nova.virt.vmwareapi import fake as vmwareapi_fake
from nova.virt.vmwareapi import volumeops
class VMwareVolumeOpsTestCase(test.NoDBTestCase):
def setUp(self):
def ... |
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 = 'properties01.xlsx'
... |
# -*-coding: utf-8-*-
import os
import pretty_midi as pm
import sys
if __name__=='__main__':
try:
try:
os.remove(os.path.splitext(sys.argv[1])[0] + "_track1.mid")
print("Removed {!r}".format(os.path.splitext(sys.argv[1])[0] + "_track1.mid"))
except:
... |
import logging
from scap.model.oval_5.sc.EntityItemType import EntityItemType
logger = logging.getLogger(__name__)
class EntityItemRegistryTypeType(EntityItemType):
MODEL_MAP = {
'elements': [
],
'attributes': {
},
}
def get_value_enum(self):
return [
'... |
from functools import wraps
import logging
import sys
import os
from inspect import isgeneratorfunction
import signal
from Queue import Empty
from multiprocessing import TimeoutError, cpu_count
from collections import Sequence
from contextlib import contextmanager
from . import signals
from .helpers import (_PackageBo... |
import copy
import hashlib
import json
import posixpath
import re
import socket
import struct
import OpenSSL
from oslo_log import log as logging
import six
from six import moves
from six.moves import http_client as httplib
from six.moves.urllib import parse as urlparse
from tempest_lib import exceptions as lib_exc
fr... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import collections
from django.utils.encoding import force_text
from django.core.validators import RegexValidator
from rest_framework import metadata
from rest_framework import serializers
from rest_framework.utils.field_mapping import ClassLookupDict
f... |
from openerp.addons.website.controllers.main import Website
from openerp.http import request, route
class Website(Website):
@route()
def customize_template_get(self, xml_id, full=False):
res = super(Website, self).customize_template_get(xml_id, full=full)
if full:
for r in request... |
#!/usr/bin/env python
# This script aims to help developers locate forms and view code that needs to
# use the new CSRF protection in Django 1.2. It tries to find all the code that
# may need the steps described in the CSRF documentation. It does not modify
# any code directly, it merely attempts to locate it. Deve... |
from ctypes import *
import unittest
class SimpleTestCase(unittest.TestCase):
def test_cint(self):
x = c_int()
self.assertEqual(x._objects, None)
x.value = 42
self.assertEqual(x._objects, None)
x = c_int(99)
self.assertEqual(x._objects, None)
def test_ccharp(sel... |
from jacket.objects.compute import base
from jacket.objects.compute import fields
@base.NovaObjectRegistry.register
class VirtCPUTopology(base.NovaObject):
# Version 1.0: Initial version
VERSION = '1.0'
fields = {
'sockets': fields.IntegerField(nullable=True, default=1),
'cores': fields.I... |
import glob
from optparse import OptionParser
import subprocess
import os
import os.path
import shutil
import sys
import tarfile
version = 'build-all.py, version 0.01'
build_dir = '../../output/all-kernels'
make_command = ["zImage", "modules"]
make_env = os.environ
pwd = os.environ.get("PWD")
make_env.update({
... |
class MeshData(object):
def __init__(self, **kwargs):
self.name = kwargs.get("name")
self.vertex_format = [
(b'v_pos', 3, 'float'),
(b'v_normal', 3, 'float'),
(b'v_tc0', 2, 'float')]
self.vertices = []
self.indices = []
def calculate_normals(s... |
import json
from hamcrest import assert_that, equal_to
from ycm.tests.conftest import UserOptions
from ycm.tests.test_utils import MockVimModule
vim_mock = MockVimModule()
from ycm.client import completion_request
class ConvertCompletionResponseToVimDatas_test:
""" This class tests the
completion_request.Con... |
import time
from lxml import etree
from openerp.osv import fields, osv
class asset_modify(osv.osv_memory):
_name = 'asset.modify'
_description = 'Modify Asset'
_columns = {
'name': fields.char('Reason', size=64, required=True),
'method_number': fields.integer('Number of Depreciations', re... |
import httplib as http
from flask import request
from django.core.exceptions import ValidationError
from framework.auth.decorators import collect_auth
from osf.models import AbstractNode
from website.exceptions import InvalidTagError, NodeStateError, TagNotFoundError
from website.project.decorators import (
must_... |
"""SCons.Tool.suncc
Tool-specific initialization for Sun Solaris (Forte) CC and cc.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010... |
from yowsup.layers import YowLayer, YowLayerEvent
from yowsup.layers.network import YowNetworkLayer
from .encoder import WriteEncoder
from .decoder import ReadDecoder
from .tokendictionary import TokenDictionary
class YowCoderLayer(YowLayer):
PROP_DOMAIN = "org.openwhatsapp.yowsup.prop.domain"
PROP_RESOURCE ... |
"""
========================
Cycle finding algorithms
========================
"""
# Copyright (C) 2010-2012 by
# Aric Hagberg <<EMAIL>>
# Dan Schult <<EMAIL>>
# Pieter Swart <<EMAIL>>
# All rights reserved.
# BSD license.
from collections import defaultdict
import networkx as nx
from networkx.utils... |
from autobahn.twisted.websocket import WebSocketClientProtocol, \
WebSocketClientFactory
from twisted.internet.defer import Deferred, inlineCallbacks
def sleep(delay):
d = Deferred()
reactor.callLater(delay, d.callback, None)
return d
class MyClientProtocol(WebSocketClientProtocol):
def onConn... |
from __future__ import absolute_import, division, unicode_literals
from . import base
class Filter(base.Filter):
"""Injects ``<meta charset=ENCODING>`` tag into head of document"""
def __init__(self, source, encoding):
"""Creates a Filter
:arg source: the source token stream
:arg en... |
import os.path
from django.utils.translation import ugettext_lazy as _
from desktop.lib.conf import Config, UnspecifiedConfigSection, ConfigSection, coerce_bool
QUERY_SERVERS = UnspecifiedConfigSection(
"query_servers",
help=_("One entry for each Query Server that can execute some queries."),
each=ConfigSecti... |
from collections import deque, Counter
class StopRecursion(Exception):
pass
class Queue:
def __init__(self, t):
self.total = t
self.used = 0
self.queue = deque()
def push(self,index,time):
if time + self.used > self.total:
return False
self.queue.append... |
import os
from operator import itemgetter
from random import randint
import asyncpg
from crax import Crax
from crax.response_types import BaseResponse, JSONResponse
from crax.urls import Route, Url
from crax.views import JSONView, TemplateView
READ_ROW_SQL = 'SELECT "id", "randomnumber" FROM "world" WHERE id = $1'
WRI... |
"""Help for building DNS wire format messages"""
import cStringIO
import struct
import random
import time
import dns.exception
import dns.tsig
QUESTION = 0
ANSWER = 1
AUTHORITY = 2
ADDITIONAL = 3
class Renderer(object):
"""Helper class for building DNS wire-format messages.
Most applications can use the hi... |
#!/usr/bin/env python
# encoding: utf-8
# Andre Anjos <<EMAIL>>
# Thu Mar 20 12:38:14 CET 2014
"""Helps looking for Boost on stock file-system locations"""
import os
import re
import sys
import glob
from distutils.version import LooseVersion
from .utils import uniq, egrep, find_header, find_library
def boost_versio... |
# -*- coding: utf-8 -*-
#
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath... |
#
# iso2022_jp_3.py: Python Unicode Codec for ISO2022_JP_3
#
# Written by Hye-Shik Chang <<EMAIL>>
#
import _codecs_iso2022, codecs
import _multibytecodec as mbc
codec = _codecs_iso2022.getcodec('iso2022_jp_3')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncoder(m... |
from cStringIO import StringIO
import json
import unittest
from zipfile import ZipFile
from compiled_file_system import CompiledFileSystem
from content_provider import ContentProvider
from file_system import FileNotFoundError
from object_store_creator import ObjectStoreCreator
from path_canonicalizer import PathCanoni... |
"""Provide some widely useful utilities. "from utils import *".
"""
import bisect
#______________________________________________________________________________
# Queues: Stack, FIFOQueue, PriorityQueue
class Queue:
"""Queue is an abstract class/interface. There are three types:
Stack(): A Last In First... |
from __future__ import unicode_literals
import six
from csvkit import CSVKitReader
from django.db import connection
from django.conf import settings
from postgres_copy import CopyMapping
from django.db.models.loading import get_model
from calaccess_raw.management.commands import CalAccessCommand
from django.core.manage... |
import urllib2
try:
import json
except ImportError:
import simplejson as json
import os
import os.path
import sys
import ConfigParser
import StringIO
configparser = None
def get_from_rhc_config(variable):
global configparser
CONF_FILE = os.path.expanduser('~/.openshift/express.conf')
if os.path.e... |
#!/usr/bin/env python
"""Pandoc filter to convert Blockquotes with attributes into Div
with attributes.
Usage:
pandoc source.md --filter=blockquote2div.py --output=output.html
A blockquote will be converted if
1. it begins with a header
2. that either
1. matches "Prerequisites", "Objectives", "Callout" o... |
'''
Created on 1.12.2016
@author: Darren
'''
'''
A 2d grid map of m rows and n columns is initially filled with water. We may perform an addLand operation which turns the water at position (row, col) into a land. Given a list of positions to operate, count the number of islands after each addLand operation. An island ... |
"""
Tests forward declarations coming from the `std` module.
"""
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
import os
class TestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
# We only emulate a fake libc++ in this test and do... |
from django.contrib.auth.models import Group
from django.contrib import messages
from django.shortcuts import render, redirect
from django.db import transaction
from jsonview.decorators import json_view
from airmozilla.base import mozillians
from airmozilla.manage import forms
from .decorators import (
staff_req... |
__all__ = []
# The following pattern is used below for importing sub-modules:
#
# 1. "from foo import *". This imports all the names from foo.__all__ into
# this module. But, this does not put those names into the __all__ of
# this module. This enables "from sympy.physics.optics import TWave" to
# work.
# 2.... |
from test.json_tests import PyTest, CTest
class JSONTestObject:
pass
class TestRecursion:
def test_listrecursion(self):
x = []
x.append(x)
try:
self.dumps(x)
except ValueError:
pass
else:
self.fail("didn't raise ValueError on list r... |
"""Tests for LazyAdamOptimizer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.opt.python.training import lazy_adam_optimizer
from tensorflow.python.framework import constant_op
from tensorflow.python.framewor... |
import uuid
from django import http
from django.core.urlresolvers import reverse
from mox import IsA
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
class FlavorsTests(test.BaseAdminViewTests):
def test_create_new_flavor_when_none_exist(self):
flavor = self.flavo... |
from msrest.serialization import Model
class ApplicationGatewayBackendHealthServer(Model):
"""Application gateway backendhealth http settings.
:param address: IP address or FQDN of backend server.
:type address: str
:param ip_configuration: Reference of IP configuration of backend server.
:type i... |
# encoding: utf-8
import logging
from framework.celery_tasks import app
from framework.postcommit_tasks.handlers import run_postcommit
logger = logging.getLogger(__name__)
@run_postcommit(once_per_request=False, celery=True)
@app.task(max_retries=5, default_retry_delay=60)
def increment_user_activity_counters(user... |
data = (
'kweon', # 0x00
'kweonj', # 0x01
'kweonh', # 0x02
'kweod', # 0x03
'kweol', # 0x04
'kweolg', # 0x05
'kweolm', # 0x06
'kweolb', # 0x07
'kweols', # 0x08
'kweolt', # 0x09
'kweolp', # 0x0a
'kweolh', # 0x0b
'kweom', # 0x0c
'kweob', # 0x0d
'kweobs', # 0x0e
'kweos', # 0x... |
"""Back-end code to support the Prereg Challenge initiative
Keeping the code together in this file should make it easier to remove the
features added to the OSF specifically to support this initiative in the future.
Other resources that are a part of the Prereg Challenge:
* website/static/js/pages/prereg-landing-pag... |
## Graphite local_settings.py
# Edit this file to customize the default Graphite webapp settings
#
# Additional customizations to Django settings can be added to this file as well
#####################################
# General Configuration #
#####################################
# Set this to a long, random unique s... |
"""
Test for LMS courseware app.
"""
from textwrap import dedent
from unittest import TestCase
from django.core.urlresolvers import reverse
import mock
from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from courseware.tests.helpers import LoginEnrollmentTestCase
from x... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
Implements reading & writing for the Minecraft Named Binary Tag (NBT) format,
created by Markus Petersson.
.. moduleauthor:: Tyler Kennedy <<EMAIL>>
"""
import gzip
from struct import unpack, pack
class BaseTag(object):
def __init__(self, value, name=None):
... |
from horton import * # pylint: disable=wildcard-import,unused-wildcard-import
def check_bond_orders(fn):
mol = IOData.from_file(fn)
operators = get_mulliken_operators(mol.obasis)
dm_full = mol.get_dm_full()
if dm_full is not None:
dm_spin = mol.get_dm_spin()
if dm_spin is not None:
... |
from ipalib import api
from ipalib.plugable import Registry
from ipaserver.advise.base import Advice
register = Registry()
@register()
class config_fedora_authconfig(Advice):
"""
Provides client configuration instructions using authconfig.
"""
description = 'Authconfig instructions for configuring F... |
from base import BasePickler
__all__ = [
'MetaExpressionPickler',
]
# ===----------------------------------------------------------------------===
# m-expression syntax:
#
# TBD...
class MetaExpressionPickler(BasePickler):
pass
# ===----------------------------------------------------------------------===
# En... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
__all__ = ['LookupBase']
class LookupBase:
def __init__(self, loader=None, **kwargs):
self._loader = loader
def _flatten(self, terms):
ret = []
for term in terms:
if isinstance(term, (l... |
# coding: utf-8
import setpath
import functions
from string import Template
class myTemplate(Template):
delimiter=r'%'
pattern = r"""
%(delim)s(?:
(?P<escaped>%(delim)s) | # Escape sequence of two delimiters
(?P<named>^) | # delimiter and a Python identifier
{(?P<braced>%(id)s)}... |
"""get the loop data to draw the diagram
Other notes:
- tested for idd version 6.0
- when E+ is updated, run versionchangecheck.py for the following objects
uses the following objects
['plantloop', ]
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __... |
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy._lib.decorator import decorator as _decorator
__all__ = ['delaunay_plot_2d', 'convex_hull_plot_2d', 'voronoi_plot_2d']
@_decorator
def _held_figure(func, obj, ax=None, **kw):
import matplotlib.pyplot as plt
if ax... |
# coding=utf-8
"""The MS5637 has only five basic commands:
1. Reset
2. Read PROM (112 bit of calibration words)
3. D1 conversion (pressure)
4. D2 conversion (temperature)
5. Read ADC result (24 bit pressure / temperature
They are executed in order. A loop can then be shortened to steps 3-5
Code initiated by Yadwinder S... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'cluz_form_create.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
... |
"""Test running bitcoind with the -rpcbind and -rpcallowip options."""
import socket
import sys
from test_framework.test_framework import BitcoinTestFramework, SkipTest
from test_framework.util import *
from test_framework.netutil import *
class RPCBindTest(BitcoinTestFramework):
def __init__(self):
su... |
from msrest.serialization import Model
class VirtualNetworkUsageName(Model):
"""Usage strings container.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar localized_value: Localized subnet size and usage string.
:vartype localized_value: str
:ivar ... |
"""
Client classes for web services.
"""
import copy
import json
import uuid
from oslo_log import log as logging
import requests
import six
import six.moves.urllib.parse as urlparse
from cinder import exception
from cinder.i18n import _, _LE
from cinder.volume.drivers.netapp.eseries import utils
LOG = logging.getL... |
import sqlalchemy as sa
from twisted.trial import unittest
from buildbot.test.util import migration
from buildbot.util import sautils
class Migration(migration.MigrateTestMixin, unittest.TestCase):
def setUp(self):
return self.setUpMigrateTest()
def tearDown(self):
return self.tearDownMigr... |
from collections import abc
import sys
_marker = object()
class istr(str):
"""Case insensitive str."""
__is_istr__ = True
def __new__(cls, val='',
encoding=sys.getdefaultencoding(), errors='strict'):
if getattr(val, '__is_istr__', False):
# Faster than instance chec... |
import functools
from django.core.exceptions import PermissionDenied
from olympia.access import acl
from olympia.amo.decorators import login_required
from olympia.constants import permissions
def _view_on_get(request):
"""Return True if the user can access this page.
If the user is in a group with rule 'Re... |
# encoding: utf8
from __future__ import unicode_literals
from django.db import models, migrations
import autoslug.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Country',
fields=[
('id', model... |
from boto.file.bucket import Bucket
class FileConnection(object):
def __init__(self, file_storage_uri):
# FileConnections are per-file storage URI.
self.file_storage_uri = file_storage_uri
def get_bucket(self, bucket_name, validate=True, headers=None):
return Bucket(bucket_name, self.... |
from rdflib.py3compat import format_doctest_out
__doc__ = format_doctest_out("""
===================
Namespace Utilities
===================
RDFLib provides mechanisms for managing Namespaces.
In particular, there is a :class:`~rdflib.namespace.Namespace` class
that takes as its argument the base URI of the namespac... |
import unittest, sys, random, time
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_browse as h2b, h2o_import as h2i
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
pass
print "Will build clouds with incre... |
#!/usr/bin/env python3
import argparse
import collections
import re
from map_helpers import parse_map
if __name__=='__main__':
parser = argparse.ArgumentParser()
parser.add_argument("mapfile")
args = parser.parse_args()
M = parse_map(args.mapfile)
# Format of this map parsing
# dict(coordinat... |
from Plugins.Plugin import PluginDescriptor
from Components.Scanner import scanDevice
from Screens.InfoBar import InfoBar
import os
def execute(option):
print "execute", option
if option is None:
return
(_, scanner, files, session) = option
scanner.open(files, session)
def mountpoint_choosen(option):
if optio... |
import os
import shutil
import subprocess
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
def main():
if len(sys.argv) != 2:
print 'usage: %s <output.html>' % sys.argv[0]
return 1
env = os.environ.copy()
env['GYP_GENERATORS'] = 'dump_dependency_json'
print 'Dumping dependencies...'
... |
import gdb
class CachedType:
def __init__(self, name):
self._type = None
self._name = name
def _new_objfile_handler(self, event):
self._type = None
gdb.events.new_objfile.disconnect(self._new_objfile_handler)
def get_type(self):
if self._type is None:
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.univention_u... |
from __future__ import with_statement
import test_shunt # pyflakes.ignore
import contextlib
from assetman.settings import Settings
from assetman.compile import NeedsCompilation
from assetman.S3UploadThread import upload_assets_to_s3
import assetman.compile
import tempfile
import logging
COMPILED_ASSET_DIR=tempfile.m... |
"""
A simple recursive-descent parser for the table file format.
The grammar implemented here is roughly (taking some liberties with whitespace
and comment parsing):
table_file ::= ( BLANK_LINE | table_def ) end_of_file ;
table_def ::= "--" IDENT CITATION NL
table_header
( table_row )+ ;
table_header ::= ( ID... |
import os
# toolchains options
ARCH = 'unicore32'
CPU = 'sep6200'
TextBase = '0x40000000'
CROSS_TOOL = 'gcc'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = '/usr/unicore/gnu-toolchain-unicore/uc4-1.0-beta-hard-RHELAS5/bin/'
else :
pr... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'LexusLee'
from tornado.gen import coroutine
from tornado import gen
from foundation.log import logger
from serverApp.common.serverAppConfig import YOUDAO_LANG_TYPE
from serverApp.common.aha import RequestHandlerAha, ResponseJSON
from serverApp.tools.youdao import... |
"""Generates common contexts"""
import logging
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from opaque_keys.edx.keys import CourseKey
from opaque_keys import InvalidKeyError
from util.request import COURSE_REGEX
log = logging.getLogger(__name__)
def course_context_from_url(url):
"""
Extrac... |
import errno
import httplib
import json
import socket
import time
import urlparse
from collections import defaultdict
element_key = "element-6066-11e4-a52e-4f735466cecf"
class WebDriverException(Exception):
http_status = None
status_code = None
def __init__(self, message):
self.message = message... |
#!/usr/bin/env python
import sys
# Ugly code, but works.
# Use: ./dat2h.py "" < z80_NP.dat >> bg80d.h; ./dat2h.py "CB" < z80_CB.dat >> bg80d.h; ./dat2h.py "DD" < z80_DD.dat >> bg80d.h; ./dat2h.py "ED" < z80_ED.dat >> bg80d.h; ./dat2h.py "FD" < z80_FD.dat >> bg80d.h; ./dat2h.py "DDCB" < z80_DDCB.dat >> bg80d.h; ... |
from django.core.management.base import LabelCommand, CommandError
from django.utils.encoding import force_unicode
class Command(LabelCommand):
help = "Outputs the specified model as a form definition to the shell."
args = "[app.model]"
label = 'application name and model name'
requires_model_vali... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
try:
import botocore
except ImportError:
pass # will be picked up from... |
"""This script makes it easier to run the SLURM expect test scripts."""
import os
import re
import sys
import time
from optparse import OptionParser
from optparse import OptionValueError
def main(argv=None):
try:
from subprocess import Popen
except:
Popen = poor_Popen_substitute
# "tests"... |
{
'name' : 'Products Expiry Date',
'version' : '1.0',
'author' : 'OpenERP SA',
'category' : 'Specific Industry Applications',
'website': 'https://www.odoo.com',
'depends' : ['stock'],
'demo' : ['product_expiry_demo.xml'],
'description': """
Track different dates on products and productio... |
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 librar... |
"""
Django settings for wedding project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... |
def typechain(*args):
# Start ignoring LineContinuationBear
"""
Returns function which applies the first transformation it can from args
and returns transformed value, or the value itself if it is in args.
>>> function = typechain(int, 'a', ord, None)
>>> function("10")
10
>>> function(... |
"""Provides device automations for Fan."""
from typing import List
import voluptuous as vol
from homeassistant.const import (
CONF_DOMAIN,
CONF_TYPE,
CONF_PLATFORM,
CONF_DEVICE_ID,
CONF_ENTITY_ID,
STATE_ON,
STATE_OFF,
)
from homeassistant.core import HomeAssistant, CALLBACK_TYPE
from homeas... |
#!/usr/bin/env python
import zlib
import subprocess as sp
def deflate(filename, outfile=None, level=6):
f = open(filename)
data = f.read()
f.close()
compress = zlib.compressobj(
level, # level: 0-9
zlib.DEFLATED, # method: must be DEFLATED
-zlib.MAX_WBITS, # window size in bits:
... |
import sys
import time
from django.conf import settings
from django.db.backends.creation import BaseDatabaseCreation
from django.db.utils import DatabaseError
from django.utils.six.moves import input
TEST_DATABASE_PREFIX = 'test_'
PASSWORD = 'Im_a_lumberjack'
class DatabaseCreation(BaseDatabaseCreation):
# Thi... |
import openerp
import openerp.tools as tools
from openerp.osv import osv
from openerp.osv import fields
from openerp.tools.safe_eval import safe_eval as eval
from openerp import SUPERUSER_ID
from openerp.tools.translate import _
class mail_group(osv.Model):
""" A mail_group is a collection of users sharing message... |
"""Helper script to generate unit test lists for the Chromecast build scripts.
"""
import glob
import optparse
import sys
def CombineList(test_files_dir, list_output_file, include_filters,
additional_runtime_options):
"""Writes a unit test file in a format compatible for Chromecast scripts.
If i... |
# -*- coding: utf-8 -*-
from conjure import documents, fields, exceptions
import unittest
import datetime
class FieldTest(unittest.TestCase):
def test_default_values(self):
class User(documents.Document):
_id = fields.StringField(default=lambda: 'test')
name = fields.StringField()
... |
"""
Autopsy Forensic Browser
Copyright 2016 Basis Technology Corp.
Contact: carrier <at> sleuthkit <dot> org
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICE... |
# pylint: disable=too-many-instance-attributes
# pylint: disable=unused-variable
# pylint: disable=too-many-arguments
'''
twitter.py contains a handful of methods for interacting
with Twitter data and returning the responses as JSON.
'''
import urlparse
import oauth2 as oauth
import requests
import base64, random
im... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
import time
from functools import partial
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.connection import exec_command
from ansible.modul... |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.http import HttpResponse
from django.views.static import serve as static_serve
from funfactory.monkeypatches import patch... |
#!/usr/bin/env python
import sys
# Disable creating .pyc files
sys.dont_write_bytecode = True
import os
import flask
import jinja_patch
from jutsu.lib.plugins import get_plugins
from jutsu.lib.db import db_session
class JutsuApp(flask.Flask):
def __init__(self, name):
super(JutsuApp, self).__init__(name)
jinja_... |
# 3p
import mock
# project
from checks import AGENT_METRICS_CHECK_NAME
from tests.checks.common import AgentCheckTest, load_check
MOCK_CONFIG = {
'instances': [
{'process_metrics': [
{
'name': 'memory_info',
'type': 'gauge',
'active': 'yes'
... |
import unittest
from ansible.modules.cloud.google._gcp_url_map import _build_path_matchers, _build_url_map_dict
class TestGCPUrlMap(unittest.TestCase):
"""Unit tests for gcp_url_map module."""
params_dict = {
'url_map_name': 'foo_url_map_name',
'description': 'foo_url_map description',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.