content
string
from __future__ import print_function import os import re from variants import ALL_VARIANTS from utils import Freeze # Possible outcomes FAIL = "FAIL" PASS = "PASS" TIMEOUT = "TIMEOUT" CRASH = "CRASH" # Outcomes only for status file, need special handling FAIL_OK = "FAIL_OK" FAIL_SLOPPY = "FAIL_SLOPPY" # Modifiers...
import fiche_paye # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
"""The Extended Ips API extension.""" import itertools from nova.api.openstack import common from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova import compute authorize = extensions.soft_extension_authorizer('compute', 'extended_ips') class ExtendedIpsController(wsgi.Controller...
import unittest as ut import unittest_decorators as utx import numpy as np import espressomd import tests_common @utx.skipIfMissingFeatures(["MASS", "ROTATIONAL_INERTIA"]) class RotationalInertia(ut.TestCase): longMessage = True # Handle for espresso system system = espressomd.System(box_l=[1.0, 1.0, 1.0]...
import logging mitmf_logger = logging.getLogger('mitmf') class DnsCache: ''' The DnsCache maintains a cache of DNS lookups, mirroring the browser experience. ''' _instance = None def __init__(self): self.customAddress = None self.cache = {} @staticmethod def getInstance(): if DnsCache._i...
from meresco.components.http.utils import redirectHttp, CRLF, insertHeader, findCookies, okJson from xml.sax.saxutils import quoteattr, escape as xmlEscape from os.path import join from .securezone import ORIGINAL_PATH from simplejson import dumps, loads from meresco.html import PostActions from .labels import getLab...
""" A widget containing a grid of clickable actions/buttons. """ from collections import namedtuple, deque from PyQt4.QtGui import ( QFrame, QAction, QToolButton, QGridLayout, QFontMetrics, QSizePolicy, QStyleOptionToolButton, QStylePainter, QStyle ) from PyQt4.QtCore import Qt, QObject, QSize, QVariant, QEv...
#! /usr/bin/python3 # this code uses the 'lcdproc-python3' library: # https://github.com/jinglemansweep/lcdproc # for more details about lcdproc, see: # http://lcdproc.org/ from lcdproc.server import Server import time import urllib.request def main(): # 'localhost' must be replaced by the network address on wh...
import unittest from ...compatibility import StringIO from ..helperfunctions import _xml_to_list from ...table import Table from ...worksheet import Worksheet from ...workbook import WorksheetMeta from ...sharedstrings import SharedStringTable class TestAssembleTable(unittest.TestCase): """ Test assembling a ...
""" This file is concerned with providing a simple interface for data stored in Elasticsearch. The class(es) defined here are fed into the preprocessing step. """ import logging import time from abc import ABCMeta, abstractmethod from six import with_metaclass from elasticsearch import Elasticsearch, helpers def _...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import atexit import errno import mmap import socket import traceback from ansible.module_u...
""" This module makes available standard errno system symbols. The value of each symbol is the corresponding integer value, e.g., on most systems, errno.ENOENT equals the integer 2. The dictionary errno.errorcode maps numeric codes to symbol names, e.g., errno.errorcode[2] could be the string 'ENOENT'. Symbols that ar...
""" Provides testing capabilities for installed copies of Iris. """ # Because this file is imported by setup.py, there may be additional runtime # imports later in the file. import multiprocessing import os import sys # NOTE: Do not inherit from object as distutils does not like it. class TestRunner: """Run the...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings import filer.fields.file class Migration(migrations.Migration): dependencies = [ ('cms', '0003_auto_20140926_2347'), ('filer', '0001_initial'), ] ope...
#!/usr/bin/env python # coding: utf8 """ Oneall Authentication for web2py Developed by Nathan Freeze (Copyright © 2013) Email <<EMAIL>> This file contains code to allow using onall.com authentication services with web2py """ import os import base64 from gluon import * from gluon.storage import Storage...
from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import flt from erpnext.selling.doctype.customer.customer import get_customer_outstanding, get_credit_limit def execute(filters=None): if not filters: filters = {} #Check if customer id is according to naming series or custo...
"""Support for binary sensors using Tellstick Net.""" from homeassistant.components import binary_sensor, tellduslive from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.helpers.dispatcher import async_dispatcher_connect from .entry import TelldusLiveEntity async def async_setup_...
from __future__ import print_function # $example on$ from pyspark.ml.classification import LogisticRegression # $example off$ from pyspark.sql import SparkSession """ An example demonstrating Logistic Regression Summary. Run with: bin/spark-submit examples/src/main/python/ml/logistic_regression_summary_example.py "...
# 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): # Changing field 'UserProfile.name' db.alter_column('auth_userprofile', 'name', self.gf('django.db.models.fields....
# separation plot # see http://mdwardlab.com/sites/default/files/GreenhillWardSacks.pdf import matplotlib.pyplot as plt import numpy as np def separation_plot( p, y, **kwargs ): """ This function creates a separation plot for logistic and probit classification. See http://mdwardlab.com/sites/default/f...
# encoding: utf-8 from __future__ import unicode_literals import re import json from .common import InfoExtractor class CBSNewsIE(InfoExtractor): IE_DESC = 'CBS News' _VALID_URL = r'http://(?:www\.)?cbsnews\.com/(?:[^/]+/)+(?P<id>[\da-z_-]+)' _TESTS = [ { 'url': 'http://www.cbsnews....
import log_and_mail # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
import collections import heapq import math import random import tkinter as tk import tkinter.messagebox as messagebox from Globals import * # Need to allow for them to be darkened/lightened for 3D shadow. COLORS = [ "#7F0000", # Red "#007F00", # Green "#00007F", # Blue "#007F7F", # Cyan "#7F007F",...
"""Testing for BOSS metric.""" # License: BSD-3-Clause import numpy as np import pytest import re from math import sqrt from pyts.metrics import boss x = np.arange(1, 6) y = np.arange(1, 6)[::-1] z = [0, 0, 0, 10, 0] @pytest.mark.parametrize( 'x, y, err_msg', [(x.reshape(1, -1), y, "'x' must a one-dimensi...
from __future__ import unicode_literals import logging import sys import os, os.path GREEN_FONT = "\x1B[0;32m" YELLOW_FONT = "\x1B[0;33m" BLUE_FONT = "\x1B[0;34m" RED_FONT = "\x1B[0;31m" RESET_FONT = "\x1B[0m" def setupLogging(colored=True, with_time=False, with_thread=False, filename=None, with_lineno=False): ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ################################################################################ # Documentation ################################################################################ ANSIBLE_METADATA = {'metadata_version': '1.1', 'statu...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from units.compat.mock import patch from ansible.modules.network.netvisor import pn_vrouter_pim_config from units.modules.utils import set_module_args from .nvos_module import TestNvosModule class TestVrouterPimConfigModule(TestN...
from LogAnalyzer import Test,TestResult import DataflashLog # import scipy # import pylab #### TEMP!!! only for dev # from scipy import signal class TestDualGyroDrift(Test): '''test for gyro drift between dual IMU data''' def __init__(self): Test.__init__(self) self.name = "Gyro Drift" self.enable = Fals...
from __future__ import absolute_import from abc import abstractmethod import os import shutil from .common import chmod_plus_w, safe_rmtree, safe_mkdir, safe_mkdtemp from .compatibility import AbstractClass from .installer import WheelInstaller from .interpreter import PythonInterpreter from .package import ( Egg...
""" YAML serializer. Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__. """ import decimal import yaml from io import StringIO from django.db import models from django.core.serializers.base import DeserializationError from django.core.serializers.python import Serializer as PythonSerializer fr...
from ginga.gtkw import ImageViewGtk from ginga.canvas.mixins import DrawingMixin, CanvasMixin, CompoundMixin from ginga.util.toolbox import ModeIndicator class ImageViewCanvasError(ImageViewGtk.ImageViewGtkError): pass class ImageViewCanvas(ImageViewGtk.ImageViewZoom, DrawingMixin, CanvasMi...
# -*- coding: utf-8 -*- """ pygments.lexers._tsql_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ These are manually translated lists from https://msdn.microsoft.com. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ # See https://msdn.microsof...
# python3 class Edge: def __init__(self, u, v, value): self.u = u self.v = v self.value = value class Graph: def __init__(self): self.edges = [] self.incoming_edges = [] self.graph = dict () #[[] for _ in range(n)] self.incoming_graph = dict() def...
import threading import psycopg2 import psycopg2.extensions from psycopg2 import extras from testconfig import dsn from testutils import unittest, ConnectingTestCase, skip_before_postgres class CancelTests(ConnectingTestCase): def setUp(self): ConnectingTestCase.setUp(self) cur = self.conn.curs...
""" Wrapper for loading templates from the filesystem. """ from django.conf import settings from django.template.base import TemplateDoesNotExist from django.template.loader import BaseLoader from django.utils._os import safe_join class Loader(BaseLoader): is_usable = True def get_template_sources(self, temp...
"""Misc os module tests Made for Jython. """ import os import unittest from test import test_support class OSTestCase(unittest.TestCase): def setUp(self): open(test_support.TESTFN, 'w').close() def tearDown(self): if os.path.exists(test_support.TESTFN): os.remove(test_support.TES...
import logging import os import StringIO from webkitpy.common.system.executive import ScriptError _log = logging.getLogger(__name__) class MockProcess(object): def __init__(self, stdout='MOCK STDOUT\n', stderr=''): self.pid = 42 self.stdout = StringIO.StringIO(stdout) self.stderr = Strin...
# *-* coding: utf-8 *-* from __future__ import unicode_literals SI_POSTALCODES = [ (1000, 'Ljubljana'), (1215, 'Medvode'), (1216, 'Smlednik'), (1217, 'Vodice'), (1218, 'Komenda'), (1219, 'Laze v Tuhinju'), (1221, 'Motnik'), (1222, 'Trojane'), (1223, 'Blagovica'), (1225, 'Lukovic...
# -*- coding: utf-8 -*- """Get public registrations for staff members. python -m scripts.staff_public_regs """ from collections import defaultdict import logging from modularodm import Q from website.models import Node, User from website.app import init_app logger = logging.getLogger('staff_public_regs') STAFF...
__author__ = 'corpu' from lettuce import step, world import webtest class RegisterFieldSteps(): #Background steps @step(u'Dado que la aplicacion ACL esta en "([^"]*)"') def dado_que_la_aplicacion_acl_esta_en_group1(step, url): world.webApp = webtest.TestApp(url) @step(u'Cuando accedo a la mi...
import os import glob import re import getopt import sys import shutil import subprocess import zipfile from mk_exception import * from mk_project import * import mk_util BUILD_DIR='build-dist' BUILD_X64_DIR=os.path.join('build-dist', 'x64') BUILD_X86_DIR=os.path.join('build-dist', 'x86') VERBOSE=True DIST_DIR='dist' ...
from xml.etree import ElementTree as etree from oslo_serialization import jsonutils as json from six.moves.urllib import parse as urllib from tempest.common import service_client class ContainerClient(service_client.ServiceClient): def create_container( self, container_name, metadata=No...
Latin7_CharToOrderMap = ( 255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 253, 82,10...
""" Unit tests for enabling self-generated certificates by default for self-paced courses. """ from certificates import api as certs_api from certificates.models import CertificateGenerationConfiguration from certificates.signals import _listen_for_course_publish from openedx.core.djangoapps.self_paced.models import Se...
"""The hosts admin extension.""" from oslo_log import log as logging import six import webob.exc from nova.api.openstack import extensions from nova import compute from nova import context as nova_context from nova import exception from nova.i18n import _ from nova.i18n import _LI from nova import objects LOG = logg...
import collections import Queue import select import signal import sys import termios import threading ESCAPE = '\x1b' NAMES = { 'escape':'\x1b', 'eof':'\x04', 'left':'\x1b[D', 'shift+left':'\x1b[1;2D', 'right':'\x1b[C', 'shift+right':'\x1b[1;2C', 'down':'\x1b[B', 'shift+down':'\x1b[1;2B', 'up':'\x1b[A', 'shift...
"""Utility for ROCm backend""" import subprocess from os.path import join, exists import tvm._ffi from tvm._ffi.base import py_str import tvm.runtime import tvm.target from . import utils def find_lld(required=True): """Find ld.lld in system. Parameters ---------- required : bool Whether it...
import os # toolchains options ARCH='arm' CPU='cortex-m3' CROSS_TOOL='iar' if os.getenv('RTT_CC'): CROSS_TOOL = os.getenv('RTT_CC') # cross_tool provides the cross compiler # EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' EXEC_PATH = '...
"""Tests for mongodb backend Authors: * Min RK """ #------------------------------------------------------------------------------- # Copyright (C) 2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this softwar...
#se!/usr/bin/python # -*- coding: utf-8 -*- from pyvows import Vows, expect from thumbor.context import Context from tc_aws import Config from fixtures.storage_fixture import IMAGE_BYTES, get_server from boto.s3.connection import S3Connection from moto import mock_s3 from tc_aws.result_storages.s3_storage import St...
#!/usr/bin/env python """Test condition for channels Copyright (C) 2011-2012, Digium, Inc. Matt Jordan <<EMAIL>> This program is free software, distributed under the terms of the GNU General Public License Version 2. """ from twisted.internet import defer from test_conditions import TestCondition import logging impo...
""" FLAC (audio) parser Documentation: * http://flac.sourceforge.net/format.html Author: Esteban Loiseau <baal AT tuxfamily.org> Creation date: 2008-04-09 """ from hachoir_parser import Parser from hachoir_core.field import FieldSet, String, Bit, Bits, UInt16, UInt24, RawBytes, Enum, NullBytes from hachoir_core.st...
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2019 Fortinet, Inc. # # 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 Lic...
"""Switches for the Elexa Guardian integration.""" from __future__ import annotations from aioguardian import Client from aioguardian.errors import GuardianError import voluptuous as vol from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry from homeassistant.co...
import socket import csv import time from string import Template DEFAULT_SOCKET_LOCATION="/var/run/haproxy.sock" RECV_SIZE = 1024 ACTION_CHOICES = ['enabled', 'disabled'] WAIT_RETRIES=25 WAIT_INTERVAL=5 ###################################################################### class TimeoutException(Exception): pass ...
""" arbitrage.py Check for arbitrage opportunities. USAGE: python arbitrage.py [--all] --all Display all arbitrage opportunities, not just profitable ones """ from models import * from decimal import * import utils import sys # the coinex transaction fee TRANSAC_FEE = 0.002 # the minimum amount of to_currency r...
#!/usr/bin/env python # dump flash logs from SITL # Andrew Tridgell, April 2013 import pexpect, os, sys, shutil, atexit import optparse, fnmatch, time, glob, traceback, signal sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'pysim')) import util ############## main program ############# ...
"""Add one or more `LinearOperators` efficiently.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import abc import six from tensorflow.contrib.linalg.python.ops import linear_operator from tensorflow.contrib.linalg.python.ops import linear_operator_di...
from __future__ import unicode_literals from weboob.tools.backend import Module from weboob.capabilities.contact import CapDirectory from .browser import MeslieuxparisBrowser __all__ = ['MeslieuxparisModule'] class MeslieuxparisModule(Module, CapDirectory): NAME = 'meslieuxparis' DESCRIPTION = 'MesLieux ...
"""HTML utilities suitable for global use.""" from __future__ import unicode_literals import re import sys import warnings from django.utils import six from django.utils.deprecation import RemovedInDjango20Warning from django.utils.encoding import force_str, force_text from django.utils.functional import allow_lazy ...
import errno import platform import socket import sys from oslo.config import cfg from nova.compute import flavors import nova.context import nova.db from nova import exception from nova.image import glance from nova.network import minidns from nova.network import model as network_model from nova.objects import insta...
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- import curses import npyscreen import time from threading import Thread from vent.api.actions import Action from vent.api.plugins import Plugin from vent.helpers.meta import Version from vent.helpers.paths import PathDirs from vent.menus.help import HelpForm from vent...
import logging import tornado.escape import tornado.ioloop import tornado.web import os.path import uuid from tornado.concurrent import Future from tornado import gen from tornado.options import define, options, parse_command_line define("port", default=8888, help="run on the given port", type=int) define("debug", de...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse from django.conf import settings from django.db.models import F from django.utils import timezone from .managers import Com...
def read_blend_rend_chunk(path): import struct blendfile = open(path, "rb") head = blendfile.read(7) if head[0:2] == b'\x1f\x8b': # gzip magic import gzip blendfile.seek(0) blendfile = gzip.open(blendfile, "rb") head = blendfile.read(7) if head != b'BLENDER': ...
from openerp.tests import common class TestNote(common.TransactionCase): def test_bug_lp_1156215(self): """ensure any users can create new users""" cr, uid = self.cr, self.uid IMD = self.registry('ir.model.data') Users = self.registry('res.users') _, demo_user = IMD.get_ob...
#! /usr/bin/env python # # Matasano Crypto Pals # Set 1 # import binascii import base64 from freqs import * from Crypto.Cipher import AES def hex2base64(a): '''Convert a string in hex to a string in base64.''' data = binascii.unhexlify(a) return base64.b64encode(data) def fixedXOR(b1, b2): int1 = int(b1.enc...
microcode = ''' def macroop CLTS { rdcr t1, regIdx(0), dataSize=8 andi t1, t1, 0xF7, dataSize=1 wrcr regIdx(0), t1, dataSize=8 }; def macroop LMSW_R { rdcr t1, regIdx(0), dataSize=8 # This logic sets MP, EM, and TS to whatever is in the operand. It will # set PE but not clear it. limm t2, "...
# encoding: utf-8 from __future__ import unicode_literals import re import json import xml.etree.ElementTree from .common import InfoExtractor from ..utils import ( compat_urllib_parse, find_xpath_attr, fix_xml_ampersands, compat_urlparse, compat_str, compat_urllib_request, compat_parse_qs...
import sys import codecs # for UTF-8/unicode if len(sys.argv) != 2: print 'usage: reverse_arpa arpa.in' sys.exit() arpaname = sys.argv[1] #\data\ #ngram 1=4 #ngram 2=2 #ngram 3=2 # #\1-grams: #-5.234679 a -3.3 #-3.456783 b #0.0000000 <s> -2.5 #-4.333333 </s> # #\2-grams: #-1.45678 a b -3.23 #-1.30490 <s> a -4...
from dasbus.server.interface import dbus_class from pyanaconda.modules.storage.devicetree.handler_interface import DeviceTreeHandlerInterface from pyanaconda.modules.storage.devicetree.viewer_interface import DeviceTreeViewerInterface __all__ = ["DeviceTreeInterface"] @dbus_class class DeviceTreeInterface(DeviceTree...
from __future__ import with_statement import warnings from celery.task import ping, PingTask, backend_cleanup from celery.tests.compat import catch_warnings from celery.tests.utils import unittest def some_func(i): return i * i class test_deprecated(unittest.TestCase): def test_ping(self): warnin...
"""Methods to interact with the FriendFeed API Detailed documentation is available at http://friendfeed.com/api/. Many parts of the FriendFeed API require authentication. To support authentication, FriendFeed gives users a "remote key" that they give to third party applications to access FriendFeed. The user's nickna...
# -*- 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): def forwards(self, orm): # Adding model 'XDomainProxyConfiguration' db.create_table('cors_csrf_xdo...
"""Bayesian Data Analysis, 3rd ed Chapter 3, demo 2 Visualise factored sampling and the corresponding marginal and conditional densities. """ from __future__ import division import os import numpy as np from scipy import stats import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec # import from util...
# -*- coding: utf-8 -*- ''' Local settings - Run in Debug mode - Use console backend for emails - Add Django Debug Toolbar - Add django-extensions as app ''' from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ DEBUG = env.bool('DJANGO_DEBUG', default...
# IMDb lookup plugin by Ghetto Wizard (2011). from util import hook, http import re import datetime from urllib2 import URLError from zipfile import ZipFile from cStringIO import StringIO from lxml import etree from util import hook, http, web base_url = "http://thetvdb.com/api/" api_key = "469B73127CA0C411" # ht...
import os import time import mock from libmproxy import script, flow import tutils def test_simple(): s = flow.State() fm = flow.FlowMaster(None, s) sp = tutils.test_data.path("scripts/a.py") p = script.Script("%s --var 40" % sp, fm) assert "here" in p.ns assert p.run("here") == 41 assert...
""" Test the TestSampleFileUtil module. Execute with py.test -v """ from __future__ import print_function, division, absolute_import, unicode_literals import tempfile import os import numpy import cosmoHammer.Constants as c from cosmoHammer.util.SampleFileUtil import SampleFileUtil class TestSampleFileUtil(object)...
from cmdutils import * import os def run(): r=RunTestLib() r.run_test('VMbaseConcurrency(-Dselftest=vmbase,concurrency)','%s -Dselftest=vmbase,concurrency' % r.avm,expectedcode=0, expectedout=[ "\['start', 'vmbase', 'concurrency'\]", "\['te...
from openerp.osv import fields, osv class plugin_thunderbird_installer(osv.osv_memory): _name = 'plugin_thunderbird.installer' _inherit = 'res.config.installer' _columns = { 'thunderbird': fields.boolean('Thunderbird Plug-in', help="Allows you to select an object that you would like to add to your...
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that Scanners are called just once. """ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', r""" import os.path def scan(node, env, envkey, arg): print 'XScanner: node =', os.path.split(str(node))[1] return [] def ...
# -*- coding: utf-8 -*- """ pygments.formatters.latex ~~~~~~~~~~~~~~~~~~~~~~~~~ Formatter for LaTeX fancyvrb output. :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import division from pygments.formatter import Forma...
"""Common constants, exceptions and helpe functions """ import sys from types import MethodType PY3 = sys.version_info[0] == 3 PY26 = sys.version_info[:2] == (2, 6) PY31 = sys.version_info[:2] == (3, 1) class DefusedXmlException(ValueError): """Base exception """ def __repr__(self): return str(se...
# -*- coding: utf-8 -*- from ..dUI import * def DamnMainStopButton(panel=None, parent=None): stopbutton = wx.Button(panel, -1, DV.l('Stop')) stopbutton.Disable() if parent is not None: panel.Bind(wx.EVT_BUTTON, parent.onStop, stopbutton) return stopbutton class DamnMainGoPanel(wx.Panel): def __init__(self, par...
from django.conf import settings from django.template import Library, Node, Template, TemplateSyntaxError from django.template.defaulttags import kwarg_re, include_is_allowed, SsiNode, URLNode from django.utils.encoding import smart_str register = Library() @register.tag def ssi(parser, token): """ Outputs t...
from datetime import datetime import pprint import os import numpy as np from util import mkdir from data import FEATURE_DIR mkdir(FEATURE_DIR) class Config(object): def __init__(self, layers, cnf=None): self.layers = layers self.cnf = cnf pprint.pprint(cnf) def get(self, k, default...
"""Make a boostrap.dat file by getting the blocks from the RPC interface.""" import sys if sys.version_info.major < 3: sys.stderr.write('Sorry, Python 3.x required by this example.\n') sys.exit(1) import bitcoin import bitcoin.rpc import struct import sys import time try: if len(sys.argv) not in (2, 3):...
import copy import chess import chess.syzygy import chess.gaviota import collections from collections import Counter import features from features import * import os.path weight_vector_3_piece = {'black_king_closer_to_winning_square': -1.400000000000001, 'black_opposition': -1.9200000000000015, 'cant catch pawn': 1.0...
# -*- coding: utf-8 -*- import re from module.plugins.internal.SimpleCrypter import SimpleCrypter class DataHuFolder(SimpleCrypter): __name__ = "DataHuFolder" __type__ = "crypter" __version__ = "0.12" __status__ = "testing" __pattern__ = r'http://(?:www\.)?data\.hu/dir/\w+' __config_...
''' A script to check that the (Linux) executables produced by gitian only contain allowed gcc, glibc and libstdc++ version symbols. This makes sure they are still compatible with the minimum supported Linux distribution versions. Example usage: find ../gitian-builder/build -type f -executable | xargs python con...
# Stock plugin configuration and build methods. These factor out the # common tasks carried out by plugins in order to configure and build # themselves. from waflib.Errors import ConfigurationError from copy import copy def plugin(name, source=None, configure=False, build=False, build_replace=False, libs=[...
""" Copyright (c) 2012-2015 RockStor, Inc. <http://rockstor.com> This file is part of RockStor. RockStor 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 la...
""" A series of tests to establish that the command-line bash completion works. """ import os import sys import unittest from django.apps import apps from django.core.management import ManagementUtility from django.utils.six import StringIO class BashCompletionTests(unittest.TestCase): """ Testing the Python...
# -*- coding: utf-8 -*- """ Tests the "preview" selector in the LMS that allows changing between Staff, Student, and Content Groups. """ from ..helpers import UniqueCourseTest, create_user_partition_json from ...pages.studio.auto_auth import AutoAuthPage from ...pages.lms.courseware import CoursewarePage from ...pages...
import decimal from decimal import Decimal from unittest import TestCase from StringIO import StringIO import simplejson as json class TestDecimal(TestCase): NUMS = "1.0", "10.00", "1.1", "1234567890.1234567890", "500" def dumps(self, obj, **kw): sio = StringIO() json.dump(obj, sio, **kw) ...
"""A small library of functions dealing with LSTMs applied to images. Tensors in this library generally have the shape (num_images, height, width, depth). """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.ndlstm.python import lstm1...
from __future__ import unicode_literals from django.contrib.admin.utils import quote from django.contrib.auth.models import User from django.template.response import TemplateResponse from django.test import TestCase, override_settings from django.urls import reverse from .models import Action, Car, Person @override...
"""Unit tests for `nova.wsgi`.""" import os.path import socket import tempfile import eventlet import eventlet.wsgi import mock from oslo_config import cfg import requests import testtools import webob import nova.exception from nova import test from nova.tests.unit import utils import nova.wsgi SSL_CERT_DIR = os.p...
import pecan from oslo_log import log as logging from oslo_config import cfg from designate.api.v2.controllers import rest LOG = logging.getLogger(__name__) CONF = cfg.CONF class LimitsController(rest.RestController): @pecan.expose(template='json:', content_type='application/json') def get_all(self): ...