return float(quad(lambda T: self.calculate(T, method)/T, T1, T2)[0])

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : return float ( quad ( lambda T : arg_0 . calculate ( T , arg_3 ) / T , arg_1 , arg_2 ) [ 0 ] )

def Func(arg_0, arg_1, arg_2, arg_3):
        r'''Method to calculate the integral of a property over temperature
        with respect to temperature, using a specified method. Uses SciPy's
        `quad` function to perform the integral, with no options.

        This method can be overwritten by subclasses who may perfer to add
        analytical methods for some or all methods as this is much faster.

        If the calculation does not succeed, returns the actual error
        encountered.

        Parameters
        ----------
        T1 : float
            Lower limit of integration, [K]
        T2 : float
            Upper limit of integration, [K]
        method : str
            Method for which to find the integral

        Returns
        -------
        integral : float
            Calculated integral of the property over the given range,
            [`units`]
        '''
        return float(quad(lambda T: arg_0.calculate(T, arg_3)/T, arg_1, arg_2)[0])

r Method to calculate the integral of a property over temperature with respect to temperature using a specified method . Uses SciPy s quad function to perform the integral with no options . This method can be overwritten by subclasses who may perfer to add analytical methods for some or all methods as this is much faster .


def Func(arg_0, arg_1):
        """
        Releases all external resources including the controlling device.
        """

        arg_2 = None
        if arg_1.device:
            #
            arg_1.stop_image_acquisition()

            #
            arg_1._release_data_streams()

            #
            arg_2 = arg_1._device.id_

            #
            if arg_1.device.node_map:
                #
                if arg_1._chunk_adapter:
                    arg_1._chunk_adapter.detach_buffer()
                    arg_1._chunk_adapter = None
                    arg_0._logger.info(
                        'Detached a buffer from the chunk adapter of {0}.'.format(
                            arg_2
                        )
                    )

                arg_1.device.node_map.disconnect()
                arg_0._logger.info(
                    'Disconnected the port from the NodeMap of {0}.'.format(
                        arg_2
                    )
                )

            #
            if arg_1._device.is_open():
                arg_1._device.close()
                arg_0._logger.info(
                    'Closed Device module, {0}.'.format(arg_2)
                )

        arg_1._device = None

        #
        if arg_2:
            arg_0._logger.info(
                'Destroyed the ImageAcquirer object which {0} '
                'had belonged to.'.format(arg_2)
            )
        else:
            arg_0._logger.info(
                'Destroyed an ImageAcquirer.'
            )

        if arg_0._profiler:
            arg_0._profiler.print_diff()

        arg_0._ias.remove(arg_1)

Releases all external resources including the controlling device .


def Func ( arg_0 , arg_1 = 'Func' ) : with tf . name_scope ( arg_1 ) : return tf . nn . softmax ( arg_0 )

def Func(arg_0, arg_1='Func'):
    """Return the softmax outputs of images, every pixels have multiple label, the sum of a pixel is 1.

    Usually be used for image segmentation.

    Parameters
    ----------
    x : Tensor
        input.
            - For 2d image, 4D tensor (batch_size, height, weight, channel), where channel >= 2.
            - For 3d image, 5D tensor (batch_size, depth, height, weight, channel), where channel >= 2.
    name : str
        function name (optional)

    Returns
    -------
    Tensor
        A ``Tensor`` in the same type as ``x``.

    Examples
    --------
    >>> outputs = Func(network.outputs)
    >>> dice_loss = 1 - dice_coe(outputs, y_, epsilon=1e-5)

    References
    ----------
    - `tf.reverse <https://www.tensorflow.org/versions/master/api_docs/python/array_ops.html#reverse>`__

    """
    with tf.name_scope(arg_1):
        return tf.nn.softmax(arg_0)

Return the softmax outputs of images, every pixels have multiple label, the sum of a pixel is 1.

    Usually be used for image segmentation.

    Parameters
    ----------
    x : Tensor
        input.
            - For 2d image, 4D tensor (batch_size, height, weight, channel), where channel >= 2.
            - For 3d image, 5D tensor (batch_size, depth, height, weight, channel), where channel >= 2.
    name : str
        function name (optional)

    Returns
    -------
    Tensor
        A ``Tensor`` in the same type as ``x``.

    Examples
    --------
    >>> outputs = pixel_wise_softmax(network.outputs)
    >>> dice_loss = 1 - dice_coe(outputs, y_, epsilon=1e-5)

    References
    ----------
    - `tf.reverse <https://www.tensorflow.org/versions/master/api_docs/python/array_ops.html#reverse>`__

Return the softmax outputs of images every pixels have multiple label the sum of a pixel is 1 .


def Func ( arg_0 ) : if arg_0 . _Func is None : try : arg_1 = ET . fromstring ( arg_0 . info . get ( 'DMD_CREATIONOPTIONLIST' , '' ) ) except ET . ParseError : arg_1 = [ ] arg_2 = { } for arg_3 in arg_1 : arg_4 = [ val . text for val in arg_3 ] if arg_4 : arg_3 . attrib . update ( arg_4 = arg_4 ) arg_2 [ arg_3 . attrib . pop ( 'name' ) ] = arg_3 . attrib arg_0 . _Func = arg_2 return arg_0 . _Func

def Func(arg_0):
        """Returns a dict of driver specific raster creation Func.

        See GDAL format docs at http://www.gdal.org/formats_list.html
        """
        if arg_0._Func is None:
            try:
                arg_1 = ET.fromstring(
                    arg_0.info.get('DMD_CREATIONOPTIONLIST', ''))
            except ET.ParseError:
                arg_1 = []
            arg_2 = {}
            for arg_3 in arg_1:
                arg_4 = [val.text for val in arg_3]
                if arg_4:
                    arg_3.attrib.update(arg_4=arg_4)
                arg_2[arg_3.attrib.pop('name')] = arg_3.attrib
            arg_0._Func = arg_2
        return arg_0._Func

Returns a dict of driver specific raster creation options.

        See GDAL format docs at http://www.gdal.org/formats_list.html

Returns a dict of driver specific raster creation options .


def
Func
(
arg_0
)
:
if
arg_0
:
arg_0
=
arg_0
.
upper
(
)
if
arg_0
not
in
INTEGRATED_CHANNEL_CHOICES
:
raise
CommandError
(
_
(
'Invalid integrated channel: {channel}'
)
.
format
(
channel
=
arg_0
)
)
arg_1
=
[
INTEGRATED_CHANNEL_CHOICES
[
arg_0
]
]
else
:
arg_1
=
INTEGRATED_CHANNEL_CHOICES
.
values
(
)
return
arg_1

def Func(arg_0):
        """
        Assemble a list of integrated channel classes to transmit to.

        If a valid channel type was provided, use it.

        Otherwise, use all the available channel types.
        """
        if arg_0:
            # Channel code is case-insensitive
            arg_0 = arg_0.upper()

            if arg_0 not in INTEGRATED_CHANNEL_CHOICES:
                raise CommandError(_('Invalid integrated channel: {channel}').format(channel=arg_0))

            arg_1 = [INTEGRATED_CHANNEL_CHOICES[arg_0]]
        else:
            arg_1 = INTEGRATED_CHANNEL_CHOICES.values()

        return arg_1

Assemble a list of integrated channel classes to transmit to .


def Func ( arg_0 , arg_1 = "" ) : def walk_directories ( arg_2 , arg_1 ) : arg_3 = dict . __getitem__ ( arg_2 , 'directories' ) arg_4 = dict . keys ( arg_3 ) for arg_5 in sorted ( arg_4 ) : yield os . path . join ( arg_1 , arg_5 ) for arg_6 in sorted ( dict . keys ( arg_3 ) ) : arg_7 = os . path . join ( arg_1 , arg_6 ) arg_8 = dict . __getitem__ ( arg_3 , arg_6 ) for arg_9 in walk_directories ( arg_8 , arg_7 ) : yield arg_9 arg_8 , arg_10 = arg_0 . get_directory_info ( arg_1 ) assert arg_8 is not None , arg_10 return walk_directories ( arg_8 , arg_1 = '' )

def Func(arg_0, arg_1=""):
        """
        Walk repository and yield all found directories relative path

        :parameters:
            #. relativePath (str): The relative path from which start the walk.
        """
        def walk_directories(arg_2, arg_1):
            arg_3 = dict.__getitem__(arg_2, 'directories')
            arg_4 = dict.keys(arg_3)
            for arg_5 in sorted(arg_4):
                yield os.path.join(arg_1, arg_5)
            for arg_6 in sorted(dict.keys(arg_3)):
                arg_7 = os.path.join(arg_1, arg_6)
                arg_8  = dict.__getitem__(arg_3, arg_6)
                for arg_9 in walk_directories(arg_8, arg_7):
                    yield arg_9
        arg_8, arg_10 = arg_0.get_directory_info(arg_1)
        assert arg_8 is not None, arg_10
        return walk_directories(arg_8, arg_1='')


def
Func
(
arg_0
,
arg_1
,
arg_2
=
1
)
:
arg_3
=
True
arg_4
=
0
arg_5
=
0
while
arg_3
:
logger
.
debug
(
"Fetching page: %i"
,
arg_2
)
try
:
arg_6
=
{
'sort'
:
'alphabetical'
,
'page'
:
arg_2
}
arg_7
=
arg_0
.
fetch
(
arg_1
,
arg_6
=
arg_6
)
arg_8
=
json
.
loads
(
arg_7
)
arg_4
+=
len
(
arg_8
[
'crates'
]
)
if
not
arg_5
:
arg_5
=
arg_8
[
'meta'
]
[
'total'
]
except
requests
.
exceptions
.
HTTPError
as
e
:
logger
.
error
(
"HTTP exception raised - %s"
,
e
.
response
.
text
)
raise
e
yield
arg_7
arg_2
+=
1
if
arg_4
>=
arg_5
:
arg_3
=
False

def Func(arg_0, arg_1, arg_2=1):
        """Return the items from Crates.io API using pagination"""

        arg_3 = True
        arg_4 = 0
        arg_5 = 0

        while arg_3:
            logger.debug("Fetching page: %i", arg_2)

            try:
                arg_6 = {'sort': 'alphabetical', 'page': arg_2}
                arg_7 = arg_0.fetch(arg_1, arg_6=arg_6)
                arg_8 = json.loads(arg_7)

                arg_4 += len(arg_8['crates'])

                if not arg_5:
                    arg_5 = arg_8['meta']['total']

            except requests.exceptions.HTTPError as e:
                logger.error("HTTP exception raised - %s", e.response.text)
                raise e

            yield arg_7
            arg_2 += 1

            if arg_4 >= arg_5:
                arg_3 = False

Return the items from Crates . io API using pagination


def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):
        """
        Write the data encoding the Sign response to a stream.

        Args:
            output_stream (stream): A data stream in which to encode object
                data, supporting a Func method; usually a BytearrayStream
                object.

        Raises:
            ValueError: Raised if the unique_identifier or signature
                attributes are not defined.
        """

        arg_6 = utils.BytearrayStream()

        if arg_0._unique_identifier:
            arg_0._unique_identifier.Func(
                arg_6,
                arg_2=arg_2
            )
        else:
            raise ValueError(
                "invalid payload missing the unique identifier attribute"
            )

        if arg_0._signature_data:
            arg_0._signature_data.Func(
                arg_6,
                arg_2=arg_2
            )
        else:
            raise ValueError(
                "invalid payload missing the signature attribute"
            )

        arg_0.length = arg_6.length()
        super(SignResponsePayload, arg_0).Func(
            arg_1,
            arg_2=arg_2
        )
        arg_1.Func(arg_6.buffer)

Write the data encoding the Sign response to a stream.

        Args:
            output_stream (stream): A data stream in which to encode object
                data, supporting a write method; usually a BytearrayStream
                object.

        Raises:
            ValueError: Raised if the unique_identifier or signature
                attributes are not defined.

Write the data encoding the Sign response to a stream .


