content string |
|---|
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'chart_font01.xlsx'
... |
from django.template.smartif import IfParser
from django.utils import unittest
class SmartIfTests(unittest.TestCase):
def assertCalcEqual(self, expected, tokens):
self.assertEqual(expected, IfParser(tokens).parse().eval({}))
# We only test things here that are difficult to test elsewhere
# Many o... |
from redis import StrictRedis
class MetadataBase(object):
def __init__(self, key_base=None, **kwargs):
self.r = StrictRedis(**kwargs)
self.key_base = key_base or 'ufyr:%s' ##Should probably be subclassed
self._get_meta_key = lambda x: self.key_base%x
self._error_key = self... |
# coding: utf8
{
'!langcode!': 'sk',
'!langname!': 'Slovenský',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" je voliteľný výraz ako "field1=\'newvalue\'". Nemôžete upravovať alebo zmazať výsledky JOINu',
'%s %%{row} deleted': '%s zmazaných... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow.compat.v2 as tf
from tf_agents.specs import tensor_spec
from tf_agents.policies import tf_policy
from typing import Any, Callable, Iterable, Optional, Sequence, Text, Tuple,... |
'''in-memory mavlink log'''
from pymavlink import mavutil
class mavmemlog(mavutil.mavfile):
'''a MAVLink log in memory. This allows loading a log into
memory to make it easier to do multiple sweeps over a log'''
def __init__(self, mav, progress_callback=None):
mavutil.mavfile.__init__(self, None, ... |
"""
Make sure msvs_application_type_revision works correctly.
"""
import TestGyp
import os
import sys
import struct
CHDIR = 'winrt-app-type-revision'
print 'This test is not currently working on the bots: https://code.google.com/p/gyp/issues/detail?id=466'
sys.exit(0)
if (sys.platform == 'win32' and
int(os.env... |
"""
Tcpdump parser
Source:
* libpcap source code (file savefile.c)
* RFC 791 (IPv4)
* RFC 792 (ICMP)
* RFC 793 (TCP)
* RFC 1122 (Requirements for Internet Hosts)
Author: Victor Stinner
Creation: 23 march 2006
"""
from lib.hachoir_parser import Parser
from lib.hachoir_core.field import (FieldSet, ParserError,
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import re
import xml.etree.ElementTree as ElementTree
from svg2code.svg_colors import SVG_COLORS
from svg2code.helpers import parseSVGNumber as parseNumber
from os import path
class RGBAColor(object):
"""rgba color format: [0... |
try:
import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.utils.hashcompat import md5_constructor
from django.forms import BooleanField
def security_hash(request, form, *args):
"""
Calculates a security hash for the given Form instance.
This crea... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = r'''
---
module: vmware_host_powermgmt_policy
short_description: Manages the Power Management Policy o... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = r'''
---
module: my_test_info
short_description: This is my test info module
version_added: "1.0.0"
description: This is my longer description explaining my test info module.
options:
name:
descripti... |
'''
The Discretized model, or the sun model.
'''
from numpy import *
from scipy import sparse as sps
import pdb
__all__=['DiscModel','load_discmodel']
class DiscModel(object):
'''
Discrete model class.
Construct:
DiscModel((Elist_neg,Elist_pos),(Tlist_neg,Tlist_pos),z=1.)
z could be one... |
"""RunTesterMap model and related logic.
RunTesterMap stores the relationship between a CompatRun
and a User. It tracks the runs a user is subscribed to.
"""
__author__ = '<EMAIL> (Alexis O. Torres)'
from google.appengine.api import memcache
from google.appengine.ext import db
from models.compat import run as compat... |
"""Tests for cleverhans.experimental.certification.dual_formulation."""
# pylint: disable=missing-docstring
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
import numpy as np
import tensorflow as tf
from cleverhans.experimental.certificatio... |
"""Unit tests for WebJournal."""
__revision__ = \
"$Id$"
# pylint invenio/modules/webjournal/lib/webjournal_tests.py
from invenio.importutils import lazy_import
from invenio.testutils import make_test_suite, run_test_suite, InvenioTestCase
issue_is_later_than = lazy_import('invenio.webjournal:issue_is_later_tha... |
import os
from django.template import Context
from django.template.engine import Engine
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango110Warning
from .utils import ROOT, TEMPLATE_DIR
OTHER_DIR = os.path.join(ROOT, 'other_templates')
@ignore_warnings(cat... |
from pyasn1.type import univ
from pyasn1.codec.cer import decoder
from pyasn1.compat.octets import ints2octs, str2octs, null
from pyasn1.error import PyAsn1Error
from sys import version_info
if version_info[0:2] < (2, 7) or \
version_info[0:2] in ( (3, 0), (3, 1) ):
try:
import unittest2 as unittest
... |
from __future__ import unicode_literals
from django.test import TestCase
from .models import Article, Car, Driver, Reporter
class ManyToOneNullTests(TestCase):
def setUp(self):
# Create a Reporter.
self.r = Reporter(name='John Smith')
self.r.save()
# Create an Article.
se... |
class CamWorkbench ( Workbench ):
"Cam workbench object"
Icon = """
/* XPM */
static const char *Cam_Box[]={
"16 16 3 1",
". c None",
"# c #000000",
"a c #c6c642",
"................",
".......#######..",
"......#aaaaa##..",
".....#aaaaa###..",
"....#aaaaa##a#..",
"...... |
from django.template import Library
register = Library()
def and_n_others(values, limit):
# A helper for the commonly appended "and N other(s)" string, with
# the appropriate pluralization.
return " and %d other%s" % (len(values) - limit,
"" if len(values) == limit + 1 else... |
u"""
Fixer for:
(a,)* *b (,c)* [,] = s
for (a,)* *b (,c)* [,] in d: ...
"""
from lib2to3 import fixer_base
from itertools import count
from lib2to3.fixer_util import (Assign, Comma, Call, Newline, Name,
Number, token, syms, Node, Leaf)
from libfuturize.fixer_util import indentation, sui... |
import os, time
from argparse import ArgumentParser
import numpy as np
from sklearn import svm, metrics
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import ShuffleSplit, GroupKFold
from sklearn.datasets import load_svmlight_file
from sklearn.externals import joblib
from utilities import... |
from setuptools import setup, find_packages
from sos import __version__ as version
name = 'sos'
setup(
name=name,
version=version,
description='Swift Origin Server',
license='Apache License (2.0)',
author='OpenStack, LLC.',
author_email='<EMAIL>',
url='https://github.com/dpgoetz/sos',
... |
""" This is a test of the chain
FTSClient -> FTSManagerHandler -> FTSDB
It supposes that the DB is present, and that the service is running
"""
from DIRAC.Core.Base.Script import parseCommandLine
parseCommandLine()
import unittest
#import mock
import uuid
from DIRAC import gLogger
from DIRAC.DataManagementS... |
"""
WSGI server implementation.
The Python Web Server Gateway Interface (WSGI) is a simple and universal
interface between web servers and web applications or frameworks.
The WSGI interface has two sides: the "server" or "gateway" side, and the
"application" or "framework" side. The server side invokes a callable
obj... |
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, flt
from frappe import _
from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.buying_controller import BuyingController
form_grid_templates = {
"indent_details": "templates/form_grid/material_request_grid.html"
}... |
'''A multi-producer, multi-consumer queue.'''
try:
import threading
except ImportError:
import dummy_threading as threading
from collections import deque
from heapq import heappush, heappop
try:
from time import monotonic as time
except ImportError:
from time import time
__all__ = ['Empty', 'Full', 'Q... |
""" Python 'utf-16' Codec
Written by Marc-Andre Lemburg (<EMAIL>).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import codecs, sys
### Codec APIs
encode = codecs.utf_16_encode
def decode(input, errors='strict'):
return codecs.utf_16_decode(input, errors, True)
class Incremental... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import abc
import lupa
from splash.render_options import BadOption
from splash.utils import truncated
class ImmediateResult(object):
def __init__(self, value):
self.value = value
class AsyncCommand(object):
def __init__(self, id, name,... |
import logging
import os
import signal
import sys
import time
from random import random, shuffle
from tempfile import mkstemp
from eventlet import spawn, patcher, Timeout
import swift.common.db
from swift.container.server import DATADIR
from swift.common.bufferedhttp import http_connect
from swift.common.db import Co... |
""" Create a new managed cpupool.
"""
import sys
from xen.xm.main import serverType, SERVER_XEN_API, server
from xen.xm.cpupool import parseCommandLine, err, help as help_options
from xen.util.sxputils import sxp2map
def help():
return help_options()
def main(argv):
try:
(opts, config) = parseComma... |
#!/usr/bin/env python
"""Configuration parameters for the client."""
from grr.lib import config_lib
from grr.lib import rdfvalue
# General Client options.
config_lib.DEFINE_string("Client.name", "GRR",
"The name of the client. This will be used as a base "
"name to g... |
import logging
from os import getenv
# local
from ona_service.pusher import Pusher
# determine compression to use for transfer
try:
import bz2 # noqa
TAR_MODE = 'w:bz2'
except ImportError:
import gzip # noqa
TAR_MODE = 'w:gz'
FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging.... |
#!/usr/bin/python
import unittest
import omniture
import os
creds = {}
creds['username'] = os.environ['OMNITURE_USERNAME']
creds['secret'] = os.environ['OMNITURE_SECRET']
class ElementTest(unittest.TestCase):
def setUp(self):
fake_list = [{"id":"123","title":"ABC"},{"id":"456","title":"DEF"}]
sel... |
import networkx as nx
import re
import sys
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction import text
from nltk.stem.wordnet import WordNetLemmatizer
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cluster import KMeans, MiniBatch... |
__author__ = "Alexander Hewer"
__email__ = "<EMAIL>"
class ActionBuilder:
def build_fit_action(self, coilPositions, timeStamp):
action = self.__base_action("FIT")
action["points"] = coilPositions
action["timeStamp"] = timeStamp
return action
def build_fix_speaker_action(self)... |
'''
IDE: Eclipse (PyDev)
Python version: 2.7
Operating system: Windows 8.1
@author: Emil Carlsson
@copyright: 2015 Emil Carlsson
@license: This program is distributed under the terms of the GNU General Public License
'''
import Model
import Tkinter as tk
from Tkconstants import LEFT
from PIL import ImageTk
from tkFo... |
"""Test data utilities."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.learn.python.learn.datasets import base
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
... |
import unittest, time, sys
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_rf
# RF train parameters
paramsTrainRF = {
'ntree' : 50,
'depth' : 30,
'bin_limit' : 10000,
'ignore' : 'AirTime,ArrDelay,DepDelay,CarrierDelay,IsArrDelayed',
... |
#!/usr/bin/env python
import os
import sys
import argparse
import time
def main():
progname = os.path.basename(sys.argv[0])
usage = progname + """ [options] <f.txt>
Run p3movie.py to process movies listed in f.txt, and the movies will be deleted to save space.
"""
args_def = {'apix':1.25, 'voltage':200, 'time'... |
"""This module is deprecated. Please use `airflow.providers.amazon.aws.operators.s3_to_redshift`."""
import warnings
# pylint: disable=unused-import
from airflow.providers.amazon.aws.operators.s3_to_redshift import S3ToRedshiftTransfer # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.provid... |
""" Python Virtual Control Panel for EMC
A virtual control panel (VCP) is used to display and control
HAL pins, which are either BIT or FLOAT valued.
Usage: pyvcp -g WxH+X+Y -c compname myfile.xml
compname is the name of the HAL component to be created.
The name of the HAL pins associated with t... |
"""SCons.Tool.GettextCommon module
Used by several tools of `gettext` toolset.
"""
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software withou... |
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class MseCasesPage(page_module.Page):
def __init__(self, url, page_set):
super(MseCasesPage, self).__init__(url=url, page_set=page_set)
def RunNavigateSteps(self, action_runner):
action_runner.NavigateT... |
"""
Tests the high-level plotting interface.
"""
# import iris tests first so that some things can be initialised before importing anything else
import iris.tests as tests
import iris.tests.test_plot as test_plot
import iris
# Run tests in no graphics mode if matplotlib is not available.
if tests.MPL_AVAILABLE:
... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/mnt/debris/devel/repo/git/luma-fixes/resources/forms/PluginListWidgetDesign.ui'
#
# by: PyQt4 UI code generator 4.8.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCor... |
"""
A stupid L3 switch
For each switch:
1) Keep a table that maps IP addresses to MAC addresses and switch ports.
Stock this table using information from ARP and IP packets.
2) When you see an ARP query, try to answer it using information in the table
from step 1. If the info in the table is old, just flood the... |
#!/usr/bin/env python
import os
import time
import datetime
import ConfigParser
import dbus
_FREMANTLE_ALARM = "Fremantle"
_DIABLO_ALARM = "Diablo"
_NO_ALARM = "None"
try:
import alarm
ALARM_TYPE = _FREMANTLE_ALARM
except (ImportError, OSError):
try:
import osso.alarmd as alarmd
ALARM_TYPE = _DIABLO_ALARM
... |
from . import constants
from .escsm import (HZSMModel, ISO2022CNSMModel, ISO2022JPSMModel,
ISO2022KRSMModel)
from .charsetprober import CharSetProber
from .codingstatemachine import CodingStateMachine
from .compat import wrap_ord
class EscCharSetProber(CharSetProber):
def __init__(sel... |
"""Command for scraping images from a URL or list of URLs.
Prerequisites:
1. The command_line package from tools/site_compare
2. Either the IE BHO or Firefox extension (or both)
Installation:
1. Build the IE BHO, or call regsvr32 on a prebuilt binary
2. Add a file called "<EMAIL>" to
the default Firefox ... |
"""Subdomain data parser for Alexa."""
__author__ = '<EMAIL> (Thomas Stromberg)'
import glob
import operator
import os
import os.path
import re
import sys
import time
if __name__ == '__main__':
sys.path.append('..')
# See if a third_party library exists -- use it if so.
try:
import third_party
except ImportEr... |
import os
import sys
import imp
import portage
from portage.const import VDB_PATH
from portage import _encodings
from portage import _shell_quote
from portage import _unicode_decode
from portage import _unicode_encode
# Stolen from the ebuild command
def package_from_ebuild(ebuild):
pf = None
if ebuild.endsw... |
from sympy.core.compatibility import range
from sympy import S, symbols, Function
from sympy.calculus.finite_diff import (
apply_finite_diff, finite_diff_weights, as_finite_diff
)
def test_apply_finite_diff():
x, h = symbols('x h')
f = Function('f')
assert (apply_finite_diff(1, [x-h, x+h], [f(x-h), f(... |
""" Tell how long the system has been running """
import sys
from pcp import pmapi
from cpmapi import PM_TYPE_U32, PM_TYPE_FLOAT
from cpmapi import PM_CONTEXT_ARCHIVE, PM_MODE_FORW, PM_ERR_VALUE
def print_timestamp(stamp):
""" Report the sample time (struct tm) in HH:MM:SS form """
return " %02d:%02d:%02d" % ... |
# -*- coding: utf-8 -*-
import mock
from nose.tools import eq_
import amo.tests
from reviews import feeds
from translations.models import Translation
class FeedTest(amo.tests.TestCase):
# Rub some unicode all over the reviews feed.
def setUp(self):
super(FeedTest, self).setUp()
self.feed = f... |
""" P1 tests for Storage motion
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
import time
_multip... |
import base64
import time
import uuid
import mock
from nova import exception
from nova import test
from nova.virt.xenapi import agent
from nova.virt.xenapi import fake as xenapi_fake
def _get_fake_instance(**kwargs):
system_metadata = []
for k, v in kwargs.items():
system_metadata.append({
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from unittest import TestCase
from django.db import models
from mock import patch
from clean_fields.utils import (
get_model_field_value, get_model_field_names, par... |
import logging
import os
import sys
import virtool.account.api
import virtool.analyses.api
import virtool.caches.api
import virtool.downloads.api
import virtool.files.api
import virtool.genbank.api
import virtool.groups.api
import virtool.history.api
import virtool.hmm.api
import virtool.http.auth
import virtool.http.... |
import os
from telemetry.page.actions import page_action
class TapAction(page_action.PageAction):
def __init__(self, selector=None, text=None, element_function=None,
left_position_percentage=0.5, top_position_percentage=0.5,
duration_ms=50):
super(TapAction, self).__init__()
s... |
from unittest import TestCase, skip, skipIf
from csmpe.decorators import delegate
class Delegate():
def __init__(self):
self.attr1 = 1
self.attr2 = 2
def method1(self):
return self.attr1
def method2(self):
return self.attr2
def method3(self, arg1, arg2=None):
... |
from makohtml2html import parseNode
#.apidoc title: MAKO to HTML engine
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import logging
from webkitpy.layout_tests.controllers import repaint_overlay
from webkitpy.layout_tests.models import test_failures
_log = logging.getLogger(__name__)
def write_test_result(filesystem, port, results_directory, test_name, driver_output,
expected_driver_output, failures):
""... |
'''
An optimized method for GridSearchCV, which iteratively performs grid search
and reduces the span of the parameters after each iteration. Made to make the
life of an engineer less boring.
'''
import numpy as np
from sklearn.model_selection import GridSearchCV
from sklearn.svm import LinearSVC
def optGridSearchCV(... |
from neutron_lib.api import converters
from neutron_lib import constants
from neutron_lib.db import constants as db_constants
ADDRESS_SCOPE = 'address_scope'
ADDRESS_SCOPE_ID = 'address_scope_id'
IPV4_ADDRESS_SCOPE = 'ipv4_%s' % ADDRESS_SCOPE
IPV6_ADDRESS_SCOPE = 'ipv6_%s' % ADDRESS_SCOPE
ALIAS = 'address-scope'
IS_... |
import shlex, subprocess
from pylab import *
from array import array
import numpy
import matplotlib.pyplot as plt
def run_simulation(ahrs_type, build_opt, traj_nb):
print "\nBuilding ahrs"
args = ["make", "clean", "run_ahrs_on_synth", "AHRS_TYPE=AHRS_TYPE_"+ahrs_type] + build_opt
# print args
p = subpro... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
compat_urllib_request,
)
from ..utils import (
ExtractorError,
)
class UdemyIE(InfoExtractor):
IE_NAME = 'udemy'
_VALID_URL = r'https?://www\.udemy\.com/(?:[^#]+#/lectu... |
from django.contrib import admin
from django.contrib.contenttypes import generic
from . import models
class AttachmentAdmin(admin.ModelAdmin):
list_display = ["id", "project", "attached_file", "owner", "content_type", "content_object"]
list_display_links = ["id", "attached_file",]
list_filter = ["project... |
import json
from tastypie.test import ResourceTestCase
from django.test.utils import override_settings
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from guardian.shortcuts import get_anonymous_user
from guardian.shortcuts import remove_perm
from geonode.base.populate_test... |
#!/usr/bin/python -u
#
# Portions of this script have been (shamelessly) stolen from the
# prior work of Daniel Veillard (genUnicode.py)
#
# I, however, take full credit for any bugs, errors or difficulties :-)
#
# William Brack
# October 2003
#
# 18 October 2003
# Modified to maintain binary compatibility with previou... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. py:currentmodule:: pySpectrumFileFormat.OxfordInstruments.INCA.test_ReadSpectrumFullResults
:synopsis: Tests for the module :py:mod:`pySpectrumFileFormat.OxfordInstruments.INCA.ReadSpectrumFullResults`
.. moduleauthor:: Hendrix Demers <<EMAIL>>
Tests for the mo... |
# Utils (c) 2002, 2004, 2007, 2008 David Turner <<EMAIL>>
#
import string, sys, os, glob
# current output directory
#
output_dir = None
# This function is used to sort the index. It is a simple lexicographical
# sort, except that it places capital letters before lowercase ones.
#
def index_sort( s1, s2 ):
i... |
from __future__ import unicode_literals
from django.contrib.sessions.base_session import (
AbstractBaseSession, BaseSessionManager,
)
class SessionManager(BaseSessionManager):
use_in_migrations = True
class Session(AbstractBaseSession):
"""
Django provides full support for anonymous sessions. The s... |
#!/usr/bin/env python
import shogun as sg
parameter_list=[[10,7,0,False]]
def tests_check_commwordkernel_memleak (num, order, gap, reverse):
import gc
from shogun import Alphabet,StringCharFeatures,StringWordFeatures,DNA
from shogun import MSG_DEBUG
from shogun import CommWordStringKernel, IdentityKernelNormalizer... |
import crm_claim_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
{
'name': 'OpenOffice Report Designer',
'version': '0.1',
'category': 'Reporting',
'description': """
This module is used along with OpenERP OpenOffice Plugin.
=========================================================
This module adds wizards to Import/Export .sxw report that you can modify in OpenOffi... |
"""WebLinkback - Administrative Lib"""
from invenio.config import CFG_SITE_LANG, CFG_SITE_URL
from invenio.urlutils import wash_url_argument
from invenio.messages import gettext_set_language, wash_language
from invenio.webuser import collect_user_info
from invenio.weblinkback_dblayer import get_all_linkbacks, \
... |
import logging
import logging.config
logging.config.fileConfig('logging.conf')
from signal_handling import *
import contextlib
import sys
import optparse
def options():
usage = "usage: %prog [options] [backdoor]"
parser = optparse.OptionParser(usage=usage)
parser.add_option("-o", "--output", dest="out", ... |
import os.path
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.auth.models import User
from avatar.settings import AVATAR_DEFAULT_URL, AVATAR_MAX_AVATARS_PER_USER
from avatar.util import get_primary_avatar
from avatar.models import Av... |
"""
This file includes the monkey-patch for requests' PATCH method, as we are using
older version of django that does not contains the PATCH method in its test client.
"""
# pylint: disable=protected-access
from __future__ import unicode_literals
from urlparse import urlparse
from django.test.client import RequestF... |
"""Benchmarks for static optimizations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import numpy as np
from tensorflow.python.client import session
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.framework impor... |
from _pytest.main import EXIT_NOTESTSCOLLECTED
import pytest
def test_version(testdir, pytestconfig):
result = testdir.runpytest("--version")
assert result.ret == 0
#p = py.path.local(py.__file__).dirpath()
result.stderr.fnmatch_lines([
'*pytest*%s*imported from*' % (pytest.__version__, )
]... |
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = 'check for streams that need to be executed and execute them'
option_list = NoArgsCommand.option_list
def handle_noargs(self, **options):
import time
from streams.models import Stream
... |
import unittest
import time
from datetime import datetime
from app import create_app, db
from app.models import User, AnonymousUser, Role, Permission, Follow
class UserModelTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
... |
"""Tests for classification of 2D coordinates."""
__author__ = 'Sean Lip'
from extensions.rules import coord_two_dim
import test_utils
class CoordTwoDimRuleUnitTests(test_utils.GenericTestBase):
"""Tests for rules operating on CoordTwoDim objects."""
def test_within_rule(self):
self.assertFalse(coo... |
# vim:fileencoding=utf-8:noet
'''Dynamic configuration files tests.'''
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
import os
import json
import tests.vim as vim_module
from tests.lib import Args, urllib_read, replace_attr
from tests import TestCase
VBLOCK = chr... |
"""Parser for Blink IDL.
The parser uses the PLY (Python Lex-Yacc) library to build a set of parsing
rules which understand the Blink dialect of Web IDL.
It derives from a standard Web IDL parser, overriding rules where Blink IDL
differs syntactically or semantically from the base parser, or where the base
parser dive... |
from oslo_serialization import jsonutils as json
import six
from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.volume import base_client
class VolumesClient(base_client.BaseClient):
"""Client class to sen... |
#!/usr/bin/env python
"""Interpreter and code coverage injector for use with ansible-test.
The injector serves two main purposes:
1) Control the python interpreter used to run test tools and ansible code.
2) Provide optional code coverage analysis of ansible code.
The injector is executed one of two ways:
1) On the... |
# -*- coding: utf-8 -*-
import markov_tool as mt
ins = mt.InstanceList()
if ins._get_native_types() != (0, {}):
print "There was a problem instantiating the InstanceList."
print ins._get_native_types()
ins['a'] = 1
if ins['a'] != 1 or ins._get_native_types() != (1, {'a': 1}):
print "There was a problem s... |
from __future__ import print_function
import sys
import re
config_file="../../../os/.config"
infile = open(config_file,'r')
for line in infile:
line = line.strip('\n')
if re.search("CONFIG_ESP_FLASH_BASE", line) != None:
flash_base_addr = line.split('=', 2)[1]
elif re.search("CONFIG_FLASH_PART_SIZE... |
from .mbcharsetprober import MultiByteCharSetProber
from .codingstatemachine import CodingStateMachine
from .chardistribution import SJISDistributionAnalysis
from .jpcntx import SJISContextAnalysis
from .mbcssm import SJIS_SM_MODEL
from .enums import ProbingState, MachineState
class SJISProber(MultiByteCharSetProber)... |
from django.test import TestCase
from django.test.client import Client
from django.urls import reverse
from model_mommy import mommy
from devicetypes.models import Type
from users.models import Lageruser
class TypeTests(TestCase):
def setUp(self):
self.client = Client()
Lageruser.objects.create... |
from django.contrib.postgres.fields import (
ArrayField, BigIntegerRangeField, DateRangeField, DateTimeRangeField,
FloatRangeField, HStoreField, IntegerRangeField,
)
from django.db import connection, models
class IntegerArrayModel(models.Model):
field = ArrayField(models.IntegerField())
class NullableIn... |
#!/usr/bin/env python
# Python Network Programming Cookbook -- Chapter - 7
# This program is optimized for Python 2.7.
# It may run on any other version with/without modifications.
from getpass import getpass
from fabric.api import env, put, sudo, prompt
from fabric.contrib.files import exists
WWW_DOC_ROOT = "/data/a... |
class factor:
number = None # factor number
bill_id = None
trans_id = None
dirty = False
## type of factor can be sell, buy
facotr_type = "sell"
def __init__(self, number):
if(number):
#get bill_id and trans_id and type from database
## set current factor deatils
... |
from datetime import datetime
from optparse import make_option
from time import sleep
from urllib import urlopen
from django.core.management.base import CommandError
from django.utils.html import strip_tags
try:
from json import loads
except ImportError: # Python < 2.6
from django.utils.simplejson import loa... |
from __future__ import absolute_import, division, print_function
import re
from .version import InvalidVersion, Version
_canonicalize_regex = re.compile(r"[-_.]+")
def canonicalize_name(name):
# This is taken from PEP 503.
return _canonicalize_regex.sub("-", name).lower()
def canonicalize_version(versio... |
import os, sys, traceback
import Ice
Ice.loadSlice('Test.ice')
import Test, TestI
def run(args, communicator):
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010")
adapter = communicator.createObjectAdapter("TestAdapter")
object = TestI.InitialI(adapter)
adapter.add(ob... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.