code
stringlengths
1
199k
import os from operator import itemgetter from gluon.storage import Storage from gluon.dal import DAL, Field, Row DBHOST = os.environ.get('DBHOST', 'localhost') DATABASE_URI = 'mysql://benchmarkdbuser:benchmarkdbpass@%s:3306/hello_world' % DBHOST class Dal(object): def __init__(self, table=None, pool_size=8): ...
from __future__ import (unicode_literals, division, absolute_import, print_function) store_version = 1 # Needed for dynamic plugin loading __license__ = 'GPL 3' __copyright__ = '2011, John Schember <john@nachtimwald.com>' __docformat__ = 'restructuredtext en' from calibre.gui2.store.basic_config import BasicStoreConfig...
from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler env.deploy_path = 'output' DEPLOY_PATH = env.deploy_path production = 'root@localhost:22' dest_path = '/var/www' env.cloudfiles_username = 'my_rac...
import os.path import sys import re import warnings import cx_Oracle from django.db import connection, models from django.db.backends.util import truncate_name from django.core.management.color import no_style from django.db.models.fields import NOT_PROVIDED from django.db.utils import DatabaseError try: from djang...
import vtk from vtk.test import Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() ren1 = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren1) iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) voxelPoints = vtk.vtkPoints() voxelPoints.SetNumberOfPoin...
import copy from openerp import models from openerp.addons.account.report.account_financial_report import\ report_account_common class report_account_common_horizontal(report_account_common): def __init__(self, cr, uid, name, context=None): super(report_account_common_horizontal, self).__init__( ...
import os import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner from datetime import datetime class InvalidTimeout(Exception): pass def testfunc(child): exp_diff1 = 1000000 exp_diff5 = 5000000 exp_diff10 = 10000000 child.expect(u"This test will p...
import unittest import pysal from pysal.core.IOHandlers.arcgis_swm import ArcGISSwmIO import tempfile import os class test_ArcGISSwmIO(unittest.TestCase): def setUp(self): self.test_file = test_file = pysal.examples.get_path('ohio.swm') self.obj = ArcGISSwmIO(test_file, 'r') def test_close(self)...
import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) import codecs from pattern.vector import Document, PORTER, LEMMA s = """ The shuttle Discovery, already delayed three times by technical problems and bad weather, was grounded again Friday, this time by a potentially dangerous gaseo...
""" CMSIS-DAP Interface Firmware Copyright (c) 2009-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 applicable law o...
""" Read/Write AMQP frames over network transports. 2009-01-14 Barry Pederson <bp@barryp.org> """ import re import socket try: import ssl HAVE_PY26_SSL = True except: HAVE_PY26_SSL = False try: bytes except: # Python 2.5 and lower bytes = str from struct import pack, unpack AMQP_PORT = 5672 AMQP...
from . import account from . import res_partner from . import ir_actions
from odoo.tests.common import HttpCase from odoo.exceptions import ValidationError class AccountingTestCase(HttpCase): """ This class extends the base TransactionCase, in order to test the accounting with localization setups. It is configured to run the tests after the installation of all modules, and will ...
from sentry.testutils.cases import RuleTestCase from sentry.rules.conditions.first_seen_event import FirstSeenEventCondition class FirstSeenEventConditionTest(RuleTestCase): rule_cls = FirstSeenEventCondition def test_applies_correctly(self): rule = self.get_rule() self.assertPasses(rule, self.e...
""" Contains CheesePreprocessor """ from ...preprocessors.base import Preprocessor class CheesePreprocessor(Preprocessor): """ Adds a cheese tag to the resources object """ def __init__(self, **kw): """ Public constructor """ super(CheesePreprocessor, self).__init__(**kw)...
"""generated file, don't modify or your data will be lost""" try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: pass
from __future__ import absolute_import import os import re import sys try: import ssl except ImportError: # pragma: no cover ssl = None if sys.version_info[0] < 3: # pragma: no cover from StringIO import StringIO string_types = basestring, text_type = unicode from types import FileType as file...
name1_0_1_0_0_4_0 = None name1_0_1_0_0_4_1 = None name1_0_1_0_0_4_2 = None name1_0_1_0_0_4_3 = None name1_0_1_0_0_4_4 = None
import datetime from decimal import Decimal import types import six def is_protected_type(obj): """Determine if the object instance is of a protected type. Objects of protected types are preserved as-is when passed to force_unicode(strings_only=True). """ return isinstance(obj, ( six.integer...
"""Fake HP client exceptions to use when mocking HP clients.""" class UnsupportedVersion(Exception): """Unsupported version of the client.""" pass class ClientException(Exception): """The base exception class for these fake exceptions.""" _error_code = None _error_desc = None _error_ref = None ...
from __future__ import absolute_import, division, print_function __metaclass__ = type from ansible.module_utils.six import PY3 from ansible.utils.unsafe_proxy import AnsibleUnsafe, AnsibleUnsafeBytes, AnsibleUnsafeText, wrap_var def test_wrap_var_text(): assert isinstance(wrap_var(u'foo'), AnsibleUnsafeText) def te...
"""Sample Input Reader for map job.""" import random import string import time from mapreduce import context from mapreduce import errors from mapreduce import operation from mapreduce.api import map_job COUNTER_IO_READ_BYTES = "io-read-bytes" COUNTER_IO_READ_MSEC = "io-read-msec" class SampleInputReader(map_job.InputR...
from test_framework.test_framework import ComparisonTestFramework from test_framework.util import * from test_framework.mininode import CTransaction, NetworkThread from test_framework.blocktools import create_coinbase, create_block from test_framework.comptool import TestInstance, TestManager from test_framework.script...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: installp author: - Kairo Araujo (@kairoaraujo) short_descripti...
"""Local settings and globals.""" import sys from os.path import normpath, join from .base import * STATIC_URL = '/static'
"""Presubmit script for Chromium browser resources. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the presubmit API built into depot_tools, and see http://www.chromium.org/developers/web-development-style-guide for the rules we're checking against here. """ import os...
from openerp.osv import osv from openerp import netsvc from openerp.tools.translate import _ class procurement_order(osv.osv): _inherit = 'procurement.order' def check_buy(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids, context=context): for line in procuremen...
def f(x): """ Returns ------- object """ return 42
# cs.???? = currentstate, any variable on the status tab in the planner can be used. print 'Start Script' for chan in range(1,9): Script.SendRC(chan,1500,False) Script.SendRC(3,Script.GetParam('RC3_MIN'),True) Script.Sleep(5000) while cs.lat == 0: print 'Waiting for GPS' Script.Sleep(1000) print 'Got GPS' ...
""" Distance and Area objects to allow for sensible and convenient calculation and conversions. Authors: Robert Coup, Justin Bronn, Riccardo Di Virgilio Inspired by GeoPy (http://exogen.case.edu/projects/geopy/) and Geoff Biggs' PhD work on dimensioned units for robotics. """ __all__ = ['A', 'Area', 'D', 'Distance'] fr...
from __future__ import unicode_literals from guessit import Guess from guessit.transfo import SingleNodeGuesser from guessit.patterns import video_rexps, sep import re import logging log = logging.getLogger(__name__) def guess_video_rexps(string): string = '-' + string + '-' for rexp, confidence, span_adjust in...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import sys import time import os def main(args): path = os.path.abspath(args[1]) fo = open(path, 'r+') content = fo.readlines() content.append('faux editor added at %s\n' % time.time()) fo.seek(0) fo.write(''...
""" Admonition directives. """ __docformat__ = 'reStructuredText' from docutils.parsers.rst import Directive from docutils.parsers.rst import states, directives from docutils.parsers.rst.roles import set_classes from docutils import nodes class BaseAdmonition(Directive): final_argument_whitespace = True option_...
import os import re import subprocess import sys import tempfile CC = "gcc" CFLAGS = "-fmax-errors=4 -std=c99 -pipe -D_POSIX_C_SOURCE=200809L -W -Wall -Wno-unused-variable -Wno-unused-parameter -Wno-unused-label -Wno-unused-value -Wno-unused-but-set-variable -Wno-unused-function -Wno-main".split(" ") class Table(): ...
from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): print(cmd) weechat = FakeWeechat() weechat_is_fake = True class IgnoreRule: """An ignore rule. This provides i...
import re from exchange.constants import ( CURRENCIES, CURRENCY_NAMES, DEFAULT_CURRENCY, CURRENCY_EUR, CURRENCY_UAH, CURRENCY_USD, CURRENCY_SESSION_KEY) def round_number(value, decimal_places=2, down=False): assert decimal_places > 0 factor = 1.0 ** decimal_places sign = -1 if va...
""" Util classes ------------ Classes which represent data types useful for the package pySpatialTools. """ from spatialelements import SpatialElementsCollection, Locations from Membership import Membership
""" This module is to support *bbox_inches* option in savefig command. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six import warnings from matplotlib.transforms import Bbox, TransformedBbox, Affine2D def adjust_bbox(fig, bbox_inches, fixed_dpi...
r""" Bending of collimating mirror ----------------------------- Uses :mod:`shadow` backend. File: `\\examples\\withShadow\\03\\03_DCM_energy.py` Influence onto energy resolution ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pictures after monochromator, :ref:`type 2 of global normalization<globalNorm>`. The nominal radius is 7.4 k...
from django.db import models import warnings from django.utils import timezone import requests from image_cropping import ImageRatioField class CompMember(models.Model): """A member of compsoc""" class Meta: verbose_name = 'CompSoc Member' verbose_name_plural = 'CompSoc Members' index = mode...
import complexism as cx import complexism.agentbased.statespace as ss import epidag as dag dbp = cx.read_dbp_script(cx.load_txt('../scripts/SIR_BN.txt')) pc = dag.quick_build_parameter_core(cx.load_txt('../scripts/pSIR.txt')) dc = dbp.generate_model('M1', **pc.get_samplers()) ag = ss.StSpAgent('Helen', dc['Sus'], pc) m...
from __future__ import division, print_function from abc import ABCMeta, abstractmethod import matplotlib as mpl mpl.use('TkAgg') from matplotlib.ticker import MaxNLocator, Formatter, Locator from matplotlib.widgets import Slider, Button import matplotlib.patches as patches import matplotlib.pyplot as plt from matplotl...
import cProfile from pathlib import Path def main(args, results_dir: Path, scenario_dir: Path): try: scenario_dir.mkdir(parents=True) except FileExistsError: pass cProfile.runctx( 'from dmprsim.scenarios.python_profile import main;' 'main(args, results_dir, scenario_dir)', ...
from django.http import HttpResponse from django.core.servers.basehttp import FileWrapper from django.contrib.auth.models import User from django.shortcuts import render_to_response, redirect, get_object_or_404 from requests import get from urllib import urlretrieve from common.models import Repository from common.util...
""" The MIT License (MIT) Copyright (c) 2016 Louis-Philippe Querel l_querel@encs.concordia.ca 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 r...
""" Created on Thu Sep 21 16:29:34 2017 @author: ishort """ import math """ procedure to generate Gaussian of unit area when passed a FWHM""" #IDL: PRO GAUSS2,FWHM,LENGTH,NGAUS def gauss2(fwhm, length): #length=length*1l & FWHM=FWHM*1l #NGAUS=FLTARR(LENGTH) ngaus = [0.0 for i in range(length)] #...
from . import config from django.shortcuts import render from mwoauth import ConsumerToken, Handshaker, tokens def requests_handshaker(): consumer_key = config.OAUTH_CONSUMER_KEY consumer_secret = config.OAUTH_CONSUMER_SECRET consumer_token = ConsumerToken(consumer_key, consumer_secret) return Handshake...
""" Request Management System - Controllers """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) menu = [ [T("Home"), False, URL(r=request, f="index")], [T("Req...
import array import numbers real_types = [numbers.Real] int_types = [numbers.Integral] iterable_types = [set, list, tuple, array.array] try: import numpy except ImportError: pass else: real_types.extend([numpy.float32, numpy.float64]) int_types.extend([numpy.int32, numpy.int64]) iterable_types.appen...
class C(object): def __init__(self): self.var = 0 class D(C): def __init__(self): self.var = 1 # self.var will be overwritten C.__init__(self) class E(object): def __init__(self): self.var = 0 # self.var will be overwritten class F(E): def __init__(self): E.__init...
import pymongo def connect (): ''' Create the connection to the MongoDB and create 3 collections needed ''' try: # Create the connection to the local host conn = pymongo.MongoClient() print 'MongoDB Connection Successful' except pymongo.errors.ConnectionFailure, err: ...
from __future__ import division def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b)) def GD(PF0, PFc): up = 0 for i in PFc: up += min([dist(i, j) for j in PF0]) return up**0.5 / (len(PFc))
import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data = get_itau_data_from_file() self.header_arquivo = itau_dat...
from argparse import ArgumentParser, ArgumentTypeError import datetime import json import re import urllib.error import urllib.parse import urllib.request import sys ISO8601 = r"^(\d{4})-?(\d{2})-?(\d{2})?[T ]?(\d{2}):?(\d{2}):?(\d{2})" def iso8601_to_unix_timestamp(value): try: return int(value) except...
"""The initialization file for the Pywikibot framework.""" from __future__ import absolute_import, unicode_literals __release__ = '2.0b3' __version__ = '$Id$' __url__ = 'https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Pywikibot' import datetime import math import re import sys import threading import json if s...
import functools import sys import pytest from numpy import array, ndarray import putil.eng from putil.test import AE, AI, CS DFLT = 'def' PY2 = bool(sys.hexversion < 0x03000000) isdflt = lambda obj: bool(obj == DFLT) h = lambda num: '100.'+('0'*num) o = lambda num: '1.'+('0'*num) pv = lambda py2arg, py3arg: py2arg if ...
import logging from abc import ABCMeta, abstractmethod from collections import deque from typing import List, Union, Iterable, Sequence log = logging.getLogger(__name__) class NoSensorsFoundException(RuntimeError): pass class Controller(metaclass=ABCMeta): @abstractmethod def run(self): raise NotImp...
from core.himesis import Himesis, HimesisPreConditionPatternLHS import uuid class HUnitDaughter2Woman_ConnectedLHS(HimesisPreConditionPatternLHS): def __init__(self): """ Creates the himesis graph representing the AToM3 model HUnitDaughter2Woman_ConnectedLHS """ # Flag this instance as compiled now self.is_c...
import locale locale.setlocale( locale.LC_ALL, '' ) print("Welcome to the (insert name here bumbblefack) Program\n") limit = float(input("How many squares do you want? ")) num = 1 print("number\tnumber^2") while num <= limit: #prints the number and squares it then seperates by a tab print (num,num**2,sep='\t') ...
from datetime import datetime from zipfile import ZipFile from io import BytesIO from lxml import etree from docxgen import * from docxgen import nsmap from . import check_tag def test_init(): doc = Document() check_tag(doc.doc, ['document', 'body']) check_tag(doc.body, ['body']) def test_save(): doc = ...
""" 将json文件中的数据存到数据库中 """ import requests import json import os from word.models import (Word, EnDefinition, CnDefinition, Audio, Pronunciation, Example, Note) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) print(BASE_DIR) def process_data(data): data = data['data']['reviews'] print(...
from django.conf import settings from django.contrib.sites.shortcuts import get_current_site from django.core.management import call_command from django.db import models, connections, transaction from django.urls import reverse from django_tenants.clone import CloneSchema from .postgresql_backend.base import _check_sch...
from nintendo import dauth, switch from anynet import http import pytest CHALLENGE_REQUEST = \ "POST /v6/challenge HTTP/1.1\r\n" \ "Host: 127.0.0.1:12345\r\n" \ "User-Agent: libcurl (nnDauth; 16f4553f-9eee-4e39-9b61-59bc7c99b7c8; SDK 12.3.0.0)\r\n" \ "Accept: */*\r\n" \ "X-Nintendo-PowerState: FA\r\n" \ "Content-...
import binascii from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut from test_framework.test_framework import BitcoinTestFramework from test_framework.test_node import ErrorMatch from test_framework.script import CScript, OP_CHECKSIG, OP_DUP, OP_EQUAL, OP_EQUALVERIFY, OP_HASH160 from test_f...
import xml.etree.ElementTree as ET import numpy as np import openmc import pytest from tests.unit_tests import assert_unbounded def test_basic(): c1 = openmc.Cell() c2 = openmc.Cell() c3 = openmc.Cell() u = openmc.Universe(name='cool', cells=(c1, c2, c3)) assert u.name == 'cool' cells = set(u.ce...
from datetime import datetime from flask import Blueprint, render_template from flask_cas import login_required from timecard.api import current_period_start from timecard.models import config, admin_required admin_views = Blueprint('admin', __name__, url_prefix='/admin', template_folder='templates') @admin_views.route...
""" Django settings for keyman project. Generated by 'django-admin startproject' using Django 1.11.7. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os BASE...
from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else: from Cryptodome.PublicKey import DSA from Cryptodome.PublicKey import RSA RSA_WEAK = 1024 RSA_OK = 2048 RSA_STR...
import re import urllib import hashlib from django import template from django.conf import settings URL_RE = re.compile(r'^https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?', re.IGNORECASE) EMAIL_RE = re.compile(r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$', re.IGNORECASE) GRAVATAR_URL_PREFIX = 'http://...
"""Test.""" import pytest TM_TABLE = [ ([0, 1, 1, 0, 1], True), ([0], True), ([1], False), ([0, 1, 0, 0], False), ] @pytest.mark.parametrize("n, result", TM_TABLE) def test_is_thue_morse(n, result): """Test.""" from is_thue_morse import is_thue_morse assert is_thue_morse(n) == result
from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { "post": { "responses": { ...
import matplotlib.pyplot as plt import numpy as np def logHist(X, N=30,fig=None, noclear=False, pdf=False, **kywds): ''' Plot logarithmic histogram or probability density function from sampled data. Args: X (numpy.ndarray): 1-D array of sampled values N (Optional[int]): Number of bins (d...
from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') return six.StringIO(csv) def test_reader_raw(stream): r = CsvReader(st...
""" WSGI config for readbacks project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "readbacks.settings") from django.core.w...
from pxl_object import PxlObject from pxl_vector import PxlVector class PxlSprite(PxlObject): def __init__(self, size, position): pass
""" Test suite for the embedded <script> extraction """ from BeautifulSoup import BeautifulSoup from nose.tools import raises, eq_ from csxj.datasources.parser_tools import media_utils from csxj.datasources.parser_tools import twitter_utils from tests.datasources.parser_tools import test_twitter_utils def make_soup(htm...
import random from urllib import urlopen import sys WORD_URL = "http://learncodethehardway.org/words.txt" WORDS = [] PHRASES = { "class %%%(%%%):": "Make a class named %%% that is-a %%%.", "class %%%(object):\n\tdef __init__(self, ***)" : "class %%% has-a __init__ hat takes self and *** parameter.", "class %%%(o...
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ from setuptools import setup, find_packages from codecs import open from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encodin...
from .game import Board for i in range(10): Board.all() print(i)
name_list=['sea_surface_elevation', 'sea_surface_height_above_geoid', 'sea_surface_height','water level', 'sea_surface_height_above_sea_level', 'water_surface_height_above_reference_datum', 'sea_surface_height_above_reference_ellipsoid'] models = dict(ADCIRC=('http...
""" fanhaorename.py """ import os import os.path import logging import fileorganizer from fileorganizer import _helper from fileorganizer.replacename import _replacename __author__ = "Jack Chang <wei0831@gmail.com>" def _tagHelper(tag): """ TODO """ result = "" for c in tag: if c.isalpha(): ...
import unittest from app.commands.file_command import FileCommand class TestFileCommand(unittest.TestCase): def setUp(self): self.window = WindowSpy() self.settings = PluginSettingsStub() self.sublime = SublimeSpy() self.os_path = OsPathSpy() # SUT self.command = File...
from flask import Blueprint from jotonce.api import route from jotonce.passphrases.models import Passphrase bp = Blueprint('passphrase', __name__, url_prefix='/passphrase') @route(bp, '/') def get(): p = Passphrase.get_random() return {"results": p}
import numpy as np from pycqed.analysis import measurement_analysis as ma from pycqed.analysis_v2 import measurement_analysis as ma2 from pycqed.measurement import sweep_functions as swf from pycqed.measurement import detector_functions as det MC_instr = None VNA_instr = None def acquire_single_linear_frequency_span(fi...
from asyncio import coroutine import pytest from aiohttp import HttpBadRequest, HttpMethodNotAllowed from fluentmock import create_mock from aiohttp_rest import RestEndpoint class CustomEndpoint(RestEndpoint): def get(self): pass def patch(self): pass @pytest.fixture def endpoint(): return R...
""" Created on Fri Jan 27 18:31:59 2017 @author: katsuya.ishiyama """ from numpy import random SUCCESS_CODE = 1 FAILURE_CODE = 0 class Strategy(): def __init__(self, n): _success_probability = _generate_success_probability(n) _strategy = {i: p for i, p in enumerate(_success_probability, 1)} ...
""" Used for extracting data such as macro definitions, variables, typedefs, and function signatures from C header files. """ from __future__ import (division, unicode_literals, print_function, absolute_import) import sys import re import os import logging from inspect import cleandoc from futur...
''' This file contains tests for the bar plot. ''' import matplotlib.pyplot as plt import pytest import shap from .utils import explainer # (pytest fixture do not remove) pylint: disable=unused-import @pytest.mark.mpl_image_compare def test_simple_bar(explainer): # pylint: disable=redefined-outer-name """ Check tha...
from datetime import timedelta, datetime import asyncio import random from .api import every, once_at, JobSchedule, default_schedule_manager __all__ = ['every_day', 'every_week', 'every_monday', 'every_tuesday', 'every_wednesday', 'every_thursday', 'every_friday', 'every_saturday', 'every_sunday', ...
""" This module provides the necessary methods for a Certification Authority. For creating the self signed Certificate for the CA, use the following command: $ openssl req -x509 -newkey rsa:2048 -keyout ca_priv.pem -out ca_cert.pem @author: Vasco Santos """ import time from M2Crypto import X509, RSA, EVP, BIO, ASN1...
from baby_steps import given, then, when from district42 import represent, schema def test_list_of_representation(): with given: sch = schema.list(schema.bool) with when: res = represent(sch) with then: assert res == "schema.list(schema.bool)" def test_list_of_values_representation()...
import cx_Freeze import sys import os executables = [cx_Freeze.Executable("MusicCompiler.py", base=None)] cx_Freeze.setup( name= "MusicCompiler", description = "Best Program Ever Known To Humanity.", author = "Space Sheep Enterprises", options = {"build_exe":{"excludes":["urllib","html","http","tkinter"...
""" A minimal front end to the Docutils Publisher, producing Docutils XML. """ try: import locale locale.setlocale(locale.LC_ALL, '') except: pass from docutils.core import publish_cmdline, default_description description = ('Generates Docutils-native XML from standalone ' 'reStructuredText s...
from messenger import Skype import keyring import utils token = keyring.get_password('messagesReceiver', 'skypeToken') registrationToken = keyring.get_password('messagesReceiver', 'skypeRegistrationToken') username = keyring.get_password('messagesReceiver', 'skypeUsername') password = keyring.get_password('messagesRece...
import os import sys # provides interaction with the Python interpreter from functools import partial from PyQt4 import QtGui # provides the graphic elements from PyQt4.QtCore import Qt # provides Qt identifiers from PyQt4.QtGui import QPushButton try: from sh import ...
a = [1,2,3,4,5] b = [2,3,4,5,6] to_100=list(range(1,100)) print ("Printing B") for i in a: print i print ("Printing A") for i in b: print i print ("Print 100 elements") for i in to_100: print i
from ga_starters import *
from test_framework.mininode import * from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * import time ''' FeeFilterTest -- test processing of feefilter messages ''' def hashToHex(hash): return format(hash, '064x') def allInvsMatch(invsExpected, testnode): for x in ra...
""" TODO: Add docstring """ import re import pexpect class MediaObject(object): """Represents an encodable object""" def __init__(self, input_filename, output_filename): self.input_filename = input_filename self.output_filename = output_filename self.media_duration = self.get_media_durat...
import random import musictheory import filezart import math from pydub import AudioSegment from pydub.playback import play class Part: def __init__(self, typ=None, intensity=0, size=0, gen=0, cho=0): self._type = typ #"n1", "n2", "bg", "ch", "ge" if intensity<0 or gen<0 or cho<0 or size<0 or intens...