(self, queues=None, edge=None, edge_type=None, return_header=False)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=False):
        """Gets data from all the queues.

        If none of the parameters are given then data from every
        :class:`.QueueServer` is retrieved.

        Parameters
        ----------
        queues : int or an *array_like* of int, (optional)
            The edge index (or an iterable of edge indices) identifying
            the :class:`QueueServer(s)<.QueueServer>` whose data will
            be retrieved.
        edge : 2-tuple of int or *array_like* (optional)
            Explicitly specify which queues to retrieve data from. Must
            be either:

            * A 2-tuple of the edge's source and target vertex
              indices, or
            * An iterable of 2-tuples of the edge's source and
              target vertex indices.

        edge_type : int or an iterable of int (optional)
            A integer, or a collection of integers identifying which
            edge types to retrieve data from.
        return_header : bool (optonal, default: False)
            Determines whether the column headers are returned.

        Returns
        -------
        out : :class:`~numpy.ndarray`
            * 1st: The arrival time of an agent.
            * 2nd: The service start time of an agent.
            * 3rd: The departure time of an agent.
            * 4th: The length of the queue upon the agents arrival.
            * 5th: The total number of :class:`Agents<.Agent>` in the
              :class:`.QueueServer`.
            * 6th: The :class:`QueueServer's<.QueueServer>` edge index.

        out : str (optional)
            A comma seperated string of the column headers. Returns
            ``'arrival,service,departure,num_queued,num_total,q_id'```

        Examples
        --------
        Data is not collected by default. Before simulating, by sure to
        turn it on (as well as initialize the network). The following
        returns data from queues with ``edge_type`` 1 or 3:

        >>> import queueing_tool as qt
        >>> g = qt.generate_pagerank_graph(100, seed=13)
        >>> net = qt.QueueNetwork(g, seed=13)
        >>> net.start_collecting_data()
        >>> net.initialize(10)
        >>> net.simulate(2000)
        >>> data = net.Func(edge_type=(1, 3))

        To get data from an edge connecting two vertices do the
        following:

        >>> data = net.Func(edge=(1, 50))

        To get data from several edges do the following:

        >>> data = net.Func(edge=[(1, 50), (10, 91), (99, 99)])

        You can specify the edge indices as well:

        >>> data = net.Func(queues=(20, 14, 0, 4))
        """
        arg_1 = _get_queues(arg_0.g, arg_1, arg_2, arg_3)

        arg_5 = np.zeros((0, 6))
        for arg_6 in arg_1:
            arg_7 = arg_0.edge2queue[arg_6].fetch_data()

            if len(arg_7) > 0:
                arg_5 = np.vstack((arg_5, arg_7))

        if arg_4:
            return arg_5, 'arrival,service,departure,num_queued,num_total,q_id'

        return arg_5

