content
stringlengths
4
20k
# -*- coding: utf-8 -*- from datetime import datetime from time import sleep from random import random import requests as rq from lxml.html import fromstring from werkzeug.urls import url_unquote from mkopen.db.models import catalog2uuid, data2uuid, Data, Version CATALOG_PREFIX = u'Народна банка' TODAY = datetime.ut...
"""OS specific console_attr helper functions.""" import os import sys def GetTermSize(): """Gets the terminal x and y dimensions in characters. _GetTermSize*() helper functions taken from: http://stackoverflow.com/questions/263890/ Returns: (columns, lines): A tuple containing the terminal x and y di...
""" A course class with some modification for users """ from collections import OrderedDict from datetime import datetime from common.courses import Course from frontend.accessible_time import AccessibleTime from frontend.base import get_database from frontend.custom.tasks import FrontendTask from frontend.user_data ...
import cPickle import unittest from cStringIO import StringIO from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests from test import test_support class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests): def setUp(self): self.dumps = cPickle.dumps self.loads = cPic...
#!/bin/python #This program prints header information and description for every obs*.h5 file in a given folder. import tables import sys import os import glob if len(sys.argv) != 2: print 'Usage: python ',sys.argv[0],' folderPath' exit(1) obsPath = sys.argv[1] for obs in sorted(glob.glob(os.path.join(obsPath,...
import CsoundAC # Load the MIDI sequence into the score. model = CsoundAC.MusicModel() model.setCppSound(csound) score = model.getScore() score.load("c:/WINDOWS/Media/town.mid") print("Score length = ", len(score)) csound.setOrchestra(''' sr = 44100 ksmps = 100 nchnls = 2 0dbfs = 1 gSfont = ...
#!/usr/bin/env python # coding: utf-8 # Rossiter-McLaughlin Effect # ============================ # # Setup # ----------------------------- # Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an online notebook session such as colab). # In[1]: #!pip instal...
import tensorflow as tf from layers import conv2d, linear, nnupsampling, batchnorm, pool from activations import lrelu import numpy as np from utils import drawblock, createfolders from scipy.misc import imsave import os # Create folders to store images gen_dir, gen_dir128 = createfolders("./genimgs/STLGANAEsample", ...
from __future__ import absolute_import, unicode_literals try: from importlib import import_module except ImportError: # python 2.6 from django.utils.importlib import import_module import sys import django from django.conf import settings from django.utils.translation import ugettext_lazy as _ try: from c...
import os import settings from utils import * from base64 import b64decode, b64encode from SocketServer import BaseRequestHandler from packets import SMTPGreeting, SMTPAUTH, SMTPAUTH1, SMTPAUTH2 # ESMTP Server class class ESMTP(BaseRequestHandler): def handle(self): try: self.request.send(str(SMTPGreeting())) ...
"""Gradients for (block) GRU/LSTM operators.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import ops from tensorflow.python.ops import gen_rnn_ops def _block_lstm_grad(op, *grads): """Gradient for the BlockLSTM op."...
# -*- coding: utf-8 -*- import pytest from framework.auth import Auth from addons.osfstorage.models import OsfStorageFolder from osf_tests.factories import ( ProjectFactory, RegionFactory, UserFactory, CommentFactory, ) from tests.base import DbTestCase from osf.management.commands import migrate_delet...
import argparse import sys import os import time import shutil from collections import namedtuple from enum import Enum, auto import kunit_config import kunit_kernel import kunit_parser KunitResult = namedtuple('KunitResult', ['status','result','elapsed_time']) KunitConfigRequest = namedtuple('KunitConfigRequest', ...
# coding: utf-8 """ Qc API Qc API # noqa: E501 The version of the OpenAPI document: 3.0.0 Contact: <EMAIL> Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import unittest import datetime import telestream_cloud_qc from telestream_cloud_qc.models.alert ...
from migrate.changeset.constraint import ForeignKeyConstraint from sqlalchemy.engine import reflection def get_foreign_key_constraint_names(engine, table, columns, ref_table, ref_columns): """Retrieve the names of foreign key constraints that match the given criteria. ...
"""Simulation tool for the trapdoor workflow on Travis. It may be worth switching to pygit2 in future. (It seems better but does not work properly on fedora 23.) """ import argparse from functools import wraps import os import shutil import shlex import subprocess import sys import git class RepoError(Exception): ...
from . import project
"""Undocumented Module""" __all__ = ['DirectObject'] from direct.directnotify.DirectNotifyGlobal import directNotify from MessengerGlobal import messenger class DirectObject: """ This is the class that all Direct/SAL classes should inherit from """ def __init__(self): pass #def __del__(...
""" Provides interface to deal with pytest. Usage:: session = webdriver.client.Session("127.0.0.1", "4444", "/") harness_result = ("OK", None) subtest_results = pytestrunner.run("/path/to/test", session.url) return (harness_result, subtest_results) """ import errno import json import os import shutil...
""" VM selection algorithms. """ from contracts import contract from neat.contracts_primitive import * from neat.contracts_extra import * from random import choice import operator import logging log = logging.getLogger(__name__) @contract def random_factory(time_step, migration_time, params): """ Creates the r...
# -*- coding: utf-8 -*- import datetime def time_distance(a, b): td = a - b difference = td.days*24*60*60 + td.seconds return abs(difference) def event_spans(event): event_duration = event.ends - event.starts spans = event_duration.days if spans < 1: spans = 1 return spans def fi...
""" Hierarchy of action classes which support multiple destinations, similar to the default actions provided by the standard argparse. """ from __future__ import absolute_import, unicode_literals import argparse import copy import six from .types import BoolType, PathType __all__ = [ 'Action', 'Nargs', ...
"""Beta Distribution.""" __all__ = ['Beta'] from .exp_family import ExponentialFamily from .constraint import UnitInterval, Positive from .utils import sample_n_shape_converter, gammaln, digamma, _clip_prob from .... import np class Beta(ExponentialFamily): r"""Create a Beta distribution object. Parameters ...
# import multiprocessing to avoid this bug (http://bugs.python.org/issue15881#msg170215_ import multiprocessing assert multiprocessing import re from setuptools import setup, find_packages def get_version(): """ Extracts the version number from the version.py file. """ VERSION_FILE = 'manager_utils/ve...
"""Utilities for tests.""" import contextlib import io import os import sys import tempfile @contextlib.contextmanager def stdout_redirector(stream): # pylint: disable=invalid-name old_stdout = sys.stdout sys.stdout = stream try: yield finally: sys.stdout = old_stdout # NamedTemporaryFile is usele...
# flake8: noqa # -*- coding: 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 'BookingItem.subtotal' db.add_column(u'booking_bookingitem', 'subtotal', ...
""" templatetools.py Tools for using ZopePageTemplates, primarily intended for use with Webware. Typically you will use TemplatePool, storing an instance of the pool. To get a template, use aPool.getTemplate(filename) -- this reuse a template if possible (but no two threads will use the same template). When you are f...
import mock from oslo.config import cfg from cdn.manager.default import driver from cdn.manager.default import services from tests.unit import base class DefaultManagerDriverTests(base.TestCase): @mock.patch('cdn.storage.base.driver.StorageDriverBase') @mock.patch('cdn.provider.base.driver.ProviderDriverBas...
# -*- coding: utf-8 -*- """Django settings for project.""" import datetime import os # sqlserver connection string from djimix.settings.local import MSSQL_EARL from djimix.settings.local import INFORMIX_ODBC, INFORMIX_ODBC_TRAIN from djimix.settings.local import ( INFORMIXSERVER, DBSERVERNAME, INFORMIXDI...
import collections import telescope_data_parser class TelescopeResultGrouper(object): """Groups together a collection of TelescopeResultReader objects. Groups together multiple TelescopeResultReader objects based on metadata groupings and allows them the group to be read as a single TelescopeResultReader ob...
import os; import random; target = 'now.dmp'; def tryGetNewDump(fn): """Dump data from driver""" # dump data from driver. cwd = os.getcwd(); os.system("rm newdump.dmp"); os.system("rm %s" % fn); if (not os.path.isdir("E:\\Sora\\dot11a")): return False; os.system("E:\\Sora\\dot11a\\...
import pytest parametrize = pytest.mark.parametrize from collections import Counter import re from sqlalchemy.orm import aliased, joinedload, lazyload from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.sql import func from pokedex.db import tables, util def test_encounter_slots(session): """Encounters...
import sys import os #sys.path.append(os.environ['CUON_PATH']) from cuon.Databases.SingleData import SingleData import logging import threading class SingleGraveyard(SingleData): def __init__(self, allTables): SingleData.__init__(self) # tables.dbd and address self.sNameOfTable = "...
"""Utilites to estimate PSDs from data. """ from six.moves import range import numpy from pycbc.types import Array, FrequencySeries, TimeSeries, zeros from pycbc.types import real_same_precision_as, complex_same_precision_as from pycbc.fft import fft, ifft def median_bias(n): """Calculate the bias of the median ...
import sys rhnpath="/usr/share/rhn" if rhnpath not in sys.path: sys.path.append(rhnpath) from spacewalkkoan import spacewalkkoan from virtualization.batching_log_notifier import BatchNotifyHandler from virtualization.constants import PropertyType from virtualization.notification import Plan,...
"""This is the Golomb ruler problem. This model aims at maximizing radar interferences in a minimum space. It is known as the Golomb Ruler problem. The idea is to put marks on a rule such that all differences between all marks are all different. The objective is to minimize the length of the rule. """ from google....
import Gaffer # Add on methods to allow monitors to be used in "with" blocks. # In python we use this mechanism in preference to the Monitor::Scope # class used in C++. def __enter( self ) : if not hasattr( self, "_scopes" ) : self._scopes = [] self._scopes.append( Gaffer.Monitor._Scope( self ) ) return self ...
from re import compile from functools import reduce rectRe = compile(r'(rect) (\d+)x(\d+)') rotaRe = compile(r'(rotate [rc])\w* \w=(\d+) by (\d+)') def makeScreen(x, y): return [[' '] * x for _ in range(y)] def transpose(l): return list(map(list, zip(*l))) def parseInstruction(inst): rect = rectRe.searc...
from pylons import tmpl_context as c from tg import request, url import json import logging from formencode import validators as fev from webhelpers import paginate import ew as ew_core import ew.jinja2_ew as ew log = logging.getLogger(__name__) def onready(text): return ew.JSScript('$(function () {%s});' % te...
"""Test configs for unroll_batch_matmul.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow.compat.v1 as tf from tensorflow.lite.testing.zip_test_utils import create_tensor_data from tensorflow.lite.testing.zip_test_utils import make_zip_of...
"""Xdawn implementation.""" # Authors: Alexandre Barachant <<EMAIL>> # # License: BSD (3-clause) import copy as cp import numpy as np from scipy import linalg from ..io.base import _BaseRaw from ..epochs import _BaseEpochs from .. import Covariance, EvokedArray, Evoked, EpochsArray from ..io.pick import pick_types f...
import logging import os import re import shlex import subprocess import tempfile import time class Piper(object): CMD = '/bin/sh -c' ARGS = '' DEFAULTS = {} class FileObject(object): __slots__ = ['var', 'fullPath', 'fp', 'data'] def __init__(self, **kwds): self.precommand() ...
import urllib import socket import httplib import re from parser import MyHTMLParser socket.setdefaulttimeout(10) class WebCrawler(object): """A simple web crawler""" link_dict = {} initial_depth = 0 #filter_list = [] parser = 0 re_compiled_obj = 0 class PageInfo: """ i store i...
import numpy as np from sklearn.decomposition import PCA as PCAr from sklearn.pipeline import Pipeline from msmbuilder.cluster import KCenters from msmbuilder.decomposition import PCA random = np.random.RandomState(42) trajs = [random.randn(10, 3) for _ in range(5)] def test_vs_sklearn(): # Compare msmbuilder.p...
from helper import unittest, PillowTestCase, hopper import io from PIL import Image # sample ppm stream TEST_ICO_FILE = "Tests/images/hopper.ico" TEST_DATA = open(TEST_ICO_FILE, "rb").read() class TestFileIco(PillowTestCase): def test_sanity(self): im = Image.open(TEST_ICO_FILE) im.load() ...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'printdialog.ui' # # by: PyQt4 UI code generator 4.11.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): ...
''' Robot test for volume actions @author: Youyk ''' import zstackwoodpecker.action_select as action_select import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_state as test_state import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.header.vm as vm_header _config_ ...
__doc__ = """ ### test setup() and teardown() logic >>> from test_utils.utils.twill_runner import * >>> from django.conf import settings >>> setup() <..._EasyTwillBrowser object at ...> >>> setup() # no duplicate registrations False >>> len(INSTALLED) 1 >>> teardown() True >>> len(INSTAL...
"""Plugin loading and management logic and classes.""" import logging from typing import Any, Dict, List, Set import entrypoints from flake8 import exceptions from flake8 import utils LOG = logging.getLogger(__name__) __all__ = ("Checkers", "Plugin", "PluginManager", "ReportFormatters") NO_GROUP_FOUND = object() ...
#!/usr/bin/env python import csv import time import sys from subprocess import check_output, check_call, Popen import random from collections import OrderedDict import math import os current_script_dir = os.path.dirname(os.path.realpath(__file__)).replace('/bin', '/python') if not os.path.exists(current_script_dir): ...
from django.core.management.base import BaseCommand, CommandError from optparse import make_option from certificates.models import CertificateWhitelist from django.contrib.auth.models import User class Command(BaseCommand): help = """ Sets or gets the certificate whitelist for a given user/course ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Website property. """ from pkg_resources import resource_stream # @UnresolvedImport from rebulk.remodule import re from rebulk import Rebulk, Rule, RemoveMatch from ..common import seps from ..common.formatters import cleanup from ..common.validators import seps_surro...
# 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 model 'Export' db.create_table('odk_viewer_export', ( ('id', self.gf('django.db.model...
from south.db import db from django.db import models from mysite.profile.models import * class Migration: def forwards(self, orm): # Adding field 'Person.photo_thumbnail_20px_wide' db.add_column('profile_person', 'photo_thumbnail_20px_wide', orm['profile.person:photo_thumbnail_20px_wi...
#! python3 # 0 # 0 000000 0 000000 0 0 000000000 00000000 00000000 0 000000 # 0 00 0 0 0 00 00 0 0 0 0 0 0 # 0 00 0 0 00000 00 000000 00 0 ...
import datetime import os import tempfile import uuid from django.core import validators from django.core.exceptions import ValidationError from django.core.files.storage import FileSystemStorage from django.db import models temp_storage_dir = tempfile.mkdtemp() temp_storage = FileSystemStorage(temp_storage_dir) ART...
""" Used to manage raw inventory and supplier relationships. This is still under heavy development. """ from django.db import models from django.utils.translation import ugettext_lazy as _ from satchmo_store.contact.models import Contact, Organization import datetime class RawItem(models.Model): """ A raw go...
"""Process Android library resources to generate R.java and crunched images.""" import optparse import os import shlex from util import build_utils def ParseArgs(): """Parses command line options. Returns: An options object as from optparse.OptionsParser.parse_args() """ parser = optparse.OptionParser()...
import os from flask import request, render_template, current_app, redirect from emonitor.modules.settings.department import Department from emonitor.modules.settings.settings import Settings from emonitor.modules.streets.city import City from emonitor.extensions import alembic, db, babel, scheduler from emonitor.sched...
#! /usr/bin/env python """Integration tests for germinate.""" # Copyright (C) 2011 Canonical Ltd. # # Germinate 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, or (at your option) any # late...
""" Volume utilities for virt drivers. """ from os_brick.initiator import connector from oslo_concurrency import processutils as putils from nova import utils def get_iscsi_initiator(execute=None): """Get iscsi initiator name for this machine.""" root_helper = utils.get_root_helper() # so we can mock ou...
""" This module tests some of the methods related to the ``ECSV`` reader/writer. Requires `pyyaml <http://pyyaml.org/>`_ to be installed. """ import os import copy import sys from io import StringIO import pytest import numpy as np from astropy.table import Table, Column, QTable, NdarrayMixin from astropy.table.tabl...
from __future__ import unicode_literals import frappe from frappe import _ import frappe.defaults from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import is_cart_enabled def show_cart_count(): if (is_cart_enabled() and frappe.db.get_value("User", frappe.session.user, "user_type") ==...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ make-release ~~~~~~~~~~~~ Helper script that performs a release. Does pretty much everything automatically for us. :copyright: (c) 2014 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import sys import os import re from dat...
""" Parsers are used to parse the content of incoming HTTP requests. They give us a generic way of being able to handle various media types on the request, such as form content or json encoded data. """ from __future__ import unicode_literals from django.conf import settings from django.core.files.uploadhandler import...
import asyncore import threading from email.header import decode_header from email import message_from_string from smtpd import SMTPServer from lettuce import after, before def _parse_header(val): result = '' elements = decode_header(val) for el, enc in elements: result += el.decode(enc) if en...
#! /usr/bin/python2 import subprocess import sys import os import time default_params = '' # 0: radial dam break # 1: gaussian # 2: balanced steady state u # 3: balanced steady state v # 4: diamond initial condition default_params += ' -s 1' N = 512 # domain size default_params += ' -n '+str(N)+' -m '+str(N) # c...
#!/usr/bin/env python3 import re from bottle import get, post, request, run, SimpleTemplate, static_file from os import kill, listdir from psutil import process_iter from signal import SIGKILL from subprocess import Popen photo_dir = '/home/pi/Photos' base = ''' <html> <head> <style> body{{ font-size:...
"""Tests for the PythonPoint tool. """ import os, sys, string from reportlab.test import unittest from reportlab.test.utils import makeSuiteForClasses, outputfile, printLocation import reportlab class PythonPointTestCase(unittest.TestCase): "Some very crude tests on PythonPoint." def test0(self): "Test...
from twext.enterprise.dal.record import Record, fromTable from twext.enterprise.dal.syntax import Parameter, Delete from twisted.internet.defer import inlineCallbacks from txdav.common.datastore.sql_tables import schema """ Module that manages store-level metadata objects used during the migration process. """ class...
"""Utility functions. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import csv import os from absl import flags import gin.tf import numpy as np import six import tensorflow.compat.v1 as tf FLAGS = flags.FLAGS def clear_folder(f...
import sys from io import BytesIO import pytest from wptserve.request import InputFile bstr = b'This is a test document\nWith new lines\nSeveral in fact...' rfile = '' test_file = '' # This will be used to test the InputFile functions against input_file = InputFile(None, 0) def setup_function(function): globa...
SKIP = "SKIP" FAIL = "FAIL" PASS = "PASS" OKAY = "OKAY" TIMEOUT = "TIMEOUT" CRASH = "CRASH" SLOW = "SLOW" FLAKY = "FLAKY" FAST_VARIANTS = "FAST_VARIANTS" NO_VARIANTS = "NO_VARIANTS" # These are just for the status files and are mapped below in DEFS: FAIL_OK = "FAIL_OK" PASS_OR_FAIL = "PASS_OR_FAIL" ALWAYS = "ALWAYS" ...
# stdlib from collections import defaultdict import time # 3p import psutil # project from checks import AgentCheck from config import _is_affirmative from utils.platform import Platform DEFAULT_AD_CACHE_DURATION = 120 DEFAULT_PID_CACHE_DURATION = 120 ATTR_TO_METRIC = { 'thr': 'threads', 'cpu...
import argparse import utils import httplib import json import ssl import sys import os import time from utils import ApiProxyClientTest class C: pass FLAGS = C class ApiProxyBookstoreTest(ApiProxyClientTest): """End to end integration test of bookstore application with deployed API PROXY at VM. It will c...
from __future__ import print_function """ A Python script for changing the name of an object. Demonstrates the use of tasks in an asynchronous way. """ import atexit import argparse import getpass from pyVim import connect from pyvmomi_tools.cli import cursor def get_args(): parser = argparse.ArgumentParser() ...
import copy import mock from rally.plugins.openstack.context.ec2 import servers from tests.unit import fakes from tests.unit import test CTX = "rally.plugins.openstack.context.ec2" SCN = "rally.plugins.openstack.scenarios" TYP = "rally.task.types" class EC2ServerGeneratorTestCase(test.TestCase): def _gen_tena...
from stevedore import extension class ExtensionsError(Exception): pass class Extensions: """Lazy singleton container for stevedore extensions. Loads each namespace when requested for the first time. """ _managers = {} def __init__(self): raise NotImplementedError() @classmeth...
from datetime import datetime import hashlib from werkzeug.security import generate_password_hash, check_password_hash from itsdangerous import TimedJSONWebSignatureSerializer as Serializer from markdown import markdown import bleach from flask import current_app, request, url_for from flask.ext.login import UserMixin,...
"""Add dummy information for a rack of machines on a /26.""" import os import sys from common import AQRunner, TestNetwork, TestRack def add_rack(building, rackid, netid, aqservice, aqhost, aqport): aq = AQRunner(aqservice=aqservice, aqhost=aqhost, aqport=aqport) rack = TestRack(building, rackid) rc = ...
#!/usr/bin/env python import gtk import subprocess import re class gpx2garmin: def __init__(self, parent = None, pytrainer_main = None, conf_dir = None, options = None): self.limit = options["gpx2garminmaxpoints"] self.device = options["gpx2garmindevice"] self.conf_dir = conf_dir s...
import IECore import IECoreScene import IECoreImage import Gaffer import GafferUI import GafferScene class SceneReaderPathPreview( GafferUI.PathPreviewWidget ) : def __init__( self, path ) : column = GafferUI.SplitContainer( GafferUI.SplitContainer.Orientation.Vertical ) GafferUI.PathPreviewWidget.__init__( ...
from kombu.tests.utils import unittest from kombu.transport.virtual.scheduling import FairCycle class MyEmpty(Exception): pass def consume(fun, n): r = [] for i in range(n): r.append(fun()) return r class test_FairCycle(unittest.TestCase): def test_cycle(self): resources = ["...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): # Flag to indicate if this migration is too risky # to run online and needs to be coordinated for offline ...
from geoserver.wps import process from com.ziclix.python.sql import zxJDBC jdbc_url = "jdbc:postgresql://192.168.40.5:3389/research" username = "modeluser" password = "modeluser" driver = "org.postgresql.Driver" @process( title='CheckModelStatus', description='Check status of running model', inputs={...
import time import unicodedata from couchpotato.core.event import addEvent, fireEvent from couchpotato.core.logger import CPLog from couchpotato.core.media._base.providers.automation.base import AutomationBase from couchpotato.environment import Env from couchpotato.core.helpers.variable import splitString log = CPL...
from .serde import extract_config_property from .deserializer import Deserializer from .serializer import Serializer class StringSerializer(Serializer[str]): def __init__(self): self.encoding = 'utf-8' self.on_error = 'strict' def serialize(self, topic: str, data: str) -> bytes: retur...
#!/usr/bin/env python """ Try to dump Odoo database in a way suitable for diff after updating Odoo (openerp-server -d db -u all) """ import sys import psycopg2 dbname = sys.argv[1] if len(sys.argv)>1 else "db" db = psycopg2.connect("dbname=" + dbname) cursor = db.cursor() EXCLUDE_TABLES = ("ir_module_module", "ir_...
from unittest import TestCase class TunTapTestCase(TestCase): def __init__(self, name, harness): super(TunTapTestCase, self).__init__(name) self.harness = harness def __str__(self): return '%s [%s]' % (super(TunTapTestCase, self).__str__(), self.harness.__c...
import json from django.core.management.base import BaseCommand from ...models import Item # BaseCommandを継承して作成 class Command(BaseCommand): # python manage.py help import_itemで表示されるメッセージ help = 'Create Item from json file' def remove_null(self, value, default): if value is None: ret...
""" Copyright 2017 BlazeMeter Inc. 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 or agreed to in writing, software...
import supybot.conf as conf import supybot.registry as registry def configure(advanced): # This will be called by supybot to configure this module. advanced is # a bool that specifies whether the user identified himself as an advanced # user or not. You should effect your configuration by manipulating th...
# Bot realizado por Alejandro Casado Quijada import telebot from telebot import types from bs4 import BeautifulSoup from lxml import html import requests import re import os.path,sys #cookielib, os.path, time, import urllib.request, urllib.parse, urllib.error #from menu import * from teclados import * from funciones_a...
import sys data = [] valid = True def out(str): sys.stderr.write(str) sys.stderr.flush() def read_bool(): while True: inp = sys.stdin.readline(1).strip() if inp == 'y' or inp == '': return True if inp == 'n': return False def getkeyval(line): key = line[:line.find(':')].strip...
import unittest import nest import os from subprocess import call HAVE_MPI = nest.ll_api.sli_func("statusdict/have_mpi ::") class TestMPIDependentTests(unittest.TestCase): @unittest.skipIf(not HAVE_MPI, 'NEST was compiled without MPI') def testsWithMPI(self): if HAVE_MPI: failing_tests =...
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from myhvac_core import cfg from myhvac_core.db import models from myhvac_core.db.measurements import * from myhvac_core.db.rooms import * from myhvac_core.db.sensors import * import logging LOG = logging.getLogger(__name__) opts = [ c...
from unittest import skipIf from django.core.exceptions import ValidationError from django.db import connection, models from django.test import SimpleTestCase, TestCase from .models import Post class TestCharField(TestCase): def test_max_length_passed_to_formfield(self): """ CharField passes it...
#!/usr/bin/env python3 # --------------------------------------------------------------------- # ------------------------- Plight Rising ----------------------------- # -----------------------------txtsd----------------------------------- # --------------------------------------------------------------------- """Runs ...
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test that SCons supports use of a home-brew ToolSurrogate class like we use in our bin/sconsexamples.py script. """ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ class Curry(object): def __init__(self, fun, *args, **...
from ansible.module_utils._text import to_text from ansible.module_utils.basic import env_fallback, return_values from ansible.module_utils.network_common import to_list, EntityCollection from ansible.module_utils.connection import Connection, exec_command _DEVICE_CONFIGS = {} _CONNECTION = None asa_argument_spec = {...