content
stringlengths
4
20k
import copy import os import sys import time from django.conf import Settings from django.db.models.loading import cache, load_app from django.utils.unittest import TestCase class InstalledAppsGlobbingTest(TestCase): def setUp(self): self.OLD_SYS_PATH = sys.path[:] sys.path.append(os.path.dirname...
""" # Majic # Copyright (C) 2015 CEH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This pr...
"""Codec for quoted-printable encoding. Like base64 and rot13, this returns Python strings, not Unicode. """ import codecs, quopri try: from cStringIO import StringIO except ImportError: from StringIO import StringIO def quopri_encode(input, errors='strict'): """Encode the input, returning a ...
""" Ansible action plugin to ensure inventory variables are set appropriately and no conflicting options have been provided. """ import re from ansible.plugins.action import ActionBase from ansible import errors # Valid values for openshift_deployment_type VALID_DEPLOYMENT_TYPES = ('origin', 'openshift-enterprise') ...
""" Sphinx plugins for Django documentation. """ import json import os import re from docutils import nodes from docutils.parsers.rst import directives from sphinx import __version__ as sphinx_ver, addnodes from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.util.compat import Directive from sphinx.util...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Command-line wrapper for the tracetool machinery. """ __author__ = "Lluís Vilanova <<EMAIL>>" __copyright__ = "Copyright 2012, Lluís Vilanova <<EMAIL>>" __license__ = "GPL version 2 or (at your option) any later version" __maintainer__ = "Stefan Hajnoczi" __e...
from __future__ import unicode_literals import mimetypes import os import random import time from email import charset as Charset, encoders as Encoders from email.generator import Generator from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase from ema...
""" The application interface to roles which checks whether any user trying to change authorization has authorization to do so, which infers authorization via role hierarchy (GlobalStaff is superset of auths of course instructor, ...), which consults the config to decide whether to check course creator role, and other ...
""" Pyramid chart """ from __future__ import division from pygal.adapters import positive from pygal.graph.stackedbar import StackedBar class VerticalPyramid(StackedBar): """Pyramid graph""" _adapters = [positive] def _format(self, value): value = value and abs(value) return super(Vert...
from oslo_config import cfg from nova.network import api as network_api from nova.tests.functional.v3 import api_sample_base from nova.tests.unit.api.openstack.compute.contrib import test_networks CONF = cfg.CONF CONF.import_opt('osapi_compute_extension', 'nova.api.openstack.compute.legacy_v2.extensio...
# Python import import os # PySide import from PySide.QtCore import Qt, Signal from PySide.QtGui import (QHBoxLayout, QLabel) # Maya import from maya import cmds # Custom import from mttConfig import MTTSettings from mttCustomWidget import StatusCollapsibleLayout, StatusScrollArea import mttFilterFileDialog import mttC...
from toolchain import Recipe, shprint from os.path import join import sh import shutil import shlex class LibSDL2TTFRecipe(Recipe): version = "2.0.12" url = "https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-{version}.tar.gz" library = "libSDL2_ttf.a" include_dir = "SDL_ttf.h" depends = ["s...
import cantera as ct # A variety of thermodynamic property methods are provided. gas = ct.Solution('air.cti') # or gas = ct.Solution('air.cti','air') gas.TP = 800, ct.one_atm # temperature, pressure, density T = gas.T P = gas.P rho = gas.density n = gas.density_mole # species non-dimensional properties hrt...
''' Utilities for testing ''' from os.path import dirname, abspath, join as pjoin from dipy.testing.spherepoints import sphere_points from dipy.testing.decorators import doctest_skip_parser from numpy.testing import assert_array_equal import numpy as np from distutils.version import LooseVersion # set path to example ...
import sys try: from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver from libcloud.common.google import GoogleBaseError, QuotaExceededError, \ ResourceExistsError, ResourceNotFoundError, ResourceInUseError _ = Provider.GCE except ImportError: pri...
import sys import os import time import re import getopt import string import codecs from xml.utils import qp_xml kill_prefix_rx = None default_domain = "localhost" exclude = [] users = { } reloc = { } max_join_delta = 3 * 60 list_format = False strip = False date_only = False no_files = False no_host = False no_auth...
import optparse import StringIO import unittest2 as unittest from webkitpy.common.host_mock import MockHost from webkitpy.layout_tests import lint_test_expectations class FakePort(object): def __init__(self, host, name, path): self.host = host self.name = name self.path = path def te...
# taken from https://code.djangoproject.com/wiki/DynamicModels and http://www.agmweb.ca/blog/andy/2249/ from django import forms from django.db import models, connection from django.apps import apps as cache from django.core.management import color from django.contrib import admin """ This module is cancer. This is a ...
import argparse import os import random import requests import sys import tempfile import uuid from libs import colorprint from libs.cli import run_command SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) # assume well-known lvm volume group on host # ...later we'll figure out how to make this dynamic VG_NAM...
import sys, os # Delay import _tkinter until we have set TCL_LIBRARY, # so that Tcl_FindExecutable has a chance to locate its # encoding directory. # Unfortunately, we cannot know the TCL_LIBRARY directory # if we don't know the tcl version, which we cannot find out # without import Tcl. Fortunately, Tcl will itself ...
#Datos del problema. competencia = { 'pista': {'v100mt','v400mt','v800mt','v3000mt','d100mt','d400mt'}, 'campo': {'vbala','vdisco','vlargo','dbala'} } puntaje = { 'lugar 1': 12, #Medalla 'lugar 2': 9, #Medalla 'lugar 3': 7, #Medalla 'lugar 4': 5, 'lugar 5': 4, 'lugar 6': 3, 'lugar 7': 2, 'lugar 8': 1 } re...
""" Additional statistics functions with support for masked arrays. """ # Original author (2007): Pierre GF Gerard-Marchant from __future__ import division, print_function, absolute_import __all__ = ['compare_medians_ms', 'hdquantiles', 'hdmedian', 'hdquantiles_sd', 'idealfourths', ...
# coding: utf-8 """Wrappers for forwarding stdout/stderr over zmq""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import print_function import atexit from binascii import b2a_hex import os import sys import threading import warnings from io impor...
# coding: utf-8 from __future__ import unicode_literals import re import itertools from .common import InfoExtractor from ..compat import ( compat_str, ) from ..utils import ( determine_ext, unified_strdate, ) class RutubeIE(InfoExtractor): IE_NAME = 'rutube' IE_DESC = 'Rutube videos' _VALID...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} import os import pipes import re def query_package(module, package, action): if packa...
""" Dialogs that query users and verify the answer before accepting. Use ttk widgets, limiting use to tcl/tk 8.5+, as in IDLE 3.6+. Query is the generic base class for a popup dialog. The user must either enter a valid answer or close the dialog. Entries are validated when <Return> is entered or [Ok] is clicked. Entri...
""" Form Widget classes specific to the Django admin site. """ import django.utils.copycompat as copy from django import forms from django.forms.widgets import RadioFieldRenderer from django.forms.util import flatatt from django.utils.html import escape from django.utils.text import truncate_words from django.utils.t...
from openerp.osv import fields,osv from openerp import tools class report_document_user(osv.osv): _name = "report.document.user" _description = "Files details by Users" _auto = False _columns = { 'name': fields.char('Year', size=64,readonly=True), 'month':fields.selection([('01','Januar...
from setuptools import setup, find_packages from holmesalf import __version__ tests_require = [ 'mock', 'nose', 'coverage', 'yanc', 'preggy', 'tox', 'ipdb', 'coveralls', 'sphinx', ] setup( name='holmesalf', version=__version__, description='holmes-alf is a wrapper for O...
import unittest from datetime import datetime from google.appengine.ext import testbed from model.activeworkitems import ActiveWorkItems class ActiveWorkItemsTest(unittest.TestCase): def setUp(self): self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_datastore_v3_...
from uuid import UUID from polyaxon.polyflow import V1RunKind def get_fxt_service(): return { "version": 1.1, "kind": "operation", "name": "foo", "description": "a description", "tags": ["tag1", "tag2"], "trigger": "all_succeeded", "component": { ...
from bicho.post_processing import IssueLogger from issues_log import * __sql_drop__ = 'DROP TABLE IF EXISTS issues_log_launchpad;' __sql_table__ = 'CREATE TABLE IF NOT EXISTS issues_log_launchpad (\ id INTEGER NOT NULL AUTO_INCREMENT, \ tracker_id INTEGER NOT NULL, \ ...
#!/usr/bin/env python # WidgetGen.py - regenerate the ScintillaWidgetCpp.cpp and ScintillaWidgetCpp.h files # Check that API includes all gtkscintilla2 functions import sys import os import getopt scintillaDirectory = "../.." scintillaIncludeDirectory = os.path.join(scintillaDirectory, "include") sys.path.append(scin...
from openerp import pooler import time from openerp.report import report_sxw class code_barcode(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(code_barcode, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) repor...
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response from nssrc.com.citrix.netscaler.nitro.service.options import options from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_...
from setuptools import setup, Extension try: from Cython.Distutils import build_ext except: use_cython = False else: use_cython = True if use_cython: ext_modules = [Extension('dpark.portable_hash', ['dpark/portable_hash.pyx'])] cmdclass = {'build_ext': build_ext} else: ext_modules = [Extension(...
"""Memebot forms""" from django import forms from django.contrib.auth.models import User from django.db.models import Q from gruntle.memebot.models import Link class EditProfileForm(forms.ModelForm): """Form for updating your user profile""" password_opts = {'min_length': 3, 'max_length': 128, 'widget': for...
from __future__ import print_function import sys import time import unittest try: from unittest.runner import _TextTestResult # new in python-2.7 except ImportError: from unittest import _TextTestResult try: # They added the skip framework to python-2.7. # Drop this once we drop python-2.6 support. unittest_ski...
import sickbeard from chardet import detect from os import name def ek(function, *args, **kwargs): """ Encoding Kludge: Call function with arguments and unicode-encode output :param function: Function to call :param args: Arguments for function :param kwargs: Arguments for function :retur...
from sympy.combinatorics.graycode import (GrayCode, bin_to_gray, random_bitstring, get_subset_from_bitstring, graycode_subsets) def test_graycode(): g = GrayCode(2) got = [] for i in g.generate_gray(): if i.startswith('0'): g.skip() got.append(i) assert got == '00 11 10...
# -*- coding: utf-8 -*- from openerp import models, fields, api, _ import openerp.addons.decimal_precision as dp from openerp.exceptions import UserError from openerp.osv import fields as old_fields class event_event(models.Model): _inherit = 'event.event' event_ticket_ids = fields.One2many( 'event....
from flask import render_template, flash, redirect from app import app from .forms import LoginForm @app.route('/') @app.route('/index') def index(): user = {'nickname': 'Johnny'} # fake user posts = [ # Fake array of posts { 'author': {'nickname': 'Michael'}, 'body': 'Beautiful...
import mock import unittest from werkzeug.routing import Map, Rule from werkzeug.test import Client from werkzeug.wrappers import Response, BaseResponse from lymph.testing import WebServiceTestCase from lymph.web.interfaces import WebServiceInterface from lymph.web.handlers import RequestHandler from lymph.web.routin...
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2012-2014 Alex Forencich 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 without restriction, including without limitation the...
from pyjamas.ui.Sink import Sink, SinkInfo from pyjamas.ui.ListBox import ListBox from pyjamas.ui.HorizontalPanel import HorizontalPanel from pyjamas.ui.VerticalPanel import VerticalPanel from pyjamas.ui import HasAlignment from pyjamas.ui.Label import Label from pyjamas.ui.Widget import Widget class Lists(Sink): ...
from openpyxl.styles import Font, Style, Alignment, Border, Side, PatternFill from openpyxl.styles import borders, fills from openpyxl.styles import Protection from .utils import memoize cell_fills = [ PatternFill( fill_type=fills.FILL_SOLID, start_color='E6EFD7', ), PatternFill( ...
import torch from third_party.models.base_model import BaseModel from . import networks import numpy as np import torch.nn.functional as F class LnrModel(BaseModel): """This class implements the layered neural rendering model for decomposing a video into layers.""" @staticmethod def modify_commandline_opt...
import unittest import webob from quantum import auth class QuantumKeystoneContextTestCase(unittest.TestCase): def setUp(self): super(QuantumKeystoneContextTestCase, self).setUp() @webob.dec.wsgify def fake_app(req): self.context = req.environ['quantum.context'] ...
from gen import * ########## # shared # ########## flow_var[0] = """ (declare-fun tau () Real) (declare-fun d1 () Real) (declare-fun g1 () Real) (declare-fun d2 () Real) (declare-fun g2 () Real) """ flow_dec[0] = """ (define-ode flow_1 ((= d/dt[d1] (- (/ 0.5 0.166) (* 0.122 d1))) (= d/dt[g1] -0.5) (= d/dt[d2] (- (/ ...
#!/usr/bin/python #-*- coding: UTF-8 -*- #Carlos Rodriguez Garcia PTAVI Practica 3 Karaoke. from xml.sax import make_parser from xml.sax.handler import ContentHandler import sys class SmallSMILHandler(ContentHandler): def __init__(self): self.elementos = [] self.tags = ['root-layout', 'region', ...
# -*- coding: utf-8 -*- import logging import pytest logger = logging.getLogger(__name__) sublogger = logging.getLogger(__name__ + ".baz") def test_fixture_help(testdir): result = testdir.runpytest("--fixtures") result.stdout.fnmatch_lines(["*caplog*"]) def test_change_level(caplog): caplog.set_level(...
import unittest import time import os import sys import multiprocessing import signal from .. import devices class DevicesTestCase( unittest.TestCase, ): @classmethod def setUpClass( cls, ): pass def setUp( self, ): self.sigint_fired = False self.sigab...
#!/usr/bin/env python """ Test one data file """ from numpy import * import sys import kernel import distance import classifier import clustering import distribution import regression import preprocessor from modshogun import Math_init_random SUPPORTED=['kernel', 'distance', 'classifier', 'clustering', 'distribution...
"""Tests behavior of the grpc.aio.Channel class.""" import logging import os import unittest import grpc from grpc.experimental import aio from src.proto.grpc.testing import messages_pb2, test_pb2_grpc from tests.unit.framework.common import test_constants from tests_aio.unit._constants import (UNARY_CALL_WITH_SLEEP...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: win_wakeonlan version_added: '2.4' short_description: Send a magic Wake-on-LAN (WoL) broadcast packet description: - The C(win_wakeonlan) module se...
import attr from cached_property import cached_property import fauxfactory from textwrap import dedent from utils import db, conf, clear_property_cache, datafile from utils.path import scripts_path from utils.version import LATEST from utils.wait import wait_for from .plugin import AppliancePlugin, AppliancePluginExc...
from __future__ import print_function import os import re import sys from collections import defaultdict from ansible.plugins.test import core, files, mathstuff TESTS = list(core.TestModule().tests().keys()) + list(files.TestModule().tests().keys()) + list(mathstuff.TestModule().tests().keys()) TEST_MAP = { '...
""" Tests of DarkLangMiddleware """ from django.contrib.auth.models import User from django.http import HttpRequest from django.test import TestCase from mock import Mock from dark_lang.middleware import DarkLangMiddleware from dark_lang.models import DarkLangConfig UNSET = object() def set_if_set(dct, key, value...
""" Django and project specific settings for usage during development. Everything should be ready-to-go for a common development environment, but you may of course tweak some options. """ # pylint: disable=wildcard-import, unused-wildcard-import from .base_settings import * CSP_POLICIES = { # The debug error pag...
""" Django settings for api project. Generated by 'django-admin startproject' using Django 1.8. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ import os from url...
from django.utils.translation import ugettext, ugettext_lazy as _ from simple_accounting.exceptions import MalformedTransaction from simple_accounting.models import AccountingProxy, Transaction, LedgerEntry, account_type from simple_accounting.utils import register_transaction from consts import ( INCOME, EXPENSE...
from tornado.escape import json_encode, json_decode import pandas as pd from qiita_db.handlers.oauth2 import authenticate_oauth from .rest_handler import RESTHandler class StudySamplesHandler(RESTHandler): @authenticate_oauth def get(self, study_id): study = self.safe_get_study(study_id) if ...
from __future__ import absolute_import import contextlib import errno import hashlib import logging import os from pip._internal.utils.temp_dir import TempDirectory from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from types import TracebackType from typing import Iterator, Op...
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin class KDump(Plugin): """Kdump crash dumps """ plugin_name = "kdump" profiles = ('system', 'debug') def setup(self): self.add_copy_spec([ "/proc/cmdline" ]) class RedHatKDump(KDump, RedHatPlugin...
import urllib import unicodecsv as csv import sys def printlist ( array ): for item in array: print item return def iscorrectdata ( cell ): scell = cell.strip() if (scell != 'Daten') and (scell != 'Geodaten'): return False else: return True #Unfortunately, some special...
"""Support for device tracking via Xfinity Gateways.""" import logging from requests.exceptions import RequestException import voluptuous as vol from xfinity_gateway import XfinityGateway from homeassistant.components.device_tracker import ( DOMAIN, PLATFORM_SCHEMA, DeviceScanner, ) from homeassistant.con...
"""Masks one `Series` based on the content of another `Series`.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.learn.python.learn.dataframe import series from tensorflow.contrib.learn.python.learn.dataframe import transform from ...
import glob,zipfile,os import sys def iscompatible(mod_version, state_version): mod_version = mod_version.split('.') state_version = state_version.split('.') if len(state_version)==2: state_version.insert(0,'0') if len(mod_version)==2: mod_version.insert(0,'0') if mod_version[0] ...
#._cv_part guppy.etc.RE from guppy.etc.RE_Rect import chooserects from guppy.etc.IterPermute import iterpermute class InfiniteError(Exception): pass class WordsMemo: def __init__(self, re, ch): self.re = re self.ch = ch self.xs = {} self.N = 0 def get_words_of_length(self, N): # Return a list of wo...
import sys from spacewalk.common.rhnLog import log_debug from spacewalk.common.rhnConfig import CFG, initCFG from spacewalk.common.rhnException import rhnException from spacewalk.common.rhnTB import add_to_seclist # SQL objects import sql_table import sql_row import sql_sequence import dbi import sql_types types = sq...
""" Simple prolog example. I'm not sure why, but the use of a temporary file seems very finicky -- perhaps there is a problem with rapidly flushing the output, etc? # """ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Define a sim...
__revision__ = "$Id$" from Crypto.Util.py3compat import * # This is a list of (expected_result, input[, description]) tuples. test_data = [ # Test vectors downloaded 2008-09-12 from # http://homes.esat.kuleuven.be/~bosselae/ripemd160.html ('9c1185a5c5e9fc54612808977ee8f548b2258d31', '', "'' (empty strin...
import plotter import common import wx import numpy import math import pubsub from constants import * from gnuradio import gr #for gr.prefs import forms ################################################## # Constants ################################################## DEFAULT_WIN_SIZE = (600, 300) #####################...
"""Test state helpers.""" import asyncio from datetime import timedelta import unittest from unittest.mock import patch import homeassistant.core as ha from homeassistant.setup import async_setup_component from homeassistant.const import (SERVICE_TURN_ON, SERVICE_TURN_OFF) from homeassistant.util.async_ import run_cor...
import cgitb; cgitb.enable() import cgi, os # Note: XenAPI.py is shipped as part of the SDK # see http://community.citrix.com/display/xs/Download+SDKs import XenAPI def main(): print "Content-type: text/html\n" form = cgi.FieldStorage() session = None if ("hostName" in form): hostName = form.getfirst("hostNa...
#!/usr/bin/env python # # Check trace components in FreeType 2 source. # # This code is explicitly into the public domain. import sys import os import re SRC_FILE_LIST = [] USED_COMPONENT = {} KNOWN_COMPONENT = {} SRC_FILE_DIRS = [ "src" ] TRACE_DEF_FILES = [ "include/internal/fttrace.h" ] # ----------------...
import serial import MySQLdb import time import datetime db = MySQLdb.connect("DESKTOP-7PF3GNC", "viral", "viral", "student") ldb= MySQLdb.connect("localhost", "classroom", "password", "timetable") print "Connected" CDay =datetime.date.today().strftime("%A"); curs=db.cursor() curs2= ldb.cursor() curs.execute("Select CO...
import data_storage import json import yaml import os from cloudferrylib.utils import utils as utl LOG = utl.get_log(__name__) MIGRATE_VM_PREFIX = 'migrate_vm_' def delete_relations(): LOG.info("started deleting old VM to hypervisor relations") keys = data_storage.keys(MIGRATE_VM_PREFIX + '*') data_stor...
# coding: utf8 { '!langcode!': 'id', '!langname!': 'Indonesian', '%d days ago': '%d hari yang lalu', '%d hours ago': '%d jam yang lalu', '%d minutes ago': '%d menit yang lalu', '%d months ago': '%d bulan yang lalu', '%d seconds ago': '%d detik yang lalu', '%d seconds from now': '%d detik dari sekarang', '%d weeks ago':...
import urllib2 import sys import json import argparse import collections baseurl = "https://download.01.org/perfmon" target_events = (u'BR_INST_RETIRED.NEAR_TAKEN', u'BR_INST_EXEC.TAKEN', u'BR_INST_RETIRED.TAKEN_JCC', u'BR_INST_TYPE_RETIRED.COND_TAKEN') ap = argpars...
import logging from django.core.urlresolvers import reverse # noqa from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs from openstack_dashboard import api LOG = logging.getLogger(__name__) class OverviewTab(tabs.Tab): name = _("Overview") ...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'network'} import re import time from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network.eos.eos import run_commands, load_config from ansible.module_utils.six ...
""" sentry.plugins.base.structs ~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function __all__ = ['ReleaseHook'] from django.db import IntegrityError, transaction ...
import os import signal import subprocess import sys import tempfile import time from ..local import utils from ..objects import output def KillProcessWithID(pid): if utils.IsWindows(): os.popen('taskkill /T /F /PID %d' % pid) else: os.kill(pid, signal.SIGTERM) MAX_SLEEP_TIME = 0.1 INITIAL_SLEEP_TIME =...
""" Tests for reporters """ import json from tests.utils import run_temci, run_temci_proc def test_console_reporter_auto_mode(): d = lambda d: { "attributes": {"description": "XYZ" + d}, "data": {"p": [1]} } out = run_temci("report in.yaml --console_mode auto", files={...
""" Copyright (c) 2007 Jan-Klaas Kollhof This file is part of jsonrpc. jsonrpc is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later ...
"""Show the set of dependency diffs introduced by a branch. Usage: show-upgrade-diffs.py [-d <directory>] <user> <branch> Assumes that there is a <user>/nomulus repository on github with the specified branch name. """ import argparse import os import six import subprocess import sys import tempfile from typing i...
from .utils import emit_sexp, issequence_except_str class UnquoteSplicingError(Exception): def __init__(self): self.msg = 'unquote_splicing appeared in invalid context' def __repr__(self): return self.msg def __str__(self): return self.msg class MochiSyntaxError(Exception): ...
from lxml import etree import unittest import xml.sax.saxutils as saxutils from capa.tests.helpers import test_capa_system from capa import customrender # just a handy shortcut lookup_tag = customrender.registry.get_class_for_tag def extract_context(xml): """ Given an xml element corresponding to the output...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('home', '0002_auto_20150321_0006'), ] ...
#pylint: disable=C import discord from discord.ext import commands import datetime from mcstatus import MinecraftServer from pagination import Pages class Info(): def __init__(self, bot): self.bot = bot # Voting done, command disabled # @commands.command() # async def vote(): # embed =...
# PermWrapper and PermLookupDict proxy the permissions system into objects that # the template system can understand. class PermLookupDict(object): def __init__(self, user, module_name): self.user, self.module_name = user, module_name def __repr__(self): return str(self.user.get_all_permission...
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.pycompat24 import get_exception from tempfile import mkstemp, mkdtemp from os import close def main(): mo...
from gluon.admin import * from gluon.fileutils import abspath, read_file, write_file from gluon.tools import Service from glob import glob import shutil import platform import time import base64 import os try: from cStringIO import StringIO except ImportError: from StringIO import StringIO service = Service(g...
from __future__ import absolute_import, division, print_function, \ with_statement import os import time import socket import select import errno import logging from collections import defaultdict from shadowsocks import shell __all__ = ['EventLoop', 'POLL_NULL', 'POLL_IN', 'POLL_OUT', 'POLL_ERR', 'P...
''' Downloads and extracts elasticsearch for backwards compatibility tests. ''' import argparse import os import platform import shutil import subprocess import urllib.request import zipfile def parse_config(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--path', metavar='DIR', defa...
from __future__ import absolute_import, unicode_literals class Person(object): def __init__(self, data): # primary attributes that should be set in all cases self.name = self._extract_name(data) self.imdb_id = self._extract_imdb_id(data) self.photo_url = self._extract_photo_url(d...
import os import sys from ansible.compat.tests import mock, unittest from ansible.module_utils.gcp import check_min_pkg_version, GCPUtils, GCPInvalidURLError def build_distribution(version): obj = mock.MagicMock() obj.version = '0.5.0' return obj class GCPUtilsTestCase(unittest.TestCase): params_di...
"""Implementation of an S3-like storage server based on local files. Useful to test features that will eventually run on S3, or if you want to run something locally that was once running on S3. We don't support all the features of S3, but it does work with the standard S3 client for the most basic semantics. To use t...
__author__ = 'Ryan Drew' import logging import logging.config import wx logging.config.dictConfig({ 'version': 1, 'propagate': False, 'disable_existing_loggers': False, 'formatters': { 'file': { 'format': '%(levelname)s:%(asctime)s:%(name)s:%(message)s', 'datefmt': "%m...