content
stringlengths
4
20k
class TransformerMixin(object): """Mixin class for all transformers in scikit-learn.""" def fit_transform(self, X, y=None, **fit_params): """Fit to data, then transform it. Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X. ...
from __future__ import print_function import time, sys, signal, atexit from upm import pyupm_hwxpxx as sensorObj def main(): ## Exit handlers ## # This function stops python from printing a stacktrace when you hit control-C def SIGINTHandler(signum, frame): raise SystemExit # This function let...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import glob from ansible.plugins.lookup import LookupBase from ansible.errors import AnsibleFileNotFound from ansible.module_utils._text import to_bytes, to_text class LookupModule(LookupBase): def run(self, terms...
"""Microsoft Internet Explorer cookie loading on Windows. Copyright 2002-2003 Johnny Lee <<EMAIL>> (MSIE Perl code) Copyright 2002-2006 John J Lee <<EMAIL>> (The Python port) This code is free software; you can redistribute it and/or modify it under the terms of the BSD or ZPL 2.1 licenses (see the file COPYING.txt i...
import threading from ctypes import byref, c_char_p, c_int, c_char, c_size_t, Structure, POINTER from django.contrib.gis import memoryview from django.contrib.gis.geos.base import GEOSBase from django.contrib.gis.geos.libgeos import GEOM_PTR from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_stri...
import os import dox.config.base as cfg_base from dox.config import dox_yaml from dox.tests import base class TestDoxYaml(base.TestCase): def setUp(self): super(TestDoxYaml, self).setUp() self.doxyaml = dox_yaml.DoxYaml({}) self.doxyaml.dox_file = os.path.join(base.SAMPLEDIR, ...
#!bpy """ Name: 'mat1.py' Blender: 2.71 Group: 'Sample' Tooltip: 'Put one image on each site of a cube' """ import bpy import os ##################################################### def delete_old_stuff(): # escape edit mode if bpy.ops.object.mode_set.poll(): bpy.ops.object.mode_set(mode='OBJECT') ...
import parsimonious class EncodingError(Exception): """ Base exception for any error that occurs during encoding. """ pass class EncodingTypeError(EncodingError): """ Raised when trying to encode a python value whose type is not supported for the output ABI type. """ pass class...
import os import multiprocessing bind = '0.0.0.0:5700' backlog = 2048 worker_class = 'gevent' workers = 4 threads = 1 worker_connections = 500 timeout = 60 keepalive = 2 max_requests = 1000 max_requests_jitter = 500 graceful_timeout = 60 spew = False daemon = False pidfile = None umask = 666 user = os.getenv('USER'...
import logging import subprocess from telemetry.core import util from telemetry.internal import forwarders from telemetry.internal.forwarders import do_nothing_forwarder class CrOsForwarderFactory(forwarders.ForwarderFactory): def __init__(self, cri): super(CrOsForwarderFactory, self).__init__() self._cri...
import py import os, sys import pytest from py._path.svnwc import InfoSvnWCCommand, XMLWCStatus, parse_wcinfotime from py._path import svnwc as svncommon from svntestbase import CommonSvnTests def test_make_repo(path1, tmpdir): repo = tmpdir.join("repo") py.process.cmdexec('svnadmin create %s' % repo) if s...
import openerp.tests.common as common class TestProcurementPlanMrpSaleForecast(common.TransactionCase): def setUp(self): super(TestProcurementPlanMrpSaleForecast, self).setUp() self.sale_forecast_model = self.env['procurement.sale.forecast'] self.wiz_model = self.env['make.procurement'] ...
from __future__ import print_function, absolute_import, division import warnings from distutils.version import LooseVersion import pytest import numpy as np import astropy from astropy.wcs import WCS from astropy import units as u from astropy.io import fits from ..spectral_cube import SpectralCube, VarianceWarning...
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test that multiple target files get retrieved from a CacheDir correctly. """ import TestSCons test = TestSCons.TestSCons() test.subdir('cache', 'multiple') cache = test.workpath('cache') multiple_bar = test.workpath('multiple', 'bar') multiple_foo ...
"""Unit tests Zenodo JSON schemas utils.""" from __future__ import absolute_import, print_function from zenodo.modules.jsonschemas.utils import merge_dicts def test_merge_dicts(): """Test jsonschema merging util.""" a1 = { 'd': { 'k1': 1, 'k2': 'v2', 'd2': { ...
from __future__ import with_statement from watchdog.utils import platform if not platform.is_windows(): raise ImportError import ctypes.wintypes import struct try: LPVOID = ctypes.wintypes.LPVOID except AttributeError: # LPVOID wasn't defined in Py2.5, guess it was introduced in Py2.6 LPVOID = ctype...
from __future__ import division, absolute_import, print_function from numpy.testing import TestCase, assert_, run_module_suite import numbers from numpy.core.numerictypes import sctypes class ABC(TestCase): def test_floats(self): for t in sctypes['float']: assert_(isinstance(t(), numbers.Real...
import subprocess from ansible import utils, errors class LookupModule(object): def __init__(self, basedir=None, **kwargs): self.basedir = basedir def run(self, terms, inject=None, **kwargs): terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject) ret = [] fo...
import os import sys import unittest import httplib import traceback import github atLeastPython26 = sys.hexversion >= 0x02060000 atLeastPython3 = sys.hexversion >= 0x03000000 atMostPython32 = sys.hexversion < 0x03030000 if atLeastPython26: import json else: # pragma no cover (Covered by all tests with Python 2...
import os from nupic.frameworks.opf.expdescriptionhelpers import importBaseDescription # the sub-experiment configuration config = \ { 'modelParams': { 'clParams': { 'clVerbosity': 0}, 'inferenceType': 'NontemporalMultiStep', 'sensorParams': { 'encoders': { 'consumption': { 'clipI...
import optparse import os import sys import tarfile import buildbot_common def main(args): parser = optparse.OptionParser() parser.add_option('--install-dir', help='Install Directory', dest='install_dir', default='naclmono') parser.add_option('--tar-p...
__doc__ = """ io compatibility module for older (pre-2.6) Python versions This does not not NOT (repeat, *NOT*) provide complete io functionality. It only wraps the portions of io functionality used by SCons, in an interface that looks enough like io for our purposes. """ __revision__ = "__FILE__ __REVISION__ __DATE...
import random import uuid from datetime import date from freezegun import freeze_time from tests.conftest import normalize_spaces def _get_example_performance_data(): return { "total_notifications": 1_789_000_000, "email_notifications": 1_123_000_000, "sms_notifications": 987_654_321, "l...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('xblock_d...
import time from datetime import datetime from dateutil.relativedelta import relativedelta from operator import itemgetter from openerp import netsvc from openerp import pooler from openerp.osv import fields, osv import openerp.addons.decimal_precision as dp from openerp.tools.translate import _ # -------------------...
from .sub_resource import SubResource class ResourceNavigationLink(SubResource): """ResourceNavigationLink resource. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param linked_resource_type: Resource type of the...
#!/usr/local/bin/python2 # Solution.c import abc import math class Shape(object): """ Shape abstract base class. """ __metaclass__ = abc.ABCMeta """ ===================================================================== Place your shape functions here. The functions needed are: tr...
__author__ = 'd' from csp import settings from django import forms from django.contrib.auth.models import User class RegistrationForm(forms.Form): email = forms.EmailField(label='', widget=forms.TextInput(attrs={'class':'form-control', ...
import catoclient.catocommand from catoclient.param import Param class DescribeTaskParameters(catoclient.catocommand.CatoCommand): Description = 'Describes the parameters defined for a task in a text readable format.' API = 'describe_task_parameters' Examples = ''' _Print the parameters of the default ver...
from openerp.osv import osv,fields from openerp.tools.translate import _ class repair_cancel(osv.osv_memory): _name = 'mrp.repair.cancel' _description = 'Cancel Repair' def cancel_repair(self, cr, uid, ids, context=None): """ Cancels the repair @param self: The object pointer. @par...
import lldb import shlex import optparse import os import textwrap from stat import * def __lldb_init_module(debugger, internal_dict): debugger.HandleCommand( 'command script add -f pmodule.pmodule pmodule -h "Generates DTrace script to profile module"') def pmodule(debugger, command, exe_ctx, result, i...
import datetime from django.test import TestCase from oscar.apps.partner import availability import pytz from ecommerce.courses.models import Course from ecommerce.extensions.catalogue.tests.mixins import CourseCatalogTestMixin from ecommerce.extensions.partner.strategy import DefaultStrategy, Selector class Defaul...
# -*- coding: utf-8 -*- """ *************************************************************************** EquivalentNumField.py --------------------- Date : January 2013 Copyright : (C) 2013 by Victor Olaya Email : volayaf at gmail dot com *******************...
#! /usr/bin/env python3 """Conversions to/from quoted-printable transport encoding as per RFC 1521.""" # (Dec 1991 version). __all__ = ["encode", "decode", "encodestring", "decodestring"] ESCAPE = b'=' MAXLINESIZE = 76 HEX = b'0123456789ABCDEF' EMPTYSTRING = b'' try: from binascii import a2b_qp, b2a_qp except ...
import os import subprocess def execute_cmd(cmd, exec_path, outfile_path): outfile = open(outfile_path,'w') cmd_subproc = subprocess.Popen( cmd , cwd = exec_path , shell=True , stdout = outfile ...
import gdb from linux import utils task_type = utils.CachedType("struct task_struct") def task_lists(): global task_type task_ptr_type = task_type.get_type().pointer() init_task = gdb.parse_and_eval("init_task").address t = g = init_task while True: while True: yield t ...
"""Certificates API This is a Python API for generating certificates asynchronously. Other Django apps should use the API functions defined in this module rather than importing Django models directly. """ import logging from django.conf import settings from django.core.urlresolvers import reverse from eventtracking ...
# This problem was asked by Google. # An XOR linked list is a more memory efficient doubly linked list. # Instead of each node holding next and prev fields, it holds a field named both, which is a XOR of the next node and the previous node. # Implement a XOR linked list; it has an add(element) which adds the element to...
import unittest from telemetry.core.platform import process_statistic_timeline_data class ProcessStatisticTimelineDataTest(unittest.TestCase): def testProcessStatisticValueMath(self): pid1 = 1 pid2 = 2 a = process_statistic_timeline_data.ProcessStatisticTimelineData(pid1, 5) b = process_statistic...
from subdownloader.client.state import BaseState, SubtitlePathStrategy from subdownloader.client.player import VideoPlayer class CliState(BaseState): def __init__(self): BaseState.__init__(self) self._interactive = False self._console = False self._recursive = False self....
# coding: utf-8 from __future__ import unicode_literals import json from .common import InfoExtractor from ..utils import ( int_or_none, mimetype2ext, ) class SandiaIE(InfoExtractor): IE_DESC = 'Sandia National Laboratories' _VALID_URL = r'https?://digitalops\.sandia\.gov/Mediasite/Play/(?P<id>[0-9a...
""" ===================================== Visualization of MLP weights on MNIST ===================================== Sometimes looking at the learned coefficients of a neural network can provide insight into the learning behavior. For example if weights look unstructured, maybe some were not used at all, or if very l...
""" Functions for parsing the gypd output from gyp. """ def parse_dictionary(var_dict, d, current_target_name): """ Helper function to get the meaningful entries in a dictionary. @param var_dict VarsDict object for storing the results of the parsing. @param d Dictionary object to parse. @param current_target...
# stdlib import os import random # project from config import check_yaml, get_confd_path user_ntp_settings = {} DEFAULT_VERSION = 3 DEFAULT_TIMEOUT = 1 # in seconds DEFAULT_PORT = "ntp" def set_user_ntp_settings(instance=None): global user_ntp_settings if instance is None: try: ntp_chec...
import time import numpy import unittest2 as unittest from nupic.support.unittesthelpers.algorithm_test_helpers \ import getNumpyRandomGenerator, convertSP, CreateSP from nupic.bindings.math import (count_gte, GetNTAReal, SM_01_32_32 as SparseBinar...
"""Support for Freebox devices (Freebox v6 and Freebox mini 4K).""" import logging import socket import voluptuous as vol from homeassistant.components.discovery import SERVICE_FREEBOX from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP from homeassistant.helpers import config_validation as...
import hr_recruitment import report import wizard import res_config # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
#!/bin/env python # Automatically translated python version of # OpenSceneGraph example program "osgwidgetshader" # !!! This program will need manual tuning before it will work. !!! import sys from osgpypp import osgDB from osgpypp import osgWidget # Translated from file 'osgwidgetshader.cpp' # -*-c++-*- osgWidg...
from sqlalchemy import MetaData, Column, Table from sqlalchemy import Boolean, Integer from nova.db.sqlalchemy import types def upgrade(migrate_engine): """Function adds network mtu, dhcp_server, and share_dhcp fields.""" meta = MetaData(bind=migrate_engine) networks = Table('networks', meta, autoload=T...
import unittest from pathlib import Path from tempfile import TemporaryDirectory import networkx import contrib.regionTrimmer as region_trimmer class TestRegionTrimmer(unittest.TestCase): def test_get_nodes(self): coords = [(0, 0), (0, -1), (-1, 0), (-1, -1)] with TemporaryDirectory() as tmpdirna...
from django.core.urlresolvers import resolve, reverse from django.http import HttpResponsePermanentRedirect from utils.tags import TagsSet class TagsMiddleware: main_view = 'main.views.home' view = 'main.views.tag.search' def process_request(self, request): if not any(s in request.GET ...
import matplotlib.pyplot as plt import numpy as np import re import argparse parser = argparse.ArgumentParser(description='Parses log file and generates train/val curves') parser.add_argument('--log-file', type=str,default="log_tr_va", help='the path of log file') args = parser.parse_args() TR_RE...
""" ====================================== Gradient Boosting Out-of-Bag estimates ====================================== Out-of-bag (OOB) estimates can be a useful heuristic to estimate the "optimal" number of boosting iterations. OOB estimates are almost identical to cross-validation estimates but they can be compute...
import logging import simplejson import sys from model import * from utils import * def encode_date(object): """Encodes Python dates as specially marked JavaScript strings.""" if isinstance(object, datetime): y, l, d, h, m, s = object.timetuple()[:6] return '<<new Date(%d,%d,%d,%d,%d)>>' % (y...
''' 'funcassociateinfo.py' sets up the command line arguments for the 'genecentric-fainfo' program. ''' import sys import bpm import argparse parser = argparse.ArgumentParser( description='Query Funcassociate for information to use with \'go-enrich\'', formatter_class=argparse.ArgumentDefaultsHelpFormatter)...
# coding: utf-8 # In[10]: ''' # Planar curves generation - Cube Method Divide a unit cube into 4 adjecent sub-cubes, pick a point randomly from each sub-unit within a pre-specified planar volume. The area within each sub-unit can be chosen based on the desired expanse of the curve. Join the chosen point by spli...
#!/usr/bin/env python __all__ = ['lizhi_download'] import json from ..common import * def lizhi_download_playlist(url, output_dir = '.', merge = True, info_only = False): # like this http://www.lizhi.fm/#/31365/ #api desc: s->start l->length band->some radio #http://www.lizhi.fm/api/radio_audios?s=0&l=100...
## # \namespace reviewTool.api.io # # \remarks Defines different input/output exporters for saving # and loading data from files # # \author Dr. D Studios # \date 08/18/11 # from . import io class IOSystem(object): _systems = {} def __init__( self, systemName, fileT...
''' Created on Mar 1, 2016 @author: kashefy ''' import os import numpy as np import parse_log as pl from eval_utils import Phase import nideep.iow.file_system_utils as fs from log_utils import is_caffe_info_log def cleanup_caffe_logname(fname): fname = fname.replace('log', '') fname = fname.replace('caffe', ...
# -*- coding: utf-8 -*- import logging import sys import numpy as np from copy import deepcopy from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot from .simulation_modules import SimulationException class SimulationStateChange(object): """ Object that is emitted when Simulator changes its state. ...
# -*- coding: utf-8 -*- """ *************************************************************************** __init__.py --------------------- Date : May 2021 Copyright : (C) 2021 by Alexander Bruy Email : alexander dot bruy at gmail dot com ********************...
from openerp.osv import orm, fields from openerp.addons import decimal_precision as dp import time class AccountAnalyticLine(orm.Model): _inherit = 'account.analytic.line' def _get_parent_line(self, cr, uid, ids, name, arg, context=None): res = {} journal_obj = self.pool['account.analytic.jo...
from __future__ import print_function import time import timeit class TreeNode(object): def __init__(self, name): self._name = name self._children = [] self._time = 0 def __str__(self): return "%s: %s" % (self._name, self._time) __repr__ = __str__ def add_child(self...
import math import avango.osg import avango.inspector import avango.display import sys argv = avango.display.init(sys.argv) view = avango.display.make_view() view.EnableTrackball.value = True ############################################################################### # some light sources -> see also below the N...
import cgi import urllib import time import random import urlparse import hmac import binascii VERSION = '1.0' # Hi Blaine! HTTP_METHOD = 'GET' SIGNATURE_METHOD = 'PLAINTEXT' # Generic exception class class OAuthError(RuntimeError): def __init__(self, message='OAuth error occured.'): self.m...
import steel from steel import bits class FineTune(bits.Structure): bits.Reserved(size=4) value = bits.Integer(size=4) class SampleLength(bits.Integer): def encode(self, value): return int(value / 2) def decode(self, value): return value * 2 class Sample(steel...
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsLayoutItemPolyline. .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version....
#!/usr/bin/python ##################################################################### # Cloud Routes Bridge # ------------------------------------------------------------------ # Description: # ------------------------------------------------------------------ # This is a bridge application between the web interface ...
# -*- coding: latin1 -*- ################################################################################################ import snap,datetime, sys, time, json, os, os.path, shutil, time, struct, random import metrics_v2,calc reload(sys) sys.setdefaultencoding('utf-8') ###############################################...
""" REST API Documentation for the NRS TFRS Credit Trading Application The Transportation Fuels Reporting System is being designed to streamline compliance reporting for transportation fuel suppliers in accordance with the Renewable & Low Carbon Fuel Requirements Regulation. OpenAPI spec version: v1 ...
import base64 import json import os.path import yaml import types import pipes import glob import re import collections import operator as py_operator from ansible import errors from ansible.utils import md5s, checksum_s from distutils.version import LooseVersion, StrictVersion from random import SystemRandom from jinj...
""" Methods for creating RequestContext for using with Mako templates. """ from django.conf import settings from django.template import RequestContext from django.template.context import _builtin_context_processors from django.utils.module_loading import import_string from util.request import safe_get_host from crum ...
import glob import os.path import numpy as np import pandas as pd import matplotlib.pyplot as plt import pprint def CreateList(Locale): ListOfFiles = [] for name in glob.glob(Locale): ListOfFiles.append(name) return ListOfFiles def Run_PCA(f): FigFile = f[:-3]+"png" if FigFile.find("Tok") ...
"""Submission job for local jobs.""" # pylint: disable=invalid-name from __future__ import absolute_import import sys import os import subprocess import logging from threading import Thread import argparse import signal sys.path.append(os.path.join(os.environ['HOME'], "mxnet/dmlc-core/tracker")) sys.path.append(os.pa...
""" DataSource is a wrapper for the OGR Data Source object, which provides an interface for reading vector geometry data from many different file formats (including ESRI shapefiles). When instantiating a DataSource object, use the filename of a GDAL-supported data source. For example, a SHP file or a TIG...
from dal import autocomplete from django import forms from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.core.validators import MaxLengthValidator, MinLengthValidator from .models import Event, Question QUESTION = "Ask your question in 280 characters" ANSWER = "...
from .gr_python import (top_block_pb, top_block_wait_unlocked, top_block_run_unlocked, top_block_start_unlocked, top_block_stop_unlocked, top_block_unlock_unlocked) #, dot_graph_tb) from .hier_block2 import hier_block2 import threading from .hier_block2 import hier_block2 class _top_block_waiter(threadin...
from itertools import chain import numpy as np import scipy.signal import mxnet as mx class Agent(object): def __init__(self, input_size, act_space, config): super(Agent, self).__init__() self.input_size = input_size self.num_envs = config.num_envs self.ctx = config.ctx sel...
""" Ironic console utilities. """ import errno import os import signal import subprocess import time from ironic_lib import utils as ironic_utils from oslo_log import log as logging from oslo_service import loopingcall from oslo_utils import fileutils from oslo_utils import netutils import psutil from ironic.common ...
# -*- coding: utf-8 -*- import unittest from wbc import app from wbc.models import DocumentModel from ..helpers import get_sphinx_mock class DocumentModelTest(unittest.TestCase): def setUp(self): chapter = u'POWSTANIE WIELKOPOLSKIE NA POCZTÓWKACH, PLAKATACH, DYPLOMACH I ULOTKACH (DO 1921 R.)' s...
"""Sale Order Related models.""" from odoo import fields, models, api, _ class SaleOrder(models.Model): """Sale Order model.""" _inherit = 'sale.order' quote_number = fields.Char(string="Quotation Number", copy=False, default=lambda self: _('New')) client_order_ref = ...
#!/usr/bin/env python # # Common configuration and logging # # <EMAIL> # import argparse import ConfigParser from os import path, access, R_OK import os import sys import time import paramiko import platform import glob2 import shutil import logging import logging.handlers from logging.handlers import RotatingFileHand...
""" Claim objects for use with resource tracking. """ from nova.openstack.common import jsonutils from nova.openstack.common import lockutils from nova.openstack.common import log as logging LOG = logging.getLogger(__name__) COMPUTE_RESOURCE_SEMAPHORE = "compute_resources" class NopClaim(object): """For use wit...
"""Tests for regularizers.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.contrib.layers.python.layers import regularizers from tensorflow.python.client import session from tensorflow.python.framework import constant_...
import traceback from cStringIO import StringIO from manager_exceptions import (ManagerError, EngineNotRunningError, ProcessingGraphNotSetError) from configuration_builder.configuration_builder_exceptions import (ClickBlockConfigurationError, ClickElem...
import math import mpmath import lib.solutions.pbs.modelParameters class SpiceComponent(object): componentType = None componentValue = None def __init__(self, componentType, componentValue): self.componentType = componentType self.componentValue = componentValue class Model(object): ...
from Borg import Borg from kaosxdot import KaosXDotParser from componentxdot import ComponentXDotParser import cairo import pangocairo from ConceptMapModel import ConceptMapModel from ComponentModel import ComponentModel from AssetModel import AssetModel from KaosModel import KaosModel import os import re def listToSt...
"""Provides a factory class for generating dynamic messages.""" __author__ = '<EMAIL> (Matt Toia)' from google.protobuf import descriptor_database from google.protobuf import descriptor_pool from google.protobuf import message from google.protobuf import reflection class MessageFactory(object): """Factory for cre...
""" Utility class for VHD related operations. Official VHD format specs can be retrieved at: http://technet.microsoft.com/en-us/library/bb676673.aspx See "Download the Specifications Without Registering" Official VHDX format specs can be retrieved at: http://www.microsoft.com/en-us/download/details.aspx?id=34750 """ ...
"""Implements parsing execution results from XML output files. The public API of this package is the :func:`~.ExecutionResult` factory method, which returns :class:`~.Result` objects, and :class:`~.ResultVisitor` abstract class to ease further processing the results. It is highly recommended to use the public API via ...
""" This package reads and writes data formats used by the Virtual Observatory (VO) initiative, particularly the VOTable XML format. """ from .table import ( parse, parse_single_table, validate, from_table, is_votable, writeto) from .exceptions import ( VOWarning, VOTableChangeWarning, VOTableSpecWarning, Uni...
from trove.db import get_db_api from trove.db import db_query from trove.common import exception from trove.common import models from trove.common import pagination from trove.common import utils from trove.openstack.common import log as logging from trove.common.i18n import _ LOG = logging.getLogger(__name__) class...
import unittest2 as unittest import requests from httpretty import HTTPretty from social.utils import module_member, parse_qs from social.backends.utils import user_backends_data, load_backends from social.tests.strategy import TestStrategy from social.tests.models import User, TestUserSocialAuth, TestNonce, \ ...
from gmpy import mpq, lcm, denom, numer, fac def atan_coefficients(NN, bits): ps = [] qs = [] temp = [] Q = 1 for k in range(2*NN+50): p = 1 q = 2*k+1 if lcm(Q, q) < 2**bits: temp.append(mpq(p,q)) Q = lcm(Q, q) else: ...
""" .. _tut_inverse_mne_dspm: Source localization with MNE/dSPM/sLORETA ========================================= The aim of this tutorials is to teach you how to compute and apply a linear inverse method such as MNE/dSPM/sLORETA on evoked/raw/epochs data. """ import numpy as np import matplotlib.pyplot as plt impo...
#!/usr/bin/env python2 import sys from utils import INF, Plane, get_bound, uniq, csort, fsplit from utils import bbox2str, matrix2str, apply_matrix_pt ## LAParams ## class LAParams(object): def __init__(self, line_overlap=0.5, char_margin=2.0, line_margin=0.5, ...
""" GB-specific Form helpers """ from __future__ import absolute_import, unicode_literals import re from django.contrib.localflavor.gb.gb_regions import GB_NATIONS_CHOICES, GB_REGION_CHOICES from django.forms.fields import CharField, Select from django.forms import ValidationError from django.utils.translation impor...
r"""A simple, fast, extensible JSON encoder and decoder JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. json exposes an API familiar to uses of the standard library marshal and pickle modules. Encoding basic Py...
#!/usr/bin/env python import sys, hashlib PATH_INSTALL = "./" sys.path.append(PATH_INSTALL) from androguard.core.androgen import AndroguardS from androguard.core.analysis import analysis from androguard.core.bytecodes import dvm TEST = 'examples/android/TestsAndroguard/bin/classes.dex' a = AndroguardS( TEST ) x = ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['deprecated'], 'supported_by': 'network'} import collections from copy import deepcopy from ansible.module_utils.basic import Ansib...