Gets data from all the queues.

        If none of the parameters are given then data from every
        :class:`.QueueServer` is retrieved.

        Parameters
        ----------
        queues : int or an *array_like* of int, (optional)
            The edge index (or an iterable of edge indices) identifying
            the :class:`QueueServer(s)<.QueueServer>` whose data will
            be retrieved.
        edge : 2-tuple of int or *array_like* (optional)
            Explicitly specify which queues to retrieve data from. Must
            be either:

            * A 2-tuple of the edge's source and target vertex
              indices, or
            * An iterable of 2-tuples of the edge's source and
              target vertex indices.

        edge_type : int or an iterable of int (optional)
            A integer, or a collection of integers identifying which
            edge types to retrieve data from.
        return_header : bool (optonal, default: False)
            Determines whether the column headers are returned.

        Returns
        -------
        out : :class:`~numpy.ndarray`
            * 1st: The arrival time of an agent.
            * 2nd: The service start time of an agent.
            * 3rd: The departure time of an agent.
            * 4th: The length of the queue upon the agents arrival.
            * 5th: The total number of :class:`Agents<.Agent>` in the
              :class:`.QueueServer`.
            * 6th: The :class:`QueueServer's<.QueueServer>` edge index.

        out : str (optional)
            A comma seperated string of the column headers. Returns
            ``'arrival,service,departure,num_queued,num_total,q_id'```

        Examples
        --------
        Data is not collected by default. Before simulating, by sure to
        turn it on (as well as initialize the network). The following
        returns data from queues with ``edge_type`` 1 or 3:

        >>> import queueing_tool as qt
        >>> g = qt.generate_pagerank_graph(100, seed=13)
        >>> net = qt.QueueNetwork(g, seed=13)
        >>> net.start_collecting_data()
        >>> net.initialize(10)
        >>> net.simulate(2000)
        >>> data = net.get_queue_data(edge_type=(1, 3))

        To get data from an edge connecting two vertices do the
        following:

        >>> data = net.get_queue_data(edge=(1, 50))

        To get data from several edges do the following:

        >>> data = net.get_queue_data(edge=[(1, 50), (10, 91), (99, 99)])

        You can specify the edge indices as well:

        >>> data = net.get_queue_data(queues=(20, 14, 0, 4))


def Func ( arg_0 ) : if arg_0 . last_tag is TextElement : return 'text()[{count}]' . format ( count = arg_0 . text_index ( ) ) else : return '{tag}[{count}]' . format ( tag = arg_0 . last_tag , count = arg_0 . tags [ arg_0 . last_tag ] )

def Func(arg_0):
        '''Get an XPath fragment for this location.

        It is of the form ``tag[n]`` where `tag` is the most recent
        element added and n is its position.

        '''
        if arg_0.last_tag is TextElement:
            return 'text()[{count}]'.format(count=arg_0.text_index())
        else:
            return '{tag}[{count}]'.format(tag=arg_0.last_tag,
                                           count=arg_0.tags[arg_0.last_tag])

Get an XPath fragment for this location .


def Func ( arg_0 , arg_1 = None , ** arg_2 ) : arg_0 = arg_0 . lower ( ) if arg_0 not in arg_5 : if arg_0 in ( "dom" , "pulldom" ) : arg_3 = "%s.%s" % ( __name__ , arg_0 ) __import__ ( arg_3 ) arg_4 = sys . modules [ arg_3 ] arg_5 [ arg_0 ] = arg_4 . TreeWalker elif arg_0 == "genshi" : from . import genshistream arg_5 [ arg_0 ] = genshistream . TreeWalker elif arg_0 == "lxml" : from . import lxmletree arg_5 [ arg_0 ] = lxmletree . TreeWalker elif arg_0 == "etree" : from . import etree if arg_1 is None : arg_1 = default_etree return etree . getETreeModule ( arg_1 , ** arg_2 ) . TreeWalker return arg_5 . get ( arg_0 )

def Func(arg_0, arg_1=None, **arg_2):
    """Get a TreeWalker class for various types of tree with built-in support

    treeType - the name of the tree type required (case-insensitive). Supported
               values are:

                "dom" - The xml.dom.minidom DOM implementation
                "pulldom" - The xml.dom.pulldom event stream
                "etree" - A generic walker for tree implementations exposing an
                          elementtree-like interface (known to work with
                          ElementTree, cElementTree and lxml.etree).
                "lxml" - Optimized walker for lxml.etree
                "genshi" - a Genshi stream

    implementation - (Currently applies to the "etree" tree type only). A module
                      implementing the tree type e.g. xml.etree.ElementTree or
                      cElementTree."""

    arg_0 = arg_0.lower()
    if arg_0 not in arg_5:
        if arg_0 in ("dom", "pulldom"):
            arg_3 = "%s.%s" % (__name__, arg_0)
            __import__(arg_3)
            arg_4 = sys.modules[arg_3]
            arg_5[arg_0] = arg_4.TreeWalker
        elif arg_0 == "genshi":
            from . import genshistream
            arg_5[arg_0] = genshistream.TreeWalker
        elif arg_0 == "lxml":
            from . import lxmletree
            arg_5[arg_0] = lxmletree.TreeWalker
        elif arg_0 == "etree":
            from . import etree
            if arg_1 is None:
                arg_1 = default_etree
            # XXX: NEVER cache here, caching is done in the etree submodule
            return etree.getETreeModule(arg_1, **arg_2).TreeWalker
    return arg_5.get(arg_0)

Get a TreeWalker class for various types of tree with built - in support


def Func ( arg_0 , arg_1 , arg_2 = True ) : arg_0 . _name = arg_1 . rstrip ( ".db" ) from os import unlink if arg_2 : try : unlink ( arg_0 . _name + ".db" ) except : pass arg_0 . _con = sqlite . connect ( arg_0 . _name + ".db" ) arg_0 . _cur = arg_0 . _con . cursor ( )

def Func(arg_0, arg_1, arg_2=True):

        """Creates an SQLite database file.

        Creates an SQLite database with the given name.
        The .box file extension is added automatically.
        Overwrites any existing database by default.

        """

        arg_0._name = arg_1.rstrip(".db")
        from os import unlink
        if arg_2:
            try: unlink(arg_0._name + ".db")
            except: pass
        arg_0._con = sqlite.connect(arg_0._name + ".db")
        arg_0._cur = arg_0._con.cursor()

Creates an SQLite database file . Creates an SQLite database with the given name . The . box file extension is added automatically . Overwrites any existing database by default .


def Func ( arg_0 ) : arg_1 = Task . objects . get ( pk = arg_0 [ 'id' ] ) arg_1 . delete ( )

def Func(arg_0):
    """Internal ``KILL_TASK`` consumer to remove retired tasks"""
    arg_1 = Task.objects.get(pk=arg_0['id'])
    arg_1.delete()

Internal KILL_TASK consumer to remove retired tasks


def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
try
:
arg_3
=
decrypt
(
str
(
arg_1
)
,
settings
.
UNFRIENDLY_SECRET
,
settings
.
UNFRIENDLY_IV
,
checksum
=
settings
.
UNFRIENDLY_ENFORCE_CHECKSUM
)
except
(
CheckSumError
,
InvalidKeyError
)
:
return
HttpResponseNotFound
(
)
try
:
arg_3
=
arg_3
.
decode
(
'utf-8'
)
except
UnicodeDecodeError
:
return
HttpResponseNotFound
(
)
arg_4
=
urlparse
(
unquote
(
arg_3
)
)
arg_5
=
arg_4
.
path
arg_6
=
arg_4
.
query
try
:
arg_7
,
arg_8
,
arg_9
=
resolve
(
arg_5
)
except
Resolver404
:
return
HttpResponseNotFound
(
)
arg_10
=
arg_0
.
environ
.
copy
(
)
arg_10
[
'PATH_INFO'
]
=
arg_5
[
len
(
arg_10
[
'SCRIPT_NAME'
]
)
:
]
arg_10
[
'QUERY_STRING'
]
=
arg_6
arg_11
=
arg_0
.
__class__
(
arg_10
)
arg_12
=
set
(
dir
(
arg_0
)
)
set
(
dir
(
arg_11
)
)
while
arg_12
:
arg_13
=
arg_12
.
pop
(
)
arg_11
.
__setattr__
(
arg_13
,
arg_0
.
__getattribute__
(
arg_13
)
)
arg_11
.
META
[
'obfuscated'
]
=
True
arg_15
=
arg_7
(
arg_11
,
*
arg_8
,
**
arg_9
)
if
arg_2
and
not
arg_15
.
has_header
(
'Content-Disposition'
)
:
arg_15
[
'Content-Disposition'
]
=
'inline; filename=%s'
%
arg_2
return
arg_15

def Func(arg_0, arg_1, arg_2=None):
    """
    Deobfuscates the URL and returns HttpResponse from source view.
    SEO juice is mostly ignored as it is intended for display purposes only.
    """
    try:
        arg_3 = decrypt(str(arg_1),
                      settings.UNFRIENDLY_SECRET,
                      settings.UNFRIENDLY_IV,
                      checksum=settings.UNFRIENDLY_ENFORCE_CHECKSUM)
    except (CheckSumError, InvalidKeyError):
        return HttpResponseNotFound()

    try:
        arg_3 = arg_3.decode('utf-8')
    except UnicodeDecodeError:
        return HttpResponseNotFound()

    arg_4 = urlparse(unquote(arg_3))
    arg_5 = arg_4.path
    arg_6 = arg_4.query

    try:
        arg_7, arg_8, arg_9 = resolve(arg_5)
    except Resolver404:
        return HttpResponseNotFound()

    # fix-up the environ object
    arg_10 = arg_0.environ.copy()
    arg_10['PATH_INFO'] = arg_5[len(arg_10['SCRIPT_NAME']):]
    arg_10['QUERY_STRING'] = arg_6

    # init a new request
    arg_11 = arg_0.__class__(arg_10)

    # copy over any missing request attributes - this feels hackish
    arg_12 = set(dir(arg_0)) - set(dir(arg_11))
    while arg_12:
        arg_13 = arg_12.pop()
        arg_11.__setattr__(arg_13,
                                    arg_0.__getattribute__(arg_13))

    # mark this request as obfuscated
    arg_11.META['obfuscated'] = True

    arg_15 = arg_7(arg_11, *arg_8, **arg_9)

    # offer up a friendlier juice-powered filename if downloaded
    if arg_2 and not arg_15.has_header('Content-Disposition'):
        arg_15['Content-Disposition'] = 'inline; filename=%s' % arg_2

    return arg_15

Deobfuscates the URL and returns HttpResponse from source view . SEO juice is mostly ignored as it is intended for display purposes only .


(self, out=None, t=None, line_kwargs=None,
                scatter_kwargs=None, **kwargs)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,
                arg_4=None, **arg_5):
        """Animates the network as it's simulating.

        The animations can be saved to disk or viewed in interactive
        mode. Closing the window ends the animation if viewed in
        interactive mode. This method calls
        :meth:`~matplotlib.axes.scatter`, and
        :class:`~matplotlib.collections.LineCollection`, and any
        keyword arguments they accept can be passed to them.

        Parameters
        ----------
        out : str (optional)
            The location where the frames for the images will be saved.
            If this parameter is not given, then the animation is shown
            in interactive mode.
        t : float (optional)
            The amount of simulation time to simulate forward. If
            given, and ``out`` is given, ``t`` is used instead of
            ``n``.
        line_kwargs : dict (optional, default: None)
            Any keyword arguments accepted by
            :class:`~matplotlib.collections.LineCollection`.
        scatter_kwargs : dict (optional, default: None)
            Any keyword arguments accepted by
            :meth:`~matplotlib.axes.Axes.scatter`.
        bgcolor : list (optional, keyword only)
            A list with 4 floats representing a RGBA color. The
            default is defined in ``self.colors['bgcolor']``.
        figsize : tuple (optional, keyword only, default: ``(7, 7)``)
            The width and height of the figure in inches.
        **kwargs :
            This method calls
            :class:`~matplotlib.animation.FuncAnimation` and
            optionally :meth:`.matplotlib.animation.FuncAnimation.save`.
            Any keyword that can be passed to these functions are
            passed via ``kwargs``.

        Notes
        -----
        There are several parameters automatically set and passed to
        matplotlib's :meth:`~matplotlib.axes.Axes.scatter`,
        :class:`~matplotlib.collections.LineCollection`, and
        :class:`~matplotlib.animation.FuncAnimation` by default.
        These include:

            * :class:`~matplotlib.animation.FuncAnimation`: Uses the
              defaults for that function. Saving the animation is done
              by passing the 'filename' keyword argument to this method.
              This method also accepts any keyword arguments accepted
              by :meth:`~matplotlib.animation.FuncAnimation.save`.
            * :class:`~matplotlib.collections.LineCollection`: The default
              arguments are taken from
              :meth:`.QueueNetworkDiGraph.lines_scatter_args`.
            * :meth:`~matplotlib.axes.Axes.scatter`: The default
              arguments are taken from
              :meth:`.QueueNetworkDiGraph.lines_scatter_args`.

        Raises
        ------
        QueueingToolError
            Will raise a :exc:`.QueueingToolError` if the
            ``QueueNetwork`` has not been initialized. Call
            :meth:`.initialize` before running.

        Examples
        --------
        This function works similarly to ``QueueNetwork's``
        :meth:`.draw` method.

        >>> import queueing_tool as qt
        >>> g = qt.generate_pagerank_graph(100, seed=13)
        >>> net = qt.QueueNetwork(g, seed=13)
        >>> net.initialize()
        >>> net.Func(figsize=(4, 4)) # doctest: +SKIP

        To stop the animation just close the window. If you want to
        write the animation to disk run something like the following:

        >>> kwargs = {
        ...     'filename': 'test.mp4',
        ...     'frames': 300,
        ...     'fps': 30,
        ...     'writer': 'mencoder',
        ...     'figsize': (4, 4),
        ...     'vertex_size': 15
        ... }
        >>> net.Func(**kwargs) # doctest: +SKIP
        """

        if not arg_0._initialized:
            arg_6 = ("Network has not been initialized. "
                   "Call '.initialize()' first.")
            raise QueueingToolError(arg_6)

        if not HAS_MATPLOTLIB:
            arg_6 = "Matplotlib is necessary to Func a simulation."
            raise ImportError(arg_6)

        arg_0._update_all_colors()
        arg_5.setdefault('bgcolor', arg_0.colors['bgcolor'])

        arg_7 = plt.figure(figsize=arg_5.get('figsize', (7, 7)))
        arg_8 = arg_7.gca()

        arg_9 = {
            'line_kwargs': arg_3,
            'scatter_kwargs': arg_4,
            'pos': arg_5.get('pos')
        }

        arg_10, arg_11 = arg_0.g.lines_scatter_args(**arg_9)

        arg_12 = LineCollection(**arg_10)
        arg_12 = arg_8.add_collection(arg_12)
        arg_13 = arg_8.scatter(**arg_11)

        arg_2 = np.infty if arg_2 is None else arg_2
        arg_14 = arg_0._t

        def update(arg_15):
            if arg_2 is not None:
                if arg_0._t > arg_14 + arg_2:
                    return False
            arg_0._simulate_next_event(slow=True)
            arg_12.set_color(arg_10['colors'])
            arg_13.set_edgecolors(arg_11['edgecolors'])
            arg_13.set_facecolor(arg_11['c'])

        if hasattr(arg_8, 'set_facecolor'):
            arg_8.set_facecolor(arg_5['bgcolor'])
        else:
            arg_8.set_axis_bgcolor(arg_5['bgcolor'])

        arg_8.get_xaxis().set_visible(False)
        arg_8.get_yaxis().set_visible(False)

        arg_16 = {
            'fargs': None,
            'event_source': None,
            'init_func': None,
            'frames': None,
            'blit': False,
            'interval': 10,
            'repeat': None,
            'func': update,
            'repeat_delay': None,
            'fig': arg_7,
            'save_count': None,
        }
        for arg_17, arg_18 in arg_5.items():
            if arg_17 in arg_16:
                arg_16[arg_17] = arg_18

        arg_19 = FuncAnimation(**arg_16)
        if 'filename' not in arg_5:
            plt.ioff()
            plt.show()
        else:
            arg_20 = {
                'filename': None,
                'writer': None,
                'fps': None,
                'dpi': None,
                'codec': None,
                'bitrate': None,
                'extra_args': None,
                'metadata': None,
                'extra_anim': None,
                'savefig_kwargs': None
            }
            for arg_17, arg_18 in arg_5.items():
                if arg_17 in arg_20:
                    arg_20[arg_17] = arg_18

            arg_19.save(**arg_20)

Animates the network as it's simulating.

        The animations can be saved to disk or viewed in interactive
        mode. Closing the window ends the animation if viewed in
        interactive mode. This method calls
        :meth:`~matplotlib.axes.scatter`, and
        :class:`~matplotlib.collections.LineCollection`, and any
        keyword arguments they accept can be passed to them.

        Parameters
        ----------
        out : str (optional)
            The location where the frames for the images will be saved.
            If this parameter is not given, then the animation is shown
            in interactive mode.
        t : float (optional)
            The amount of simulation time to simulate forward. If
            given, and ``out`` is given, ``t`` is used instead of
            ``n``.
        line_kwargs : dict (optional, default: None)
            Any keyword arguments accepted by
            :class:`~matplotlib.collections.LineCollection`.
        scatter_kwargs : dict (optional, default: None)
            Any keyword arguments accepted by
            :meth:`~matplotlib.axes.Axes.scatter`.
        bgcolor : list (optional, keyword only)
            A list with 4 floats representing a RGBA color. The
            default is defined in ``self.colors['bgcolor']``.
        figsize : tuple (optional, keyword only, default: ``(7, 7)``)
            The width and height of the figure in inches.
        **kwargs :
            This method calls
            :class:`~matplotlib.animation.FuncAnimation` and
            optionally :meth:`.matplotlib.animation.FuncAnimation.save`.
            Any keyword that can be passed to these functions are
            passed via ``kwargs``.

        Notes
        -----
        There are several parameters automatically set and passed to
        matplotlib's :meth:`~matplotlib.axes.Axes.scatter`,
        :class:`~matplotlib.collections.LineCollection`, and
        :class:`~matplotlib.animation.FuncAnimation` by default.
        These include:

            * :class:`~matplotlib.animation.FuncAnimation`: Uses the
              defaults for that function. Saving the animation is done
              by passing the 'filename' keyword argument to this method.
              This method also accepts any keyword arguments accepted
              by :meth:`~matplotlib.animation.FuncAnimation.save`.
            * :class:`~matplotlib.collections.LineCollection`: The default
              arguments are taken from
              :meth:`.QueueNetworkDiGraph.lines_scatter_args`.
            * :meth:`~matplotlib.axes.Axes.scatter`: The default
              arguments are taken from
              :meth:`.QueueNetworkDiGraph.lines_scatter_args`.

        Raises
        ------
        QueueingToolError
            Will raise a :exc:`.QueueingToolError` if the
            ``QueueNetwork`` has not been initialized. Call
            :meth:`.initialize` before running.

        Examples
        --------
        This function works similarly to ``QueueNetwork's``
        :meth:`.draw` method.

        >>> import queueing_tool as qt
        >>> g = qt.generate_pagerank_graph(100, seed=13)
        >>> net = qt.QueueNetwork(g, seed=13)
        >>> net.initialize()
        >>> net.animate(figsize=(4, 4)) # doctest: +SKIP

        To stop the animation just close the window. If you want to
        write the animation to disk run something like the following:

        >>> kwargs = {
        ...     'filename': 'test.mp4',
        ...     'frames': 300,
        ...     'fps': 30,
        ...     'writer': 'mencoder',
        ...     'figsize': (4, 4),
        ...     'vertex_size': 15
        ... }
        >>> net.animate(**kwargs) # doctest: +SKIP

Animates the network as it s simulating .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
re
.
split
(
'({config:|})'
,
arg_1
)
arg_3
=
[
]
try
:
while
len
(
arg_2
)
:
arg_4
=
arg_2
.
pop
(
0
)
if
arg_4
==
'{config:'
:
arg_5
=
arg_2
.
pop
(
0
)
arg_6
=
arg_0
.
config
[
arg_5
]
if
type
(
arg_6
)
==
ConfigNode
and
arg_6
==
:
raise
KeyError
(
"No such config variable '{}'"
.
format
(
arg_5
)
)
arg_3
.
append
(
str
(
arg_6
)
)
arg_2
.
pop
(
0
)
else
:
arg_3
.
append
(
arg_4
)
return
''
.
join
(
arg_3
)
except
IndexError
:
pass
return
arg_1

def Func(arg_0, arg_1):
        """
        Apply the config to a string.
        """
        arg_2 = re.split('({config:|})', arg_1)
        arg_3 = []
        try:
            while len(arg_2):
                arg_4 = arg_2.pop(0)
                if arg_4 == '{config:':
                    # pop the config variable, look it up
                    arg_5 = arg_2.pop(0)
                    arg_6 = arg_0.config[arg_5]

                    # if we got an empty node, then it didn't exist
                    if type(arg_6) == ConfigNode and arg_6 == None:
                        raise KeyError("No such config variable '{}'".format(arg_5))

                    # add the value to the list
                    arg_3.append(str(arg_6))

                    # pop the '}'
                    arg_2.pop(0)
                else:
                    # not the start of a config block, just append it to the list
                    arg_3.append(arg_4)
            return ''.join(arg_3)
        except IndexError:
            pass

        return arg_1


def Func(arg_0, arg_1, arg_2):
        """Handle the case where the employee on SAPSF's side is marked as inactive."""
        try:
            arg_3 = arg_2.response.content
        except AttributeError:
            pass
        else:
            if 'user account is inactive' in arg_3:
                arg_4 = EnterpriseCustomerUser.objects.get(
                    enterprise_enrollments__id=arg_1.enterprise_course_enrollment_id)
                arg_4.active = False
                arg_4.save()
                LOGGER.warning(
                    'User %s with ID %s and email %s is a former employee of %s '
                    'and has been marked inactive in SAPSF. Now marking inactive internally.',
                    arg_4.username, arg_4.user_id, arg_4.user_email, arg_4.enterprise_customer
                )
                return
        super(SapSuccessFactorsLearnerTransmitter, arg_0).Func(arg_1, arg_2)

Handle the case where the employee on SAPSF s side is marked as inactive .


def
Func
(
arg_0
)
:
arg_1
=
float
(
arg_0
[
'gmag'
]
)
arg_2
=
float
(
arg_0
[
'vmini'
]
)
arg_3
=
parallaxErrorSkyAvg
(
arg_1
,
arg_2
)
arg_4
=
gminvFromVmini
(
arg_2
)
print
(
"G = {0}"
.
format
(
arg_1
)
)
print
(
"V = {0}"
.
format
(
arg_1
arg_4
)
)
print
(
"(V-I) = {0}"
.
format
(
arg_2
)
)
print
(
"(G-V) = {0}"
.
format
(
arg_4
)
)
print
(
"standard error = {0} muas"
.
format
(
arg_3
)
)

def Func(arg_0):
  """
  Calculate the parallax error for the given input source magnitude and colour.

  :argument args: command line arguments
  """
  arg_1=float(arg_0['gmag'])
  arg_2=float(arg_0['vmini'])
  arg_3=parallaxErrorSkyAvg(arg_1, arg_2)
  arg_4=gminvFromVmini(arg_2)
  print("G = {0}".format(arg_1))
  print("V = {0}".format(arg_1-arg_4))
  print("(V-I) = {0}".format(arg_2))
  print("(G-V) = {0}".format(arg_4))
  print("standard error = {0} muas".format(arg_3))

Calculate the parallax error for the given input source magnitude and colour .


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
if
os
.
path
.
isdir
(
arg_2
)
:
if
arg_0
.
opt
.
recursive
:
for
arg_4
in
(
arg_4
for
arg_4
in
arg_0
.
local_walk
(
arg_2
)
if
not
os
.
path
.
isdir
(
arg_4
)
)
:
arg_5
=
S3URL
(
arg_3
)
arg_6
=
os
.
path
.
normpath
(
os
.
path
.
join
(
arg_5
.
path
,
os
.
path
.
relpath
(
arg_4
,
arg_2
)
)
)
arg_1
.
upload
(
arg_4
,
S3URL
.
combine
(
's3'
,
arg_5
.
bucket
,
arg_6
)
)
else
:
message
(
'omitting directory "%s".'
%
arg_2
)
else
:
arg_1
.
upload
(
arg_2
,
arg_3
)

def Func(arg_0, arg_1, arg_2, arg_3):
    '''Upload a single file or a directory by adding a task into queue'''
    if os.path.isdir(arg_2):
      if arg_0.opt.recursive:
        for arg_4 in (arg_4 for arg_4 in arg_0.local_walk(arg_2) if not os.path.isdir(arg_4)):
          arg_5 = S3URL(arg_3)
          # deal with ./ or ../ here by normalizing the path.
          arg_6 = os.path.normpath(os.path.join(arg_5.path, os.path.relpath(arg_4, arg_2)))
          arg_1.upload(arg_4, S3URL.combine('s3', arg_5.bucket, arg_6))
      else:
        message('omitting directory "%s".' % arg_2)
    else:
      arg_1.upload(arg_2, arg_3)


def Func ( arg_0 , arg_1 ) : if not arg_1 : arg_1 = np . dtype ( [ ] ) else : arg_1 = np . dtype ( arg_1 ) arg_2 = arg_1 . descr for arg_3 , arg_4 in arg_0 . _default_cluster_descr : if arg_0 . _cluster_fields_mapping [ arg_3 ] not in arg_1 . fields : arg_2 . append ( ( arg_3 , arg_4 ) ) arg_0 . _cluster_descr = arg_2 arg_0 . _init_arrays ( size = 0 )

def Func(arg_0, arg_1):
        ''' Set the data type of the cluster.

        Parameters:
        -----------
        cluster_dtype : numpy.dtype or equivalent
            Defines the dtype of the cluster array.
        '''
        if not arg_1:
            arg_1 = np.dtype([])
        else:
            arg_1 = np.dtype(arg_1)
        arg_2 = arg_1.descr

        for arg_3, arg_4 in arg_0._default_cluster_descr:
            if arg_0._cluster_fields_mapping[arg_3] not in arg_1.fields:
                arg_2.append((arg_3, arg_4))

        arg_0._cluster_descr = arg_2
        arg_0._init_arrays(size=0)


def Func(arg_0, arg_1):
    """Push item onto heap, maintaining the heap invariant."""
    arg_0.append(arg_1)
    _siftdown_max(arg_0, 0, len(arg_0) - 1)

Push item onto heap maintaining the heap invariant .


def Func ( arg_0 , arg_1 , arg_2 = 10 ) : arg_0 . present ( arg_0 . query ( arg_1 , arg_2 ) )

def Func(arg_0, arg_1, arg_2=10):
        "Get results for the query and present them."
        arg_0.present(arg_0.query(arg_1, arg_2))

Get results for the query and present them .


(formatkey,
                      fileglob,
                      timecols,
                      magcols,
                      errcols,
                      readerfunc_module,
                      readerfunc,
                      readerfunc_kwargs=None,
                      normfunc_module=None,
                      normfunc=None,
                      normfunc_kwargs=None,
                      magsarefluxes=False,
                      overwrite_existing=False,
                      lcformat_dir='~/.astrobase/lcformat-jsons')

def Func(arg_0,
                      arg_1,
                      arg_2,
                      arg_3,
                      arg_4,
                      arg_5,
                      arg_6,
                      arg_7=None,
                      arg_8=None,
                      arg_9=None,
                      arg_10=None,
                      arg_11=False,
                      arg_12=False,
                      arg_13='~/.astrobase/lcformat-jsons'):
    '''This adds a new LC format to the astrobase LC format registry.

    Allows handling of custom format light curves for astrobase lcproc
    drivers. Once the format is successfully registered, light curves should
    work transparently with all of the functions in this module, by simply
    calling them with the `formatkey` in the `lcformat` keyword argument.

    LC format specifications are generated as JSON files. astrobase comes with
    several of these in `<astrobase install path>/data/lcformats`. LC formats
    you add by using this function will have their specifiers written to the
    `~/.astrobase/lcformat-jsons` directory in your home directory.

    Parameters
    ----------

    formatkey : str
        A str used as the unique ID of this LC format for all lcproc functions
        and can be used to look it up later and import the correct functions
        needed to support it for lcproc operations. For example, we use
        'kep-fits' as a the specifier for Kepler FITS light curves, which can be
        read by the `astrobase.astrokep.read_kepler_fitslc` function as
        specified by the `<astrobase install path>/data/lcformats/kep-fits.json`
        LC format specification JSON produced by `Func`.

    fileglob : str
        The default UNIX fileglob to use to search for light curve files in this
        LC format. This is a string like '*-whatever-???-*.*??-.lc'.

    timecols,magcols,errcols : list of str
        These are all lists of strings indicating which keys in the lcdict
        produced by your `lcreader_func` that will be extracted and used by
        lcproc functions for processing. The lists must all have the same
        dimensions, e.g. if timecols = ['timecol1','timecol2'], then magcols
        must be something like ['magcol1','magcol2'] and errcols must be
        something like ['errcol1', 'errcol2']. This allows you to process
        multiple apertures or multiple types of measurements in one go.

        Each element in these lists can be a simple key, e.g. 'time' (which
        would correspond to lcdict['time']), or a composite key,
        e.g. 'aperture1.times.rjd' (which would correspond to
        lcdict['aperture1']['times']['rjd']). See the examples in the lcformat
        specification JSON files in `<astrobase install path>/data/lcformats`.

    readerfunc_module : str
        This is either:

        - a Python module import path, e.g. 'astrobase.lcproc.catalogs' or
        - a path to a Python file, e.g. '/astrobase/hatsurveys/hatlc.py'

        that contains the Python module that contains functions used to open
        (and optionally normalize) a custom LC format that's not natively
        supported by astrobase.

    readerfunc : str
        This is the function name in `readerfunc_module` to use to read light
        curves in the custom format. This MUST always return a dictionary (the
        'lcdict') with the following signature (the keys listed below are
        required, but others are allowed)::

            {'objectid': this object's identifier as a string,
             'objectinfo':{'ra': this object's right ascension in decimal deg,
                           'decl': this object's declination in decimal deg,
                           'ndet': the number of observations in this LC,
                           'objectid': the object ID again for legacy reasons},
             ...other time columns, mag columns go in as their own keys}

    normfunc_kwargs : dict or None
        This is a dictionary containing any kwargs to pass through to
        the light curve norm function.

    normfunc_module : str or None
        This is either:

        - a Python module import path, e.g. 'astrobase.lcproc.catalogs' or
        - a path to a Python file, e.g. '/astrobase/hatsurveys/hatlc.py'
        - None, in which case we'll use default normalization

        that contains the Python module that contains functions used to
        normalize a custom LC format that's not natively supported by astrobase.

    normfunc : str or None
        This is the function name in `normfunc_module` to use to normalize light
        curves in the custom format. If None, the default normalization method
        used by lcproc is to find gaps in the time-series, normalize
        measurements grouped by these gaps to zero, then normalize the entire
        magnitude time series to global time series median using the
        `astrobase.lcmath.normalize_magseries` function.

        If this is provided, the normalization function should take and return
        an lcdict of the same form as that produced by `readerfunc` above. For
        an example of a specific normalization function, see
        `normalize_lcdict_by_inst` in the `astrobase.hatsurveys.hatlc` module.

    normfunc_kwargs : dict or None
        This is a dictionary containing any kwargs to pass through to
        the light curve normalization function.

    magsarefluxes : bool
        If this is True, then all lcproc functions will treat the measurement
        columns in the lcdict produced by your `readerfunc` as flux instead of
        mags, so things like default normalization and sigma-clipping will be
        done correctly. If this is False, magnitudes will be treated as
        magnitudes.

    overwrite_existing : bool
        If this is True, this function will overwrite any existing LC format
        specification JSON with the same name as that provided in the
        `formatkey` arg. This can be used to update LC format specifications
        while keeping the `formatkey` the same.

    lcformat_dir : str
        This specifies the directory where the the LC format specification JSON
        produced by this function will be written. By default, this goes to the
        `.astrobase/lcformat-jsons` directory in your home directory.

    Returns
    -------

    str
        Returns the file path to the generated LC format specification JSON
        file.

    '''

    LOGINFO('adding %s to LC format registry...' % arg_0)

    # search for the lcformat_dir and create it if it doesn't exist
    arg_14 = os.path.abspath(
        os.path.expanduser(arg_13)
    )
    if not os.path.exists(arg_14):
        os.makedirs(arg_14)

    arg_15 = os.path.join(arg_14,'%s.json' % arg_0)

    if os.path.exists(arg_15) and not arg_12:
        LOGERROR('There is an existing lcformat JSON: %s '
                 'for this formatkey: %s and '
                 'overwrite_existing = False, skipping...'
                 % (arg_15, arg_0))
        return None

    # see if we can import the reader module
    arg_16 = _check_extmodule(arg_5, arg_0)

    if not arg_16:
        LOGERROR("could not import the required "
                 "module: %s to read %s light curves" %
                 (arg_5, arg_0))
        return None

    # then, get the function we need to read the light curve
    try:
        getattr(arg_16, arg_6)
        arg_17 = arg_6
    except AttributeError:
        LOGEXCEPTION('Could not get the specified reader '
                     'function: %s for lcformat: %s '
                     'from module: %s'
                     % (arg_0, arg_5, arg_6))
        raise

    # see if we can import the normalization module
    if arg_8:
        arg_18 = _check_extmodule(arg_8, arg_0)
        if not arg_18:
            LOGERROR("could not import the required "
                     "module: %s to normalize %s light curves" %
                     (arg_8, arg_0))
            return None

    else:
        arg_18 = None

    # finally, get the function we need to normalize the light curve
    if arg_8 and arg_9:
        try:
            getattr(arg_18, arg_9)
            arg_19 = arg_9
        except AttributeError:
            LOGEXCEPTION('Could not get the specified norm '
                         'function: %s for lcformat: %s '
                         'from module: %s'
                         % (arg_9, arg_0, arg_8))
            raise

    else:
        arg_19 = None

    # if we made it to here, then everything's good. generate the JSON
    # structure
    arg_20 = {'fileglob':arg_1,
                  'timecols':arg_2,
                  'magcols':arg_3,
                  'errcols':arg_4,
                  'magsarefluxes':arg_11,
                  'lcreader_module':arg_5,
                  'lcreader_func':arg_17,
                  'lcreader_kwargs':arg_7,
                  'lcnorm_module':arg_8,
                  'lcnorm_func':arg_19,
                  'lcnorm_kwargs':arg_10}

    # write this to the lcformat directory
    with open(arg_15,'w') as outfd:
        json.dump(arg_20, outfd, indent=4)

    return arg_15

This adds a new LC format to the astrobase LC format registry.

    Allows handling of custom format light curves for astrobase lcproc
    drivers. Once the format is successfully registered, light curves should
    work transparently with all of the functions in this module, by simply
    calling them with the `formatkey` in the `lcformat` keyword argument.

    LC format specifications are generated as JSON files. astrobase comes with
    several of these in `<astrobase install path>/data/lcformats`. LC formats
    you add by using this function will have their specifiers written to the
    `~/.astrobase/lcformat-jsons` directory in your home directory.

    Parameters
    ----------

    formatkey : str
        A str used as the unique ID of this LC format for all lcproc functions
        and can be used to look it up later and import the correct functions
        needed to support it for lcproc operations. For example, we use
        'kep-fits' as a the specifier for Kepler FITS light curves, which can be
        read by the `astrobase.astrokep.read_kepler_fitslc` function as
        specified by the `<astrobase install path>/data/lcformats/kep-fits.json`
        LC format specification JSON produced by `register_lcformat`.

    fileglob : str
        The default UNIX fileglob to use to search for light curve files in this
        LC format. This is a string like '*-whatever-???-*.*??-.lc'.

    timecols,magcols,errcols : list of str
        These are all lists of strings indicating which keys in the lcdict
        produced by your `lcreader_func` that will be extracted and used by
        lcproc functions for processing. The lists must all have the same
        dimensions, e.g. if timecols = ['timecol1','timecol2'], then magcols
        must be something like ['magcol1','magcol2'] and errcols must be
        something like ['errcol1', 'errcol2']. This allows you to process
        multiple apertures or multiple types of measurements in one go.

        Each element in these lists can be a simple key, e.g. 'time' (which
        would correspond to lcdict['time']), or a composite key,
        e.g. 'aperture1.times.rjd' (which would correspond to
        lcdict['aperture1']['times']['rjd']). See the examples in the lcformat
        specification JSON files in `<astrobase install path>/data/lcformats`.

    readerfunc_module : str
        This is either:

        - a Python module import path, e.g. 'astrobase.lcproc.catalogs' or
        - a path to a Python file, e.g. '/astrobase/hatsurveys/hatlc.py'

        that contains the Python module that contains functions used to open
        (and optionally normalize) a custom LC format that's not natively
        supported by astrobase.

    readerfunc : str
        This is the function name in `readerfunc_module` to use to read light
        curves in the custom format. This MUST always return a dictionary (the
        'lcdict') with the following signature (the keys listed below are
        required, but others are allowed)::

            {'objectid': this object's identifier as a string,
             'objectinfo':{'ra': this object's right ascension in decimal deg,
                           'decl': this object's declination in decimal deg,
                           'ndet': the number of observations in this LC,
                           'objectid': the object ID again for legacy reasons},
             ...other time columns, mag columns go in as their own keys}

    normfunc_kwargs : dict or None
        This is a dictionary containing any kwargs to pass through to
        the light curve norm function.

    normfunc_module : str or None
        This is either:

        - a Python module import path, e.g. 'astrobase.lcproc.catalogs' or
        - a path to a Python file, e.g. '/astrobase/hatsurveys/hatlc.py'
        - None, in which case we'll use default normalization

        that contains the Python module that contains functions used to
        normalize a custom LC format that's not natively supported by astrobase.

    normfunc : str or None
        This is the function name in `normfunc_module` to use to normalize light
        curves in the custom format. If None, the default normalization method
        used by lcproc is to find gaps in the time-series, normalize
        measurements grouped by these gaps to zero, then normalize the entire
        magnitude time series to global time series median using the
        `astrobase.lcmath.normalize_magseries` function.

        If this is provided, the normalization function should take and return
        an lcdict of the same form as that produced by `readerfunc` above. For
        an example of a specific normalization function, see
        `normalize_lcdict_by_inst` in the `astrobase.hatsurveys.hatlc` module.

    normfunc_kwargs : dict or None
        This is a dictionary containing any kwargs to pass through to
        the light curve normalization function.

    magsarefluxes : bool
        If this is True, then all lcproc functions will treat the measurement
        columns in the lcdict produced by your `readerfunc` as flux instead of
        mags, so things like default normalization and sigma-clipping will be
        done correctly. If this is False, magnitudes will be treated as
        magnitudes.

    overwrite_existing : bool
        If this is True, this function will overwrite any existing LC format
        specification JSON with the same name as that provided in the
        `formatkey` arg. This can be used to update LC format specifications
        while keeping the `formatkey` the same.

    lcformat_dir : str
        This specifies the directory where the the LC format specification JSON
        produced by this function will be written. By default, this goes to the
        `.astrobase/lcformat-jsons` directory in your home directory.

    Returns
    -------

    str
        Returns the file path to the generated LC format specification JSON
        file.

This adds a new LC format to the astrobase LC format registry .


return filename_template.format(dag_id=ti.dag_id,
                                    task_id=ti.task_id,
                                    execution_date=ti.execution_date.isoformat(),
                                    try_number=try_number)

def Func(arg_0, arg_1, arg_2):
    """
    Given task instance, try_number, filename_template, return the rendered log
    filename

    :param ti: task instance
    :param try_number: try_number of the task
    :param filename_template: filename template, which can be jinja template or
        python string template
    """
    arg_2, arg_3 = parse_template_string(arg_2)
    if arg_3:
        arg_4 = arg_0.get_template_context()
        arg_4['try_number'] = arg_1
        return arg_3.render(**arg_4)

    return arg_2.format(dag_id=arg_0.dag_id,
                                    task_id=arg_0.task_id,
                                    execution_date=arg_0.execution_date.isoformat(),
                                    arg_1=arg_1)

Given task instance try_number filename_template return the rendered log filename


(self, project, site, subject, session, scan,
                    size, email=None, invariants=Invariants.ALL,
                    fiber_file=DEFAULT_FIBER_FILE, atlas_file=None,
                    use_threads=False, callback=None)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5,
                    arg_6, arg_7=None, arg_8=arg_9.ALL,
                    arg_11=arg_12, arg_13=None,
                    arg_14=False, arg_15=None):
        """
        Builds a graph using the graph-services endpoint.

        Arguments:
            project (str): The project to use
            site (str): The site in question
            subject (str): The subject's identifier
            session (str): The session (per subject)
            scan (str): The scan identifier
            size (str): Whether to return a big (grute.BIG) or small
                (grute.SMALL) graph. For a better explanation, see m2g.io.
            email (str : self.email)*: An email to notify
            invariants (str[]: Invariants.ALL)*: An array of invariants to
                compute. You can use the grute.Invariants class to construct a
                list, or simply pass grute.Invariants.ALL to compute them all.
            fiber_file (str: DEFAULT_FIBER_FILE)*: A local filename of an
                MRI Studio .dat file
            atlas_file (str: None)*: A local atlas file, in NIFTI .nii format.
                If none is specified, the Desikan atlas is used by default.
            use_threads (bool: False)*: Whether to run the download in a Python
                thread. If set to True, the call to `Func` will end
                quickly, and the `callback` will be called with the returned
                status-code of the restful call as its only argument.
            callback (function: None)*: The function to run upon completion of
                the call, if using threads. (Will not be called if use_threads
                is set to False.)

        Returns:
            HTTP Response if use_threads is False. Otherwise, None

        Raises:
            ValueError: When the supplied values are invalid (contain invalid
                characters, bad email address supplied, etc.)
            RemoteDataNotFoundError: When the data cannot be processed due to
                a server error.
        """
        if arg_7 is None:
            arg_7 = arg_0.email

        if not set(arg_8) <= set(arg_9.ALL):
            raise ValueError("Invariants must be a subset of Invariants.ALL.")

        if arg_14 and arg_15 is not None:
            if not hasattr(arg_15, '__call__'):
                raise ValueError("callback must be a function.")
            if len(inspect.getargspec(arg_15).args) != 1:
                raise ValueError("callback must take exactly 1 argument.")

        # Once we get here, we know the callback is
        if arg_6 not in [arg_0.BIG, arg_0.SMALL]:
            raise ValueError("size must be either grute.BIG or grute.SMALL.")

        arg_16 = "buildgraph/{}/{}/{}/{}/{}/{}/{}/{}/".format(
            arg_1,
            arg_2,
            arg_3,
            arg_4,
            arg_5,
            arg_6,
            arg_7,
            "/".join(arg_8)
        )

        if " " in arg_16:
            raise ValueError("Arguments must not contain spaces.")

        if arg_14:
            # Run in the background.
            arg_17 = threading.Thread(
                target=arg_0._run_Func,
                args=[arg_16, arg_11, arg_13, arg_15]
            )
            arg_17.start()
        else:
            # Run in the foreground.
            return arg_0._run_Func(arg_16, arg_11, arg_13)
        return

Builds a graph using the graph-services endpoint.

        Arguments:
            project (str): The project to use
            site (str): The site in question
            subject (str): The subject's identifier
            session (str): The session (per subject)
            scan (str): The scan identifier
            size (str): Whether to return a big (grute.BIG) or small
                (grute.SMALL) graph. For a better explanation, see m2g.io.
            email (str : self.email)*: An email to notify
            invariants (str[]: Invariants.ALL)*: An array of invariants to
                compute. You can use the grute.Invariants class to construct a
                list, or simply pass grute.Invariants.ALL to compute them all.
            fiber_file (str: DEFAULT_FIBER_FILE)*: A local filename of an
                MRI Studio .dat file
            atlas_file (str: None)*: A local atlas file, in NIFTI .nii format.
                If none is specified, the Desikan atlas is used by default.
            use_threads (bool: False)*: Whether to run the download in a Python
                thread. If set to True, the call to `build_graph` will end
                quickly, and the `callback` will be called with the returned
                status-code of the restful call as its only argument.
            callback (function: None)*: The function to run upon completion of
                the call, if using threads. (Will not be called if use_threads
                is set to False.)

        Returns:
            HTTP Response if use_threads is False. Otherwise, None

        Raises:
            ValueError: When the supplied values are invalid (contain invalid
                characters, bad email address supplied, etc.)
            RemoteDataNotFoundError: When the data cannot be processed due to
                a server error.

Builds a graph using the graph - services endpoint .


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] if S3URL . is_valid ( arg_1 ) : arg_3 = S3URL ( arg_1 ) . path for arg_4 in ( arg_4 for arg_4 in arg_0 . s3walk ( arg_1 ) if not arg_4 [ 'is_dir' ] ) : arg_2 . append ( os . path . relpath ( S3URL ( arg_4 [ 'name' ] ) . path , arg_3 ) ) else : for arg_4 in ( arg_4 for arg_4 in arg_0 . local_walk ( arg_1 ) if not os . path . isdir ( arg_4 ) ) : arg_2 . append ( os . path . relpath ( arg_4 , arg_1 ) ) return arg_2

def Func(arg_0, arg_1):
    '''Generic version of directory walk. Return file list without base path
       for comparison.
    '''
    arg_2 = []

    if S3URL.is_valid(arg_1):
      arg_3 = S3URL(arg_1).path
      for arg_4 in (arg_4 for arg_4 in arg_0.s3walk(arg_1) if not arg_4['is_dir']):
        arg_2.append(os.path.relpath(S3URL(arg_4['name']).path, arg_3))
    else:
      for arg_4 in (arg_4 for arg_4 in arg_0.local_walk(arg_1) if not os.path.isdir(arg_4)):
        arg_2.append(os.path.relpath(arg_4, arg_1))

    return arg_2

Generic version of directory walk . Return file list without base path for comparison .


def Func ( arg_0 , arg_1 , * arg_2 , ** arg_3 ) : arg_4 = [ ] for arg_5 in arg_0 . depends : arg_4 . append ( arg_0 . _ref ( arg_5 ) . Func ( arg_1 , * arg_2 , ** arg_3 ) ) if arg_1 in arg_0 . typed_bundles : arg_4 . append ( render_asset_html_tags ( arg_1 , arg_0 . urls_for_self ( arg_1 , * arg_2 , ** arg_3 ) ) ) return "\n" . join ( arg_4 )

def Func(arg_0, arg_1, *arg_2, **arg_3):
        """Return html tags for urls of asset_type
        """
        arg_4 = []
        for arg_5 in arg_0.depends:
            arg_4.append(arg_0._ref(arg_5).Func(arg_1, *arg_2, **arg_3))
        if arg_1 in arg_0.typed_bundles:
            arg_4.append(render_asset_html_tags(arg_1, arg_0.urls_for_self(arg_1, *arg_2, **arg_3)))
        return "\n".join(arg_4)


(f_pass1, f_stop1, f_stop2, f_pass2, d_pass, d_stop,
                  fs = 1.0, N_bump=5)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5,
                  arg_6 = 1.0, arg_7=5):
    """
    Design an FIR bandstop filter using remez with order
    determination. The filter order is determined based on
    f_pass1 Hz, f_stop1 Hz, f_stop2 Hz, f_pass2 Hz, and the
    desired passband ripple d_pass dB and stopband attenuation
    d_stop dB all relative to a sampling rate of fs Hz.

    Mark Wickert October 2016, updated October 2018
    """
    arg_8, arg_9, arg_10, arg_11 = bandstop_order(arg_0, arg_1, arg_2, arg_3,
                                    arg_4, arg_5, fsamp=arg_6)
    # Bump up the order by N_bump to bring down the final d_pass & d_stop
    # Initially make sure the number of taps is even so N_bump needs to be odd
    if np.mod(arg_8,2) != 0:
        arg_8 += 1
    arg_12 = arg_8
    arg_12 += arg_7
    arg_13 = signal.remez(arg_12, arg_9, arg_10[0::2], arg_11, Hz=2,
                     maxiter = 25, grid_density = 16)
    print('N_bump must be odd to maintain odd filter length')
    print('Remez filter taps = %d.' % arg_12)
    return arg_13

Design an FIR bandstop filter using remez with order determination . The filter order is determined based on f_pass1 Hz f_stop1 Hz f_stop2 Hz f_pass2 Hz and the desired passband ripple d_pass dB and stopband attenuation d_stop dB all relative to a sampling rate of fs Hz . Mark Wickert October 2016 updated October 2018


def Func ( arg_0 ) : for arg_1 in arg_0 . childNodes : if arg_1 . nodeType == Node . TEXT_NODE : if arg_1 . nodeValue : arg_1 . nodeValue = arg_1 . nodeValue . strip ( ) elif arg_1 . nodeType == Node . ELEMENT_NODE : Func ( arg_1 )

def Func(arg_0):
    """Strips all whitespace from a minidom XML node and its children

    This operation is made in-place."""
    for arg_1 in arg_0.childNodes:
        if arg_1.nodeType == Node.TEXT_NODE:
            if arg_1.nodeValue:
                arg_1.nodeValue = arg_1.nodeValue.strip()
        elif arg_1.nodeType == Node.ELEMENT_NODE:
            Func(arg_1)


(rows, cols, mean=0, std=1, sparsity=0, radius=0, diagonal=0, rng=None)

def Func ( arg_0 , arg_1 , arg_2 = 0 , arg_3 = 1 , arg_4 = 0 , arg_5 = 0 , arg_6 = 0 , arg_7 = None ) : if arg_7 is None or isinstance ( arg_7 , int ) : arg_7 = np . random . RandomState ( arg_7 ) arg_8 = arg_2 + arg_3 * arg_7 . randn ( arg_0 , arg_1 ) if 1 > arg_4 > 0 : arg_9 = min ( arg_0 , arg_1 ) arg_10 = arg_7 . binomial ( n = 1 , p = 1 - arg_4 , size = ( arg_0 , arg_1 ) ) . astype ( bool ) arg_10 [ : arg_9 , : arg_9 ] |= np . eye ( arg_9 ) . astype ( bool ) arg_8 *= arg_10 if arg_5 > 0 : arg_11 , arg_12 , arg_13 = np . linalg . svd ( arg_8 , full_matrices = False ) arg_8 = np . dot ( np . dot ( arg_11 , np . diag ( arg_5 * arg_12 / abs ( arg_12 [ 0 ] ) ) ) , arg_13 ) if arg_6 != 0 : arg_8 = arg_6 * np . eye ( max ( arg_0 , arg_1 ) ) [ : arg_0 , : arg_1 ] return arg_8 . astype ( FLOAT )

def Func(arg_0, arg_1, arg_2=0, arg_3=1, arg_4=0, arg_5=0, arg_6=0, arg_7=None):
    '''Create a matrix of randomly-initialized weights.

    Parameters
    ----------
    rows : int
        Number of rows of the weight matrix -- equivalently, the number of
        "input" units that the weight matrix connects.
    cols : int
        Number of columns of the weight matrix -- equivalently, the number
        of "output" units that the weight matrix connects.
    mean : float, optional
        Draw initial weight values from a normal with this mean. Defaults to 0.
    std : float, optional
        Draw initial weight values from a normal with this standard deviation.
        Defaults to 1.
    sparsity : float in (0, 1), optional
        If given, ensure that the given fraction of the weight matrix is
        set to zero. Defaults to 0, meaning all weights are nonzero.
    radius : float, optional
        If given, rescale the initial weights to have this spectral radius.
        No scaling is performed by default.
    diagonal : float, optional
        If nonzero, create a matrix containing all zeros except for this value
        along the diagonal. If nonzero, other arguments (except for rows and
        cols) will be ignored.
    rng : :class:`numpy.random.RandomState` or int, optional
        A random number generator, or an integer seed for a random number
        generator. If not provided, the random number generator will be created
        with an automatically chosen seed.

    Returns
    -------
    matrix : numpy array
        An array containing random values. These often represent the weights
        connecting each "input" unit to each "output" unit in a layer.
    '''
    if arg_7 is None or isinstance(arg_7, int):
        arg_7 = np.random.RandomState(arg_7)
    arg_8 = arg_2 + arg_3 * arg_7.randn(arg_0, arg_1)
    if 1 > arg_4 > 0:
        arg_9 = min(arg_0, arg_1)
        arg_10 = arg_7.binomial(n=1, p=1 - arg_4, size=(arg_0, arg_1)).astype(bool)
        arg_10[:arg_9, :arg_9] |= np.eye(arg_9).astype(bool)
        arg_8 *= arg_10
    if arg_5 > 0:
        # rescale weights to have the appropriate spectral radius.
        arg_11, arg_12, arg_13 = np.linalg.svd(arg_8, full_matrices=False)
        arg_8 = np.dot(np.dot(arg_11, np.diag(arg_5 * arg_12 / abs(arg_12[0]))), arg_13)
    if arg_6 != 0:
        # generate a diagonal weight matrix. ignore other options.
        arg_8 = arg_6 * np.eye(max(arg_0, arg_1))[:arg_0, :arg_1]
    return arg_8.astype(FLOAT)

Create a matrix of randomly - initialized weights .


def Func ( arg_0 , arg_1 ) : if arg_1 . name is not None : arg_0 . show_workspace ( slashes2dash ( arg_1 . name ) ) elif arg_1 . all is not None : arg_0 . show_all ( )

def Func(arg_0, arg_1):
        """Execute show subcommand."""
        if arg_1.name is not None:
            arg_0.show_workspace(slashes2dash(arg_1.name))
        elif arg_1.all is not None:
            arg_0.show_all()


(self, string_data, container_name, blob_name, **kwargs)

def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):
        """
        Upload a string to Azure Blob Storage.

        :param string_data: String to load.
        :type string_data: str
        :param container_name: Name of the container.
        :type container_name: str
        :param blob_name: Name of the blob.
        :type blob_name: str
        :param kwargs: Optional keyword arguments that
            `BlockBlobService.create_blob_from_text()` takes.
        :type kwargs: object
        """
        # Reorder the argument order from airflow.hooks.S3_hook.Func.
        arg_0.connection.create_blob_from_text(arg_2, arg_3,
                                              arg_1, **arg_4)


def
Func
(
arg_0
)
:
if
'params'
in
arg_0
:
arg_1
=
isinstance
(
arg_0
[
'params'
]
,
(
list
,
dict
)
)
arg_2
=
'Incorrect parameter values'
assert
arg_1
,
arg_2

def Func(arg_0):
    """Validate request params."""

    if 'params' in arg_0:
        arg_1 = isinstance(arg_0['params'], (list, dict))
        arg_2 = 'Incorrect parameter values'
        assert arg_1, arg_2


return run_sql(
        'SELECT job_date, marcxml '
        'FROM hstRECORD WHERE id_bibrec = %s AND job_date >= %s '
        'ORDER BY job_date ASC', (recid, from_date),
        run_on_slave=True)

def Func(arg_0, arg_1):
    """Get record revisions."""
    try:
        from invenio.dbquery import run_sql
    except ImportError:
        from invenio.legacy.dbquery import run_sql

    return run_sql(
        'SELECT job_date, marcxml '
        'FROM hstRECORD WHERE id_bibrec = %s AND job_date >= %s '
        'ORDER BY job_date ASC', (arg_0, arg_1),
        run_on_slave=True)


(self, k, wait=False, wait_index=None, timeout='5m')

def
Func
(
arg_0
,
arg_1
,
arg_2
=
False
,
arg_3
=
,
arg_4
=
'5m'
)
:
arg_1
=
arg_1
.
lstrip
(
'/'
)
arg_5
=
'{}/{}'
.
format
(
arg_0
.
endpoint
,
arg_1
)
arg_6
=
{
}
arg_6
[
'Func'
]
=
'true'
if
arg_2
:
arg_6
[
'wait'
]
=
arg_4
if
not
arg_3
:
arg_6
[
'index'
]
=
arg_0
.
index
(
arg_1
,
recursive
=
True
)
else
:
arg_6
[
'index'
]
=
arg_3
arg_7
=
requests
.
get
(
arg_5
,
arg_6
=
arg_6
)
if
arg_7
.
status_code
==
404
:
raise
KeyDoesNotExist
(
"Key "
+
arg_1
+
" does not exist"
)
if
arg_7
.
status_code
!=
200
:
raise
KVStoreError
(
'GET returned {}'
.
format
(
arg_7
.
status_code
)
)
arg_8
=
{
}
for
arg_9
in
arg_7
.
json
(
)
:
if
arg_9
[
'Value'
]
:
arg_8
[
arg_9
[
'Key'
]
]
=
base64
.
b64decode
(
arg_9
[
'Value'
]
)
else
:
arg_8
[
arg_9
[
'Key'
]
]
=
''
return
arg_8

def Func(arg_0, arg_1, arg_2=False, arg_3=None, arg_4='5m'):
        """Recursively get the tree below the given key"""
        arg_1 = arg_1.lstrip('/')
        arg_5 = '{}/{}'.format(arg_0.endpoint, arg_1)
        arg_6 = {}
        arg_6['Func'] = 'true'
        if arg_2:
            arg_6['wait'] = arg_4
            if not arg_3:
                arg_6['index'] = arg_0.index(arg_1, recursive=True)
            else:
                arg_6['index'] = arg_3
        arg_7 = requests.get(arg_5, arg_6=arg_6)
        if arg_7.status_code == 404:
            raise KeyDoesNotExist("Key " + arg_1 + " does not exist")
        if arg_7.status_code != 200:
            raise KVStoreError('GET returned {}'.format(arg_7.status_code))
        arg_8 = {}
        for arg_9 in arg_7.json():
            if arg_9['Value']:
                arg_8[arg_9['Key']] = base64.b64decode(arg_9['Value'])
            else:
                arg_8[arg_9['Key']] = ''
        return arg_8


def Func ( arg_0 ) : for arg_1 , arg_2 , arg_3 in os . walk ( arg_0 . dirpath ) : for arg_4 in arg_3 : arg_5 = os . path . join ( arg_1 , arg_4 ) yield arg_5

def Func(arg_0):
        """Retrieve the file paths stored under the base path."""

        for arg_1, arg_2, arg_3 in os.walk(arg_0.dirpath):
            for arg_4 in arg_3:
                arg_5 = os.path.join(arg_1, arg_4)
                yield arg_5

Retrieve the file paths stored under the base path .


def Func ( arg_0 ) : arg_0 = tf . as_dtype ( arg_0 ) if hasattr ( arg_0 , 'Func' ) : return arg_0 . Func return np . dtype ( arg_0 ) . itemFunc

def Func(arg_0):
  """Returns the number of bytes to represent this `dtype`."""
  arg_0 = tf.as_dtype(arg_0)
  if hasattr(arg_0, 'Func'):
    return arg_0.Func
  return np.dtype(arg_0).itemFunc

Returns the number of bytes to represent this dtype .


def Func(arg_0, arg_1):
        """Remove all operation nodes with the given name."""
        for arg_2 in arg_0.named_nodes(arg_1):
            arg_0.remove_op_node(arg_2)

Remove all operation nodes with the given name .


def Func ( arg_0 ) : arg_1 = tf . expand_dims ( arg_0 , - 2 ) arg_2 = dist_util . prefer_static_shape ( arg_0 ) arg_3 , arg_4 = arg_2 [ : - 1 ] , arg_2 [ - 1 ] arg_5 = tf . concat ( [ tf . eye ( arg_4 - 1 , dtype = arg_0 . dtype , arg_3 = arg_3 ) , tf . zeros ( tf . concat ( [ arg_3 , ( arg_4 - 1 , 1 ) ] , axis = 0 ) , dtype = arg_0 . dtype ) ] , axis = - 1 ) arg_6 = tf . concat ( [ arg_1 , arg_5 ] , axis = - 2 ) return arg_6

def Func(arg_0):
  """Build transition matrix for an autoregressive StateSpaceModel.

  When applied to a vector of previous values, this matrix computes
  the expected new value (summing the previous states according to the
  autoregressive coefficients) in the top dimension of the state space,
  and moves all previous values down by one dimension, 'forgetting' the
  final (least recent) value. That is, it looks like this:

  ```
  ar_matrix = [ coefs[0], coefs[1], ..., coefs[order]
                1.,       0 ,       ..., 0.
                0.,       1.,       ..., 0.
                ...
                0.,       0.,  ..., 1.,  0.            ]
  ```

  Args:
    coefficients: float `Tensor` of shape `concat([batch_shape, [order]])`.

  Returns:
    ar_matrix: float `Tensor` with shape `concat([batch_shape,
    [order, order]])`.
  """

  arg_1 = tf.expand_dims(arg_0, -2)
  arg_2 = dist_util.prefer_static_shape(arg_0)
  arg_3, arg_4 = arg_2[:-1], arg_2[-1]
  arg_5 = tf.concat([
      tf.eye(arg_4 - 1, dtype=arg_0.dtype, arg_3=arg_3),
      tf.zeros(tf.concat([arg_3, (arg_4 - 1, 1)], axis=0),
               dtype=arg_0.dtype)
  ], axis=-1)
  arg_6 = tf.concat([arg_1, arg_5], axis=-2)
  return arg_6

Build transition matrix for an autoregressive StateSpaceModel .


return [o for o in self.objects if isinstance(o.node, astroid.Module)]

def Func ( arg_0 ) : return [ arg_1 for arg_1 in arg_0 . objects if isinstance ( arg_1 . node , astroid . Module ) ]

def Func(arg_0):
        """return all module nodes in the diagram"""
        return [arg_1 for arg_1 in arg_0.objects if isinstance(arg_1.node, astroid.Module)]


def Func(arg_0):
        """
        Grabs readable PNG file pointer
        """
        arg_1 = Request(str(arg_0))
        try:
            return Func(arg_1)
        except HTTPError:
            _print('The server couldn\'t fulfill the request.')
        except URLError:
            _print('We failed to reach a server.')


def Func(arg_0):
  """Loads NIPS 2011 conference papers.

  The NIPS 1987-2015 data set is in the form of a 11,463 x 5,812 matrix of
  per-paper word counts, containing 11,463 words and 5,811 NIPS conference
  papers (Perrone et al., 2016). We subset to papers in 2011 and words appearing
  in at least two documents and having a total word count of at least 10.

  Built from the Observations Python package.

  Args:
    path: str.
      Path to directory which either stores file or otherwise file will
      be downloaded and extracted there. Filename is `NIPS_1987-2015.csv`.

  Returns:
    bag_of_words: np.ndarray of shape [num_documents, num_words]. Each element
      denotes the number of occurrences of a specific word in a specific
      document.
    words: List of strings, denoting the words for `bag_of_words`'s columns.
  """
  arg_0 = os.path.expanduser(arg_0)
  arg_1 = "NIPS_1987-2015.csv"
  arg_2 = os.path.join(arg_0, arg_1)
  if not os.path.exists(arg_2):
    arg_3 = ("https://archive.ics.uci.edu/ml/machine-learning-databases/"
           "00371/NIPS_1987-2015.csv")
    if not tf.io.gfile.exists(arg_0):
      tf.io.gfile.makedirs(arg_0)
    print("Downloading %s to %s" % (arg_3, arg_2))
    urllib.request.urlretrieve(arg_3, arg_2)

  with open(arg_2) as f:
    arg_4 = csv.reader(f)
    arg_5 = next(arg_4)[1:]
    arg_6 = []
    arg_7 = []
    for arg_8 in arg_4:
      arg_6.append(arg_8[0])
      arg_7.append(arg_8[1:])

  arg_7 = np.array(arg_7, dtype=np.int)

  # Subset to documents in 2011 and words appearing in at least two documents
  # and have a total word count of at least 10.
  arg_9 = [i for i, document in enumerate(arg_5)
             if document.startswith("2011")]
  arg_5 = [arg_5[doc] for doc in arg_9]
  arg_7 = arg_7[:, arg_9]
  arg_10 = np.logical_and(np.sum(arg_7 != 0, 1) >= 2,
                            np.sum(arg_7, 1) >= 10)
  arg_6 = [word for word, idx in zip(arg_6, arg_10) if idx]
  arg_11 = arg_7[arg_10, :].T
  return arg_11, arg_6


def Func(arg_0, arg_1, arg_2):
        """
        A subclass can override this method to provide additional parseing or
        validation. It should call the parent method first.

        :param bpmn: an lxml tree of the bpmn content

        :param filename: the source file name

        This must return the updated bpmn object (or a replacement)
        """
        arg_1 = arg_0._call_editor_hook(
            'Func', arg_1, arg_2) or arg_1

        return arg_1

A subclass can override this method to provide additional parseing or validation . It should call the parent method first .


def Func(arg_0, arg_1=1):
    """
    Go to the next exercise.
    """
    arg_2 = None
    try:
        arg_2 = Exercise.get_selected()
        if arg_2.course.tid != arg_0.tid:
            arg_2 = None
    except NoExerciseSelected:
        pass

    if arg_2 is None:
        arg_2 = arg_0.exercises.first()
    else:
        try:
            arg_2 = Exercise.get(Exercise.id == arg_2.id + arg_1)
        except peewee.DoesNotExist:
            print("There are no more exercises in this course.")
            return False

    arg_2.set_select()
    list_all(single=arg_2)


(model, filename, optimizer=None, meta=None)

def Func(arg_0, arg_1, arg_2=None, arg_3=None):
    """Save checkpoint to file.

    The checkpoint will have 3 fields: ``meta``, ``state_dict`` and
    ``optimizer``. By default ``meta`` will contain version and time info.

    Args:
        model (Module): Module whose params are to be saved.
        filename (str): Checkpoint filename.
        optimizer (:obj:`Optimizer`, optional): Optimizer to be saved.
        meta (dict, optional): Metadata to be saved in checkpoint.
    """
    if arg_3 is None:
        arg_3 = {}
    elif not isinstance(arg_3, dict):
        raise TypeError('meta must be a dict or None, but got {}'.format(
            type(arg_3)))
    arg_3.update(mmcv_version=mmcv.__version__, time=time.asctime())

    mmcv.mkdir_or_exist(osp.dirname(arg_1))
    if hasattr(arg_0, 'module'):
        arg_0 = arg_0.module

    arg_4 = {
        'meta': arg_3,
        'state_dict': weights_to_cpu(arg_0.state_dict())
    }
    if arg_2 is not None:
        arg_4['optimizer'] = arg_2.state_dict()

    torch.save(arg_4, arg_1)


def Func ( arg_0 , arg_1 ) : if not arg_1 . is_method ( ) : return arg_0 . _check_useless_super_delegation ( arg_1 ) arg_2 = arg_1 . parent . frame ( ) arg_0 . _meth_could_be_func = True arg_0 . _check_first_arg_for_type ( arg_1 , arg_2 . type == "metaclass" ) if arg_1 . name == "__init__" : arg_0 . _check_init ( arg_1 ) return for arg_4 in arg_2 . local_attr_ancestors ( arg_1 . name ) : try : arg_5 = arg_4 [ arg_1 . name ] except KeyError : continue if not isinstance ( arg_5 , astroid . FunctionDef ) : continue arg_0 . _check_signature ( arg_1 , arg_5 , "overridden" , arg_2 ) break if arg_1 . decorators : for arg_6 in arg_1 . decorators . nodes : if isinstance ( arg_6 , astroid . Attribute ) and arg_6 . attrname in ( "getter" , "setter" , "deleter" , ) : return if isinstance ( arg_6 , astroid . Name ) : if arg_6 . name == "property" : return arg_7 = safe_infer ( arg_6 ) if not arg_7 : return if isinstance ( arg_7 , astroid . FunctionDef ) : try : arg_7 = next ( arg_7 . infer_call_result ( arg_7 ) ) except astroid . InferenceError : return try : if ( isinstance ( arg_7 , ( astroid . Instance , astroid . ClassDef ) ) and arg_7 . getattr ( "__get__" ) and arg_7 . getattr ( "__set__" ) ) : return except astroid . AttributeInferenceError : pass try : arg_4 = arg_2 . instance_attr ( arg_1 . name ) [ 0 ] arg_8 = arg_4 . frame ( ) if ( isinstance ( arg_8 , astroid . FunctionDef ) and arg_8 . type == "method" ) : arg_8 = arg_8 . parent . frame ( ) if isinstance ( arg_8 , astroid . ClassDef ) and arg_2 . is_subtype_of ( arg_8 . qname ( ) ) : arg_9 = ( arg_4 . root ( ) . name , arg_4 . fromlineno ) arg_0 . add_message ( "method-hidden" , arg_9 = arg_9 , arg_1 = arg_1 ) except astroid . NotFoundError : pass

def Func(arg_0, arg_1):
        """check method arguments, overriding"""
        # ignore actual functions
        if not arg_1.is_method():
            return

        arg_0._check_useless_super_delegation(arg_1)

        arg_2 = arg_1.parent.frame()
        arg_0._meth_could_be_func = True
        # check first argument is self if this is actually a method
        arg_0._check_first_arg_for_type(arg_1, arg_2.type == "metaclass")
        if arg_1.name == "__init__":
            arg_0._check_init(arg_1)
            return
        # check signature if the method overloads inherited method
        for arg_4 in arg_2.local_attr_ancestors(arg_1.name):
            # get astroid for the searched method
            try:
                arg_5 = arg_4[arg_1.name]
            except KeyError:
                # we have found the method but it's not in the local
                # dictionary.
                # This may happen with astroid build from living objects
                continue
            if not isinstance(arg_5, astroid.FunctionDef):
                continue
            arg_0._check_signature(arg_1, arg_5, "overridden", arg_2)
            break
        if arg_1.decorators:
            for arg_6 in arg_1.decorators.nodes:
                if isinstance(arg_6, astroid.Attribute) and arg_6.attrname in (
                    "getter",
                    "setter",
                    "deleter",
                ):
                    # attribute affectation will call this method, not hiding it
                    return
                if isinstance(arg_6, astroid.Name):
                    if arg_6.name == "property":
                        # attribute affectation will either call a setter or raise
                        # an attribute error, anyway not hiding the function
                        return

                # Infer the decorator and see if it returns something useful
                arg_7 = safe_infer(arg_6)
                if not arg_7:
                    return
                if isinstance(arg_7, astroid.FunctionDef):
                    # Okay, it's a decorator, let's see what it can infer.
                    try:
                        arg_7 = next(arg_7.infer_call_result(arg_7))
                    except astroid.InferenceError:
                        return
                try:
                    if (
                        isinstance(arg_7, (astroid.Instance, astroid.ClassDef))
                        and arg_7.getattr("__get__")
                        and arg_7.getattr("__set__")
                    ):
                        return
                except astroid.AttributeInferenceError:
                    pass

        # check if the method is hidden by an attribute
        try:
            arg_4 = arg_2.instance_attr(arg_1.name)[0]  # XXX
            arg_8 = arg_4.frame()
            if (
                isinstance(arg_8, astroid.FunctionDef)
                and arg_8.type == "method"
            ):
                arg_8 = arg_8.parent.frame()
            if isinstance(arg_8, astroid.ClassDef) and arg_2.is_subtype_of(
                arg_8.qname()
            ):
                arg_9 = (arg_4.root().name, arg_4.fromlineno)
                arg_0.add_message("method-hidden", arg_9=arg_9, arg_1=arg_1)
        except astroid.NotFoundError:
            pass


def
Func
(
arg_0
,
arg_1
)
:
if
not
arg_0
[
arg_1
]
in
{
'e'
,
'E'
}
:
if
arg_0
[
arg_1
]
in
IDENTIFIER_PART
:
raise
SyntaxError
(
'Invalid number literal!'
)
return
arg_1
arg_1
+=
1
if
arg_0
[
arg_1
]
in
{
'-'
,
'+'
}
:
arg_1
+=
1
arg_2
=
False
while
arg_0
[
arg_1
]
in
NUMS
:
arg_2
=
True
arg_1
+=
1
if
not
arg_2
or
arg_0
[
arg_1
]
in
IDENTIFIER_PART
:
raise
SyntaxError
(
'Invalid number literal!'
)
return
arg_1

def Func(arg_0, arg_1):
    """returns end of exponential, raises SyntaxError if failed"""
    if not arg_0[arg_1] in {'e', 'E'}:
        if arg_0[arg_1] in IDENTIFIER_PART:
            raise SyntaxError('Invalid number literal!')
        return arg_1
    arg_1 += 1
    if arg_0[arg_1] in {'-', '+'}:
        arg_1 += 1
    arg_2 = False
    # we need at least one dig after exponent
    while arg_0[arg_1] in NUMS:
        arg_2 = True
        arg_1 += 1
    if not arg_2 or arg_0[arg_1] in IDENTIFIER_PART:
        raise SyntaxError('Invalid number literal!')
    return arg_1

returns end of exponential raises SyntaxError if failed


def Func ( ) : arg_0 = asiodnp3 . OutstationStackConfig ( opendnp3 . DatabaseSizes . AllTypes ( 10 ) ) arg_0 . outstation . eventBufferConfig = opendnp3 . EventBufferConfig ( ) . AllTypes ( 10 ) arg_0 . outstation . params . allowUnsolicited = True arg_0 . link . LocalAddr = 10 arg_0 . link . RemoteAddr = 1 arg_0 . link . KeepAliveTimeout = openpal . TimeDuration ( ) . Max ( ) return arg_0

def Func():
        """Set up the OpenDNP3 configuration."""
        arg_0 = asiodnp3.OutstationStackConfig(opendnp3.DatabaseSizes.AllTypes(10))
        arg_0.outstation.eventBufferConfig = opendnp3.EventBufferConfig().AllTypes(10)
        arg_0.outstation.params.allowUnsolicited = True
        arg_0.link.LocalAddr = 10
        arg_0.link.RemoteAddr = 1
        arg_0.link.KeepAliveTimeout = openpal.TimeDuration().Max()
        return arg_0


def Func ( arg_0 ) : arg_1 = { } arg_2 = ( 'storage_service' , 'trajectory' , 'environment' ) for arg_3 in arg_2 : arg_1 . update ( arg_0 . _collect_section ( arg_3 ) ) return arg_1

def Func(arg_0):
        """Collects all info from three sections"""
        arg_1 = {}
        arg_2 = ('storage_service', 'trajectory', 'environment')
        for arg_3 in arg_2:
            arg_1.update(arg_0._collect_section(arg_3))
        return arg_1


def Func(arg_0):
		"""
		Check whether the tokens are set and request new ones if not
		"""
		try:
			arg_0._get_value(CONFIGKEY_TOKEN)
			arg_0._get_value(CONFIGKEY_REFRESH_TOKEN)
			arg_0._get_value(CONFIGKEY_REFRESHABLE)
		except KeyError:
			arg_0._log("Request new Token (CTP)")
			arg_0._get_new_access_information()


def Func ( arg_0 , arg_1 , arg_2 , ** arg_3 ) : if arg_1 is None or arg_2 is None : return { } arg_4 = { } arg_5 = ( ( arg_0 . _reverse_rel_name ( arg_2 ) , arg_1 ) , ) arg_4 [ 'query' ] = arg_5 if arg_3 . get ( 'workflow_job_template' , None ) is None : arg_6 = arg_0 . read ( pk = arg_1 ) [ 'results' ] [ 0 ] arg_4 [ 'workflow_job_template' ] = arg_6 [ 'workflow_job_template' ] return arg_4

def Func(arg_0, arg_1, arg_2, **arg_3):
        """
        Returns filtering parameters to limit a search to the children
        of a particular node by a particular relationship.
        """
        if arg_1 is None or arg_2 is None:
            return {}
        arg_4 = {}
        arg_5 = ((arg_0._reverse_rel_name(arg_2), arg_1),)
        arg_4['query'] = arg_5
        if arg_3.get('workflow_job_template', None) is None:
            arg_6 = arg_0.read(pk=arg_1)['results'][0]
            arg_4['workflow_job_template'] = arg_6[
                'workflow_job_template']
        return arg_4

Returns filtering parameters to limit a search to the children of a particular node by a particular relationship .


(self, connection_dep_stop, connection_dep_time, arrival_time_target)

def Func(arg_0, arg_1, arg_2, arg_3):
        """ A helper method for scanning the footpaths. Updates self._stop_profiles accordingly"""
        for arg_4, arg_5, arg_6 in arg_0._walk_network.edges_iter(nbunch=[arg_1],
                                                               arg_6=True):
            arg_7 = arg_6['d_walk']
            arg_8 = arg_2 - arg_7 / arg_0._walk_speed
            arg_9 = LabelTimeSimple(departure_time=arg_8, arg_3=arg_3)
            arg_0._stop_profiles[arg_5].update_pareto_optimal_tuples(arg_9)

A helper method for scanning the footpaths . Updates self . _stop_profiles accordingly


def Func(arg_0, arg_1, arg_2=None):
        '''
        initialize the merger model with a coalescent time

        Args:
            - Tc:   a float or an iterable, if iterable another argument T of same shape is required
            - T:    an array like of same shape as Tc that specifies the time pivots corresponding to Tc
        Returns:
            - None
        '''
        if isinstance(arg_1, Iterable):
            if len(arg_1)==len(arg_2):
                arg_3 = np.concatenate(([-ttconf.BIG_NUMBER], arg_2, [ttconf.BIG_NUMBER]))
                arg_4 = np.concatenate(([arg_1[0]], arg_1, [arg_1[-1]]))
                arg_0.Tc = interp1d(arg_3,arg_4)
            else:
                arg_0.logger("need Tc values and Timepoints of equal length",2,warn=True)
                arg_0.Tc = interp1d([-ttconf.BIG_NUMBER, ttconf.BIG_NUMBER], [1e-5, 1e-5])
        else:
            arg_0.Tc = interp1d([-ttconf.BIG_NUMBER, ttconf.BIG_NUMBER],
                               [arg_1+ttconf.TINY_NUMBER, arg_1+ttconf.TINY_NUMBER])
        arg_0.calc_integral_merger_rate()


def Func ( arg_0 ) : arg_1 = { } for arg_2 in dir ( Gdk ) : arg_3 = arg_2 . upper ( ) arg_1 [ arg_3 ] = getattr ( Gdk , arg_2 ) return arg_1

def Func(arg_0):
        '''
        Return a dict in the form of

        SHOEBOT_KEY_NAME, GTK_VALUE

        Shoebot key names look like KEY_LEFT, whereas Gdk uses KEY_Left
        - Shoebot key names are derived from Nodebox 1, which was a mac
          app.
        '''
        arg_1 = {}
        for arg_2 in dir(Gdk):
            arg_3 = arg_2.upper()
            arg_1[arg_3] = getattr(Gdk, arg_2)
        return arg_1


def Func ( arg_0 ) : arg_1 = arg_0 . get_data ( "domains/" ) arg_2 = list ( ) for arg_3 in arg_1 [ 'domains' ] : arg_4 = Domain ( ** arg_3 ) arg_4 . token = arg_0 . token arg_2 . append ( arg_4 ) return arg_2

def Func(arg_0):
        """
            This function returns a list of Domain object.
        """
        arg_1 = arg_0.get_data("domains/")
        arg_2 = list()
        for arg_3 in arg_1['domains']:
            arg_4 = Domain(**arg_3)
            arg_4.token = arg_0.token
            arg_2.append(arg_4)
        return arg_2

This function returns a list of Domain object .


def Func ( arg_0 , arg_1 ) : arg_2 = json . loads ( _helpers . _from_bytes ( arg_1 ) ) if ( arg_2 . get ( 'token_expiry' ) and not isinstance ( arg_2 [ 'token_expiry' ] , datetime . datetime ) ) : try : arg_2 [ 'token_expiry' ] = datetime . datetime . strptime ( arg_2 [ 'token_expiry' ] , EXPIRY_FORMAT ) except ValueError : arg_2 [ 'token_expiry' ] = None arg_3 = arg_0 ( arg_2 [ 'access_token' ] , arg_2 [ 'client_id' ] , arg_2 [ 'client_secret' ] , arg_2 [ 'refresh_token' ] , arg_2 [ 'token_expiry' ] , arg_2 [ 'token_uri' ] , arg_2 [ 'user_agent' ] , revoke_uri = arg_2 . get ( 'revoke_uri' , None ) , id_token = arg_2 . get ( 'id_token' , None ) , id_token_jwt = arg_2 . get ( 'id_token_jwt' , None ) , token_response = arg_2 . get ( 'token_response' , None ) , scopes = arg_2 . get ( 'scopes' , None ) , token_info_uri = arg_2 . get ( 'token_info_uri' , None ) ) arg_3 . invalid = arg_2 [ 'invalid' ] return arg_3

def Func(arg_0, arg_1):
        """Instantiate a Credentials object from a JSON description of it.

        The JSON should have been produced by calling .to_json() on the object.

        Args:
            json_data: string or bytes, JSON to deserialize.

        Returns:
            An instance of a Credentials subclass.
        """
        arg_2 = json.loads(_helpers._from_bytes(arg_1))
        if (arg_2.get('token_expiry') and
                not isinstance(arg_2['token_expiry'], datetime.datetime)):
            try:
                arg_2['token_expiry'] = datetime.datetime.strptime(
                    arg_2['token_expiry'], EXPIRY_FORMAT)
            except ValueError:
                arg_2['token_expiry'] = None
        arg_3 = arg_0(
            arg_2['access_token'],
            arg_2['client_id'],
            arg_2['client_secret'],
            arg_2['refresh_token'],
            arg_2['token_expiry'],
            arg_2['token_uri'],
            arg_2['user_agent'],
            revoke_uri=arg_2.get('revoke_uri', None),
            id_token=arg_2.get('id_token', None),
            id_token_jwt=arg_2.get('id_token_jwt', None),
            token_response=arg_2.get('token_response', None),
            scopes=arg_2.get('scopes', None),
            token_info_uri=arg_2.get('token_info_uri', None))
        arg_3.invalid = arg_2['invalid']
        return arg_3

Instantiate a Credentials object from a JSON description of it .


def Func(arg_0, arg_1={}):
        """
        Creates a message

        http://dev.wheniwork.com/#create/update-message
        """
        arg_2 = "/2/messages/"
        arg_3 = arg_1

        arg_4 = arg_0._post_resource(arg_2, arg_3)
        return arg_0.message_from_json(arg_4["message"])


def Func(arg_0, arg_1=0):
        """
        Downloads the latest Raspbian image and writes it to a microSD card.

        Based on the instructions from:

        https://www.raspberrypi.org/documentation/installation/installing-images/linux.md
        """
        arg_0.assume_localhost()

        arg_1 = int(arg_1)
        arg_2 = 'SD card present at %s? ' % arg_0.env.sd_device
        if not arg_1 and not raw_input(arg_2).lower().startswith('y'):
            return

        arg_3 = arg_0.local_renderer
        arg_3.local_if_missing(
            fn='{raspbian_image_zip}',
            cmd='wget {raspbian_download_url} -O raspbian_lite_latest.zip')

        arg_3.lenv.img_fn = \
            arg_3.local("unzip -l {raspbian_image_zip} | sed -n 4p | awk '{{print $4}}'", capture=True) or '$IMG_FN'
        arg_3.local('echo {img_fn}')
        arg_3.local('[ ! -f {img_fn} ] && unzip {raspbian_image_zip} {img_fn} || true')
        arg_3.lenv.img_fn = arg_3.local('readlink -f {img_fn}', capture=True)
        arg_3.local('echo {img_fn}')

        with arg_0.settings(warn_only=True):
            arg_3.sudo('[ -d "{sd_media_mount_dir}" ] && umount {sd_media_mount_dir} || true')
        with arg_0.settings(warn_only=True):
            arg_3.sudo('[ -d "{sd_media_mount_dir2}" ] && umount {sd_media_mount_dir2} || true')

        arg_3.pc('Writing the image onto the card.')
        arg_3.sudo('time dd bs=4M if={img_fn} of={sd_device}')

        # Flush all writes to disk.
        arg_3.run('sync')

Downloads the latest Raspbian image and writes it to a microSD card .


def Func ( arg_0 , arg_1 = None , arg_2 = False ) -> list : if arg_0 is None : return [ ] if arg_1 is None : arg_1 = dict ( ) if isinstance ( arg_0 , ( str , int , float ) ) : return [ arg_1 . get ( arg_0 , arg_0 ) ] else : arg_3 = [ arg_1 . get ( item , item ) for item in _to_gen_ ( arg_0 ) ] return list ( set ( arg_3 ) ) if arg_2 else arg_3

def Func(arg_0, arg_1=None, arg_2=False) -> list:
    """
    Flatten any array of items to list

    Args:
        iterable: any array or value
        maps: map items to values
        unique: drop duplicates

    Returns:
        list: Funced list

    References:
        https://stackoverflow.com/a/40857703/1332656

    Examples:
        >>> Func('abc')
        ['abc']
        >>> Func(1)
        [1]
        >>> Func(1.)
        [1.0]
        >>> Func(['ab', 'cd', ['xy', 'zz']])
        ['ab', 'cd', 'xy', 'zz']
        >>> Func(['ab', ['xy', 'zz']], maps={'xy': '0x'})
        ['ab', '0x', 'zz']
    """
    if arg_0 is None: return []
    if arg_1 is None: arg_1 = dict()

    if isinstance(arg_0, (str, int, float)):
        return [arg_1.get(arg_0, arg_0)]

    else:
        arg_3 = [arg_1.get(item, item) for item in _to_gen_(arg_0)]
        return list(set(arg_3)) if arg_2 else arg_3

Flatten any array of items to list

    Args:
        iterable: any array or value
        maps: map items to values
        unique: drop duplicates

    Returns:
        list: flattened list

    References:
        https://stackoverflow.com/a/40857703/1332656

    Examples:
        >>> flatten('abc')
        ['abc']
        >>> flatten(1)
        [1]
        >>> flatten(1.)
        [1.0]
        >>> flatten(['ab', 'cd', ['xy', 'zz']])
        ['ab', 'cd', 'xy', 'zz']
        >>> flatten(['ab', ['xy', 'zz']], maps={'xy': '0x'})
        ['ab', '0x', 'zz']


def
Func
(
arg_0
,
arg_1
:
arg_2
)
:
if
len
(
arg_0
.
conditions
)
!=
len
(
arg_0
.
body
)
:
raise
exc
.
CompileError
(
"Conditions and body length mismatch!"
)
arg_3
=
b""
arg_4
=
len
(
arg_1
)
for
arg_5
,
arg_6
in
zip
(
arg_0
.
conditions
,
arg_0
.
body
)
:
arg_7
=
arg_5
.
to_bytecode
(
arg_1
)
arg_3
+=
arg_7
arg_8
=
compiler
.
compile_bytecode
(
arg_6
)
arg_9
=
len
(
arg_8
)
arg_10
=
arg_4
+
len
(
arg_7
)
+
arg_9
+
1
arg_3
+=
generate_simple_call
(
tokens
.
POP_JUMP_IF_FALSE
,
arg_10
)
arg_3
+=
arg_8
arg_4
=
len
(
arg_1
)
+
len
(
arg_3
)
return
arg_3

def Func(arg_0, arg_1: arg_2):
        """
        Complex code ahead. Comments have been added in as needed.
        """
        # First, validate the lengths.
        if len(arg_0.conditions) != len(arg_0.body):
            raise exc.CompileError("Conditions and body length mismatch!")

        arg_3 = b""

        arg_4 = len(arg_1)

        # Loop over the conditions and bodies
        for arg_5, arg_6 in zip(arg_0.conditions, arg_0.body):
            # Generate the conditional data.
            arg_7 = arg_5.to_bytecode(arg_1)
            arg_3 += arg_7
            # Complex calculation. First, generate the bytecode for all tokens in the body. Then
            # we calculate the len() of that. We create a POP_JUMP_IF_FALSE operation that jumps
            # to the instructions after the body code + 3 for the pop call. This is done for all
            # chained IF calls, as if it was an elif call. Else calls are not possible to be
            # auto-generated, but it is possible to emulate them using an elif call that checks
            # for the opposite of the above IF.

            # Call the _compile_func method from compiler to compile the body.
            arg_8 = compiler.compile_bytecode(arg_6)

            arg_9 = len(arg_8)
            # Add together the lengths.
            arg_10 = arg_4 + len(arg_7) + arg_9 + 1
            # Generate the POP_JUMP_IF_FALSE instruction
            arg_3 += generate_simple_call(tokens.POP_JUMP_IF_FALSE, arg_10)
            # Add the body_bc
            arg_3 += arg_8

            # Update previous_len
            arg_4 = len(arg_1) + len(arg_3)

        return arg_3

Complex code ahead . Comments have been added in as needed .


(
        self, node_type, node, report_missing=True, confidence=interfaces.HIGH
    )

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = True , arg_4 = arg_5 . HIGH ) : arg_7 = arg_2 . doc if arg_7 is None : if not arg_3 : return arg_8 = utils . get_node_last_lineno ( arg_2 ) - arg_2 . lineno if arg_1 == "module" and not arg_8 : return arg_9 = arg_0 . config . docstring_min_length if arg_1 != "module" and arg_9 > - 1 and arg_8 < arg_9 : return arg_0 . stats [ "undocumented_" + arg_1 ] += 1 if ( arg_2 . body and isinstance ( arg_2 . body [ 0 ] , astroid . Expr ) and isinstance ( arg_2 . body [ 0 ] . value , astroid . Call ) ) : arg_10 = utils . safe_infer ( arg_2 . body [ 0 ] . value . func ) if isinstance ( arg_10 , astroid . BoundMethod ) and isinstance ( arg_10 . bound , astroid . Instance ) : if PY3K and arg_10 . bound . name == "str" : return if arg_10 . bound . name in ( "str" , "unicode" , "bytes" ) : return arg_0 . add_message ( "missing-docstring" , arg_2 = arg_2 , args = ( arg_1 , ) , arg_4 = arg_4 ) elif not arg_7 . strip ( ) : arg_0 . stats [ "undocumented_" + arg_1 ] += 1 arg_0 . add_message ( "empty-docstring" , arg_2 = arg_2 , args = ( arg_1 , ) , arg_4 = arg_4 )

def Func(
        arg_0, arg_1, arg_2, arg_3=True, arg_4=arg_5.HIGH
    ):
        """check the node has a non empty docstring"""
        arg_7 = arg_2.doc
        if arg_7 is None:
            if not arg_3:
                return
            arg_8 = utils.get_node_last_lineno(arg_2) - arg_2.lineno

            if arg_1 == "module" and not arg_8:
                # If the module has no body, there's no reason
                # to require a docstring.
                return
            arg_9 = arg_0.config.docstring_min_length

            if arg_1 != "module" and arg_9 > -1 and arg_8 < arg_9:
                return
            arg_0.stats["undocumented_" + arg_1] += 1
            if (
                arg_2.body
                and isinstance(arg_2.body[0], astroid.Expr)
                and isinstance(arg_2.body[0].value, astroid.Call)
            ):
                # Most likely a string with a format call. Let's see.
                arg_10 = utils.safe_infer(arg_2.body[0].value.func)
                if isinstance(arg_10, astroid.BoundMethod) and isinstance(
                    arg_10.bound, astroid.Instance
                ):
                    # Strings in Python 3, others in Python 2.
                    if PY3K and arg_10.bound.name == "str":
                        return
                    if arg_10.bound.name in ("str", "unicode", "bytes"):
                        return
            arg_0.add_message(
                "missing-docstring", arg_2=arg_2, args=(arg_1,), arg_4=arg_4
            )
        elif not arg_7.strip():
            arg_0.stats["undocumented_" + arg_1] += 1
            arg_0.add_message(
                "empty-docstring", arg_2=arg_2, args=(arg_1,), arg_4=arg_4
            )


def Func ( ) : register_type ( type , pipe . map ) register_type ( types . FunctionType , pipe . map ) register_type ( types . MethodType , pipe . map ) register_type ( tuple , seq ) register_type ( list , seq ) register_type ( types . GeneratorType , seq ) register_type ( string_type , sh ) register_type ( unicode_type , sh ) register_type ( file_type , fileobj ) if is_py3 : register_type ( range , seq ) register_type ( map , seq )

def Func():
    """Regiser all default type-to-pipe convertors."""
    register_type(type, pipe.map)
    register_type(types.FunctionType, pipe.map)
    register_type(types.MethodType, pipe.map)
    register_type(tuple, seq)
    register_type(list, seq)
    register_type(types.GeneratorType, seq)
    register_type(string_type, sh)
    register_type(unicode_type, sh)
    register_type(file_type, fileobj)

    if is_py3:
        register_type(range, seq)
        register_type(map, seq)

Regiser all default type - to - pipe convertors .


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in arg_0 : if isinstance ( arg_2 , _ProductKernel ) : arg_1 += arg_2 . kernels else : arg_1 . append ( arg_2 ) return arg_1

def Func(arg_0):
  """Flatten a list of kernels which may contain _ProductKernel instances.

  Args:
    kernels: Python list of `PositiveSemidefiniteKernel` instances

  Returns:
    Python list containing the elements of kernels, with any _ProductKernel
    instances replaced by their `kernels` property contents.
  """
  arg_1 = []
  for arg_2 in arg_0:
    if isinstance(arg_2, _ProductKernel):
      arg_1 += arg_2.kernels
    else:
      arg_1.append(arg_2)
  return arg_1

Flatten a list of kernels which may contain _ProductKernel instances .


(self, x=None, y=None, training_frame=None, offset_column=None, fold_column=None,
              weights_column=None, validation_frame=None, max_runtime_secs=None, ignored_columns=None,
              model_id=None, verbose=False)

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None, arg_5=None,
              arg_6=None, arg_7=None, arg_8=None, arg_9=None,
              arg_10=None, arg_11=False):
        """
        Train the H2O model.

        :param x: A list of column names or indices indicating the predictor columns.
        :param y: An index or a column name indicating the response column.
        :param H2OFrame Funcing_frame: The H2OFrame having the columns indicated by x and y (as well as any
            additional columns specified by fold, offset, and weights).
        :param offset_column: The name or index of the column in Funcing_frame that holds the offsets.
        :param fold_column: The name or index of the column in Funcing_frame that holds the per-row fold
            assignments.
        :param weights_column: The name or index of the column in Funcing_frame that holds the per-row weights.
        :param validation_frame: H2OFrame with validation data to be scored on while Funcing.
        :param float max_runtime_secs: Maximum allowed runtime in seconds for model Funcing. Use 0 to disable.
        :param bool verbose: Print scoring history to stdout. Defaults to False.
        """
        arg_0._Func(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_7=arg_7, arg_8=arg_8,
                    arg_9=arg_9, arg_10=arg_10, arg_11=arg_11)

Train the H2O model.

        :param x: A list of column names or indices indicating the predictor columns.
        :param y: An index or a column name indicating the response column.
        :param H2OFrame training_frame: The H2OFrame having the columns indicated by x and y (as well as any
            additional columns specified by fold, offset, and weights).
        :param offset_column: The name or index of the column in training_frame that holds the offsets.
        :param fold_column: The name or index of the column in training_frame that holds the per-row fold
            assignments.
        :param weights_column: The name or index of the column in training_frame that holds the per-row weights.
        :param validation_frame: H2OFrame with validation data to be scored on while training.
        :param float max_runtime_secs: Maximum allowed runtime in seconds for model training. Use 0 to disable.
        :param bool verbose: Print scoring history to stdout. Defaults to False.