content
stringlengths
4
20k
from insights.parsers.smartctl import SMARTctl from insights.parsers import ParseException from insights.tests import context_wrap import pytest STANDARD_DRIVE = """ smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-267.el7.x86_64] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools...
"""VIF drivers for VMware.""" from oslo.config import cfg from oslo.vmware import exceptions as vexc from nova import exception from nova.i18n import _LW from nova.network import model from nova.openstack.common import log as logging from nova.virt.vmwareapi import network_util from nova.virt.vmwareapi import vim_uti...
"""Tests for distutils.command.register.""" import sys import os import unittest import getpass import urllib import warnings from test.support import check_warnings, run_unittest from distutils.command import register as register_module from distutils.command.register import register from distutils.core ...
"""Create tests for each fuzzer""" import copy import glob def mako_plugin(dictionary): targets = dictionary['targets'] tests = dictionary['tests'] for tgt in targets: if tgt['build'] == 'fuzzer': new_target = copy.deepcopy(tgt) new_target['build'] = 'test' new...
"""Pressure util functions.""" import logging from numbers import Number from homeassistant.const import ( PRESSURE, PRESSURE_HPA, PRESSURE_INHG, PRESSURE_MBAR, PRESSURE_PA, PRESSURE_PSI, UNIT_NOT_RECOGNIZED_TEMPLATE, ) _LOGGER = logging.getLogger(__name__) VALID_UNITS = [PRESSURE_PA, PR...
import json from alerts.actions.dashboard_geomodel import message class TestDashboardGeomodel(object): def mock_write_db_entry(self, alert_record): self.test_result_record = alert_record def mock_connect_db(self): self.test_connect_called = True def setup(self): # Mock boto ser...
import hashlib import os import pytest from Bootstrapper import BootstrapperPlugin from Bootstrapper.BootstrapperDb import BootstrapperDb from Peer import Peer from Crypt import CryptRsa from util import helper @pytest.fixture() def bootstrapper_db(request): BootstrapperPlugin.db.close() BootstrapperPlugin....
"Unit test for the MplStyleManager class." __version__ = "$Revision: #1 $" #=========================================================================== # Required imports. Do not modify these. import unittest #=========================================================================== # Place all imports after her...
import goocanvas import cairo import unittest import pango import gtk class TestImage(unittest.TestCase): def make_image_item(self, **kwargs): item = goocanvas.Image(**kwargs) return item ''' Test goocanvas.Image properties ''' def test_image_x_property(self): item = self.make...
import math from scipy.integrate import quad k=50 a=5.0 b=3.0 m=16.0 fac=0.0 valor=0.0 acum_sum=0.0 integral=0.0 nor=0.0 pois=0.0 ser=0.0 pux=[] px=[] acumulada=[] servidor=[] llegada=[] def factorial(x,n): if (n>0): x=factorial(x,n-1) x=x*n else: x=1 return x def congruencialMixt...
""" This file exists to contain all Django and Python compatibility issues. In order to avoid circular references, nothing should be imported from debug_toolbar. """ from django.conf import settings from django.core.exceptions import ImproperlyConfigured try: from django.template.base import linebreak_iter # NO...
# -*- coding: utf-8 -*- from django.conf import settings from django.core.exceptions import ImproperlyConfigured try: # Django versions >= 1.9 from django.utils.module_loading import import_module except ImportError: # Django versions < 1.9 from django.utils.importlib import import_module def send_sm...
from sigma.core.permission import check_admin from sigma.core.permission import check_write from config import Prefix import discord async def announcementchannel(cmd, message, args): if not check_admin(message.author, message.channel): # user is no server admin embed = discord.Embed(title='⛔ Unp...
from __future__ import unicode_literals from functools import partial from django.contrib.admin.checks import InlineModelAdminChecks from django.contrib.admin.options import InlineModelAdmin, flatten_fieldsets from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.forms impo...
"""Python client library for the Facebook Platform. This client library is designed to support the Graph API and the official Facebook JavaScript SDK, which is the canonical way to implement Facebook authentication. Read more about the Graph API at https://developers.facebook.com/docs/graph-api. """ import hashlib i...
import copy import json from tests.base import JenkinsTestBase class JenkinsJobsTestBase(JenkinsTestBase): config_xml = """ <matrix-project> <actions/> <description>Foo</description> </matrix-project>""" class JenkinsGetJobsTestBase(JenkinsJobsTestBase): jobs_in_fo...
""" Copyright (c) 2003-2005 Gustavo Niemeyer <<EMAIL>> This module offers extensions to the standard python 2.3+ datetime module. """ from dateutil.tz import tzfile from tarfile import TarFile import os __author__ = "Gustavo Niemeyer <<EMAIL>>" __license__ = "PSF License" __all__ = ["setcachesize", "gettz", "rebuil...
###PLEASE RUN USING PYTHON3 ###AUTHOR: ADITYA D PAI ###------GRID SPACE SIMULATOR------- import random import sys def getGrid(size): (width,height)=size obstacles=[] count=int(height*(random.randint(height-1,height+5)/10)) for i in range (0,count): origin_x=random.randint(0,width-1) origin_y=random.randint(0,he...
#!/usr/bin/env python import os import subprocess # from config import Config from flask.ext.migrate import Migrate, MigrateCommand from flask.ext.script import Manager, Shell from redis import Redis from rq import Connection, Queue, Worker from app import create_app, db from app.models import (CsvBodyCell, CsvBodyRo...
import sqlite3 # This is really hacky. At some point it should really get replaced with a proper # database system that can share connections between threads, et cetera - but for # now, this works. global_db_path = None def init(db_path): global global_db_path global_db_path = db_path # Create tabl...
from PyQt4 import QtCore from colors import Colors from demoitem import DemoItem from demoitemanimation import DemoItemAnimation from demotextitem import DemoTextItem from headingitem import HeadingItem class MenuContentItem(DemoItem): def __init__(self, el, scene=None, parent=None): super(MenuContentIte...
#!/usr/bin/env python # -*- coding: utf-8 -*- from random import randrange from shutil import rmtree from tempfile import gettempdir from tempfile import mkdtemp import os import sys import mock from testify import TestCase from testify import assert_equal from testify import assert_false from testify import assert_ra...
""" SQL functions reference lists: https://web.archive.org/web/20130407175746/http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.0.0.html http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.1.html """ import re import sys from django.contrib.gis.db.backends.base.operations import \ BaseSpatialOperations from django...
#! /usr/bin/env python2 """ mbed SDK Copyright (c) 2011-2013 ARM Limited 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/LICENSE-2.0 Unless required by applicabl...
from django.apps import apps as django_apps from bcpp_community.surveys import ANONYMOUS_SURVEY, BCPP_YEAR_3 from bcpp_community.surveys import BHS_SURVEY, AHS_SURVEY, ESS_SURVEY from survey import S from survey.site_surveys import site_surveys from ...exceptions import EnrollmentError from ...managers import Enrollme...
from qwt.qt.QtGui import QImage import numpy as np def array_to_qimage(arr, copy=False): """Convert NumPy array to QImage object""" # https://gist.githubusercontent.com/smex/5287589/raw/toQImage.py if arr is None: return QImage() if len(arr.shape) not in (2, 3): raise NotIm...
#!/usr/bin/env python # coding=utf-8 import sys import os import cv2 import gzip import datetime import logging import numpy as np from glob import glob module_dir = os.path.dirname(os.path.abspath(__file__)) module_name = os.path.basename(__file__).split('.')[0] log_path = os.path.join(module_dir, os.path.pardir...
import collections import threading class LruCache(object): def __init__(self, capacity=3000): self.capacity = capacity self.cache = collections.OrderedDict() self.lock = threading.Lock() self.running = True def get(self, key): with self.lock: record = Non...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models from ..utils import get_user_model User = get_user_model() user_orm_label = '%s.%s' % (User._meta.app_label, User._meta.object_name) user_model_label = '%s.%s' % (User._meta.app_label, Us...
from .util import check_output, check_call, PIPE, Popen, CalledProcessError from shutil import copyfileobj import logging log = logging.getLogger(__package__+".boot") kernelprefix = "/boot/vmlinuz-" def kernelver(kernel): if kernel.startswith(kernelprefix): return kernel.split(kernelprefix,1)[1] else...
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsLayoutItemLabel. .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ""...
"""Base Command class, and related routines""" import os import sys import tempfile import traceback import time import optparse from pip import cmdoptions from pip.locations import running_under_virtualenv from pip.log import logger from pip.download import PipSession from pip.exceptions import (BadCommand, Installa...
from toontown.coghq.SpecImports import * GlobalEntities = { 1000: { 'type': 'levelMgr', 'name': 'LevelMgr', 'comment': '', 'parentEntId': 0, 'cogLevel': 0, 'farPlaneDistance': 1500, 'modelFilename': 'phase_10/models/lawbotHQ/LawbotCourtroom3', 'wantD...
"""Testing for SAX-VSM.""" # License: BSD-3-Clause import numpy as np from math import log from sklearn.metrics.pairwise import cosine_similarity from pyts.classification import SAXVSM X = [[0, 0, 0, 1, 0, 0, 1, 1, 1], [0, 1, 1, 1, 0, 0, 1, 1, 1], [0, 0, 0, 1, 0, 0, 0, 1, 0]] y = [0, 0, 1] def test_actu...
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Profile.cc_version' db.add_column('environments_profile', 'cc_version', self.gf('django.db.models...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ***************************************** Author: zhlinh Email: <EMAIL> Version: 0.0.1 Created Time: 2016-03-03 Last_modify: 2016-03-03 ****************************************** ''' ''' Reverse a linked list from position m to n. Do it in-...
##==============================================================# ## SECTION: Imports # ##==============================================================# import os import subprocess import sys ##==============================================================# ## SECTION: Fun...
# -*- coding: utf-8 -*- ''' Specto Add-on Copyright (C) 2015 lambda This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any l...
# -*- coding: utf-8 -*- from openerp.osv import osv, fields class WebsiteResPartner(osv.Model): _name = 'res.partner' _inherit = ['res.partner', 'website.seo.metadata'] def _get_ids(self, cr, uid, ids, flds, args, context=None): return {i: i for i in ids} def _set_private(self, cr, uid, ids...
import random import dpll import time from utils import binomialCoefficient count = 0 def satProbabilityRate(n, m, k, num): # Uguale a SatProbability, solo che invece che rendere # il numero di esempi positivi e negativi, restituisce # la probabilita' di successo. results, recCalls, ratio = satProbabi...
""" WiFi Positioning System Wrappers around the SkyHook and Google Locations APIs to resolve wireless routers' MAC addresses (BSSID) to physical locations. """ try: from json import dumps, loads except: from simplejson import dumps, loads from urllib2 import Request, urlopen from urllib import url...
#!/usr/bin/env python import time, datetime, random, math, threading, os, serial class LiveData(threading.Thread): def __init__(self, environment): threading.Thread.__init__(self) self.daemon = True #self.portName = "/dev/ttyUSB0" self.portName = "/dev/RADIO" self.environme...
# toolchains options ARCH = 'arm' CPU = 'sep4020' CROSS_TOOL = 'keil' if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin' elif CROSS_TOOL == 'keil': PLATFORM = 'armcc' EXEC_PATH = 'c:/Keil' BUILD = 'debug' if PLATFORM == 'gcc': ...
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function from behave import __version__ from behave.configuration import Configuration, ConfigError from behave.parser import ParserError from behave.runner import Runner from behave.runner_util import print_undefined_step_snippets, \ InvalidFil...
# -*- coding: utf-8 -*- """Copyright 2014 Roger R Labbe Jr. filterpy library. http://github.com/rlabbe/filterpy Documentation at: https://filterpy.readthedocs.org Supporting book at: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python This is licensed under an MIT license. See the readme.MD file for mor...
import b2.build.feature as feature import b2.build.targets as targets import b2.build.property_set as property_set import b2.build.virtual_target as virtual_target import b2.build.targets from b2.manager import get_manager import bjam import os feature.feature("symlink-location", ["project-relative", "build-relati...
import re from django.db.backends import BaseDatabaseIntrospection # This light wrapper "fakes" a dictionary interface, because some SQLite data # types include variables in them -- e.g. "varchar(30)" -- and can't be matched # as a simple dictionary lookup. class FlexibleFieldLookupDict(object): # Maps SQL types t...
# Maked by Mr. Have fun! Version 0.2 import sys from net.sf.l2j.gameserver.model.quest import State from net.sf.l2j.gameserver.model.quest import QuestState from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest GOUPHS_CONTRACT_ID = 1559 REEPS_CONTRACT_ID = 1560 ELVEN_WINE_ID = 1561 BRONPS_DICE_ID ...
import superdesk from lxml import etree as etree from lxml.etree import SubElement from flask import current_app as app from superdesk.publish.formatters import Formatter from superdesk.errors import FormatterError from superdesk.metadata.item import ITEM_TYPE, CONTENT_TYPE, EMBARGO, FORMAT, FORMATS from apps.archive.c...
from __future__ import absolute_import from django.db import transaction, connection, models try: from django.db import connections, router except ImportError: # pre-Django 1.2 connections = router = None # noqa class QueueManager(models.Manager): def publish(self, queue_name, payload): queue,...
from direct.directnotify.DirectNotifyGlobal import directNotify from toontown.cogdominium.DistCogdoLevelGame import DistCogdoLevelGame from toontown.cogdominium.CogdoBoardroomGameBase import CogdoBoardroomGameBase from toontown.cogdominium import CogdoBoardroomGameConsts as Consts from toontown.toonbase import Toontown...
#!/usr/bin/env python import os import wx import time from GUI.splashScreen import SplashScreen from GUI.startScreen import StartScreen from GUI.filemenu import FileMenu from GUI.mainWindow import MainWindow ################################################################ ## The Main app class controls the GUI of ...
# -*- coding: utf-8 -*- """ :copyright: (c) 2014 by the mediaTUM authors :license: GPL3, see COPYING for details """ import string from base64 import b64encode import factory.alchemy from factory.fuzzy import * import scrypt from contenttypes import Directory, Collection, Document, Collections, Home from core ...
#!/usr/bin/env python import re import json from subprocess import Popen, PIPE, run import time from importlib import import_module, reload import os.path import appdirs from twisted.internet import task from twisted.internet.defer import Deferred from twisted.internet.protocol import ClientFactory as BaseClientFactor...
import tensorflow as tf import numpy as np import baselines.common.tf_util as U from tensorflow.python.ops import math_ops from tensorflow.python.ops import nn class Pd(object): """ A particular probability distribution """ def flatparam(self): raise NotImplementedError def mode(self): ...
""" Tests for miscellaneous (non-magic) ``np.ndarray``/``np.generic`` methods. More extensive tests are performed for the methods' function-based counterpart in `../from_numeric.py`. """ from __future__ import annotations import operator from typing import cast, Any import numpy as np class SubClass(np.ndarray): ...
# -*- coding: utf-8 -*- from south.db import db from south.v2 import SchemaMigration from django.conf import settings from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'TouristicContentType' db.create_table('t_b_contenu_touristique_type', ( ...
#This dataset was pulled off Kaggle.com as under the dataset named "Predict'em All at the link below #https://www.kaggle.com/semioniy/predictemall #The data describes pokemon sightings in the mobile game Pokemon Go, developed by Niantic. In the game, players use a mobile # device's GPS capability to locate, captur...
from django.conf import settings as djangosettings from django.contrib import messages from django.contrib.auth.decorators import permission_required from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django.template import RequestContext from django.views.decorators.csrf ...
from ast import literal_eval from pprint import pformat import os import shutil import logging from errbot import BotPlugin, botcmd from errbot.plugin_manager import PluginConfigurationException, PluginActivationException from errbot.repo_manager import RepoException class Plugins(BotPlugin): @botcmd(admin_only...
import pytest from pip._internal.commands.debug import create_vendor_txt_map from pip._internal.utils import compatibility_tags @pytest.mark.parametrize('expected_text', [ 'sys.executable: ', 'sys.getdefaultencoding: ', 'sys.getfilesystemencoding: ', 'locale.getpreferredencoding: ', 'sys.platform...
"""This example creates a creative field associated with a given advertiser. To get an advertiser ID, run get_advertisers.py. """ import argparse import sys from apiclient import sample_tools from oauth2client import client # Declare command-line flags. argparser = argparse.ArgumentParser(add_help=False) argparser....
"""TODO""" import random import numpy from sensorimotor import stp if __name__ == "__main__": r = random.Random(42) w = 20 nInputs = 500 A, B, C, D, E = [numpy.zeros([nInputs], dtype=numpy.bool) for _ in xrange(5)] A[:w] = 1 B[w:2*w] = 1 C[2*w:3*w] = 1 D[3*w:4*w] = 1 E[4*w:5*w] = 1 coincThres...
""" Visualize the links created by rules. 1. requires graphviz pip install graphviz apt-get install graphviz To run : ./st2-analyze-links.py --action_ref <action-ref> The command must run on a StackStorm box. """ import eventlet import os import sets import sys from oslo_config import cfg from...
import esp import network class SM: def wait(self): print("wait") def find_channel(self): print("find channel") def getting_ssid_pswd(self, dtype): print("getting ssid type", dtype) def link(self, ssid, password): print("Link", ssid, password) self.indicator....
"""SDR classifier diff tool. This class can be used just like versions of the SDR classifier but internally creates instances of each SDR classifier. Each record is fed to both classifiers and the results are checked for differences. """ import numbers from nupic.algorithms.sdr_classifier import SDRClassifier from n...
""" Japanese-language mappings for language-dependent features of reStructuredText. """ __docformat__ = 'reStructuredText' # Corrections to these translations are welcome! # 間違いがあれば、どうぞ正しい翻訳を教えて下さい。 directives = { # language-dependent: fixed '注目': 'attention', '注意': 'caution', 'code (translation requ...
""" Created on Tue Jan 03 10:55:39 2017 @author: Ricky """ ##################################################################### """ Importing program modules """ ##################################################################### import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates...
import shared import threading import time import sys from pyelliptic.openssl import OpenSSL import ctypes import hashlib import highlevelcrypto from addresses import * from debug import logger from pyelliptic import arithmetic import tr class addressGenerator(threading.Thread): def __init__(self): # QThr...
from m5.objects import * from arm_generic import * import switcheroo root = LinuxArmFSSwitcheroo( mem_class=DDR3_1600_8x8, cpu_classes=(DerivO3CPU, DerivO3CPU) ).create_root() # Setup a custom test method that uses the switcheroo tester that # switches between CPU models. run_test = switcheroo.run_test
# -*- coding: utf-8 -*- """ General description: """ ############################################################################### # imports ############################################################################### import os import logging import pandas as pd import numpy as np import matplotlib.pyplot as plt...
import sys import time try: import boto from boto import route53 from boto.route53.record import ResourceRecordSets except ImportError: print "failed=True msg='boto required for this module'" sys.exit(1) def commit(changes, retry_interval): """Commit changes, but retry PriorRequestNotComplete ...
#! /usr/bin/python3 import random import sys import argparse import re rng = random.SystemRandom() parser = argparse.ArgumentParser(description='password generator') parser.add_argument('chars', help="number of characters in password") parser.add_argument('num', help="number of words to be used") parser.add_argument...
# -*- coding: utf-8 -*- """The APFS path specification resolver helper implementation.""" from dfvfs.file_io import apfs_file_io from dfvfs.lib import definitions from dfvfs.resolver_helpers import manager from dfvfs.resolver_helpers import resolver_helper from dfvfs.vfs import apfs_file_system class APFSResolverHel...
"""Class to """ from __future__ import absolute_import from __future__ import print_function import math #MAX_IOFF = 30000 #extern size_t ioff[MAX_IOFF]; # #MAX_DF = 500 #extern double df[MAX_DF]; # #MAX_BC = 20 #extern double bc[MAX_BC][MAX_BC]; # #MAX_FAC = 100 #extern double fac[MAX_FAC]; # # #MAX_DF = 500 #extern...
from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import flt, fmt_money, getdate, formatdate from frappe.model.document import Document from erpnext.accounts.party import validate_party_gle_currency, get_party_account_currency from erpnext.accounts.utils import get_account_cur...
""" Distribution configuration for neurom """ # pylint: disable=R0801 import os from setuptools import setup from setuptools import find_packages VERSION = "1.4.15.dev1" REQS = ['click>=7.0', 'enum-compat>=0.0.2', 'future>=0.16.0', 'h5py>=2.7.1', 'matplotlib>=1.3.1', 'numpy>=1...
"""This module is deprecated. Please use `airflow.providers.amazon.aws.log.s3_task_handler`.""" import warnings # pylint: disable=unused-import from airflow.providers.amazon.aws.log.s3_task_handler import S3TaskHandler # noqa warnings.warn( "This module is deprecated. Please use `airflow.providers.amazon.aws.log...
"""Windows can't run .sh files, so this is a Python implementation of update.sh. This script should replace update.sh on all platforms eventually.""" import argparse import os import re import shutil import subprocess import stat import sys import time # Do NOT CHANGE this if you don't know what you're doing -- see #...
import pygame.font import json from pygame.sprite import Group from ship import Ship class Scoreboard(): """A class to represent everything that is required to show the scoreboard.""" def __init__(self, ai_settings, screen, stats): """Initializes Scoreboard settings.""" self.ai_settings = ai_settings self.st...
from time import sleep import logging import random import re from requests.sessions import Session import js2py from copy import deepcopy try: from urlparse import urlparse except ImportError: from urllib.parse import urlparse DEFAULT_USER_AGENTS = [ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit...
""" Tests for cgsnapshot code. """ import json from xml.dom import minidom import webob from cinder import context from cinder import db from cinder.openstack.common import log as logging from cinder import test from cinder.tests.api import fakes from cinder.tests import utils import cinder.volume LOG = logging.ge...
import numpy as np from sisl._internal import set_module from sisl import Atom, Geometry, SuperCell __all__ = ['nanotube'] @set_module("sisl.geom") def nanotube(bond, atoms=None, chirality=(1, 1)): """ Nanotube with user-defined chirality. This routine is implemented as in `ASE`_ with some cosmetic changes...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('instance', '0019_auto_20150808_1122'), ] operations = [ migrations.AlterField( model_name='openedxinstance', ...
from .health_evaluation import HealthEvaluation class NodeHealthEvaluation(HealthEvaluation): """Represents health evaluation for a node, containing information about the data and the algorithm used by health store to evaluate health. The evaluation is returned only when the aggregated health state is eit...
""" Dialog for adding fracture to interface. """ import PyQt5.QtWidgets as QtWidgets from LayerEditor.leconfig import cfg import PyQt5.QtGui as QtGui import gm_base.icon as icon class AddFractureDlg(QtWidgets.QDialog): def __init__(self, fracture_positions, parent=None): super(AddFractureDlg, self).__ini...
"""Tests formatting as writer-agnostic ExcelCells ExcelFormatter is tested implicitly in pandas/tests/io/test_excel.py """ import pytest from pandas.io.formats.excel import CSSToExcelConverter @pytest.mark.parametrize('css,expected', [ # FONT # - name ('font-family: foo,bar', {'font': {'name': 'foo'}})...
import logging import os import shutil import subprocess import sys import tempfile import unittest ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) VERBOSE = False class CalledProcessError(subprocess.CalledProcessError): """Makes 2.6 version act like 2.7""" def __init__(self, returncode, cmd, output): ...
""" InaSAFE Disaster risk assessment tool developed by AusAid - **Paragraph.** Contact : <EMAIL> .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, ...
import os import platform import textwrap import unittest import pytest from conans.test.assets.genconanfile import GenConanfile from conans.test.assets.sources import gen_function_cpp from conans.test.utils.tools import TestClient from conans.util.files import save, load @pytest.mark.tool_cmake @pytest.mark.skipi...
import markdown BRK = markdown.inlinepatterns.BRK NOIMG = markdown.inlinepatterns.NOIMG SPACE = r"(?:\s*(?:\r\n|\r|\n)?\s*)" SPACED_LINK_RE = markdown.inlinepatterns.LINK_RE.replace( NOIMG + BRK, NOIMG + BRK + SPACE) SPACED_REFERENCE_RE = markdown.inlinepatterns.REFERENCE_RE.replace( NOIMG + BRK, NOIMG + BRK...
import os from off_utils.off_handler import OffHandler sub_dirs = os.listdir('.') off_handler = OffHandler() for sub_dir in sub_dirs: if "D0" not in sub_dir: continue print sub_dir off_file = sub_dir + '/' + sub_dir + '.off' off_handler.read(off_file) scale = off_handler.get_scale_factor...
# -*- coding: utf-8 -*- def copy_plugins_to(plugin_list, to_placeholder, to_language=None, parent_plugin_id=None, no_signals=False): """ Copies a list of plugins to a placeholder to a language. """ old_parent_cache = {} plugins_ziplist = [] first = True for old_plugin in plugin_list: ...
from .middleware import Middleware from .schema import request_schema, response_schema, SchemaDecoratorError import falcon, falcon.testing import json import logging import unittest class NonJSONResource(object): def __init__(self): self.received = None def on_post(self, req, resp): self.rec...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of Heimdall. Heimdall is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ...
import datetime import mock from django.utils import timezone from mock import Mock, call, PropertyMock from django.test import TestCase from django.contrib.sessions.models import Session from mysite.celery import send_outcome, check_anonymous class CeleryTasksTest(TestCase): @mock.patch('mysite.celery.UserSess...
""" This file contains receivers of course publication signals. """ import logging from django.dispatch import receiver from django.utils import timezone from opaque_keys.edx.keys import CourseKey from xmodule.modulestore.django import SignalHandler from openedx.core.djangoapps.credit.verification_access import upda...
{'name' : 'name', 'version' : '0.1', 'author' : "Camptocamp,Odoo Community Association (OCA)", 'maintainer': 'Camptocamp', 'category': 'Warehouse', 'complexity': "normal", # easy, normal, expert 'depends' : ['stock', 'product'], 'description': """Allows to set a stock level composed by a configuration using th...
from threading import Thread import rospy from optparse import OptionParser # import Aldebaran API (must be in PYTHONPATH): try: from naoqi import ALProxy, ALBroker, ALModule except ImportError: raise RuntimeError("Error importing NaoQI. Please make sure that Aldebaran's NaoQI API is in your PYTHONPATH.") c...
from os import path import pytest from django.core.files.uploadedfile import SimpleUploadedFile from django.urls import reverse from antigonovo.django_assertions import dj_assert_contains from antigonovo.moveis.models import Movel def test_app_link_in_home(client): response = client.get('/') dj_assert_conta...