content string |
|---|
import copy
import logging
import random
import time
from oslo_config import cfg
import six
from ironic.openstack.common._i18n import _, _LE, _LI
periodic_opts = [
cfg.BoolOpt('run_external_periodic_tasks',
default=True,
help='Some periodic tasks can be run in a separate process.... |
class ModuleDocFragment(object):
# Standard CNOS documentation fragment
DOCUMENTATION = '''
options:
outputfile:
description:
- This specifies the file path where the output of each command
execution is saved. Each command that is specified in the merged
templat... |
import unittest, time, sys
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_import as h2i, h2o_exec, h2o_rf
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
h2o.init(3)
@classmethod
def tearDownCl... |
# Gurdy.py
# Aaron Taylor
# Moose Abumeeiz
#
# This is the first boss, Gurdy. He just sits there and takes your bullets
#
from pygame import *
from const import *
from func import *
from Animation import *
from Enemy import *
class Gurdy(Enemy):
x = 6
y = 3
health = 100
hurtDistance = 2
def __init__(self, tex... |
from __future__ import division, absolute_import, print_function, unicode_literals
from awlsim.common.compat import *
from awlsim.core.systemblocks.systemblocks import *
from awlsim.core.util import *
class SFCm1(SFC):
name = (-1, "__SFC_NOP", None)
def run(self):
s = self.cpu.statusWord
s.BIE = 1 |
from base_handler import BaseHandler
from base_handler import Permission
from waterfall import buildbot
from waterfall import masters
from model.wf_step import WfStep
class FailureLog(BaseHandler):
PERMISSION_LEVEL = Permission.CORP_USER
def HandleGet(self):
"""Fetch the log of a failed step as a JSON result... |
import numpy as num
from pyrocko.guts import Bool
from .plugin import PluginConfig, Plugin
class DerampConfig(PluginConfig):
demean = Bool.T(optional=True, default=True)
class Deramp(Plugin):
def __init__(self, scene, config=None):
self.scene = scene
self.config = config or DerampConfig()... |
"""Standard functions for creating slots.
A slot is a `Variable` created with the same first m-dimension as a primary
variable or `Tensor`. A slot is always scoped in the namespace of the primary
object and typically has the same device and type.
Slots are typically used as accumulators to track values associated wit... |
"""Add has function and dependent pgcrpyto
Revision ID: 5552dfae2cb0
Revises: c225ea8fbf5e
Create Date: 2019-09-14 06:19:36.520447
"""
# revision identifiers, used by Alembic.
revision = '5552dfae2cb0'
down_revision = 'c225ea8fbf5e'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as ... |
from markdown import message, CRITICAL
import sys
## Import
def importETree():
"""Import the best implementation of ElementTree, return a module object."""
etree_in_c = None
try: # Is it Python 2.5+ with C implemenation of ElementTree installed?
import xml.etree.cElementTree as etree_in_c
excep... |
""" The implementation of bdd test engine"""
import os
import time
import sys
import threading
import uuid
from testkitlite.util.log import LOGGER
from testkitlite.util.result import TestSetResut
from testkitlite.util import tr_utils
import subprocess
STR_PASS = 'PASS'
STR_FAIL = 'FAIL'
STR_BLOCK = 'BLOCK'
DEFAULT_TI... |
"""Mimic pyquick exercise -- optional extra exercise.
Google's Python Class
Read in the file specified on the command line.
Do a simple split() on whitespace to obtain all the words in the file.
Rather than read the file line by line, it's easier to read
it into one giant string and split it once.
Build a "mimic" dic... |
import unittest
from environment import GetAppVersion
from test_object_store import TestObjectStore
from object_store_creator import ObjectStoreCreator
class _FooClass(object):
def __init__(self): pass
class ObjectStoreCreatorTest(unittest.TestCase):
def setUp(self):
self._creator = ObjectStoreCreator(start_... |
"""
A sub-package for efficiently dealing with polynomials.
Within the documentation for this sub-package, a "finite power series,"
i.e., a polynomial (also referred to simply as a "series") is represented
by a 1-D numpy array of the polynomial's coefficients, ordered from lowest
order term to highest. For example, a... |
import yaml
import os
class BaseConfigError(Exception):
pass
class ConfigParsingError(BaseConfigError):
pass
class ConfigReadError(BaseConfigError):
pass
class BaseHolder(object):
def __init__(self, configfile="/etc/qlivestats.yaml"):
self.name = self.__class__.__name__.lower()
... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class ForkNotifyTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 2
self.setup_clean_chain = False
alert_filename = None # Set by setup_network
def ... |
#Replace game name with the rom name, github: https://github.com/dsoft20
#This script takes the gamelist.xml generated by the Universal XML-Scraper
#and replace the scraped name field (<name>) with the rom name
# <path>./Game name (Europe).zip</path>
# <name>Game name</name>
# TO
# <path>./Game name (Europe).z... |
"""Analyze powershell import statements."""
from __future__ import absolute_import, print_function
import os
import re
from lib.util import (
display,
)
def get_powershell_module_utils_imports(powershell_targets):
"""Return a dictionary of module_utils names mapped to sets of powershell file paths.
:ty... |
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_user_security_exempt_list
except ImportE... |
import asyncio
from collections import namedtuple
import struct
from aerospike_py.connection import Connection, ASConnectionError
from aerospike_py.result_code import ASMSGProtocolException
class ASIOException(Exception):
pass
class InvalidMessageException(Exception):
pass
# --- all messages ---
Aerospi... |
# Description: FreeViz projector
# Category: projection
# Uses: zoo
# Referenced: Orange.projection.linear
# Classes: Orange.projection.linear.FreeViz, Orange.projection.linear.Projector
import Orange
import numpy as np
tab = Orange.data.Table('titanic')
ind = Orange.data.sample.SubsetIndices2(p0=0.99... |
from unittest import TestCase
from similarityPy.algorithms.mean import Mean
from tests import test_logger
__author__ = 'cenk'
class MeanTest(TestCase):
def setUp(self):
pass
def test_algorithm_with_list(self):
test_logger.debug("MeanTest - test_algorithm_with_list Starts")
mean = M... |
'''
Created on Mar 9, 2016
@author: charper
'''
from collections import Counter
import logging
from lib import lib_dbg_filehandler, lib_consolehandler, lib_inf_filehandler
module_logger=logging.getLogger(__name__)
module_logger.addHandler(lib_inf_filehandler)
module_logger.addHandler(lib_dbg_filehandler)
... |
from pyecharts.charts import Sankey
from pyecharts import options as opts
linkes=[
{'source':'03万','target':'续费后03万','value':20},
{'source':'03万','target':'续费后05万','value':70},
{'source':'03万','target':'续费后10万','value':25},
{'source':'03万','target':'续费后15万','value':12},
{'source':'03万','target':'续费后25万','value':10},
{... |
from StandardDataSets.scripts import JudgeAssistant
# Please feed your node list here:
tagLst = ['library_effects', 'effect', 'profile_COMMON', 'technique', 'lambert']
attrName = ''
attrVal = ''
dataToCheck = ''
class SimpleJudgingObject:
def __init__(self, _tagLst, _attrName, _attrVal, _data):
... |
import unittest
from cupy import testing
@testing.gpu
class TestSplit(unittest.TestCase):
_multiprocess_can_split_ = True
@testing.numpy_cupy_array_equal()
def test_array_spliti1(self, xp):
a = testing.shaped_arange((3, 11), xp)
split = xp.array_split(a, 4, 1)
return xp.concaten... |
"""
sentry.quotas.redis
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from time import time
from sentry.exceptions import InvalidConfiguration
from sentry.quotas.base import NotRa... |
"""Functions new to the pyScss library."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import os.path
import random
import six
from six.moves import xrange
from scss import config
from scss.errors ... |
import json
from pbr import git
def write_pbr_json(cmd, basename, filename):
if not hasattr(cmd.distribution, 'pbr') or not cmd.distribution.pbr:
return
git_dir = git._run_git_functions()
if not git_dir:
return
values = dict()
git_version = git.get_git_short_sha(git_dir)
is_re... |
import copy
import logging
from hashlib import sha1
from typing import List
import simplejson as json
from treeherder.log_parser.utils import validate_perf_data
from treeherder.model.models import OptionCollection
from treeherder.perf.models import (PerformanceDatum,
PerformanceFra... |
"""Tests for Python ops defined in image_grad.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.ops import gradient_checker
from tensorflow.python.ops import... |
"""
Generating and counting primes.
"""
from __future__ import print_function, division
import random
from bisect import bisect
# Using arrays for sieving instead of lists greatly reduces
# memory consumption
from array import array as _array
from .primetest import isprime
from sympy.core.compatibility import as_int... |
from ast import literal_eval
from whoosh.compat import b, bytes_type, text_type, integer_types, PY3
from whoosh.compat import iteritems, dumps, loads, xrange
from whoosh.codec import base
from whoosh.matching import ListMatcher
from whoosh.reading import TermInfo, TermNotFound
if not PY3:
class memoryview:
... |
from swampdragon.route_handler import BaseModelRouter, SUCCESS
from swampdragon.serializers.model_serializer import ModelSerializer
from swampdragon.testing.dragon_testcase import DragonTestCase
from .models import TwoFieldModel
class Serializer(ModelSerializer):
class Meta:
update_fields = ('text', 'numb... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
depends_on = (
("apikey", "0002_auto__add_field_apikey_client"),
)
def forwards(self, orm):
"Write your forwards methods here."
... |
from __future__ import absolute_import, print_function
import mmap
import os
import sys
this_file = os.path.abspath(__file__)
this_dir = os.path.split(this_file)[0]
root_dir = os.path.split(this_dir)[0]
pywayland_dir = os.path.join(root_dir, "pywayland")
if os.path.exists(pywayland_dir):
sys.path.append(root_dir)... |
from rx.core import Observable, ObservableBase, Disposable
from rx.internal import extensionmethod
from rx.disposables import CompositeDisposable
from rx.subjects import Subject
class PausableObservable(ObservableBase):
def __init__(self, source, pauser=None):
self.source = source
self.controller ... |
import os
from importlib import import_module
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from django.utils._os import upath
from django.utils.module_loading import module_has_submodule
MODELS_MODULE_NAME = 'models'
class AppConfig(object):
"""
Class representing a Django ap... |
"""
Module for trigger class dependent data set, consiting of
- cluster containers
- track containers
- jet containers (tracks found in jets)
:organization: ALICE Collaboration
:copyright:
:author: Markus Fasel
:contact: <EMAIL>
:organization: Lawrence Berkeley National Laboratory
"""
from ROOT import TIter, TList
fr... |
import sys
import unittest
import Tkinter as tkinter
import ttk
from test.test_support import requires, run_unittest, swap_attr
from test_ttk.support import AbstractTkTest, destroy_default_root
requires('gui')
class LabeledScaleTest(AbstractTkTest, unittest.TestCase):
def tearDown(self):
self.root.update... |
"""Different kinds of SAX Exceptions"""
import sys
if sys.platform[:4] == "java":
from java.lang import Exception
del sys
# ===== SAXEXCEPTION =====
class SAXException(Exception):
"""Encapsulate an XML error or warning. This class can contain
basic error or warning information from either the XML parser o... |
import abc
import base64
import copy
import os
from cloudinit import ec2_utils
from cloudinit import log as logging
from cloudinit import sources
from cloudinit import url_helper
from cloudinit import util
# For reference: http://tinyurl.com/laora4c
LOG = logging.getLogger(__name__)
FILES_V1 = {
# Path <-> (met... |
from neuralnet import *
from sparse_code_layer import *
import scipy.linalg
class SparseCoder(NeuralNet):
def SetLayerAndEdgeClass(self):
self.LayerClass = SparseCodeLayer
self.EdgeClass = Edge
def Show(self):
encoder = self.encoder.params['weight'].asarray()
decoder = self.decoder.params['weight'... |
from Screen import Screen
from Components.Pixmap import Pixmap, MovingPixmap
from Components.Label import Label
from Components.ActionMap import ActionMap
from Components.HelpMenuList import HelpMenuList
from Screens.Rc import Rc
class HelpMenu(Screen, Rc):
def __init__(self, session, list):
Screen.__init__(self, s... |
"""Pylons environment configuration"""
import os
from mako.lookup import TemplateLookup
from pylons.configuration import PylonsConfig
from pylons.error import handle_mako_error
import job_runner.lib.app_globals as app_globals
import job_runner.lib.helpers
from job_runner.config.routing import make_map
def load_envir... |
# encoding: utf-8
"""
Open Packaging Convention (OPC) objects related to package parts.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from .compat import cls_method_fn
from .oxml import serialize_part_xml
from ..oxml import parse_xml
from .packuri import PackURI
from ... |
from m5.params import *
from MemObject import MemObject
# An address mapper changes the packet addresses in going from the
# slave port side of the mapper to the master port side. When the
# slave port is queried for the address ranges, it also performs the
# necessary range updates. Note that snoop requests that trav... |
from django.test import TestCase
from cparte.models import Channel
import channel_middleware
import ConfigParser
import json
import re
import tweepy
class TwitterTestCase(TestCase):
fixtures = ['cparte.json']
url = "https://twitter.com/"
config = ConfigParser.ConfigParser()
config.read('cparte/config... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from six import string_types, text_type, binary_type, PY3
# to_bytes and to_unicode were written by Toshio Kuratomi for the
# python-kitchen library https://pypi.python.org/pypi/kitchen
# They are licensed in kitchen under the ter... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import shelve
import os
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase):
def read_shelve(self, shelve_filename, key):
"""
Read the value o... |
from lxml import etree
import time
import requests
import constants as CONSTANTS
import urllib
import logging
from pymal import Mal
import sys
class MyAnimeList(object):
def __init__(self, username, password):
self.username = username
self.password = password
self.mal = Mal.Mal(username, p... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import base64
from ansible.errors import AnsibleError
from ansible.module_utils._text import to_bytes
from ansible.module_utils.six import string_types
from ansible.module_utils.parsing.convert_bool import boolean
from a... |
from abc import ABCMeta, abstractmethod
import sys
if sys.version >= '3':
xrange = range
from pyspark import SparkContext
from pyspark.sql import DataFrame
from pyspark.ml import Estimator, Transformer, Model
from pyspark.ml.param import Params
from pyspark.ml.util import _jvm
from pyspark.ml.common import inherit... |
"""Fast, arbitrary precision integers.
:undocumented: __package__
"""
__all__ = ["Integer"]
from Crypto.Util.py3compat import *
from Crypto import Random
try:
from Crypto.Math._Numbers_gmp import Integer
from Crypto.Math._Numbers_gmp import implementation as _implementation
except (ImportError, OSError):
... |
from openerp.osv import fields, osv
class account_invoice(osv.osv):
_inherit = 'account.invoice'
def action_number(self, cr, uid, ids, *args):
result = super(account_invoice, self).action_number(cr, uid, ids, *args)
for inv in self.browse(cr, uid, ids):
self.pool.get('account.invoi... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import time
import glob
import urlparse
from ansible.module_utils._text import to_text
from ansible.plugins.action.ce import ActionModule as _ActionModule
class ActionModule(_ActionModule):
def run(self, tmp=None,... |
from PySide import QtGui, QtCore
import cv
import PIL.Image
import StringIO
def pilimage_to_iplimage(pil_image):
# Check zero size of image
if pil_image.size == (0, 0):
return cv.CreateImage( (0, 0), cv.IPL_DEPTH_8U, 3)
ipl_image = cv.CreateImageHeader(pil_image.size, cv.IPL_DEPTH_8U, 3)
# Th... |
{
"name": "MRP - Product variants with MRP operations",
"version": "1.0",
"depends": [
"mrp_product_variants",
"mrp_operations_extension",
],
"author": "OdooMRP team,"
"AvanzOSC,"
"Serv. Tecnol. Avanzados - Pedro M. Baeza",
"website": "http://www.odoom... |
from twisted.enterprise import reflector
from twisted.enterprise.util import DBError, getKeyColumn, quote, safe
from twisted.enterprise.util import _TableInfo
from twisted.enterprise.row import RowObject
from twisted.python import reflect
class SQLReflector(reflector.Reflector):
"""I reflect on a database and loa... |
'''Unit tests for io.FileNode'''
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
import os
import StringIO
import unittest
from grit.node import misc
from grit.node import io
from grit.node import empty
from grit import grd_reader
from grit import u... |
"""Runs bazel build/test for current repo."""
import argparse
import os
import subprocess
import sys
ORIG_CWD = os.getcwd()
def test_infra(*paths):
"""Return path relative to root of test-infra repo."""
return os.path.join(ORIG_CWD, os.path.dirname(__file__), '..', *paths)
def check(*cmd):
"""Log and ru... |
"""
Commands for reporting test success of failure to the manager.
@since: 12.3
"""
from twisted.protocols.amp import Command, String, Boolean, ListOf
class AddSuccess(Command):
"""
Add a success.
"""
arguments = [('testName', String())]
response = [('success', Boolean())]
class AddError(Com... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import re
from django.core import serializers
from django.core.serializers.base import DeserializationError
from django.core.serializers.json import DjangoJSONEncoder
from django.test import SimpleTestCase, TestCase, TransactionTestCase
from ... |
import django_sites as sites
from django.core.urlresolvers import reverse as django_reverse
URL_TEMPLATE = "{scheme}://{domain}/{path}"
def build_url(path, scheme="http", domain="localhost"):
return URL_TEMPLATE.format(scheme=scheme, domain=domain, path=path.lstrip("/"))
def is_absolute_url(path):
"""Test ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.nxos import nxos_pim
from .nxos_module import TestNxosModule, load_fixture, set_module_args
class TestNxosPimModule(TestNxosModule):
module = nxos_pim
def... |
import wx
from grid_plotter_base import grid_plotter_base
from OpenGL import GL
import common
import numpy
import gltext
import math
LEGEND_TEXT_FONT_SIZE = 8
LEGEND_BOX_PADDING = 3
MIN_PADDING = 35, 10, 0, 0 #top, right, bottom, left
#constants for the waveform storage
SAMPLES_KEY = 'samples'
COLOR_SPEC_KEY = 'color_... |
""" Addons module.
This module serves to contain all OpenERP addons, across all configured addons
paths. For the code to manage those addons, see openerp.modules.
Addons are made available under `openerp.addons` after
openerp.tools.config.parse_config() is called (so that the addons paths are
known).
This module als... |
from xl import settings
def migrate():
"""
Migrates the old 'miscellaneous/rating_*'
to the new 'rating/*' settings
"""
if settings.MANAGER.has_option('miscellaneous/rating_steps'):
value = settings.get_option('miscellaneous/rating_steps', 5)
settings.set_option('rating/maxi... |
"""Tools to assist importing optional external modules."""
from __future__ import print_function, division
import sys
# Override these in the module to change the default warning behavior.
# For example, you might set both to False before running the tests so that
# warnings are not printed to the console, or set bo... |
"""
Utilities for extracting text from generated classes.
"""
def is_string(txt):
if isinstance(txt, str):
return True
try:
if isinstance(txt, unicode):
return True
except NameError:
pass
return False
def description(obj):
if obj is None:
return None
... |
from decimal import Decimal as D
from django.test import TestCase
import mock
from oscar.apps.offer import models
from oscar.test import factories
from oscar.test.basket import add_product, add_products
class TestAFixedPriceDiscountAppliedWithCountCondition(TestCase):
def setUp(self):
range = models.Ra... |
#!/usr/bin/env python
"""
Compute some network properties for the lollipop graph.
"""
# Copyright (C) 2004 by
# Aric Hagberg <<EMAIL>>
# Dan Schult <<EMAIL>>
# Pieter Swart <<EMAIL>>
# All rights reserved.
# BSD license.
from networkx import *
G = lollipop_graph(4,6)
pathlengths=[]
print("source ... |
from __future__ import unicode_literals
import re
from django.template import (Node, Variable, TemplateSyntaxError,
TokenParser, Library, TOKEN_TEXT, TOKEN_VAR)
from django.template.base import _render_value_in_context
from django.template.defaulttags import token_kwargs
from django.utils import six
from django.ut... |
"""
This module collects helper functions and classes that "span" multiple levels
of MVC. In other words, these functions/classes introduce controlled coupling
for convenience's sake.
"""
from django.http import (
Http404, HttpResponse, HttpResponsePermanentRedirect, HttpResponseRedirect,
)
from django.template imp... |
"""Tests for distutils.cmd."""
import unittest
import os
from test.test_support import captured_stdout, run_unittest
from distutils.cmd import Command
from distutils.dist import Distribution
from distutils.errors import DistutilsOptionError
from distutils import debug
class MyCmd(Command):
def initiali... |
"""
Requirements file parsing
"""
from __future__ import absolute_import
import os
import re
import shlex
import optparse
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves import filterfalse
import pip
from pip.download import get_file_content
from pip.req.req_install import ... |
from __future__ import unicode_literals
import frappe
def execute():
# reload schema
for doctype in ("Work Order", "Work Order Item", "Work Order Operation",
"BOM Item", "BOM Explosion Item", "BOM"):
frappe.reload_doctype(doctype)
frappe.reload_doc("stock", "doctype", "item")
frappe.reload_doc("stock", "doc... |
"""Tests for convolution related functionality in tensorflow.ops.nn."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.python.framework import constant_op... |
#!/usr/bin/env python
"""
Read coachmap.swf and export all coaches to dist/coaches/*.{svg,js}.
"""
from swf.movie import SWF
from swf.export import SVGExporter, SingleShapeSVGExporterMixin, FrameSVGExporterMixin, NamesSVGExporterMixin
from swf.tag import TagPlaceObject, TagDefineShape, TagDefineSprite, TagFrameLabel
... |
import pytest
from flexget.components.tmdb.api_tmdb import TMDBSearchResult
from flexget.manager import Session
@pytest.mark.online
class TestTmdbLookup:
config = """
tasks:
test:
mock:
- {title: '[Group] Taken 720p', imdb_url: 'http://www.imdb.com/title/tt0936501/'}
... |
"""
Log-related functions and structures.
"""
from builtins import map
import sys
import logging
from colorama import AnsiToWin32
from functools import partial
from contextlib import contextmanager
from .colorizer import Colorizer
from .mark.objects import Mark
from .stream import stream_has_color_support
class Co... |
def write_fstab(lines, dest):
fs_w = open(dest, 'w')
for l in lines:
fs_w.write(l)
fs_w.flush()
fs_w.close()
def set_mount(**kwargs):
""" set/change a mount point location in fstab """
# kwargs: name, src, fstype, opts, dump, passno, state, fstab=/etc/fstab
args = dict(
o... |
"""
Benchmark a server's response to a simple displayname startswith
report.
"""
from urllib2 import HTTPDigestAuthHandler
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet import reactor
from twisted.web.client import Agent
from twisted.web.http_headers import Headers
from httpau... |
# -*- coding: utf-8 -*-
"""
backports.makefile
~~~~~~~~~~~~~~~~~~
Backports the Python 3 ``socket.makefile`` method for use with anything that
wants to create a "fake" socket object.
"""
import io
from socket import SocketIO
def backport_makefile(self, mode="r", buffering=None, encoding=None,
... |
"""Fixer for apply().
This converts apply(func, v, k) into (func)(*v, **k)."""
# Local imports
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Call, Comma, parenthesize
class FixApply(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< 'apply... |
import json
from unittest import mock
from mitmproxy.test import taddons
from mitmproxy.test import tflow
from mitmproxy import flowfilter
from mitmproxy.tools.web.app import flow_to_json
from mitmproxy.tools.web import static_viewer
from mitmproxy.addons import save
def test_save_static(tmpdir):
tmpdir.mkdir(... |
import logging
from content_api.items.service import ItemsService
logger = logging.getLogger(__name__)
class PackagesService(ItemsService):
"""
A service that knows how to perform CRUD operations on the `package`
content types.
Serves mainly as a proxy to the data layer.
"""
def on_fetched... |
# -*- coding: utf-8 -*-
from dCore import *
from dLog import *
from dTubes import *
import time
import tarfile
import shutil
class DamnVideoModule:
def __init__(self, uri):
self.name = 'generic'
self.uri = uri
self.link = None
self.id = None
self.valid = None
self.title = None
self.ticket = None
self.t... |
from django.core.urlresolvers import reverse
from tests.browser.selenium_helpers import SeleniumTestCase
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import InvalidElementStateException
from orm.models import Project, Release, BitbakeVersion
class TestNewProjectPage(SeleniumTestCa... |
import re
import time
from funcy.debug import *
from funcy.flow import silent
def test_tap():
assert capture(tap, 42) == '42\n'
assert capture(tap, 42, label='Life and ...') == 'Life and ...: 42\n'
def test_log_calls():
log = []
@log_calls(log.append)
def f(x, y):
return x + y
f(1... |
"""Browser to test web applications.
(from web.py)
"""
from utils import re_compile
from net import htmlunquote
import httplib, urllib, urllib2
import copy
from StringIO import StringIO
DEBUG = False
__all__ = [
"BrowserError",
"Browser", "AppBrowser",
"AppHandler"
]
class BrowserError(Exception):
p... |
import uuid
try:
from py_utils import slots_metaclass
SlotsMetaclass = slots_metaclass.SlotsMetaclass # pylint: disable=invalid-name
except ImportError:
# TODO(benjhayden): Figure out why py_utils doesn't work in dev_appserver.py
SlotsMetaclass = None # pylint: disable=invalid-name
from tracing.value.diagnost... |
import os
import re
from setuptools import setup, find_packages
base_path = os.path.dirname(__file__)
# Get the version (borrowed from SQLAlchemy)
fp = open(os.path.join(base_path, 'lunaport_client', '__init__.py'))
VERSION = re.compile(r".*__version__ = '(.*?)'",
re.S).match(fp.read()).group(1)
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Licens... |
__author__ = '<EMAIL> (Jeff Scudder)'
import io
import pickle
import os.path
import tempfile
import atom.http_core
class Error(Exception):
pass
class NoRecordingFound(Error):
pass
class MockHttpClient(object):
debug = False
real_client = None
last_request_was_live = False
# The following members ar... |
import logging
import instance
from openerp.workflow.helpers import Session
from openerp.workflow.helpers import Record
from openerp.workflow.helpers import WorkflowActivity
logger = logging.getLogger(__name__)
import openerp
from openerp.tools.safe_eval import safe_eval as eval
class Environment(dict):
"""
... |
"""Python threading tools."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import threading
import sys
try:
# noinspection PyPep8Naming
import Queue as queue
except ImportError:
# noinspection PyUnresolvedReferences
import queue # pylint: disable=locally-dis... |
__author__ = 'Plateforme bioinformatique Toulouse and SIGENAE'
__copyright__ = 'Copyright (C) 2015 INRA'
__license__ = 'GNU General Public License'
__version__ = '3.2.3'
__email__ = '<EMAIL>'
__status__ = 'prod'
import os
import sys
import gzip
import time
import tarfile
import argparse
CURRENT_DIR = os.path.dirname(... |
"""astroid packaging information"""
distname = 'astroid'
modname = 'astroid'
numversion = (1, 0, 0)
version = '.'.join([str(num) for num in numversion])
install_requires = ['logilab-common >= 0.60.0']
license = 'LGPL'
author = 'Logilab'
author_email = '<EMAIL>'
mailinglist = "mailto://%s" % author_email
web = 'ht... |
import cv2
import time
import string
import random
from scipy import ndimage
import numpy as np
from datetime import datetime
def get_normal_map(img):
img = img.astype(np.float)
img = img / 255.0
img = - img + 1
img[img < 0] = 0
img[img > 1] = 1
return img
def get_gray_map(img):
gray = c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.