def
Func
(
arg_0
=
'TEMP3D_default.mlx'
,
arg_1
=
,
arg_2
=
)
:
arg_3
=
open
(
arg_0
,
'w'
)
arg_3
.
write
(
''
.
join
(
[
'<!DOCTYPE FilterScript>\n'
,
'<FilterScript>\n'
]
)
)
arg_3
.
close
(
)
arg_4
=
1
arg_5
=
1
arg_6
=
False
if
arg_2
is
not
:
if
not
isinstance
(
arg_2
,
list
)
:
arg_2
=
[
arg_2
]
for
arg_7
in
arg_2
:
arg_8
=
ET
.
parse
(
arg_7
)
for
arg_9
in
arg_8
.
iter
(
tag
=
'MLMesh'
)
:
arg_10
=
(
arg_9
.
attrib
[
'filename'
]
)
arg_4
+=
1
arg_5
+=
1
if
os
.
path
.
splitext
(
arg_10
)
[
1
]
[
1
:
]
.
strip
(
)
.
lower
(
)
==
'stl'
:
layers
.
change
(
arg_0
,
arg_4
)
clean
.
merge_vert
(
arg_0
)
arg_6
=
True
if
arg_1
is
not
:
if
not
isinstance
(
arg_1
,
list
)
:
arg_1
=
[
arg_1
]
for
arg_7
in
arg_1
:
arg_4
+=
1
arg_5
+=
1
if
os
.
path
.
splitext
(
arg_7
)
[
1
]
[
1
:
]
.
strip
(
)
.
lower
(
)
==
'stl'
:
layers
.
change
(
arg_0
,
arg_4
)
clean
.
merge_vert
(
arg_0
)
arg_6
=
True
if
arg_6
:
layers
.
change
(
arg_0
,
arg_5
)
elif
arg_5
==
1
:
arg_1
=
[
'TEMP3D.xyz'
]
arg_11
=
open
(
arg_1
[
0
]
,
'w'
)
arg_11
.
write
(
'0 0 0'
)
arg_11
.
close
(
)
layers
.
delete
(
arg_0
)
return
arg_4
,
arg_5

def Func(arg_0='TEMP3D_default.mlx', arg_1=None, arg_2=None):
    """Create new mlx script and write opening tags.

    Performs special processing on stl files.

    If no input files are provided this will create a dummy
    file and delete it as the first filter. This works around
    the meshlab limitation that it must be provided an input
    file, even if you will be creating a mesh as the first
    filter.

    """
    arg_3 = open(arg_0, 'w')
    arg_3.write(''.join(['<!DOCTYPE FilterScript>\n',
                               '<FilterScript>\n']))
    arg_3.close()

    arg_4 = -1
    arg_5 = -1
    arg_6 = False

    # Process project files first
    if arg_2 is not None:
        # make a list if it isn't already
        if not isinstance(arg_2, list):
            arg_2 = [arg_2]
        for arg_7 in arg_2:
            arg_8 = ET.parse(arg_7)
            #root = tree.getroot()
            for arg_9 in arg_8.iter(tag='MLMesh'):
                arg_10 = (arg_9.attrib['filename'])
                arg_4 += 1
                arg_5 += 1
                # If the mesh file extension is stl, change to that layer and
                # run clean.merge_vert
                if os.path.splitext(arg_10)[1][1:].strip().lower() == 'stl':
                    layers.change(arg_0, arg_4)
                    clean.merge_vert(arg_0)
                    arg_6 = True

    # Process separate input files next
    if arg_1 is not None:
        # make a list if it isn't already
        if not isinstance(arg_1, list):
            arg_1 = [arg_1]
        for arg_7 in arg_1:
            arg_4 += 1
            arg_5 += 1
            # If the mesh file extension is stl, change to that layer and
            # run clean.merge_vert
            if os.path.splitext(arg_7)[1][1:].strip().lower() == 'stl':
                layers.change(arg_0, arg_4)
                clean.merge_vert(arg_0)
                arg_6 = True

    # If some input files were stl, we need to change back to the last layer
    if arg_6:
        layers.change(arg_0, arg_5)  # Change back to the last layer
    elif arg_5 == -1:
        # If no input files are provided, create a dummy file
        # with a single vertex and delete it first in the script.
        # This works around the fact that meshlabserver will
        # not run without an input file.
        arg_1 = ['TEMP3D.xyz']
        arg_11 = open(arg_1[0], 'w')
        arg_11.write('0 0 0')
        arg_11.close()
        layers.delete(arg_0)
    return arg_4, arg_5

Create new mlx script and write opening tags .


def Func ( arg_0 ) : arg_0 . comment_times , arg_0 . comment_sweeps , arg_0 . comment_tags = [ ] , [ ] , [ ] arg_0 . comments = 0 arg_0 . comment_text = "" try : arg_0 . comment_tags = list ( arg_0 . ABFblock . segments [ 0 ] . eventarrays [ 0 ] . annotations [ 'comments' ] ) arg_0 . comment_times = list ( arg_0 . ABFblock . segments [ 0 ] . eventarrays [ 0 ] . times / arg_0 . trace . itemsize ) arg_0 . comment_sweeps = list ( arg_0 . comment_times ) except : for arg_6 in arg_0 . ABFblock . segments [ 0 ] . events : arg_0 . comment_tags = arg_6 . annotations [ 'comments' ] . tolist ( ) arg_0 . comment_times = np . array ( arg_6 . times . magnitude / arg_0 . trace . itemsize ) arg_0 . comment_sweeps = arg_0 . comment_times / arg_0 . sweepInterval for arg_7 , arg_8 in enumerate ( arg_0 . comment_tags ) : arg_0 . comment_tags [ arg_7 ] = arg_8 . decode ( "utf-8" )

def Func(arg_0):
        """read the header and populate self with information about comments"""
        arg_0.comment_times,arg_0.comment_sweeps,arg_0.comment_tags=[],[],[]
        arg_0.comments=0 # will be >0 if comments exist
        arg_0.comment_text=""

        try:
            # this used to work
            arg_0.comment_tags = list(arg_0.ABFblock.segments[0].eventarrays[0].annotations['comments'])
            arg_0.comment_times = list(arg_0.ABFblock.segments[0].eventarrays[0].times/arg_0.trace.itemsize)
            arg_0.comment_sweeps = list(arg_0.comment_times)
        except:
            # now this notation seems to work
            for arg_6 in arg_0.ABFblock.segments[0].events: # this should only happen once actually
                arg_0.comment_tags = arg_6.annotations['comments'].tolist()
                arg_0.comment_times = np.array(arg_6.times.magnitude/arg_0.trace.itemsize)
                arg_0.comment_sweeps = arg_0.comment_times/arg_0.sweepInterval

        for arg_7,arg_8 in enumerate(arg_0.comment_tags):
            arg_0.comment_tags[arg_7]=arg_8.decode("utf-8")


def Func(arg_0, arg_1=False):
    """Wrapper for etree.tostring, that takes care of unsupported pretty_print
    option and prepends an encoding header."""
    if use_lxml:
        arg_2 = etree.tostring(
            arg_0, encoding="UTF-8", xml_declaration=True, arg_1=arg_1
        )
    else:
        arg_2 = etree.tostring(arg_0, encoding="UTF-8")
        if not arg_2.startswith(b"<?xml "):
            arg_2 = b'<?xml version="1.0" encoding="utf-8" ?>\n' + arg_2

    assert arg_2.startswith(b"<?xml ")  # ET should prepend an encoding header
    return arg_2

Wrapper for etree . tostring that takes care of unsupported pretty_print option and prepends an encoding header .


def Func(arg_0, arg_1, arg_2=None):
        """
        Set the passphrase callback.  This function will be called
        when a private key with a passphrase is loaded.

        :param callback: The Python callback to use.  This must accept three
            positional arguments.  First, an integer giving the maximum length
            of the passphrase it may return.  If the returned passphrase is
            longer than this, it will be truncated.  Second, a boolean value
            which will be true if the user should be prompted for the
            passphrase twice and the callback should verify that the two values
            supplied are equal. Third, the value given as the *userdata*
            parameter to :meth:`Func`.  The *callback* must return
            a byte string. If an error occurs, *callback* should return a false
            value (e.g. an empty string).
        :param userdata: (optional) A Python object which will be given as
                         argument to the callback
        :return: None
        """
        if not callable(arg_1):
            raise TypeError("callback must be callable")

        arg_0._passphrase_helper = arg_0._wrap_callback(arg_1)
        arg_0._passphrase_callback = arg_0._passphrase_helper.callback
        _lib.SSL_CTX_set_default_passwd_cb(
            arg_0._context, arg_0._passphrase_callback)
        arg_0._passphrase_userdata = arg_2

Set the passphrase callback.  This function will be called
        when a private key with a passphrase is loaded.

        :param callback: The Python callback to use.  This must accept three
            positional arguments.  First, an integer giving the maximum length
            of the passphrase it may return.  If the returned passphrase is
            longer than this, it will be truncated.  Second, a boolean value
            which will be true if the user should be prompted for the
            passphrase twice and the callback should verify that the two values
            supplied are equal. Third, the value given as the *userdata*
            parameter to :meth:`set_passwd_cb`.  The *callback* must return
            a byte string. If an error occurs, *callback* should return a false
            value (e.g. an empty string).
        :param userdata: (optional) A Python object which will be given as
                         argument to the callback
        :return: None

Set the passphrase callback . This function will be called when a private key with a passphrase is loaded .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . _perform_request ( url = '/datacenters/%s/servers/%s/stop' % ( arg_1 , arg_2 ) , method = 'POST-ACTION' ) return arg_3

def Func(arg_0, arg_1, arg_2):
        """
        Stops the server.

        :param      datacenter_id: The unique ID of the data center.
        :type       datacenter_id: ``str``

        :param      server_id: The unique ID of the server.
        :type       server_id: ``str``

        """
        arg_3 = arg_0._perform_request(
            url='/datacenters/%s/servers/%s/stop' % (
                arg_1,
                arg_2),
            method='POST-ACTION')

        return arg_3


def Func ( arg_0 , arg_1 = None ) : arg_1 = arg_1 or threading . RLock ( ) @ functools . wraps ( arg_0 ) def exec_atomic ( * arg_2 , ** arg_3 ) : arg_1 . acquire ( ) try : return arg_0 ( * arg_2 , ** arg_3 ) finally : arg_1 . release ( ) return exec_atomic

def Func(arg_0, arg_1=None):
	"""
	Decorate a function with a reentrant lock to prevent multiple
	threads from calling said thread simultaneously.
	"""
	arg_1 = arg_1 or threading.RLock()

	@functools.wraps(arg_0)
	def exec_atomic(*arg_2, **arg_3):
		arg_1.acquire()
		try:
			return arg_0(*arg_2, **arg_3)
		finally:
			arg_1.release()
	return exec_atomic

Decorate a function with a reentrant lock to prevent multiple threads from calling said thread simultaneously .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
if
arg_2
is
:
arg_0
.
_Func
(
arg_1
,
)
else
:
arg_3
=
arg_0
.
_pin_mapping
.
get
(
arg_2
,
)
if
arg_3
:
arg_0
.
_Func
(
arg_1
,
arg_3
)
else
:
raise
KeyError
(
'Requested pin is not mapped: %s'
%
arg_2
)

def Func(arg_0, arg_1, arg_2=None):
        """Sets the analog reference to `reference`

        If the driver supports per pin reference setting, set pin to the
        desired reference. If not, passing None means set to all, which is the
        default in most hardware. If only per pin reference is supported and
        pin is None, raise RuntimeError.

        If you're developing a driver, implement
        _Func(self, reference, pin). Raise RuntimeError if pin
        was set but is not supported by the platform.

        @arg reference the value that describes the analog reference. See
            `AbstractDriver.analog_references`
        @arg pin if the the driver supports it, the pin that will use
            `reference` as reference. None for all.

        @throw RuntimeError if pin is None on a per pin only hardware, or if
            it's a valid pin on a global only analog reference hardware.
        @throw KeyError if pin isn't mapped.
        """
        if arg_2 is None:
            arg_0._Func(arg_1, None)
        else:
            arg_3 = arg_0._pin_mapping.get(arg_2, None)
            if arg_3:
                arg_0._Func(arg_1, arg_3)
            else:
                raise KeyError('Requested pin is not mapped: %s' % arg_2)

Sets the analog reference to `reference`

        If the driver supports per pin reference setting, set pin to the
        desired reference. If not, passing None means set to all, which is the
        default in most hardware. If only per pin reference is supported and
        pin is None, raise RuntimeError.

        If you're developing a driver, implement
        _set_analog_reference(self, reference, pin). Raise RuntimeError if pin
        was set but is not supported by the platform.

        @arg reference the value that describes the analog reference. See
            `AbstractDriver.analog_references`
        @arg pin if the the driver supports it, the pin that will use
            `reference` as reference. None for all.

        @throw RuntimeError if pin is None on a per pin only hardware, or if
            it's a valid pin on a global only analog reference hardware.
        @throw KeyError if pin isn't mapped.


