How to use the future.standard_library.install_aliases function in future

To help you get started, we’ve selected a few future examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chainer / chainerrl / tests / wrappers_tests / test_randomize_action.py View on Github external
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import *  # NOQA
from future import standard_library
standard_library.install_aliases()  # NOQA

import unittest

from chainer import testing
from chainer.testing import condition
import gym
import gym.spaces

import chainerrl


class ActionRecordingEnv(gym.Env):

    observation_space = gym.spaces.Box(low=-1, high=1, shape=(1,))
    action_space = gym.spaces.Discrete(3)
github hplgit / preprocess / test / testsupport.py View on Github external
#!/usr/bin/env python

from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
import os
import sys
import types
import shutil


#---- test constants

TMPDIR = "tmp"



#---- Support routines

def _escapeArg(arg):
github Neurosim-lab / netpyne / netpyne / analysis / lfp.py View on Github external
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import

from builtins import range
from builtins import round
from builtins import str
try:
    basestring
except NameError:
    basestring = str

from future import standard_library
standard_library.install_aliases()
from netpyne import __gui__

if __gui__:
    import matplotlib.pyplot as plt
    from matplotlib import mlab
import numpy as np
from numbers import Number
from .utils import colorList, exception, _saveFigData, _showFigure, _smooth1d


# -------------------------------------------------------------------------------------------------------------------
## Plot LFP (time-resolved, power spectral density, time-frequency and 3D locations)
# -------------------------------------------------------------------------------------------------------------------
@exception
def plotLFP (electrodes = ['avg', 'all'], plots = ['timeSeries', 'PSD', 'spectrogram', 'locations'], timeRange=None, NFFT=256, noverlap=128, 
    nperseg=256, minFreq=1, maxFreq=100, stepFreq=1, smooth=0, separation=1.0, includeAxon=True, logx=False, logy=False, norm=False, dpi=200, overlay=False, filtFreq = False, filtOrder=3, detrend=False, specType='morlet', fontSize=14, colors = None, maxPlots=8, lineWidth=1.5, figSize = (8,8), saveData = None, saveFig = None, showFig = True): 
github weecology / retriever / retriever / lib / load_json.py View on Github external
from __future__ import division
from __future__ import print_function

from future import standard_library

standard_library.install_aliases()
from builtins import zip
from builtins import str
import json
from collections import OrderedDict
from retriever.lib.templates import TEMPLATES
from retriever.lib.models import myTables
from retriever.lib.tools import open_fr


def read_json(json_file, debug=False):
    """Read Json dataset package files

    Load each json and get the appropriate encoding for the dataset
    Reload the json using the encoding to ensure correct character sets
    """
    json_object = OrderedDict()
github cesium-ml / cesium / mltsp / Flask / src / wtforms / ext / appengine / db.py View on Github external
.. code-block:: python

   class BaseContactForm(Form):
       # Add an extra, non-model related field.
       subscribe_to_news = f.BooleanField()

   # Generate a form based on the model.
   ContactForm = model_form(Contact, base_class=BaseContactForm)

"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
from wtforms import Form, validators, widgets, fields as f
from wtforms.ext.appengine.fields import GeoPtPropertyField, ReferencePropertyField, StringListPropertyField


def get_TextField(kwargs):
    """
    Returns a ``TextField``, applying the ``db.StringProperty`` length limit
    of 500 bytes.
    """
    kwargs['validators'].append(validators.length(max=500))
    return f.TextField(**kwargs)


def get_IntegerField(kwargs):
    """
github cesium-ml / cesium / TCP / Algorithms / simbad_id_lookup.py View on Github external
#!/usr/bin/env python
""" Adapted from josh's simbad.py
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import str
from builtins import *
from future import standard_library
standard_library.install_aliases()

import os, sys

import urllib.request, urllib.parse, urllib.error


def query_votable(src_name="HD 27290"):

    #alt_html_pre = "http://simbad.u-strasbg.fr/simbad/sim-coo?"
    #html_pre = "http://simbad.harvard.edu/simbad/sim-coo?"
    html = "http://simbad.harvard.edu/simbad/sim-id?"


    #params = urllib.urlencode({'output.format': "VOTABLE", "Coord": "%fd%f" % (ra, dec),\
    #                               'Radius': rad, 'Radius.unit': "arcsec"})
github didier-barvaux / rohc / contrib / python / pcap.py View on Github external
#
# Replace Scapy to read PCAP in a way compatible with both Python2
# and Python3.
#

"""
Read PCAP and PCAP-NG packet captures
"""

from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import hex
from future import standard_library
standard_library.install_aliases()

# read and parse pcap file
# see http://wiki.wireshark.org/Development/LibpcapFileFormat
import sys
import io
import struct
import six

class FileFormat(object):
    """The different types of PCAP file formats"""
    PCAP = 0xA1B2C3D4
    PCAP_NG = 0x0A0D0D0A
    UNKNOWN = -1

# see http://www.tcpdump.org/linktypes.html
# http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html#appendixLinkTypes
github cesium-ml / cesium / TCP / Software / feature_extract / Code / extractors / stetson_extractor.py View on Github external
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import *
from future import standard_library
standard_library.install_aliases()
import os,sys
from ..FeatureExtractor import FeatureExtractor

#sys.path.append(os.path.abspath(os.environ.get("TCP_DIR")+'/Algorithms'))
from .....Algorithms.stetson_stats import stetson_mean, stetson_j, stetson_k


class stetson_mean_extractor(FeatureExtractor):
    """ An iteratively weighted mean"""
    active = True
    extname = 'stetson_mean' #extractor's name
    def extract(self):
        value = stetson_mean(self.flux_data)
        return value
github cryoem / eman2 / libpyEM / mpi_eman.py View on Github external
# 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA

from future import standard_library
standard_library.install_aliases()
import sys
from pickle import dumps,loads
from zlib import compress,decompress
from struct import pack,unpack
import numpy as np

# no longer used
def mpi_dout(data):
	"""Convert data for transmission efficiently"""

	if isinstance(data,str):
		if len(data)>256 : return "C"+compress(data,1)
		else : return "S"+data
	else :
		d2x=dumps(data,-1)
		if len(d2x)>256 : return "Z"+compress(d2x,1)
github rlpy / rlpy / rlpy / __init__.py View on Github external
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import rlpy.Agents
import rlpy.Tools
import rlpy.Domains
import rlpy.MDPSolvers
import rlpy.Experiments
import rlpy.Policies
import rlpy.Representations