Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
#!/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):
"""
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):
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()
.. 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):
"""
#!/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"})
#
# 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
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
# 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)
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