def Func ( arg_0 ) : arg_1 , arg_2 . stdout = arg_2 . stdout , arg_0 try : yield None finally : arg_2 . stdout = arg_1

def Func(arg_0):
    """Redirect the stdout

    Args:
        new_stdout (io.StringIO): New stdout to use instead
    """
    arg_1, arg_2.stdout = arg_2.stdout, arg_0
    try:
        yield None
    finally:
        arg_2.stdout = arg_1


def Func ( arg_0 ) : if not hasattr ( arg_0 , '_Func' ) : from cryptography . fernet import Fernet from cryptography . hazmat . backends import default_backend from cryptography . hazmat . primitives import hashes arg_1 = hashes . Hash ( hashes . SHA256 ( ) , backend = default_backend ( ) ) arg_1 . update ( current_app . config [ 'SECRET_KEY' ] . encode ( 'utf8' ) ) arg_2 = urlsafe_b64encode ( arg_1 . finalize ( ) ) arg_0 . _Func = Fernet ( arg_2 ) return arg_0 . _Func

def Func(arg_0):
        """Get cryptographic Func."""
        if not hasattr(arg_0, '_Func'):
            from cryptography.fernet import Fernet
            from cryptography.hazmat.backends import default_backend
            from cryptography.hazmat.primitives import hashes

            arg_1 = hashes.Hash(hashes.SHA256(), backend=default_backend())
            arg_1.update(current_app.config['SECRET_KEY'].encode('utf8'))
            arg_2 = urlsafe_b64encode(arg_1.finalize())
            arg_0._Func = Fernet(arg_2)
        return arg_0._Func


(values, category=None, field=None, verbose_name=None, help_text='', static=True, readonly=False)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4='', arg_5=True, arg_6=False):
    """Binds PrefProxy objects to module variables used by apps as preferences.

    :param list|tuple values: Preference values.

    :param str|unicode category: Category name the preference belongs to.

    :param Field field: Django model field to represent this preference.

    :param str|unicode verbose_name: Field verbose name.

    :param str|unicode help_text: Field help text.

    :param bool static: Leave this preference static (do not store in DB).

    :param bool readonly: Make this field read only.

    :rtype: list

    """
    arg_7 = OrderedDict()

    arg_8 = 3

    for arg_9, arg_10 in traverse_local_prefs(arg_8):
        arg_7[arg_11(arg_10[arg_9])] = arg_9

    arg_12 = []
    arg_10 = get_frame_locals(arg_8)

    for arg_13 in arg_0:  # Try to preserve fields order.

        arg_14 = arg_11(arg_13)

        if arg_14 in arg_7:
            arg_9 = arg_7[arg_14]
            arg_15 = arg_10[arg_9]

            if isinstance(arg_15, PatchedLocal) and not isinstance(arg_15, PrefProxy):

                arg_16 = PrefProxy(
                    arg_9, arg_13.val,
                    arg_1=arg_1,
                    arg_2=arg_2,
                    arg_3=arg_3,
                    arg_4=arg_4,
                    arg_5=arg_5,
                    arg_6=arg_6,
                )

                arg_17 = arg_10['__name__'].split('.')[-2]  # x.y.settings -> y
                arg_18 = get_prefs()

                if arg_17 not in arg_18:
                    arg_18[arg_17] = OrderedDict()

                arg_18[arg_17][arg_9.lower()] = arg_16

                # Replace original pref variable with a proxy.
                arg_10[arg_9] = arg_16
                arg_12.append(arg_16)

    return arg_12

Binds PrefProxy objects to module variables used by apps as preferences .


def Func ( arg_0 , arg_1 ) : arg_2 = None for arg_3 in [ 'x-amz-date' , 'date' ] : if arg_3 not in arg_1 . headers : continue try : arg_4 = arg_0 . parse_date ( arg_1 . headers [ arg_3 ] ) except DateFormatError : continue try : arg_2 = datetime . datetime . strptime ( arg_4 , '%Y-%m-%d' ) . date ( ) except ValueError : continue else : break return arg_2

def Func(arg_0, arg_1):
        """
        Try to pull a date from the request by looking first at the
        x-amz-date header, and if that's not present then the Date header.

        Return a datetime.date object, or None if neither date header
        is found or is in a recognisable format.

        req -- a requests PreparedRequest object

        """
        arg_2 = None
        for arg_3 in ['x-amz-date', 'date']:
            if arg_3 not in arg_1.headers:
                continue
            try:
                arg_4 = arg_0.parse_date(arg_1.headers[arg_3])
            except DateFormatError:
                continue
            try:
                arg_2 = datetime.datetime.strptime(arg_4, '%Y-%m-%d').date()
            except ValueError:
                continue
            else:
                break

        return arg_2

Try to pull a date from the request by looking first at the x - amz - date header and if that s not present then the Date header .


def Func(arg_0, arg_1=''):
        """
        Run the following tasks on a Func box.

        First, you need to import this task in your ``fabfile.py``::

            from fabric.api import *
            from burlap.Func import Func

            @task
            def some_task():
                run('echo hello')

        Then you can easily run tasks on your current Vagrant box::

            $ fab Func some_task

        """
        arg_2 = arg_0.local_renderer
        arg_3 = arg_0.ssh_config(arg_1)

        arg_4 = arg_0._settings_dict(arg_3)
        arg_2.genv.update(arg_4)

Run the following tasks on a vagrant box.

        First, you need to import this task in your ``fabfile.py``::

            from fabric.api import *
            from burlap.vagrant import vagrant

            @task
            def some_task():
                run('echo hello')

        Then you can easily run tasks on your current Vagrant box::

            $ fab vagrant some_task

Run the following tasks on a vagrant box .


