code
stringlengths
1
199k
import unittest import IECore import Gaffer import GafferImage import os class FilterTest( unittest.TestCase ) : def testDefaultFilter( self ) : filters = GafferImage.Filter.filters() default = GafferImage.Filter.defaultFilter() self.assertTrue( default in filters ) def testFilterList( self ) : filters = Gaff...
import sys, os extensions = [] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'Viper' copyright = u'2014, Claudio Guarnieri' version = '1.1' release = '1.1' exclude_patterns = [] pygments_style = 'sphinx' html_theme = 'default' html_static_path = ['_static'] htmlhelp_basename = '...
''' This script sends a ping to a specific mote and waits for the pingResponse notification. If any other pingResponses are received, the program continues listening and waits until the correct one is received. ''' import sys import os if __name__ == "__main__": here = sys.path[0] sys.path.insert(0, os.path.joi...
"""Test the stacking classifier and regressor.""" import pytest import numpy as np import scipy.sparse as sparse from sklearn.base import BaseEstimator from sklearn.base import ClassifierMixin from sklearn.base import RegressorMixin from sklearn.base import clone from sklearn.exceptions import ConvergenceWarning from s...
from __future__ import absolute_import import six import logging from collections import namedtuple from symsynd.macho.arch import get_cpu_name from symsynd.utils import parse_addr from sentry.interfaces.contexts import DeviceContextType logger = logging.getLogger(__name__) APPLE_SDK_MAPPING = { 'iPhone OS': 'iOS',...
from datetime import datetime import pandas as pd from pandas.util.testing import assert_frame_equal import ulmo import ulmo.usgs.eddn.parsers as parsers import test_util fmt = '%y%j%H%M%S' message_test_sets = [ { 'dcp_address': 'C5149430', 'number_of_lines': 4, 'parser': 'twdb_stevens', ...
import datetime import decimal import hashlib import logging from time import time from django.conf import settings from django.utils.encoding import force_bytes from django.utils.timezone import utc logger = logging.getLogger('django.db.backends') class CursorWrapper: def __init__(self, cursor, db): self.c...
import asyncio import os from urllib.parse import urlparse import aiohttp def damerau_levenshtein(first_string, second_string): """Returns the Damerau-Levenshtein edit distance between two strings.""" previous = None prev_a = None current = [i for i, x in enumerate(second_string, 1)] + [0] for a_pos...
""" This modules defines a collection of markers used in charts. The make* functions return a simple shape or a widget as for the smiley. """ __version__=''' $Id: markers.py 2385 2004-06-17 15:26:05Z rgbecker $ ''' from reportlab.lib import colors from reportlab.graphics.shapes import Rect, Line, Circle, Polygon from r...
""" Generalized Linear models. """ from __future__ import division from abc import ABCMeta, abstractmethod import numbers import warnings import numpy as np import scipy.sparse as sp from scipy import linalg from scipy import sparse from ..externals import six from ..externals.joblib import Parallel, delayed from ..bas...
''' tag_treetagger.py This module is a wrapper to TreeTagger. ''' import os import sys import string import six import sklearn from itertools import chain from bakfu.core.routes import register from bakfu.process.base import BaseProcessor __errors__ = [] try: import pattern.fr except Exception: e = sys.exc_info...
from __future__ import print_function, absolute_import, division import warnings import pytest import numpy as np from astropy import units as u from astropy.wcs import WCS from astropy.io import fits from radio_beam import Beam, Beams from .helpers import assert_allclose from .test_spectral_cube import cube_and_raw fr...
from __future__ import division __author__ = 'youval.dar'
from __future__ import absolute_import from HTMLParser import *
import pytest @pytest.fixture def builtins_open(mocker): return mocker.patch('six.moves.builtins.open') @pytest.fixture def isfile(mocker): return mocker.patch('os.path.isfile', return_value=True) @pytest.fixture @pytest.mark.usefixtures('isfile') def history_lines(mocker): def aux(lines): mock = mo...
from datetime import date, time, timedelta from decimal import Decimal import itertools from django.utils import timezone from six.moves import xrange from .models import Person def get_fixtures(n=None): """ Returns `n` dictionaries of `Person` objects. If `n` is not specified it defaults to 6. """ ...
TASKS = { "tests.tasks.general.Retry": { "max_retries": 1, "retry_delay": 1 } }
from .. import app, celery import hashlib import hmac import time import requests from . import wechat_custom @celery.task def get(openid): """获取天气与空气质量预报""" content = [] current_hour = time.strftime('%H') try: pm_25_info = get_pm2_5_info() except Exception, e: app.logger.warning(u'P...
import astropy.io.fits import numpy as np import matplotlib.pyplot as plt filtered = np.zeros((2040,4)) combined_extracted_1d_spectra_ = astropy.io.fits.open("xtfbrsnN20160705S0025.fits") exptime = float(combined_extracted_1d_spectra_[0].header['EXPTIME']) wstart = combined_extracted_1d_spectra_[1].header['CRVAL1'] wde...
from msrest.service_client import ServiceClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION from .operations.storage_accounts_operations import StorageAccountsOperations from .operations.usage_operations import UsageOperations from . import models ...
"""SCons.Tool.aixc++ Tool-specific initialization for IBM xlC / Visual Age C++ compiler. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ __revision__ = "src/engine/SCons/Tool/aixc++.py rel_2.5.1:3735:9dc6cee5c16...
"""SCons.Tool.yacc Tool-specific initialization for yacc. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ __revision__ = "src/engine/SCons/Tool/yacc.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" i...
from django.views.generic import ListView, DetailView, CreateView, \ DeleteView, UpdateView from baseapp.models import Disadvantaged_group from django.contrib import auth, messages class Disadvantaged_groupView(object): model = Disadvantaged_group def get_template_names(self): ...
"""Test harness for the logging module. Run all tests. Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved. """ import logging import logging.handlers import logging.config import codecs import datetime import pickle import io import gc import json import os import queue import random import re import select impor...
import sys from pubnub import Pubnub as Pubnub publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo' subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo' secret_key = len(sys.argv) > 3 and sys.argv[3] or 'demo' cipher_key = len(sys.argv) > 4 and sys.argv[4] or 'abcd' ssl_on = len(sys.argv) > 5 and bool(sys.a...
from __future__ import print_function from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(co...
""" Just a purple sphere """ from vapory import * objects = [ # SUN LightSource([1500,2500,-2500], 'color',1), # SKY Sphere( [0,0,0],1, 'hollow', Texture( Pigment( 'gradient', [0,1,0], 'color_map{[0 color White] [1 color Blue ]}'...
import logging import re import aexpect from autotest.client import utils from autotest.client.shared import error from virttest import utils_net from virttest import utils_test from virttest import utils_misc @error.context_aware def run(test, params, env): """ MULTI_QUEUE chang queues number test 1) Boot ...
""" Invenio mail sending utilities. send_email() is the main API function people should be using; just check out its docstring. """ __revision__ = "$Id$" import os import re import sys from cStringIO import StringIO from time import sleep import smtplib import socket from email import Encoders from email.Header import...
from papyon.event import EventsDispatcher from papyon.msnp2p.constants import * from papyon.msnp2p.SLP import * from papyon.msnp2p.transport import * from papyon.util.parsing import build_account from papyon.util.timer import Timer import papyon.util.element_tree as ElementTree import gobject import base64 import loggi...
"""Tests for the dtb_platdata module This includes unit tests for some functions and functional tests for the dtoc tool. """ import collections import os import struct import sys import tempfile import unittest from dtoc import dtb_platdata from dtb_platdata import conv_name_to_c from dtb_platdata import get_compat_nam...
"""engine.SCons.Platform.sunos Platform-specific initialization for Sun systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ __revision__ = "src/engine/SCons/Platform/sunos.py rel_2.5.0:3543:937e55c...
""" Helper functions for handling DB accesses. """ import subprocess import logging import gzip import io from nominatim.db.connection import get_pg_env from nominatim.errors import UsageError LOG = logging.getLogger() def _pipe_to_proc(proc, fdesc): chunk = fdesc.read(2048) while chunk and proc.poll() is None:...
from config import hostname, port, username, password import carddav import sogotests import unittest import webdavlib import time class JsonDavEventTests(unittest.TestCase): def setUp(self): self._connect_as_user() def _connect_as_user(self, newuser=username, newpassword=password): self.dv = ca...
import base64 import binascii import json import os import random import re import socket from cloudinit import log as logging from cloudinit import serial from cloudinit import sources from cloudinit import util LOG = logging.getLogger(__name__) SMARTOS_ATTRIB_MAP = { # Cloud-init Key : (SmartOS Key, Strip line en...
from math import ceil, log import random import sys if '--help' in sys.argv[1:]: print "\t-D [network size]: makes a test bench for network of [size]X[size]. Size can be " print "\t only multiples of two. default value is 4." print "\t-DW [data_width]: sets the data width of the network!" prin...
{ 'name': 'Timesheet on Issues', 'version': '1.0', 'category': 'Project Management', 'description': """ This module adds the Timesheet support for the Issues/Bugs Management in Project. ================================================================================= Worklogs can be maintained to signif...
from __future__ import absolute_import from __future__ import unicode_literals import re from .html import _BaseHTMLProcessor from .sgml import _SGML_AVAILABLE from .urls import make_safe_absolute_uri class _HTMLSanitizer(_BaseHTMLProcessor): acceptable_elements = { 'a', 'abbr', 'acronym', ...
from __future__ import (absolute_import, division, print_function) from PyQt4 import QtCore from mantid.simpleapi import * import numpy as n try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s def saveCustom(idx,fname,sep = ' ',logs = [],title = False,error = False...
import re import urlparse from feedparser.api import parse from feedparser.util import FeedParserDict from sickbeard import logger from sickrage.helper.exceptions import ex def getFeed(url, request_headers=None, handlers=None): parsed = list(urlparse.urlparse(url)) parsed[2] = re.sub("/{2,}", "/", parsed[2]) #...
from __future__ import unicode_literals from django.apps import AppConfig class LoginConfig(AppConfig): name = 'login'
""" This payload receives the msfvenom shellcode, base64 encodes it, and stores it within the payload. At runtime, the executable decodes the shellcode and executes it in memory. module by @christruncer """ import base64 from datetime import date from datetime import timedelta from modules.common import shellcode from ...
"""Unit tests for `biggus._init`""" from __future__ import absolute_import, division, print_function from six.moves import (filter, input, map, range, zip) # noqa
c.JupyterHub.authenticator_class = 'jupyterhub.auth.PAMAuthenticator' c.JupyterHub.base_url = '/' c.JupyterHub.config_file = '/etc/jupyterhub/jupyterhub_config.py' c.JupyterHub.cookie_secret = open('/var/lib/jupyterhub/jupyterhub_cookie_secret', 'rb').read().strip() c.JupyterHub.cookie_secret_file = 'jupyterhub_cookie_...
from gimpfu import * from colorsys import rgb_to_yiq from textwrap import dedent from random import randint gettext.install("gimp20-python", gimp.locale_directory, unicode=True) AVAILABLE_CHANNELS = (_("Red"), _("Green"), _("Blue"), _("Luma (Y)"), _("Hue"), _("Saturation"), _...
""" The script can be used to setup a virtual environment for running Firefox UI Tests. It will automatically install the firefox ui test package, all its dependencies, and optional packages if specified. """ import argparse import os import shutil import subprocess import sys import urllib2 import zipfile VIRTUALENV_U...
import mock from nose.tools import ok_ from crontabber.app import CronTabber from socorro.unittest.cron.jobs.base import IntegrationTestBase from socorro.unittest.cron.setup_configman import ( get_config_manager_for_crontabber, ) from socorro.schemas import CRASH_REPORT_JSON_SCHEMA_AS_STRING class TestUploadCrashRe...
from openerp import api, models class WebsiteMenu(models.Model): _inherit = "website.menu" @api.multi def get_parents(self, revert=False, include_self=False): """List current menu's parents. :param bool revert: Indicates if the result must be revert before returning. ...
""" mock_django.signals ~~~~~~~~~~~~~~~~ :copyright: (c) 2012 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ import contextlib import mock @contextlib.contextmanager def mock_signal_receiver(signal, wraps=None, **kwargs): """ Temporarily attaches a receiver to the provided ``signal`` wi...
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh.""" from import_shims.warn import warn_deprecated_import warn_deprecated_import('grades.rest_api.v1.tests.test_grading_policy_view', 'lms.djangoapps.grades.rest_api.v1.tests.test_grading_policy_view') from lms.djangoapps.grades.rest_api.v1.t...
from spack import * class RAffyqcreport(RPackage): """This package creates a QC report for an AffyBatch object. The report is intended to allow the user to quickly assess the quality of a set of arrays in an AffyBatch object.""" homepage = "https://www.bioconductor.org/packages/affyQCReport/" url ...
import pytest import trezorlib.messages as m from .conftest import setup_client @setup_client() @pytest.mark.parametrize( "message", [ m.Ping(message="hello", button_protection=True), m.GetAddress( address_n=[0], coin_name="Bitcoin", script_type=m.InputScriptT...
from rezgui.qt import QtGui from rezgui.util import create_pane from rezgui.mixins.ContextViewMixin import ContextViewMixin from rezgui.models.ContextModel import ContextModel from rez.config import config from rez.vendor import yaml from rez.vendor.yaml.error import YAMLError from rez.vendor.schema.schema import Schem...
"""Tests for all code snippets used in public docs.""" import glob import gzip import logging import os import tempfile import unittest import uuid import apache_beam as beam from apache_beam import coders from apache_beam import pvalue from apache_beam import typehints from apache_beam.transforms.util import assert_th...
import secure_upgrade_export as sec_api import os import sys sys.path.append('/home/caros/secure_upgrade/python') root_config_path = "/home/caros/secure_upgrade/config/secure_config.json" ret = sec_api.init_secure_upgrade(root_config_path) if ret is True: print('Security environment init successfully!') else: p...
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response from nssrc.com.citrix.netscaler.nitro.service.options import options from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_...
import six from heat.common import exception from heat.common.i18n import _ from heat.engine import constraints from heat.engine import properties from heat.engine import resource from heat.engine import support from heat.engine import watchrule COMMON_PROPERTIES = ( ALARM_ACTIONS, OK_ACTIONS, REPEAT_ACTIONS, INSUF...
""" Autopsy Forensic Browser Copyright 2016-2018 Basis Technology Corp. Contact: carrier <at> sleuthkit <dot> org 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/LI...
class ConversionTable(object): def __init__(self): self.__connection_type_map = {} self.__network_conversion_table = {} self.__node_conversion_table = {} self.__port_conversion_table = {} self.__link_conversion_table = {} self.__flow_conversion_table = {} def get_...
import setuptools setuptools.setup( setup_requires=['pbr'], pbr=True)
import datetime import math import mock import time import unittest import dcm.agent.connection.websocket as websocket import dcm.agent.handshake as handshake import dcm.agent.tests.utils.general as test_utils from dcm.agent.events.globals import global_space as dcm_events def fake_incoming_message(incoming_doc): p...
from .glpi import GlpiService from .glpi_item import GlpiItem class KnowBase(GlpiItem): """ Object of KB """ def __init__(self, attributes={}): """ Construct an KB Item. """ GlpiItem.__init__(self, {}) defaults = { "knowbaseitemcategories_id": 0, "users_id": 2, ...
from rest_framework import serializers as ser from api.base.serializers import ShowIfVersion from api.providers.serializers import PreprintProviderSerializer class DeprecatedPreprintProviderSerializer(PreprintProviderSerializer): class Meta: type_ = 'preprint_providers' # Deprecated fields header_te...
from nailgun.db import db from nailgun.db.sqlalchemy import models from nailgun import consts from nailgun.objects import NailgunCollection from nailgun.objects import NailgunObject from nailgun.objects.serializers.action_log import ActionLogSerializer class ActionLog(NailgunObject): #: SQLAlchemy model for ActionL...
from __future__ import print_function from networking_cisco._i18n import _ from neutronclient.common import extension from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron.v2_0 import router from networking_cisco.neutronclient import hostingdevice R_RESOURCE = 'router' DEVICE_L3_ROUTERS = '/ho...
from plaso.parsers.bencode_plugins import transmission from plaso.parsers.bencode_plugins import utorrent
"""Auto-generated file, do not edit by hand. IE metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_IE = PhoneMetadata(id='IE', country_code=None, international_prefix=None, general_desc=PhoneNumberDesc(national_number_pattern='[159]\\d{2,5}', possible_number_pattern=...
import argparse import collections import contextlib import os import shlex import shutil import subprocess import sys import tempfile requirement = None project = None def run_command(cmd): print(cmd) cmd_list = shlex.split(str(cmd)) p = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, ...
import mock from oslo_serialization import jsonutils from nova import objects from nova.objects import base as obj_base from nova.scheduler.filters import numa_topology_filter from nova import test from nova.tests.unit import fake_instance from nova.tests.unit.scheduler import fakes from nova.virt import hardware class...
from .cql3handling import simple_cql_types class CQLHelpTopics(object): def get_help_topics(self): return [ t[5:] for t in dir(self) if t.startswith('help_') ] def print_help_topic(self, topic): getattr(self, 'help_' + topic.lower())() def help_types(self): print "\n CQL types...
import re,urllib2 class Get_public_ip: def getip(self): try: myip = self.visit("http://ip.chinaz.com/getip.aspx") except: try: myip = self.visit("http://ipv4.icanhazip.com/") except: myip = "So sorry!!!" return myip def visit(self,url): opener = urllib2.urlopen(url)...
def find_max_val_recur(coins,l,r): if l + 1 == r: return max(coins[l],coins[r]) if l == r: return coins[i] left_choose = coins[l] + min(find_max_val_recur(coins,l+1,r - 1),find_max_val_recur(coins,l+2,r)) right_choose = coins[r] + min(find_max_val_recur(coins,l + 1,r-1),find_max_val_rec...
from __future__ import absolute_import import os from oslo_config import cfg, types from st2common import log as logging import st2common.config as common_config from st2common.constants.system import DEFAULT_CONFIG_FILE_PATH from st2common.constants.garbage_collection import DEFAULT_COLLECTION_INTERVAL from st2common....
from __future__ import absolute_import import os.path from setuptools import setup, find_packages from dist_utils import fetch_requirements from dist_utils import apply_vagrant_workaround from st2actions import __version__ ST2_COMPONENT = "st2actions" BASE_DIR = os.path.dirname(os.path.abspath(__file__)) REQUIREMENTS_F...
from random import Random import numpy as np import scipy.sparse as sp from numpy.testing import assert_array_equal from numpy.testing import assert_allclose import pytest from sklearn.feature_extraction import DictVectorizer from sklearn.feature_selection import SelectKBest, chi2 @pytest.mark.parametrize("sparse", (Tr...
from __future__ import unicode_literals from os.path import abspath, dirname, join needs_sphinx = '1.7' extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.ifconfig', 'sphinx.ext.napoleon', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode', 'bokeh.sphinxext.bokeh_autodoc...
from __future__ import print_function from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem.PyMol import MolViewer from rdkit.Chem.Subshape import SubshapeBuilder,SubshapeObjects,SubshapeAligner from rdkit.six.moves import cPickle import copy m1 = Chem.MolFromMolFile('test_data/square1.mol') m2 = Chem.M...
import logging import queue import re import threading import time from abc import abstractmethod from typing import Any, Callable, Optional, Union, List, Pattern from .connectors import OtCliHandler from .errors import ExpectLineTimeoutError, CommandError from .utils import match_line class OTCommandHandler: """Th...
from ginga.misc import Bunch class StageError(Exception): pass class Stage(object): """Class to handle a pipeline stage.""" _stagename = 'generic' def __init__(self): super(Stage, self).__init__() # default name, until user changes it self.name = str(self) # for holding w...
import optparse import pyrax import swiftclient from django.core.management.base import BaseCommand, CommandError from cumulus.settings import CUMULUS def cdn_enabled_for_container(container): """pyrax.cf_wrapper.CFClient assumes cdn_connection. Currently the pyrax swift client wrapper assumes that if you'r...
from lib.util.memorized import memorized from lib.graph.graph import Graph @memorized(['orig', 'step']) def trans_frater_augmentation(orig, g, trans, frat, col, nodes, step, td, ldoFunc): fratGraph = Graph() newTrans = {} for v in g: for x, y, _, in g.trans_trips(v): ...
import numpy as np import pytest pytestmark = pytest.mark.gpu import dask.array as da from dask.array.gufunc import apply_gufunc from dask.array.utils import assert_eq cupy = pytest.importorskip("cupy") def test_apply_gufunc_axis(): def mydiff(x): return np.diff(x) a = cupy.random.randn(3, 6, 4) da_...
import time, sys, random from Queue import Empty import processing # may get overwritten def value_func(running, mutex): random.seed() time.sleep(random.random()*4) mutex.acquire() print '\n\t\t\t' + str(processing.currentProcess()) + ' has finished' running.value -= 1 mutex.releas...
"""Renders one or more template files using the Jinja template engine.""" import codecs import argparse import os import sys from util import build_utils sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir)) from pylib.constants import host_paths sys.path.append(os.path.join(host_paths.DIR_SOURCE_ROOT, 't...
from __future__ import absolute_import, division, print_function, unicode_literals import pytest ; pytest from mock import patch from six import string_types import bokeh.client.session as bcs def test_module_docstring_warning(): assert bcs._BOKEH_CLIENT_APP_WARNING_BODY in bcs.__doc__ def test_DEFAULT_SESSION_ID()...
import pickle import tempfile import shutil import os import numbers import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_raises_regexp from sklearn.utils.tes...
"""Test that types defined in shared libraries work correctly.""" import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class TestRealDefinition(TestBase): mydir = TestBase.compute_mydir(__file__) @skipUnlessDarwin def test_frame_var_af...
from __future__ import print_function from bokeh.core.properties import String from bokeh.document import Document from bokeh.embed import file_html from bokeh.models.callbacks import Callback from bokeh.models.glyphs import Circle from bokeh.models import Plot, DataRange1d, LinearAxis, ColumnDataSource, PanTool, Wheel...
"""TestEnvironment classes. These classes abstract away the various setups needed to run the WebDriver java tests in various environments. """ from __future__ import absolute_import import logging import os import sys import chrome_paths import util _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) if util.IsLinux...
from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from builtins import * import emission.core.get_database as edb def fix_key(check_field, new_key): ...
""" Implementation of the RECAP algorithm from Lewell et al. JCICS *38* 511-522 (1998) The published algorithm is implemented more or less without modification. The results are returned as a hierarchy of nodes instead of just as a set of fragments. The hope is that this will allow a bit more flexibility in working with...
''' Copyright (c) 2014 Potential Ventures Ltd All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and...
from test_framework import BitcreditTestFramework from bitcreditrpc.authproxy import AuthServiceProxy, JSONRPCException from decimal import Decimal from util import * import os import shutil class TxnMallTest(BitcreditTestFramework): def add_options(self, parser): parser.add_option("--mineblock", dest="mine...
import smtplib import argparse from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart def main(args): # Allow HTML-formatted emails (very simplistic atm, should be expanded if used) msg = MIMEMultipart("alternative") if args["body"].startswith("<html>", 0, 10): msg.attach(MIMEText(args...
from __future__ import unicode_literals import redis, frappe, re import cPickle as pickle from frappe.utils import cstr class RedisWrapper(redis.Redis): """Redis client that will automatically prefix conf.db_name""" def make_key(self, key, user=None): if user: if user == True: user = frappe.session.user k...
"""rename documentpage Revision ID: e34d28e9a167 Revises: a5ccf5eaa73f Create Date: 2016-03-08 10:22:16.063105 """ from alembic import op revision = 'e34d28e9a167' down_revision = 'a5ccf5eaa73f' def upgrade(): op.rename_table('page', 'document_page') def downgrade(): op.rename_table('document_page', 'page')
from test_framework.test_framework import ComparisonTestFramework from test_framework.util import * from test_framework.comptool import TestManager, TestInstance, RejectResult from test_framework.blocktools import * import copy import time ''' In this test we connect to one node over p2p, and test block requests: 1) Va...
import unittest import numpy import chainer from chainer.backends import cuda import chainer.functions as F from chainer import gradient_check from chainer import testing from chainer.testing import attr @testing.parameterize(*testing.product({ 'shape': [(), (3, 2)], })) class Log1pFunctionTest(unittest.TestCase): ...
from U32 import U32 def c2l(c): "char[4] to unsigned long" l = U32(c[0]) l = l | (U32(c[1]) << 8) l = l | (U32(c[2]) << 16) l = l | (U32(c[3]) << 24) return l def c2ln(c,l1,l2,n): "char[n] to two unsigned long???" c = c + n l1, l2 = U32(0), U32(0) f = 0 if n == 8: l2 ...
import os from avocado import Test from avocado.utils import archive, process from avocado.utils.software_manager import SoftwareManager class EvmCtl(Test): """ evmctl-testsuite :avocado: tags=security,testsuite """ def setUp(self): ''' Install the basic packages to support evmctl ...