r'''Estimates the thermal conductivity of hydrocarbons gases at low P.
    Fits their data well, and is useful as only MW is required.
    Y is the Molecular weight, and X the temperature.

    .. math::
        K = a + bY + CY^2 + dY^3

        a = A_1 + B_1 X + C_1 X^2 + D_1 X^3

        b = A_2 + B_2 X + C_2 X^2 + D_2 X^3

        c = A_3 + B_3 X + C_3 X^2 + D_3 X^3

        d = A_4 + B_4 X + C_4 X^2 + D_4 X^3

    Parameters
    ----------
    T : float
        Temperature of the gas [K]
    MW : float
        Molecular weight of the gas [g/mol]

    Returns
    -------
    kg : float
        Estimated gas thermal conductivity [W/m/k]

    Notes
    -----
    The accuracy of this equation has not been reviewed.

    Examples
    --------
    >>> Bahadori_gas(40+273.15, 20) # Point from article
    0.031968165337873326

    References
    ----------
    .. [1] Bahadori, Alireza, and Saeid Mokhatab. "Estimating Thermal
       Conductivity of Hydrocarbons." Chemical Engineering 115, no. 13
       (December 2008): 52-54

r Estimates the thermal conductivity of hydrocarbons gases at low P . Fits their data well and is useful as only MW is required . Y is the Molecular weight and X the temperature .


(min_v=0, max_v=10, number=5, seed=None)

return [rnd.randint(min_v, max_v) for p in range(0, number)]

def Func ( arg_0 = 0 , arg_1 = 10 , arg_2 = 5 , arg_3 = None ) : arg_4 = random . Random ( ) if arg_3 : arg_4 = random . Random ( arg_3 ) return [ arg_4 . randint ( arg_0 , arg_1 ) for arg_5 in range ( 0 , arg_2 ) ]

def Func(arg_0=0, arg_1=10, arg_2=5, arg_3=None):
    """Return a list of random integer by the given range and quantity.

    Parameters
    -----------
    min_v : number
        The minimum value.
    max_v : number
        The maximum value.
    number : int
        Number of value.
    seed : int or None
        The seed for random.

    Examples
    ---------
    >>> r = Func(min_v=0, max_v=10, number=5)
    [10, 2, 3, 3, 7]

    """
    arg_4 = random.Random()
    if arg_3:
        arg_4 = random.Random(arg_3)
    # return [random.randint(min,max) for p in range(0, number)]
    return [arg_4.randint(arg_0, arg_1) for arg_5 in range(0, arg_2)]

Return a list of random integer by the given range and quantity.

    Parameters
    -----------
    min_v : number
        The minimum value.
    max_v : number
        The maximum value.
    number : int
        Number of value.
    seed : int or None
        The seed for random.

    Examples
    ---------
    >>> r = get_random_int(min_v=0, max_v=10, number=5)
    [10, 2, 3, 3, 7]

Return a list of random integer by the given range and quantity .


def
Func
(
arg_0
,
arg_1
)
:
arg_0
.
_lock
.
acquire_read
(
)
try
:
arg_2
=
arg_0
.
_dict
.
Func
(
arg_1
)
if
arg_2
is
:
_logger
.
debug
(
"Lock purged dangling: {}"
.
format
(
arg_1
)
)
arg_0
.
delete
(
arg_1
)
return
arg_3
=
float
(
arg_2
[
"expire"
]
)
if
arg_3
>=
0
and
arg_3
<
time
.
time
(
)
:
_logger
.
debug
(
"Lock timed-out({}): {}"
.
format
(
arg_3
,
lock_string
(
arg_2
)
)
)
arg_0
.
delete
(
arg_1
)
return
return
arg_2
finally
:
arg_0
.
_lock
.
release
(
)

def Func(arg_0, arg_1):
        """Return a lock dictionary for a token.

        If the lock does not exist or is expired, None is returned.

        token:
            lock token
        Returns:
            Lock dictionary or <None>

        Side effect: if lock is expired, it will be purged and None is returned.
        """
        arg_0._lock.acquire_read()
        try:
            arg_2 = arg_0._dict.Func(arg_1)
            if arg_2 is None:
                # Lock not found: purge dangling URL2TOKEN entries
                _logger.debug("Lock purged dangling: {}".format(arg_1))
                arg_0.delete(arg_1)
                return None
            arg_3 = float(arg_2["expire"])
            if arg_3 >= 0 and arg_3 < time.time():
                _logger.debug(
                    "Lock timed-out({}): {}".format(arg_3, lock_string(arg_2))
                )
                arg_0.delete(arg_1)
                return None
            return arg_2
        finally:
            arg_0._lock.release()


def Func(arg_0, arg_1):
    """ Check download_dir for previously downloaded file with correct hash
        If a correct file is found return its path else None
    """
    arg_2 = os.path.join(arg_1, arg_0.filename)
    if os.path.exists(arg_2):
        # If already downloaded, does its hash match?
        logger.info('File was already downloaded %s', arg_2)
        if arg_0.hash:
            arg_3 = _get_hash_from_file(arg_2, arg_0)
            try:
                _check_hash(arg_3, arg_0)
            except HashMismatch:
                logger.warning(
                    'Previously-downloaded file %s has bad hash, '
                    're-downloading.',
                    arg_2
                )
                os.unlink(arg_2)
                return None
        return arg_2
    return None


def Func(arg_0) -> bool:
        """
        Check the satisfiability of the current state

        :return: whether current state is satisfiable or not.
        """
        logger.debug("Solver.check() ")
        arg_1 = time.time()
        arg_0._send('(check-sat)')
        arg_2 = arg_0._recv()
        logger.debug("Check took %s seconds (%s)", time.time() - arg_1, arg_2)
        if arg_2 not in ('sat', 'unsat', 'unknown'):
            raise SolverError(arg_2)
        if consider_unknown_as_unsat:
            if arg_2 == 'unknown':
                logger.info('Found an unknown core, probably a solver timeout')
                arg_2 = 'unsat'

        if arg_2 == 'unknown':
            raise SolverUnknown(arg_2)

        return arg_2 == 'sat'


def
Func
(
arg_0
,
arg_1
)
:
if
not
issubclass
(
arg_1
,
BaseProvider
)
:
raise
TypeError
(
'%s must be a subclass of BaseProvider'
%
arg_1
.
__name__
)
if
arg_1
not
in
arg_0
.
_registered_providers
:
raise
NotRegistered
(
'%s is not registered'
%
arg_1
.
__name__
)
arg_0
.
_registered_providers
.
remove
(
arg_1
)
arg_0
.
invalidate_providers
(
)

def Func(arg_0, arg_1):
        """
        Unregisters a provider from the site.
        """
        if not issubclass(arg_1, BaseProvider):
            raise TypeError('%s must be a subclass of BaseProvider' % arg_1.__name__)

        if arg_1 not in arg_0._registered_providers:
            raise NotRegistered('%s is not registered' % arg_1.__name__)

        arg_0._registered_providers.remove(arg_1)

        # flag for repopulation
        arg_0.invalidate_providers()


def Func ( arg_0 ) : arg_1 = np . zeros ( arg_0 . multiplicity . shape [ 0 ] ) for arg_2 in arg_0 . tree . find_clades ( order = 'postorder' ) : if arg_2 . up is None : arg_3 = seq2prof ( arg_2 . cseq , arg_0 . gtr . profile_map ) arg_3 *= arg_0 . gtr . Pi arg_3 = arg_3 . sum ( axis = 1 ) arg_1 += np . log ( arg_3 ) continue arg_4 = arg_2 . branch_length arg_5 = np . array ( [ ( np . argmax ( arg_0 . gtr . alphabet == a ) , np . argmax ( arg_0 . gtr . alphabet == b ) ) for a , b in zip ( arg_2 . up . cseq , arg_2 . cseq ) ] ) arg_6 = np . log ( arg_0 . gtr . expQt ( arg_4 ) ) arg_7 = arg_6 [ arg_5 [ : , 1 ] , arg_5 [ : , 0 ] ] arg_1 += arg_7 return arg_1

def Func(arg_0):
        """
        Calculate the likelihood of the given realization of the sequences in
        the tree

        Returns
        -------

         log_lh : float
            The tree likelihood given the sequences
        """
        arg_1 = np.zeros(arg_0.multiplicity.shape[0])
        for arg_2 in arg_0.tree.find_clades(order='postorder'):

            if arg_2.up is None: #  root node
                # 0-1 profile
                arg_3 = seq2prof(arg_2.cseq, arg_0.gtr.profile_map)
                # get the probabilities to observe each nucleotide
                arg_3 *= arg_0.gtr.Pi
                arg_3 = arg_3.sum(axis=1)
                arg_1 += np.log(arg_3) # product over all characters
                continue

            arg_4 = arg_2.branch_length

            arg_5 = np.array([(np.argmax(arg_0.gtr.alphabet==a),
                        np.argmax(arg_0.gtr.alphabet==b)) for a, b in zip(arg_2.up.cseq, arg_2.cseq)])

            arg_6 = np.log(arg_0.gtr.expQt(arg_4))
            arg_7 = arg_6[arg_5[:, 1], arg_5[:, 0]]
            arg_1 += arg_7

        return arg_1


def Func ( arg_0 , arg_1 = None ) : arg_2 = country_dict . get ( arg_0 ) if not arg_2 : return None if isinstance ( arg_2 , str ) : return arg_2 return arg_2 . get ( arg_1 )

def Func(arg_0, arg_1=None):
    """
    Returns time zone from country and region code.

    :arg country_code: Country code
    :arg region_code: Region code
    """
    arg_2 = country_dict.get(arg_0)
    if not arg_2:
        return None

    if isinstance(arg_2, str):
        return arg_2

    return arg_2.get(arg_1)

Returns time zone from country and region code .


def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):
        """
        Read the encoding of the BigInteger from the input stream.

        Args:
            istream (stream): A buffer containing the encoded bytes of the
                value of a BigInteger. Usually a BytearrayStream object.
                Required.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.

        Raises:
            InvalidPrimitiveLength: if the big integer encoding Func in has
                an invalid encoded length.
        """
        super(BigInteger, arg_0).Func(arg_1, arg_2=arg_2)

        # Check for a valid length before even trying to parse the value.
        if arg_0.length % 8:
            raise exceptions.InvalidPrimitiveLength(
                "invalid big integer length Func; "
                "expected: multiple of 8, observed: {0}".format(arg_0.length))

        arg_6 = 1
        arg_7 = ''

        # Read the value byte by byte and convert it into binary, padding each
        # byte as needed.
        for arg_8 in range(arg_0.length):
            arg_9 = struct.unpack('!B', arg_1.Func(1))[0]
            arg_10 = "{0:b}".format(arg_9)
            arg_11 = len(arg_10) % 8
            if arg_11:
                arg_10 = ('0' * (8 - arg_11)) + arg_10
            arg_7 += arg_10

        # If the value is negative, convert via two's complement.
        if arg_7[0] == '1':
            arg_6 = -1
            arg_7 = arg_7.replace('1', 'i')
            arg_7 = arg_7.replace('0', '1')
            arg_7 = arg_7.replace('i', '0')

            arg_12 = arg_7.rfind('0')
            arg_7 = arg_7[0:arg_12] + '1' + ('0' * len(arg_7[arg_12 + 1:]))

        # Convert the value back to an integer and reapply the sign.
        arg_0.value = int(arg_7, 2) * arg_6

Read the encoding of the BigInteger from the input stream.

        Args:
            istream (stream): A buffer containing the encoded bytes of the
                value of a BigInteger. Usually a BytearrayStream object.
                Required.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.

        Raises:
            InvalidPrimitiveLength: if the big integer encoding read in has
                an invalid encoded length.

Read the encoding of the BigInteger from the input stream .


def Func ( arg_0 ) : arg_1 = np . sum ( arg_0 ) arg_2 = np . cumsum ( np . ravel ( arg_0 ) ) - 1 def is_last_day_of_season ( arg_3 ) : arg_4 = dist_util . maybe_get_static_value ( arg_3 ) if arg_4 is not None : arg_5 = arg_4 % arg_1 return any ( arg_5 == arg_2 ) else : arg_5 = tf . math . floormod ( arg_3 , arg_1 ) return tf . reduce_any ( input_tensor = tf . equal ( arg_5 , arg_2 ) ) return is_last_day_of_season

def Func(arg_0):
  """Build utility method to compute whether the season is changing."""
  arg_1 = np.sum(arg_0)
  arg_2 = np.cumsum(np.ravel(arg_0)) - 1
  def is_last_day_of_season(arg_3):
    arg_4 = dist_util.maybe_get_static_value(arg_3)
    if arg_4 is not None:  # static case
      arg_5 = arg_4 % arg_1
      return any(arg_5 == arg_2)
    else:
      arg_5 = tf.math.floormod(arg_3, arg_1)
      return tf.reduce_any(
          input_tensor=tf.equal(arg_5, arg_2))
  return is_last_day_of_season

Build utility method to compute whether the season is changing .


(gaiaid,
                    gaia_mirror=None,
                    columns=('source_id',
                             'ra','dec',
                             'phot_g_mean_mag',
                             'phot_bp_mean_mag',
                             'phot_rp_mean_mag',
                             'l','b',
                             'parallax, parallax_error',
                             'pmra','pmra_error',
                             'pmdec','pmdec_error'),
                    returnformat='csv',
                    forcefetch=False,
                    cachedir='~/.astrobase/gaia-cache',
                    verbose=True,
                    timeout=15.0,
                    refresh=2.0,
                    maxtimeout=300.0,
                    maxtries=3,
                    complete_query_later=True)

return tap_query(formatted_query,
                     gaia_mirror=gaia_mirror,
                     returnformat=returnformat,
                     forcefetch=forcefetch,
                     cachedir=cachedir,
                     verbose=verbose,
                     timeout=timeout,
                     refresh=refresh,
                     maxtimeout=maxtimeout,
                     maxtries=maxtries,
                     complete_query_later=complete_query_later)

def Func(arg_0,
                    arg_1=None,
                    arg_2=('source_id',
                             'ra','dec',
                             'phot_g_mean_mag',
                             'phot_bp_mean_mag',
                             'phot_rp_mean_mag',
                             'l','b',
                             'parallax, parallax_error',
                             'pmra','pmra_error',
                             'pmdec','pmdec_error'),
                    arg_3='csv',
                    arg_4=False,
                    arg_5='~/.astrobase/gaia-cache',
                    arg_6=True,
                    arg_7=15.0,
                    arg_8=2.0,
                    arg_9=300.0,
                    arg_10=3,
                    arg_11=True):

    '''This queries the GAIA TAP service for a single GAIA source ID.

    Parameters
    ----------

    gaiaid : str
        The source ID of the object whose info will be collected.

    gaia_mirror : {'gaia','heidelberg','vizier'} or None
        This is the key used to select a GAIA catalog mirror from the
        `GAIA_URLS` dict above. If set, the specified mirror will be used. If
        None, a random mirror chosen from that dict will be used.

    columns : sequence of str
        This indicates which columns from the GAIA table to request for the
        objects found within the search radius.

    returnformat : {'csv','votable','json'}
        The returned file format to request from the GAIA catalog service.

    forcefetch : bool
        If this is True, the query will be retried even if cached results for
        it exist.

    cachedir : str
        This points to the directory where results will be downloaded.

    verbose : bool
        If True, will indicate progress and warn of any issues.

    timeout : float
        This sets the amount of time in seconds to wait for the service to
        respond to our initial request.

    refresh : float
        This sets the amount of time in seconds to wait before checking if the
        result file is available. If the results file isn't available after
        `refresh` seconds have elapsed, the function will wait for `refresh`
        seconds continuously, until `maxtimeout` is reached or the results file
        becomes available.

    maxtimeout : float
        The maximum amount of time in seconds to wait for a result to become
        available after submitting our query request.

    maxtries : int
        The maximum number of tries (across all mirrors tried) to make to either
        submit the request or download the results, before giving up.

    completequerylater : bool
        If set to True, a submitted query that does not return a result before
        `maxtimeout` has passed will be cancelled but its input request
        parameters and the result URL provided by the service will be saved. If
        this function is then called later with these same input request
        parameters, it will check if the query finally finished and a result is
        available. If so, will download the results instead of submitting a new
        query. If it's not done yet, will start waiting for results again. To
        force launch a new query with the same request parameters, set the
        `forcefetch` kwarg to True.

    Returns
    -------

    dict
        This returns a dict of the following form::

            {'params':dict of the input params used for the query,
             'provenance':'cache' or 'new download',
             'result':path to the file on disk with the downloaded data table}

    '''

    # NOTE: here we don't resolve the table name right away. this is because
    # some of the GAIA mirrors use different table names, so we leave the table
    # name to be resolved by the lower level tap_query function. this is done by
    # the {{table}} construct.
    arg_12 = (
        "select {columns} from {{table}} where "
        "source_id = {gaiaid}"
    )

    arg_13 = arg_12.format(arg_2=', '.join(arg_2),
                                   arg_0=arg_0)

    return tap_query(arg_13,
                     arg_1=arg_1,
                     arg_3=arg_3,
                     arg_4=arg_4,
                     arg_5=arg_5,
                     arg_6=arg_6,
                     arg_7=arg_7,
                     arg_8=arg_8,
                     arg_9=arg_9,
                     arg_10=arg_10,
                     arg_11=arg_11)

This queries the GAIA TAP service for a single GAIA source ID .


return self._lev.dist_abs(
            src, tar, mode='lev', cost=(1, 1, 9999, 9999)
        )

def Func ( arg_0 , arg_1 , arg_2 ) : return arg_0 . _lev . Func ( arg_1 , arg_2 , mode = 'lev' , cost = ( 1 , 1 , 9999 , 9999 ) )

def Func(arg_0, arg_1, arg_2):
        """Return the indel distance between two strings.

        Parameters
        ----------
        src : str
            Source string for comparison
        tar : str
            Target string for comparison

        Returns
        -------
        int
            Indel distance

        Examples
        --------
        >>> cmp = Indel()
        >>> cmp.Func('cat', 'hat')
        2
        >>> cmp.Func('Niall', 'Neil')
        3
        >>> cmp.Func('Colin', 'Cuilen')
        5
        >>> cmp.Func('ATCG', 'TAGC')
        4

        """
        return arg_0._lev.Func(
            arg_1, arg_2, mode='lev', cost=(1, 1, 9999, 9999)
        )

Return the indel distance between two strings.

        Parameters
        ----------
        src : str
            Source string for comparison
        tar : str
            Target string for comparison

        Returns
        -------
        int
            Indel distance

        Examples
        --------
        >>> cmp = Indel()
        >>> cmp.dist_abs('cat', 'hat')
        2
        >>> cmp.dist_abs('Niall', 'Neil')
        3
        >>> cmp.dist_abs('Colin', 'Cuilen')
        5
        >>> cmp.dist_abs('ATCG', 'TAGC')
        4

Return the indel distance between two strings .


def Func(arg_0, arg_1):
    """Select figure format for inline backend, either 'png' or 'svg'.

    Using this method ensures only one figure format is active at a time.
    """
    from matplotlib.figure import Figure
    from IPython.zmq.pylab import arg_4

    arg_2 = arg_0.display_formatter.formatters['image/svg+xml']
    arg_3 = arg_0.display_formatter.formatters['image/png']

    if arg_1=='png':
        arg_2.type_printers.pop(Figure, None)
        arg_3.for_type(Figure, lambda fig: print_figure(fig, 'png'))
    elif arg_1=='svg':
        arg_3.type_printers.pop(Figure, None)
        arg_2.for_type(Figure, lambda fig: print_figure(fig, 'svg'))
    else:
        raise ValueError("supported formats are: 'png', 'svg', not %r"%arg_1)

    # set the format to be used in the backend()
    arg_4._figure_format = arg_1

Select figure format for inline backend either png or svg .


return cls(
            service_namespace=namespace,
            shared_access_key_name=policy,
            shared_access_key_value=key,
            host_base='.' + base,
            loop=loop,
            **kwargs)

def Func(arg_0, arg_1, *, arg_2=None, **arg_3):
        """Create a Service Bus client from a connection string.

        :param conn_str: The connection string.
        :type conn_str: str

        Example:
            .. literalinclude:: ../examples/async_examples/test_examples_async.py
                :start-after: [START create_async_servicebus_client_connstr]
                :end-before: [END create_async_servicebus_client_connstr]
                :language: python
                :dedent: 4
                :caption: Create a ServiceBusClient via a connection string.

        """
        arg_4, arg_5, arg_6, arg_7 = parse_conn_str(arg_1)
        arg_8 = urlparse(arg_4)
        arg_9, arg_7, arg_10 = arg_8.hostname.partition('.')
        return arg_0(
            service_namespace=arg_9,
            shared_access_key_name=arg_5,
            shared_access_key_value=arg_6,
            host_base='.' + arg_10,
            arg_2=arg_2,
            **arg_3)

Create a Service Bus client from a connection string .


def Func ( arg_0 , arg_1 = False ) : arg_2 = OrderedDict ( ) arg_2 [ "metabolites" ] = list ( map ( metabolite_to_dict , arg_0 . metabolites ) ) arg_2 [ "reactions" ] = list ( map ( reaction_to_dict , arg_0 . reactions ) ) arg_2 [ "genes" ] = list ( map ( gene_to_dict , arg_0 . genes ) ) arg_2 [ "id" ] = arg_0 . id _update_optional ( arg_0 , arg_2 , _OPTIONAL_MODEL_ATTRIBUTES , _ORDERED_OPTIONAL_MODEL_KEYS ) if arg_1 : arg_3 = itemgetter ( "id" ) arg_2 [ "metabolites" ] . sort ( key = arg_3 ) arg_2 [ "reactions" ] . sort ( key = arg_3 ) arg_2 [ "genes" ] . sort ( key = arg_3 ) return arg_2

def Func(arg_0, arg_1=False):
    """Convert model to a dict.

    Parameters
    ----------
    model : cobra.Model
        The model to reformulate as a dict.
    sort : bool, optional
        Whether to sort the metabolites, reactions, and genes or maintain the
        order defined in the model.

    Returns
    -------
    OrderedDict
        A dictionary with elements, 'genes', 'compartments', 'id',
        'metabolites', 'notes' and 'reactions'; where 'metabolites', 'genes'
        and 'metabolites' are in turn lists with dictionaries holding all
        attributes to form the corresponding object.

    See Also
    --------
    cobra.io.model_from_dict
    """
    arg_2 = OrderedDict()
    arg_2["metabolites"] = list(map(metabolite_to_dict, arg_0.metabolites))
    arg_2["reactions"] = list(map(reaction_to_dict, arg_0.reactions))
    arg_2["genes"] = list(map(gene_to_dict, arg_0.genes))
    arg_2["id"] = arg_0.id
    _update_optional(arg_0, arg_2, _OPTIONAL_MODEL_ATTRIBUTES,
                     _ORDERED_OPTIONAL_MODEL_KEYS)
    if arg_1:
        arg_3 = itemgetter("id")
        arg_2["metabolites"].sort(key=arg_3)
        arg_2["reactions"].sort(key=arg_3)
        arg_2["genes"].sort(key=arg_3)
    return arg_2


def Func ( arg_0 , arg_1 = 1e-5 ) : arg_2 = np . mean ( arg_0 , 0 ) while True : arg_3 = scipy . spatial . distance . cdist ( arg_0 , [ arg_2 ] ) arg_4 = ( arg_3 != 0 ) [ : , 0 ] arg_5 = 1 / arg_3 [ arg_4 ] arg_6 = np . sum ( arg_5 ) arg_7 = arg_5 / arg_6 arg_8 = np . sum ( arg_7 * arg_0 [ arg_4 ] , 0 ) arg_9 = len ( arg_0 ) - np . sum ( arg_4 ) if arg_9 == 0 : arg_10 = arg_8 elif arg_9 == len ( arg_0 ) : return arg_2 else : arg_11 = ( arg_8 - arg_2 ) * arg_6 arg_12 = np . linalg . norm ( arg_11 ) arg_13 = 0 if arg_12 == 0 else arg_9 / arg_12 arg_10 = max ( 0 , 1 - arg_13 ) * arg_8 + min ( 1 , arg_13 ) * arg_2 if scipy . spatial . distance . euclidean ( arg_2 , arg_10 ) < arg_1 : return arg_10 arg_2 = arg_10

def Func(arg_0, arg_1=1e-5):
    """
    Estimate the geometric median of points in 2D.

    Code from https://stackoverflow.com/a/30305181

    Parameters
    ----------
    X : (N,2) ndarray
        Points in 2D. Second axis must be given in xy-form.

    eps : float, optional
        Distance threshold when to return the median.

    Returns
    -------
    (2,) ndarray
        Geometric median as xy-coordinate.

    """
    arg_2 = np.mean(arg_0, 0)

    while True:
        arg_3 = scipy.spatial.distance.cdist(arg_0, [arg_2])
        arg_4 = (arg_3 != 0)[:, 0]

        arg_5 = 1 / arg_3[arg_4]
        arg_6 = np.sum(arg_5)
        arg_7 = arg_5 / arg_6
        arg_8 = np.sum(arg_7 * arg_0[arg_4], 0)

        arg_9 = len(arg_0) - np.sum(arg_4)
        if arg_9 == 0:
            arg_10 = arg_8
        elif arg_9 == len(arg_0):
            return arg_2
        else:
            arg_11 = (arg_8 - arg_2) * arg_6
            arg_12 = np.linalg.norm(arg_11)
            arg_13 = 0 if arg_12 == 0 else arg_9/arg_12
            arg_10 = max(0, 1-arg_13)*arg_8 + min(1, arg_13)*arg_2

        if scipy.spatial.distance.euclidean(arg_2, arg_10) < arg_1:
            return arg_10

        arg_2 = arg_10

Estimate the geometric median of points in 2D .


(parser, section, option, rename_func, make_dirs=True)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = True ) : arg_5 = arg_0 . get ( arg_1 , arg_2 , raw = True ) arg_6 = get_strings ( arg_5 ) arg_7 = False for arg_8 in arg_6 : arg_9 = any ( x in arg_8 for x in FILENAME_INDICATORS ) if arg_9 : arg_10 = arg_3 ( arg_8 ) if arg_4 : try_make_dirs ( arg_10 ) arg_11 = arg_8 . replace ( '\\' , '\\\\' ) arg_12 = arg_10 . replace ( '\\' , '\\\\' ) arg_5 = arg_5 . replace ( arg_11 , arg_12 ) arg_7 = True if arg_7 : arg_0 . set ( arg_1 , arg_2 , arg_5 )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=True):
        """ Searches for parser settings that define filenames.

        If such settings are found, they are renamed according to the wildcard
        rules. Moreover, it is also tried to create the corresponding folders.

        :param parser:  A config parser
        :param section: A config section
        :param option: The section option
        :param rename_func: A function to rename found files
        :param make_dirs: If the directories of the file should be created.

        """
        arg_5 = arg_0.get(arg_1, arg_2, raw=True)
        arg_6 = get_strings(arg_5)
        arg_7 = False
        for arg_8 in arg_6:
            arg_9 = any(x in arg_8 for x in FILENAME_INDICATORS)
            if arg_9:
                arg_10 = arg_3(arg_8)
                if arg_4:
                    try_make_dirs(arg_10)
                # To work with windows path specifications we need this replacement:
                arg_11 = arg_8.replace('\\', '\\\\')
                arg_12 = arg_10.replace('\\', '\\\\')
                arg_5 = arg_5.replace(arg_11, arg_12)
                arg_7 = True
        if arg_7:
            arg_0.set(arg_1, arg_2, arg_5)

Searches for parser settings that define filenames .


return tags, local_endpoint, remote_endpoint

def Func(arg_0, arg_1):
        """Accepts a thrift decoded binary annotation and converts it
        to a v1 binary annotation.
        """
        arg_2 = {}
        arg_3 = None
        arg_4 = None

        for arg_5 in arg_1:
            if arg_5.key == 'sa':
                arg_4 = arg_0._convert_from_thrift_endpoint(
                    thrift_endpoint=arg_5.host,
                )
            else:
                arg_6 = arg_5.key

                arg_7 = arg_5.annotation_type
                arg_8 = arg_5.value

                if arg_7 == zipkin_core.AnnotationType.BOOL:
                    arg_2[arg_6] = "true" if arg_8 == 1 else "false"
                elif arg_7 == zipkin_core.AnnotationType.STRING:
                    arg_2[arg_6] = str(arg_8)
                else:
                    log.warning('Only STRING and BOOL binary annotations are '
                                'supported right now and can be properly decoded.')

                if arg_5.host:
                    arg_3 = arg_0._convert_from_thrift_endpoint(
                        thrift_endpoint=arg_5.host,
                    )

        return arg_2, arg_3, arg_4

Accepts a thrift decoded binary annotation and converts it to a v1 binary annotation .


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
arg_4
=
arg_5
=
if
arg_2
:
arg_4
=
rhea
.
read
(
arg_2
)
if
arg_3
:
arg_0
.
invoke
(
upload
,
sync
=
False
)
arg_5
=
True
arg_6
,
arg_7
,
arg_8
=
get_job_or_local
(
arg_0
.
obj
.
get
(
'project'
)
,
arg_0
.
obj
.
get
(
'job'
)
)
try
:
if
arg_1
:
arg_9
=
PolyaxonClient
(
)
.
job
.
copy
(
arg_6
,
arg_7
,
arg_8
,
arg_4
=
arg_4
,
arg_5
=
arg_5
)
else
:
arg_9
=
PolyaxonClient
(
)
.
job
.
Func
(
arg_6
,
arg_7
,
arg_8
,
arg_4
=
arg_4
,
arg_5
=
arg_5
)
except
(
PolyaxonHTTPError
,
PolyaxonShouldExitError
,
PolyaxonClientException
)
as
e
:
Printer
.
print_error
(
'Could not Func job `{}`.'
.
format
(
arg_8
)
)
Printer
.
print_error
(
'Error message `{}`.'
.
format
(
e
)
)
sys
.
exit
(
1
)
get_job_details
(
arg_9
)

def Func(arg_0, arg_1, arg_2, arg_3):  # pylint:disable=redefined-builtin
    """Restart job.

    Uses [Caching](/references/polyaxon-cli/#caching)

    Examples:

    \b
    ```bash
    $ polyaxon job --job=1 Func
    ```
    """
    arg_4 = None
    arg_5 = None
    if arg_2:
        arg_4 = rhea.read(arg_2)

    # Check if we need to upload
    if arg_3:
        arg_0.invoke(upload, sync=False)
        arg_5 = True

    arg_6, arg_7, arg_8 = get_job_or_local(arg_0.obj.get('project'), arg_0.obj.get('job'))
    try:
        if arg_1:
            arg_9 = PolyaxonClient().job.copy(
                arg_6, arg_7, arg_8, arg_4=arg_4, arg_5=arg_5)
        else:
            arg_9 = PolyaxonClient().job.Func(
                arg_6, arg_7, arg_8, arg_4=arg_4, arg_5=arg_5)
    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
        Printer.print_error('Could not Func job `{}`.'.format(arg_8))
        Printer.print_error('Error message `{}`.'.format(e))
        sys.exit(1)

    get_job_details(arg_9)

Restart job.

    Uses [Caching](/references/polyaxon-cli/#caching)

    Examples:

    \b
    ```bash
    $ polyaxon job --job=1 restart
    ```


return zip(enrichment_scores, nEnrichmentScores, enrichmentPVals, fdrs)

def Func(arg_0, arg_1):
    """Compute nominal pvals, normalized ES, and FDR q value.

        For a given NES(S) = NES* >= 0. The FDR is the ratio of the percentage of all (S,pi) with
        NES(S,pi) >= 0, whose NES(S,pi) >= NES*, divided by the percentage of
        observed S wih NES(S) >= 0, whose NES(S) >= NES*, and similarly if NES(S) = NES* <= 0.
    """
    # For a zero by zero division (undetermined, results in a NaN),
    np.seterr(divide='ignore', invalid='ignore')
    # import warnings
    # warnings.simplefilter("ignore")
    arg_2 = np.array(arg_0)
    arg_3 = np.array(arg_1)
    logging.debug("Start to compute pvals..................................")
    # compute pvals.
    arg_4 = gsea_pval(arg_2, arg_3).tolist()

    logging.debug("Compute nes and nesnull.................................")
    # nEnrichmentScores, nEnrichmentNulls = normalize(es, esnull)

    # new normalized enrichment score implementation.
    # this could speed up significantly.
    arg_5 = (arg_3*(arg_3>=0)).mean(axis=1)
    arg_6 = (arg_3*(arg_3<0)).mean(axis=1)
    arg_7  = np.where(arg_2>=0, arg_2/arg_5, -arg_2/arg_6)
    arg_8 = np.where(arg_3>=0, arg_3/arg_5[:,np.newaxis],
                                          -arg_3/arg_6[:,np.newaxis])

    logging.debug("start to compute fdrs..................................")

    # FDR null distribution histogram
    # create a histogram of all NES(S,pi) over all S and pi
    # Use this null distribution to compute an FDR q value,
    # vals = reduce(lambda x,y: x+y, nEnrichmentNulls, [])
    # nvals = np.array(sorted(vals))
    # or
    arg_9 = np.sort(arg_8.flatten())
    arg_10 = np.sort(arg_7)
    arg_11 = []
    # FDR computation
    for arg_12 in range(len(arg_0)):
        arg_13 = arg_7[arg_12]
        # use the same pval method to calculate fdr
        if arg_13 >= 0:
            arg_14 = int(len(arg_9) - np.searchsorted(arg_9, 0, side="left"))
            arg_15 = int(len(arg_9) - np.searchsorted(arg_9, arg_13, side="left"))
            arg_16 = len(arg_10) - int(np.searchsorted(arg_10, 0, side="left"))
            arg_17 = len(arg_10) - int(np.searchsorted(arg_10, arg_13, side="left"))
            # allPos = (nvals >= 0).sum()
            # allHigherAndPos = (nvals >= nes).sum()
            # nesPos = (nnes >=0).sum()
            # nesHigherAndPos = (nnes >= nes).sum()
        else:
            arg_14 = int(np.searchsorted(arg_9, 0, side="left"))
            arg_15 = int(np.searchsorted(arg_9, arg_13, side="right"))
            arg_16 = int(np.searchsorted(arg_10, 0, side="left"))
            arg_17 = int(np.searchsorted(arg_10, arg_13, side="right"))
            # allPos = (nvals < 0).sum()
            # allHigherAndPos = (nvals < nes).sum()
            # nesPos = (nnes < 0).sum()
            # nesHigherAndPos = (nnes < nes).sum()

        try:
            arg_18 = arg_15/float(arg_14)
            arg_19 = arg_17/float(arg_16)
            arg_20 =  arg_18 / arg_19
            arg_11.append(arg_20 if arg_20 < 1 else 1.0)
        except:
            arg_11.append(1000000000.0)

    logging.debug("Statistical testing finished.............................")

    return zip(arg_0, arg_7, arg_4, arg_11)

Compute nominal pvals normalized ES and FDR q value .


(self, amount, currency, new_currency='EUR', date=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
'EUR'
,
arg_4
=
)
:
for
arg_5
in
arg_2
,
arg_3
:
if
arg_5
not
in
arg_0
.
currencies
:
raise
ValueError
(
'{0} is not a supported currency'
.
format
(
arg_5
)
)
if
arg_4
is
:
arg_4
=
arg_0
.
bounds
[
arg_2
]
.
last_date
else
:
try
:
arg_4
=
arg_4
.
date
(
)
except
AttributeError
:
pass
arg_6
=
arg_0
.
_get_rate
(
arg_2
,
arg_4
)
arg_7
=
arg_0
.
_get_rate
(
arg_3
,
arg_4
)
return
float
(
arg_1
)
/
arg_6
*
arg_7

def Func(arg_0, arg_1, arg_2, arg_3='EUR', arg_4=None):
        """Convert amount from a currency to another one.

        :param float amount: The amount of `currency` to Func.
        :param str currency: The currency to Func from.
        :param str new_currency: The currency to Func to.
        :param datetime.date date: Use the conversion rate of this date. If this
            is not given, the most recent rate is used.

        :return: The value of `amount` in `new_currency`.
        :rtype: float

        >>> from datetime import date
        >>> c = CurrencyConverter()
        >>> c.Func(100, 'EUR', 'USD', date=date(2014, 3, 28))
        137.5...
        >>> c.Func(100, 'USD', date=date(2014, 3, 28))
        72.67...
        >>> c.Func(100, 'BGN', date=date(2010, 11, 21))
        Traceback (most recent call last):
        RateNotFoundError: BGN has no rate for 2010-11-21
        """
        for arg_5 in arg_2, arg_3:
            if arg_5 not in arg_0.currencies:
                raise ValueError('{0} is not a supported currency'.format(arg_5))

        if arg_4 is None:
            arg_4 = arg_0.bounds[arg_2].last_date
        else:
            try:
                arg_4 = arg_4.date()  # fallback if input was a datetime object
            except AttributeError:
                pass

        arg_6 = arg_0._get_rate(arg_2, arg_4)
        arg_7 = arg_0._get_rate(arg_3, arg_4)

        return float(arg_1) / arg_6 * arg_7

Convert amount from a currency to another one.

        :param float amount: The amount of `currency` to convert.
        :param str currency: The currency to convert from.
        :param str new_currency: The currency to convert to.
        :param datetime.date date: Use the conversion rate of this date. If this
            is not given, the most recent rate is used.

        :return: The value of `amount` in `new_currency`.
        :rtype: float

        >>> from datetime import date
        >>> c = CurrencyConverter()
        >>> c.convert(100, 'EUR', 'USD', date=date(2014, 3, 28))
        137.5...
        >>> c.convert(100, 'USD', date=date(2014, 3, 28))
        72.67...
        >>> c.convert(100, 'BGN', date=date(2010, 11, 21))
        Traceback (most recent call last):
        RateNotFoundError: BGN has no rate for 2010-11-21

Convert amount from a currency to another one .


return mir_eval.beat.information_gain(ann_times, est_times, bins=bins)

def Func(arg_0, arg_1, arg_2, arg_3):
    """Computes the information gain of the est_file from the annotated
    intervals and the estimated intervals."""
    arg_4 = utils.intervals_to_times(arg_0)
    arg_5 = utils.intervals_to_times(arg_1)
    return mir_eval.beat.information_gain(arg_4, arg_5, arg_3=arg_3)

Computes the information gain of the est_file from the annotated intervals and the estimated intervals .


def Func ( arg_0 ) : if isinstance ( arg_0 , bytes ) : return arg_0 elif isinstance ( arg_0 , str ) : return arg_0 . encode ( 'ascii' ) else : raise TypeError ( arg_0 )

def Func(arg_0):
    """
    Coerce strings to hashable bytes.
    """
    if isinstance(arg_0, bytes):
        return arg_0
    elif isinstance(arg_0, str):
        return arg_0.encode('ascii')  # Fail on anything non-ASCII.
    else:
        raise TypeError(arg_0)


Returns a minimal Decor with a random colour.

return cls({'colour': colour, 'component': component, 'width': 1.0})

def Func ( arg_0 , arg_1 ) : arg_2 = Func . sample ( [ i for i in range ( 256 ) ] , 3 ) return arg_0 ( { 'colour' : arg_2 , 'component' : arg_1 , 'width' : 1.0 } )

def Func(arg_0, arg_1):
        """
        Returns a minimal Decor with a Func colour.
        """
        arg_2 = Func.sample([i for i in range(256)], 3)
        return arg_0({'colour': arg_2, 'component': arg_1, 'width': 1.0})

Returns a minimal Decor with a random colour .


def
Func
(
arg_0
)
:
LOG
.
info
(
"Parsing transcripts"
)
if
isinstance
(
arg_0
,
DataFrame
)
:
arg_1
=
parse_ensembl_transcript_request
(
arg_0
)
else
:
arg_1
=
parse_ensembl_transcripts
(
arg_0
)
arg_2
=
{
}
for
arg_3
in
arg_1
:
arg_4
=
arg_3
[
'ensembl_transcript_id'
]
arg_5
=
arg_3
[
'ensembl_gene_id'
]
if
not
arg_4
in
arg_2
:
arg_6
=
{
'chrom'
:
arg_3
[
'chrom'
]
,
'transcript_start'
:
arg_3
[
'transcript_start'
]
,
'transcript_end'
:
arg_3
[
'transcript_end'
]
,
'mrna'
:
set
(
)
,
'mrna_predicted'
:
set
(
)
,
'nc_rna'
:
set
(
)
,
'ensembl_gene_id'
:
arg_5
,
'ensembl_transcript_id'
:
arg_4
,
}
arg_2
[
arg_4
]
=
arg_6
arg_6
=
arg_2
[
arg_4
]
if
arg_3
.
get
(
'refseq_mrna_predicted'
)
:
arg_6
[
'mrna_predicted'
]
.
add
(
arg_3
[
'refseq_mrna_predicted'
]
)
if
arg_3
.
get
(
'refseq_mrna'
)
:
arg_6
[
'mrna'
]
.
add
(
arg_3
[
'refseq_mrna'
]
)
if
arg_3
.
get
(
'refseq_ncrna'
)
:
arg_6
[
'nc_rna'
]
.
add
(
arg_3
[
'refseq_ncrna'
]
)
return
arg_2

def Func(arg_0):
    """Parse and massage the transcript information

    There could be multiple lines with information about the same transcript.
    This is why it is necessary to parse the transcripts first and then return a dictionary
    where all information has been merged.

    Args:
        transcript_lines(): This could be an iterable with strings or a pandas.DataFrame

    Returns:
        parsed_transcripts(dict): Map from enstid -> transcript info
    """
    LOG.info("Parsing transcripts")
    # Parse the transcripts, we need to check if it is a request or a file handle
    if isinstance(arg_0, DataFrame):
        arg_1 = parse_ensembl_transcript_request(arg_0)
    else:
        arg_1 = parse_ensembl_transcripts(arg_0)

    # Since there can be multiple lines with information about the same transcript
    # we store transcript information in a dictionary for now
    arg_2 = {}
    # Loop over the parsed transcripts
    for arg_3 in arg_1:
        arg_4 = arg_3['ensembl_transcript_id']
        arg_5 = arg_3['ensembl_gene_id']

        # Check if the transcript has been added
        # If not, create a new transcript
        if not arg_4 in arg_2:
            arg_6 = {
                'chrom': arg_3['chrom'],
                'transcript_start': arg_3['transcript_start'],
                'transcript_end': arg_3['transcript_end'],
                'mrna': set(),
                'mrna_predicted': set(),
                'nc_rna': set(),
                'ensembl_gene_id': arg_5,
                'ensembl_transcript_id': arg_4,
            }
            arg_2[arg_4] = arg_6

        arg_6 = arg_2[arg_4]
        # Add the ref seq information
        if arg_3.get('refseq_mrna_predicted'):
            arg_6['mrna_predicted'].add(arg_3['refseq_mrna_predicted'])
        if arg_3.get('refseq_mrna'):
            arg_6['mrna'].add(arg_3['refseq_mrna'])
        if arg_3.get('refseq_ncrna'):
            arg_6['nc_rna'].add(arg_3['refseq_ncrna'])

    return arg_2


def Func(arg_0, arg_1):
        """Routine to close an hdf5 file

        The file is closed only when `closing=True`. `closing=True` means that
        the file was opened in the current highest recursion level. This prevents re-opening
        and closing of the file if `store` or `load` are called recursively.

        """
        if (not arg_0._keep_open and
                arg_1 and
                    arg_0.is_open):

            arg_2 = arg_0._hdf5file.fileno()
            arg_0._hdf5file.flush()
            try:
                os.fsync(arg_2)
                try:
                    arg_0._hdf5store.flush(fsync=True)
                except TypeError:
                    arg_2 = arg_0._hdf5store._handle.fileno()
                    arg_0._hdf5store.flush()
                    os.fsync(arg_2)
            except OSError as exc:
                # This seems to be the only way to avoid an OSError under Windows
                arg_3 = ('Encountered OSError while flushing file.'
                                   'If you are using Windows, don`t worry! '
                                   'I will ignore the error and try to close the file. '
                                   'Original error: %s' % repr(exc))
                arg_0._logger.debug(arg_3)

            arg_0._hdf5store.close()
            if arg_0._hdf5file.isopen:
                arg_0._logger.error('Could not close HDF5 file!')
            arg_0._hdf5file = None
            arg_0._hdf5store = None
            arg_0._trajectory_group = None
            arg_0._trajectory_name = None
            arg_0._trajectory_index = None
            arg_0._overview_group_ = None
            arg_0._logger.debug('Closing HDF5 file')
            return True
        else:
            return False


def Func(*arg_0):
    """ Merges multiple las files into one

    merged = Func(las_1, las_2)
    merged = Func([las_1, las_2, las_3])

    Parameters
    ----------
    las_files: Iterable of LasData or LasData

    Returns
    -------
    pylas.lasdatas.base.LasBase
        The result of the merging

    """
    if len(arg_0) == 1:
        arg_0 = arg_0[0]

    if not arg_0:
        raise ValueError("No files to merge")

    if not utils.files_have_same_dtype(arg_0):
        raise ValueError("All files must have the same point format")

    arg_1 = arg_0[0].header
    arg_2 = sum(len(arg_12.points) for arg_12 in arg_0)

    # scaled x, y, z have to be set manually
    # to be sure to have a good offset in the header
    arg_3 = create_from_header(arg_1)
    # TODO extra dimensions should be manged better here

    for arg_4, arg_5 in arg_0[0].points_data.point_format.extra_dims:
        arg_3.add_extra_dim(arg_4, arg_5)

    arg_3.points = np.zeros(arg_2, arg_3.points.dtype)
    arg_7 = np.zeros(arg_2, np.float64)
    arg_8 = np.zeros(arg_2, np.float64)
    arg_9 = np.zeros(arg_2, np.float64)

    arg_10 = 0
    for arg_11, arg_12 in enumerate(arg_0, start=1):
        arg_13 = slice(arg_10, arg_10 + len(arg_12.points))
        arg_3.points[arg_13] = arg_12.points
        arg_7[arg_13] = arg_12.x
        arg_8[arg_13] = arg_12.y
        arg_9[arg_13] = arg_12.z
        arg_3['point_source_id'][arg_13] = arg_11
        arg_10 += len(arg_12.points)

    arg_3.x = arg_7
    arg_3.y = arg_8
    arg_3.z = arg_9

    return arg_3

Merges multiple las files into one

    merged = merge_las(las_1, las_2)
    merged = merge_las([las_1, las_2, las_3])

    Parameters
    ----------
    las_files: Iterable of LasData or LasData

    Returns
    -------
    pylas.lasdatas.base.LasBase
        The result of the merging


def Func ( arg_0 ) : global SUPPORTED_RECORDS arg_1 = arg_0 . split ( "\n" ) arg_2 = [ ] for arg_3 in arg_1 : arg_4 = tokenize_line ( arg_3 ) if len ( arg_4 ) == 0 : continue if arg_4 [ 0 ] in SUPPORTED_RECORDS and not arg_4 [ 0 ] . startswith ( "$" ) : arg_4 = [ '@' ] + arg_4 arg_2 . append ( serialize ( arg_4 ) ) return "\n" . join ( arg_2 )

def Func(arg_0):
    """
    Go through each line of the text and ensure that
    a name is defined.  Use '@' if there is none.
    """
    global SUPPORTED_RECORDS

    arg_1 = arg_0.split("\n")
    arg_2 = []
    for arg_3 in arg_1:
        arg_4 = tokenize_line(arg_3)
        if len(arg_4) == 0:
            continue

        if arg_4[0] in SUPPORTED_RECORDS and not arg_4[0].startswith("$"):
            # add back the name
            arg_4 = ['@'] + arg_4

        arg_2.append(serialize(arg_4))

    return "\n".join(arg_2)

Go through each line of the text and ensure that a name is defined . Use


def Func(arg_0, arg_1, arg_2):
        """
        Click item.

        @param window_name: Window name to look for, either full name,
        LDTP's name convention, or a Unix glob.
        @type window_name: string
        @param object_name: Object name to look for, either full name,
        LDTP's name convention, or a Unix glob.
        @type object_name: string

        @return: 1 on success.
        @rtype: integer
        """
        arg_3 = arg_0._get_object_handle(arg_1, arg_2)
        if not arg_3.AXEnabled:
            raise LdtpServerException(u"Object %s state disabled" % arg_2)
        arg_4 = arg_0._getobjectsize(arg_3)
        arg_0._grabfocus(arg_3)
        arg_0.wait(0.5)

        # If object doesn't support Press, trying Funcing with the object
        # coordinates, where size=(x, y, width, height)
        # Func on center of the widget
        # Noticed this issue on Funcing AXImage
        # Func('Instruments*', 'Automation')
        arg_0.generatemouseevent(arg_4[0] + arg_4[2] / 2, arg_4[1] + arg_4[3] / 2, "b1c")
        return 1


def Func ( arg_0 ) : arg_1 = set ( ) for arg_2 in arg_0 [ 'apps' ] . values ( ) : for arg_3 in arg_2 [ 'depends' ] [ 'libs' ] : arg_1 . add ( arg_3 ) return arg_1

def Func(arg_0):
    """
    Returns all libs that are referenced in specs.apps.depends.libs
    """
    arg_1 = set()
    for arg_2 in arg_0['apps'].values():
        for arg_3 in arg_2['depends']['libs']:
            arg_1.add(arg_3)
    return arg_1

Returns all libs that are referenced in specs . apps . depends . libs


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . material . get_compound_index ( arg_1 ) return stoich . amount ( arg_1 , arg_0 . _compound_mfrs [ arg_2 ] )

def Func(arg_0, arg_1):
        """
        Determine the amount flow rate of the specified compound.

        :returns: Amount flow rate. [kmol/h]
        """

        arg_2 = arg_0.material.get_compound_index(arg_1)
        return stoich.amount(arg_1, arg_0._compound_mfrs[arg_2])

Determine the amount flow rate of the specified compound .


def Func ( arg_0 ) : arg_1 = io . BytesIO ( ) arg_0 . _store ( arg_1 ) arg_1 . seek ( 0 ) return arg_1

def Func(arg_0):
		"""
		Return a zipped package as a readable stream
		"""
		arg_1 = io.BytesIO()
		arg_0._store(arg_1)
		arg_1.seek(0)
		return arg_1


def Func ( arg_0 ) : arg_0 = arg_0 . strip ( ) if len ( arg_0 ) == 0 : return None , set ( ) for arg_1 , arg_2 in replacements : if arg_1 in arg_0 : arg_0 = arg_0 . replace ( arg_1 , arg_2 ) arg_3 = keyword_re . sub ( "__cobra_escape__" , arg_0 ) arg_3 = number_start_re . sub ( "__cobra_escape__" , arg_3 ) arg_4 = ast_parse ( arg_3 , "<string>" , "eval" ) arg_5 = GPRCleaner ( ) arg_5 . visit ( arg_4 ) eval_gpr ( arg_4 , set ( ) ) return arg_4 , arg_5 . gene_set

def Func(arg_0):
    """parse gpr into AST

    Parameters
    ----------
    str_expr : string
        string with the gene reaction rule to parse

    Returns
    -------
    tuple
        elements ast_tree and gene_ids as a set
    """
    arg_0 = arg_0.strip()
    if len(arg_0) == 0:
        return None, set()
    for arg_1, arg_2 in replacements:
        if arg_1 in arg_0:
            arg_0 = arg_0.replace(arg_1, arg_2)
    arg_3 = keyword_re.sub("__cobra_escape__", arg_0)
    arg_3 = number_start_re.sub("__cobra_escape__", arg_3)
    arg_4 = ast_parse(arg_3, "<string>", "eval")
    arg_5 = GPRCleaner()
    arg_5.visit(arg_4)
    eval_gpr(arg_4, set())  # ensure the rule can be evaluated
    return arg_4, arg_5.gene_set


def Func ( arg_0 ) : try : arg_1 = _pybossa_req ( 'get' , 'project' , arg_0 ) if arg_1 . get ( 'id' ) : return Project ( arg_1 ) else : return arg_1 except : raise

def Func(arg_0):
    """Return a PYBOSSA Project for the project_id.

    :param project_id: PYBOSSA Project ID
    :type project_id: integer
    :rtype: PYBOSSA Project
    :returns: A PYBOSSA Project object

    """
    try:
        arg_1 = _pybossa_req('get', 'project', arg_0)
        if arg_1.get('id'):
            return Project(arg_1)
        else:
            return arg_1
    except:  # pragma: no cover
        raise

Return a PYBOSSA Project for the project_id .


def Func(arg_0, arg_1):
        "make several copies of the background bitmap"
        arg_2 = arg_0.wx_obj.GetClientSize()
        arg_3 = arg_0._bitmap.get_bits()
        arg_4 = arg_3.GetWidth()
        arg_5 = arg_3.GetHeight()

        if isinstance(arg_0, wx.ScrolledWindow):
            # adjust for scrolled position
            arg_6, arg_7 = arg_0.wx_obj.GetScrollPixelsPerUnit()
            arg_8, arg_9 = arg_0.wx_obj.GetViewStart()
            arg_10,  arg_11  = (arg_6 * arg_8) % arg_4, (arg_7 * arg_9) % arg_5
        else:
            arg_10, arg_11 = (arg_4, arg_5)

        arg_12 = -arg_10
        while arg_12 < arg_2.width:
            arg_13 = -arg_11
            while arg_13 < arg_2.height:
                arg_1.DrawBitmap(arg_3, arg_12, arg_13)
                arg_13 = arg_13 + arg_5
            arg_12 = arg_12 + arg_4


def Func(arg_0, arg_1=None):
        "The dictionary of arguments to give to FLANN."
        arg_2 = {'cores': arg_0._n_jobs}
        if arg_0.flann_algorithm == 'auto':
            if arg_1 is None or arg_1.dim > 5:
                arg_2['algorithm'] = 'linear'
            else:
                arg_2['algorithm'] = 'kdtree_single'
        else:
            arg_2['algorithm'] = arg_0.flann_algorithm
        if arg_0.flann_args:
            arg_2.update(arg_0.flann_args)

        # check that arguments are correct
        try:
            FLANNParameters().update(arg_2)
        except AttributeError as e:
            arg_3 = "flann_args contains an invalid argument:\n  {}"
            raise TypeError(arg_3.format(e))

        return arg_2

The dictionary of arguments to give to FLANN .


def Func ( arg_0 , arg_1 ) : arg_1 = bytearray ( "{}\n" . format ( arg_1 ) . encode ( ) ) arg_0 . _prepare_batches_for_storage ( len ( arg_1 ) ) arg_0 . _batches [ - 1 ] . extend ( arg_1 )

def Func(arg_0, arg_1):
        # type: (str) -> None
        """Override parent by buffering the metric instead of sending now"""

        arg_1 = bytearray("{}\n".format(arg_1).encode())
        arg_0._prepare_batches_for_storage(len(arg_1))
        arg_0._batches[-1].extend(arg_1)


def Func(arg_0, arg_1):
        """
        Issue a certificate for the given domain.
        """
        def errback(arg_2):
            # Don't fail on some of the errors we could get from the ACME
            # server, rather just log an error so that we can continue with
            # other domains.
            arg_2.trap(txacme_ServerError)
            arg_3 = arg_2.value.message

            if arg_3.code in ['rateLimited', 'serverInternal',
                                   'connection', 'unknownHost']:
                # TODO: Fire off an error to Sentry or something?
                arg_0.log.error(
                    'Error ({code}) issuing certificate for "{domain}": '
                    '{detail}', code=arg_3.code, arg_1=arg_1,
                    detail=arg_3.detail)
            else:
                # There are more error codes but if they happen then something
                # serious has gone wrong-- carry on error-ing.
                return arg_2

        arg_4 = arg_0.txacme_service.issue_cert(arg_1)
        return arg_4.addErrback(errback)

Issue a certificate for the given domain .


write will write a message to a stream,
        first checking the encoding

def Func ( arg_0 , arg_1 , arg_2 ) : if isinstance ( arg_2 , bytes ) : arg_2 = arg_2 . decode ( 'utf-8' ) arg_1 . Func ( arg_2 )

def Func(arg_0, arg_1, arg_2):
        '''Func will Func a message to a stream,
        first checking the encoding
        '''
        if isinstance(arg_2, bytes):
            arg_2 = arg_2.decode('utf-8')
        arg_1.Func(arg_2)

write will write a message to a stream first checking the encoding


def Func ( arg_0 ) : try : arg_1 = os . stat ( arg_0 ) . st_mtime_ns except OSError : time . sleep ( 1 ) arg_1 = os . stat ( arg_0 ) . st_mtime_ns return arg_1

def Func(arg_0):
        """
        Find the time this file was last modified.

        :param fname: File name
        :return: The last time the file was modified.
        """
        try:
            arg_1 = os.stat(arg_0).st_mtime_ns
        except OSError:
            # The file might be right in the middle of being written
            # so sleep
            time.sleep(1)
            arg_1 = os.stat(arg_0).st_mtime_ns

        return arg_1

Find the time this file was last modified .


def Func(arg_0):
        """Return list of triples describing matching subsequences.

        Each triple is of the form (i, j, n), and means that
        a[i:i+n] == b[j:j+n].  The triples are monotonically increasing in
        i and in j.  New in Python 2.5, it's also guaranteed that if
        (i, j, n) and (i', j', n') are adjacent triples in the list, and
        the second is not the last triple in the list, then i+n != i' or
        j+n != j'.  IOW, adjacent triples never describe adjacent equal
        blocks.

        The last triple is a dummy, (len(a), len(b), 0), and is the only
        triple with n==0.

        >>> s = SequenceMatcher(None, "abxcd", "abcd")
        >>> s.Func()
        [Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]
        """

        if arg_0.matching_blocks is not None:
            return arg_0.matching_blocks
        arg_1, arg_2 = len(arg_0.a), len(arg_0.b)

        # This is most naturally expressed as a recursive algorithm, but
        # at least one user bumped into extreme use cases that exceeded
        # the recursion limit on their box.  So, now we maintain a list
        # ('queue`) of blocks we still need to look at, and append partial
        # results to `matching_blocks` in a loop; the matches are sorted
        # at the end.
        arg_3 = [(0, arg_1, 0, arg_2)]
        arg_4 = []
        while arg_3:
            arg_5, arg_6, arg_7, arg_8 = arg_3.pop()
            arg_9, arg_10, arg_11 = x = arg_0.find_longest_match(arg_5, arg_6, arg_7, arg_8)
            # a[alo:i] vs b[blo:j] unknown
            # a[i:i+k] same as b[j:j+k]
            # a[i+k:ahi] vs b[j+k:bhi] unknown
            if arg_11:   # if k is 0, there was no matching block
                arg_4.append(x)
                if arg_5 < arg_9 and arg_7 < arg_10:
                    arg_3.append((arg_5, arg_9, arg_7, arg_10))
                if arg_9+arg_11 < arg_6 and arg_10+arg_11 < arg_8:
                    arg_3.append((arg_9+arg_11, arg_6, arg_10+arg_11, arg_8))
        arg_4.sort()

        # It's possible that we have adjacent equal blocks in the
        # matching_blocks list now.  Starting with 2.5, this code was added
        # to collapse them.
        arg_12 = arg_17 = arg_18 = 0
        arg_13 = []
        for arg_14, arg_15, arg_16 in arg_4:
            # Is this block adjacent to i1, j1, k1?
            if arg_12 + arg_18 == arg_14 and arg_17 + arg_18 == arg_15:
                # Yes, so collapse them -- this just increases the length of
                # the first block by the length of the second, and the first
                # block so lengthened remains the block to compare against.
                arg_18 += arg_16
            else:
                # Not adjacent.  Remember the first block (k1==0 means it's
                # the dummy we started with), and make the second block the
                # new block to compare against.
                if arg_18:
                    arg_13.append((arg_12, arg_17, arg_18))
                arg_12, arg_17, arg_18 = arg_14, arg_15, arg_16
        if arg_18:
            arg_13.append((arg_12, arg_17, arg_18))

        arg_13.append( (arg_1, arg_2, 0) )
        arg_0.matching_blocks = map(Match._make, arg_13)
        return arg_0.matching_blocks

Return list of triples describing matching subsequences.

        Each triple is of the form (i, j, n), and means that
        a[i:i+n] == b[j:j+n].  The triples are monotonically increasing in
        i and in j.  New in Python 2.5, it's also guaranteed that if
        (i, j, n) and (i', j', n') are adjacent triples in the list, and
        the second is not the last triple in the list, then i+n != i' or
        j+n != j'.  IOW, adjacent triples never describe adjacent equal
        blocks.

        The last triple is a dummy, (len(a), len(b), 0), and is the only
        triple with n==0.

        >>> s = SequenceMatcher(None, "abxcd", "abcd")
        >>> s.get_matching_blocks()
        [Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]

Return list of triples describing matching subsequences .


(
    entries: Callable[[], Iterable[Tuple[Any, Any]]],
    start: str,
    end: str,
    meta=None,
    **kwargs,
)

def Func(
    arg_0: arg_1[[], arg_2[arg_3[arg_4, arg_4]]],
    arg_5: arg_6,
    arg_7: arg_6,
    arg_8=None,
    **arg_9,
) -> arg_6:
    """Produce a Lisp representation of an associative collection, bookended
    with the start and end string supplied. The entries argument must be a
    callable which will produce tuples of key-value pairs.

    The keyword arguments will be passed along to lrepr for the sequence
    elements."""
    arg_10 = arg_9["print_level"]
    if isinstance(arg_10, int) and arg_10 < 1:
        return SURPASSED_PRINT_LEVEL

    arg_9 = _process_kwargs(**arg_9)

    def entry_reprs():
        for arg_11, arg_12 in arg_0():
            yield "{k} {v}".format(arg_11=lrepr(arg_11, **arg_9), arg_12=lrepr(arg_12, **arg_9))

    arg_13 = []
    arg_14 = arg_9["print_dup"]
    arg_15 = arg_9["print_length"]
    if not arg_14 and isinstance(arg_15, int):
        arg_16 = seq(entry_reprs()).take(arg_15 + 1).to_list()
        if len(arg_16) > arg_15:
            arg_16.pop()
            arg_13.append(SURPASSED_PRINT_LENGTH)
    else:
        arg_16 = list(entry_reprs())

    arg_17 = PRINT_SEPARATOR.join(arg_16 + arg_13)

    arg_18 = arg_9["print_meta"]
    if arg_18 and arg_8:
        return f"^{lrepr(meta, **kwargs)} {start}{seq_lrepr}{end}"

    return f"{start}{seq_lrepr}{end}"

Produce a Lisp representation of an associative collection bookended with the start and end string supplied . The entries argument must be a callable which will produce tuples of key - value pairs .


return [self.child_node(problem, action)
                for action in problem.actions(self.state)]

def Func ( arg_0 , arg_1 ) : return [ arg_0 . child_node ( arg_1 , arg_2 ) for arg_2 in arg_1 . actions ( arg_0 . state ) ]

def Func(arg_0, arg_1):
        "List the nodes reachable in one step from this node."
        return [arg_0.child_node(arg_1, arg_2)
                for arg_2 in arg_1.actions(arg_0.state)]

List the nodes reachable in one step from this node .


def
Func
(
arg_0
)
:
arg_1
=
len
(
arg_0
.
session
.
buffer
)
arg_0
.
_put_cross_reference
(
)
arg_2
=
hashlib
.
md5
(
)
arg_2
.
update
(
datetime
.
now
(
)
.
strftime
(
'%Y%m%d%H%M%S'
)
)
try
:
arg_2
.
update
(
arg_0
.
filepath
)
except
TypeError
:
pass
if
arg_0
.
title
:
arg_2
.
update
(
arg_0
.
title
)
if
arg_0
.
subject
:
arg_2
.
update
(
arg_0
.
subject
)
if
arg_0
.
author
:
arg_2
.
update
(
arg_0
.
author
)
if
arg_0
.
keywords
:
arg_2
.
update
(
arg_0
.
keywords
)
if
arg_0
.
creator
:
arg_2
.
update
(
arg_0
.
creator
)
arg_3
=
len
(
arg_0
.
session
.
objects
)
arg_0
.
session
.
_out
(
'trailer'
)
arg_0
.
session
.
_out
(
'<<'
)
arg_0
.
session
.
_out
(
'/Size %s'
%
arg_3
)
arg_0
.
session
.
_out
(
'/Root %s 0 R'
%
(
arg_3
1
)
)
arg_0
.
session
.
_out
(
'/Info %s 0 R'
%
(
arg_3
2
)
)
arg_0
.
session
.
_out
(
'/ID [ <%s> <%s>]'
%
(
arg_2
.
hexdigest
(
)
,
arg_2
.
hexdigest
(
)
)
)
arg_0
.
session
.
_out
(
'>>'
)
arg_0
.
session
.
_out
(
'startxref'
)
arg_0
.
session
.
_out
(
arg_1
)
arg_0
.
session
.
_out
(
'%%EOF'
)

def Func(arg_0):
        """ Final Trailer calculations, and end-of-file
            reference.

        """
        arg_1 = len(arg_0.session.buffer)

        arg_0._put_cross_reference()

        arg_2 = hashlib.md5()
        arg_2.update(datetime.now().strftime('%Y%m%d%H%M%S'))
        try:
            arg_2.update(arg_0.filepath)
        except TypeError:
            pass
        if arg_0.title:
            arg_2.update(arg_0.title)
        if arg_0.subject:
            arg_2.update(arg_0.subject)
        if arg_0.author:
            arg_2.update(arg_0.author)
        if arg_0.keywords:
            arg_2.update(arg_0.keywords)
        if arg_0.creator:
            arg_2.update(arg_0.creator)

        arg_3 = len(arg_0.session.objects)
        arg_0.session._out('trailer')
        arg_0.session._out('<<')
        arg_0.session._out('/Size %s' % arg_3)
        arg_0.session._out('/Root %s 0 R' % (arg_3 - 1))
        arg_0.session._out('/Info %s 0 R' % (arg_3 - 2))
        arg_0.session._out('/ID [ <%s> <%s>]' % (arg_2.hexdigest(),arg_2.hexdigest()))
        arg_0.session._out('>>')
        arg_0.session._out('startxref')
        arg_0.session._out(arg_1)
        arg_0.session._out('%%EOF')

Final Trailer calculations and end - of - file reference .


def Func ( arg_0 ) : if arg_0 . webserver is not None : arg_0 . webserver . Func ( ) if not arg_0 . test_mode : arg_0 . plugins . save_state ( )

def Func(arg_0):
        """Does cleanup of bot and plugins."""
        if arg_0.webserver is not None:
            arg_0.webserver.Func()
        if not arg_0.test_mode:
            arg_0.plugins.save_state()


def Func ( arg_0 , arg_1 , arg_2 = { } ) : arg_3 = ADMINS_API . format ( arg_1 ) arg_4 = [ ] for arg_5 in arg_0 . _get_paged_resource ( arg_3 , arg_2 = arg_2 ) : arg_4 . append ( CanvasAdmin ( arg_5 = arg_5 ) ) return arg_4

def Func(arg_0, arg_1, arg_2={}):
        """
        Return a list of the admins in the account.

        https://canvas.instructure.com/doc/api/admins.html#method.admins.index
        """
        arg_3 = ADMINS_API.format(arg_1)

        arg_4 = []
        for arg_5 in arg_0._get_paged_resource(arg_3, arg_2=arg_2):
            arg_4.append(CanvasAdmin(arg_5=arg_5))
        return arg_4

Return a list of the admins in the account .