return {"$" + class_name: self._json_convert(obj.tolist())}

def Func ( arg_0 , arg_1 , arg_2 = arg_3 ) : return { "$" + arg_2 : arg_0 . _json_convert ( arg_1 . tolist ( ) ) }

def Func(arg_0, arg_1, arg_2=arg_3):
        """
        ``numpy.ndarray`` dumper.
        """
        return {"$" + arg_2: arg_0._json_convert(arg_1.tolist())}


def Func ( arg_0 , arg_1 ) : if arg_1 . name in arg_0 . properties : del arg_0 . properties [ arg_1 . name ]

def Func(arg_0, arg_1):
        """
        Remove a property from this thing.

        property_ -- property to remove
        """
        if arg_1.name in arg_0.properties:
            del arg_0.properties[arg_1.name]


r'''Method to calculate `a_alpha` and its first and second
        derivatives for this EOS. Returns `a_alpha`, `da_alpha_dT`, and
        `d2a_alpha_dT2`. See `GCEOS.a_alpha_and_derivatives` for more
        documentation. Uses the set values of `Tc`, `omega`, and `a`.

        Because of its similarity for the TWUPR EOS, this has been moved to an
        external `TWU_a_alpha_common` function. See it for further
        documentation.

return TWU_a_alpha_common(T, self.Tc, self.omega, self.a, full=full, quick=quick, method='SRK')

def Func ( arg_0 , arg_1 , arg_2 = True , arg_3 = True ) : return TWU_a_alpha_common ( arg_1 , arg_0 . Tc , arg_0 . omega , arg_0 . a , arg_2 = arg_2 , arg_3 = arg_3 , method = 'SRK' )

def Func(arg_0, arg_1, arg_2=True, arg_3=True):
        r'''Method to calculate `a_alpha` and its first and second
        derivatives for this EOS. Returns `a_alpha`, `da_alpha_dT`, and
        `d2a_alpha_dT2`. See `GCEOS.Func` for more
        documentation. Uses the set values of `Tc`, `omega`, and `a`.

        Because of its similarity for the TWUPR EOS, this has been moved to an
        external `TWU_a_alpha_common` function. See it for further
        documentation.
        '''
        return TWU_a_alpha_common(arg_1, arg_0.Tc, arg_0.omega, arg_0.a, arg_2=arg_2, arg_3=arg_3, method='SRK')

r Method to calculate a_alpha and its first and second derivatives for this EOS . Returns a_alpha da_alpha_dT and d2a_alpha_dT2 . See GCEOS . a_alpha_and_derivatives for more documentation . Uses the set values of Tc omega and a . Because of its similarity for the TWUPR EOS this has been moved to an external TWU_a_alpha_common function . See it for further documentation .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_0 . set_validation ( batch_size = arg_2 . batchSize , val_rdd = arg_1 , trigger = EveryEpoch ( ) , val_method = [ Top1Accuracy ( ) ] ) arg_0 . set_checkpoint ( EveryEpoch ( ) , arg_2 . checkpointPath )

def Func(arg_0, arg_1, arg_2):
    """
    Set validation and checkpoint for distributed optimizer.
    """
    arg_0.set_validation(
        batch_size=arg_2.batchSize,
        val_rdd=arg_1,
        trigger=EveryEpoch(),
        val_method=[Top1Accuracy()]
    )
    arg_0.set_checkpoint(EveryEpoch(), arg_2.checkpointPath)

Set validation and checkpoint for distributed optimizer .


def Func(arg_0):
    """Return ArgumentParser with any extra arguments."""
    arg_1 = argparse.ArgumentParser(
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    )
    arg_2 = appdirs.AppDirs('hangups', 'hangups')
    arg_3 = os.path.join(arg_2.user_cache_dir, 'refresh_token.txt')
    arg_1.add_argument(
        '--token-path', default=arg_3,
        help='path used to store OAuth refresh token'
    )
    arg_1.add_argument(
        '-d', '--debug', action='store_true',
        help='log detailed debugging messages'
    )
    for arg_4 in arg_0:
        arg_1.add_argument(arg_4, required=True)
    return arg_1

Return ArgumentParser with any extra arguments .


def
Func
(
arg_0
,
arg_1
)
:
logger
.
debug
(
"Diagram canvas changed!"
)
arg_2
=
arg_0
.
diagram_canvas
for
arg_3
in
arg_0
.
tools
:
if
arg_2
is
not
:
print
"Adding tool: %s"
%
arg_3
arg_2
.
tools
.
append
(
arg_3
(
arg_2
)
)

def Func(arg_0, arg_1):
        """ Handles the diagram canvas being set """

        logger.debug("Diagram canvas changed!")
        arg_2 = arg_0.diagram_canvas

        for arg_3 in arg_0.tools:
            if arg_2 is not None:
                print "Adding tool: %s" % arg_3
                arg_2.tools.append(arg_3(arg_2))


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . get ( arg_1 , arg_2 ) arg_4 = [ ] for arg_5 in arg_3 . split ( '\n' ) : for arg_6 in arg_5 . split ( ',' ) : arg_6 = arg_6 . strip ( ) if arg_6 : arg_4 . append ( arg_6 ) return arg_4

def Func(arg_0, arg_1, arg_2):
        """Read a list of strings.

        The value of `section` and `option` is treated as a comma- and newline-
        separated list of strings.  Each value is stripped of whitespace.

        Returns the list of strings.

        """
        arg_3 = arg_0.get(arg_1, arg_2)
        arg_4 = []
        for arg_5 in arg_3.split('\n'):
            for arg_6 in arg_5.split(','):
                arg_6 = arg_6.strip()
                if arg_6:
                    arg_4.append(arg_6)
        return arg_4


def Func ( arg_0 , arg_1 ) : arg_2 = sum ( map ( arg_0 . count , [ "c" , "g" ] ) ) return arg_2 / arg_1

def Func(arg_0, arg_1):
        """Get proportion of GC from a string

        Parameters
        ----------
        s : str
            Arbitrary string

        Returns
        -------
        x : float
            GC proportion.
        """

        arg_2 = sum(map(arg_0.count, ["c", "g"]))

        return arg_2 / arg_1


return HTTPError(url, status, message, headers, StringIO(body))

def
Func
(
arg_0
)
:
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
,
arg_6
=
urlparse
(
arg_0
)
arg_7
=
url2pathname
(
arg_3
)
if
os
.
path
.
isfile
(
arg_7
)
:
return
urllib2
.
urlopen
(
arg_0
)
elif
arg_3
.
endswith
(
'/'
)
and
os
.
path
.
isdir
(
arg_7
)
:
arg_8
=
[
]
for
arg_9
in
os
.
listdir
(
arg_7
)
:
if
arg_9
==
'index.html'
:
with
open
(
os
.
path
.
join
(
arg_7
,
arg_9
)
,
'r'
)
as
fp
:
arg_10
=
fp
.
read
(
)
break
elif
os
.
path
.
isdir
(
os
.
path
.
join
(
arg_7
,
arg_9
)
)
:
arg_9
+=
'/'
arg_8
.
append
(
"%s"
%
(
arg_9
,
arg_9
)
)
else
:
arg_10
=
(
"<title>%s</title>"
%
arg_0
)
+
"%s"
%
'\n'
.
join
(
arg_8
)
arg_11
,
arg_12
=
200
,
"OK"
else
:
arg_11
,
arg_12
,
arg_10
=
404
,
"Path not found"
,
"Not found"
arg_13
=
{
'content-type'
:
'text/html'
}
return
HTTPError
(
arg_0
,
arg_11
,
arg_12
,
arg_13
,
StringIO
(
arg_10
)
)

def Func(arg_0):
    """Read a local path, with special support for directories"""
    arg_1, arg_2, arg_3, arg_4, arg_5, arg_6 = urlparse(arg_0)
    arg_7 = url2pathname(arg_3)
    if os.path.isfile(arg_7):
        return urllib2.urlopen(arg_0)
    elif arg_3.endswith('/') and os.path.isdir(arg_7):
        arg_8 = []
        for arg_9 in os.listdir(arg_7):
            if arg_9=='index.html':
                with open(os.path.join(arg_7,arg_9),'r') as fp:
                    arg_10 = fp.read()
                break
            elif os.path.isdir(os.path.join(arg_7,arg_9)):
                arg_9+='/'
            arg_8.append("%s" % (arg_9,arg_9))
        else:
            arg_10 = ("<title>%s</title>" % arg_0) + \
                "%s" % '\n'.join(arg_8)
        arg_11, arg_12 = 200, "OK"
    else:
        arg_11, arg_12, arg_10 = 404, "Path not found", "Not found"

    arg_13 = {'content-type': 'text/html'}
    return HTTPError(arg_0, arg_11, arg_12, arg_13, StringIO(arg_10))

Read a local path with special support for directories


return [self._i2p(i, j) for i in ind for j in ['z', 'y', 'x']]

def Func ( arg_0 , arg_1 ) : arg_1 = arg_0 . _vps ( listify ( arg_1 ) ) return [ arg_0 . _i2p ( arg_2 , arg_3 ) for arg_2 in arg_1 for arg_3 in [ 'z' , 'y' , 'x' ] ]

def Func(arg_0, arg_1):
        """ Get position of one or more particles """
        arg_1 = arg_0._vps(listify(arg_1))
        return [arg_0._i2p(arg_2, arg_3) for arg_2 in arg_1 for arg_3 in ['z', 'y', 'x']]


def Func ( arg_0 ) : arg_1 = arg_0 . declaration if arg_1 . show_location : arg_0 . set_show_location ( arg_1 . show_location ) if arg_1 . show_traffic : arg_0 . set_show_traffic ( arg_1 . show_traffic ) if arg_1 . show_indoors : arg_0 . set_show_indoors ( arg_1 . show_indoors ) if arg_1 . show_buildings : arg_0 . set_show_buildings ( arg_1 . show_buildings ) arg_2 = arg_0 . map arg_3 = arg_2 . getId ( ) arg_2 . onCameraChange . connect ( arg_0 . on_camera_changed ) arg_2 . onCameraMoveStarted . connect ( arg_0 . on_camera_move_started ) arg_2 . onCameraMoveCanceled . connect ( arg_0 . on_camera_move_stopped ) arg_2 . onCameraIdle . connect ( arg_0 . on_camera_move_stopped ) arg_2 . setOnCameraChangeListener ( arg_3 ) arg_2 . setOnCameraMoveStartedListener ( arg_3 ) arg_2 . setOnCameraMoveCanceledListener ( arg_3 ) arg_2 . setOnCameraIdleListener ( arg_3 ) arg_2 . onMapClick . connect ( arg_0 . on_map_clicked ) arg_2 . setOnMapClickListener ( arg_3 ) arg_2 . onMapLongClick . connect ( arg_0 . on_map_long_clicked ) arg_2 . setOnMapLongClickListener ( arg_3 ) arg_2 . onMarkerClick . connect ( arg_0 . on_marker_clicked ) arg_2 . setOnMarkerClickListener ( arg_0 . map . getId ( ) ) arg_2 . onMarkerDragStart . connect ( arg_0 . on_marker_drag_start ) arg_2 . onMarkerDrag . connect ( arg_0 . on_marker_drag ) arg_2 . onMarkerDragEnd . connect ( arg_0 . on_marker_drag_end ) arg_2 . setOnMarkerDragListener ( arg_3 ) arg_2 . onInfoWindowClick . connect ( arg_0 . on_info_window_clicked ) arg_2 . onInfoWindowLongClick . connect ( arg_0 . on_info_window_long_clicked ) arg_2 . onInfoWindowClose . connect ( arg_0 . on_info_window_closed ) arg_2 . setOnInfoWindowClickListener ( arg_3 ) arg_2 . setOnInfoWindowCloseListener ( arg_3 ) arg_2 . setOnInfoWindowLongClickListener ( arg_3 ) arg_2 . onPolygonClick . connect ( arg_0 . on_poly_clicked ) arg_2 . onPolylineClick . connect ( arg_0 . on_poly_clicked ) arg_2 . setOnPolygonClickListener ( arg_3 ) arg_2 . setOnPolylineClickListener ( arg_3 ) arg_2 . onCircleClick . connect ( arg_0 . on_circle_clicked ) arg_2 . setOnCircleClickListener ( arg_3 )

def Func(arg_0):
        """ Add markers, polys, callouts, etc.."""
        arg_1 = arg_0.declaration
        if arg_1.show_location:
            arg_0.set_show_location(arg_1.show_location)
        if arg_1.show_traffic:
            arg_0.set_show_traffic(arg_1.show_traffic)
        if arg_1.show_indoors:
            arg_0.set_show_indoors(arg_1.show_indoors)
        if arg_1.show_buildings:
            arg_0.set_show_buildings(arg_1.show_buildings)

        #: Local ref access is faster
        arg_2 = arg_0.map
        arg_3 = arg_2.getId()

        #: Connect signals
        #: Camera
        arg_2.onCameraChange.connect(arg_0.on_camera_changed)
        arg_2.onCameraMoveStarted.connect(arg_0.on_camera_move_started)
        arg_2.onCameraMoveCanceled.connect(arg_0.on_camera_move_stopped)
        arg_2.onCameraIdle.connect(arg_0.on_camera_move_stopped)
        arg_2.setOnCameraChangeListener(arg_3)
        arg_2.setOnCameraMoveStartedListener(arg_3)
        arg_2.setOnCameraMoveCanceledListener(arg_3)
        arg_2.setOnCameraIdleListener(arg_3)

        #: Clicks
        arg_2.onMapClick.connect(arg_0.on_map_clicked)
        arg_2.setOnMapClickListener(arg_3)
        arg_2.onMapLongClick.connect(arg_0.on_map_long_clicked)
        arg_2.setOnMapLongClickListener(arg_3)

        #: Markers
        arg_2.onMarkerClick.connect(arg_0.on_marker_clicked)
        arg_2.setOnMarkerClickListener(arg_0.map.getId())
        arg_2.onMarkerDragStart.connect(arg_0.on_marker_drag_start)
        arg_2.onMarkerDrag.connect(arg_0.on_marker_drag)
        arg_2.onMarkerDragEnd.connect(arg_0.on_marker_drag_end)
        arg_2.setOnMarkerDragListener(arg_3)

        #: Info window
        arg_2.onInfoWindowClick.connect(arg_0.on_info_window_clicked)
        arg_2.onInfoWindowLongClick.connect(arg_0.on_info_window_long_clicked)
        arg_2.onInfoWindowClose.connect(arg_0.on_info_window_closed)
        arg_2.setOnInfoWindowClickListener(arg_3)
        arg_2.setOnInfoWindowCloseListener(arg_3)
        arg_2.setOnInfoWindowLongClickListener(arg_3)

        #: Polys
        arg_2.onPolygonClick.connect(arg_0.on_poly_clicked)
        arg_2.onPolylineClick.connect(arg_0.on_poly_clicked)
        arg_2.setOnPolygonClickListener(arg_3)
        arg_2.setOnPolylineClickListener(arg_3)

        #: Circle
        arg_2.onCircleClick.connect(arg_0.on_circle_clicked)
        arg_2.setOnCircleClickListener(arg_3)


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . get_conn ( ) arg_1 = arg_0 . _inject_project_id ( arg_1 , FILTER , FILTER_PROJECT_ID ) arg_3 = arg_2 . transferJobs ( ) . list ( arg_1 = json . dumps ( arg_1 ) ) arg_4 = [ ] while arg_3 is not None : arg_5 = arg_3 . execute ( num_retries = arg_0 . num_retries ) arg_4 . extend ( arg_5 [ TRANSFER_JOBS ] ) arg_3 = arg_2 . transferJobs ( ) . list_next ( previous_request = arg_3 , previous_response = arg_5 ) return arg_4

def Func(arg_0, arg_1):
        """
        Lists long-running operations in Google Storage Transfer
        Service that match the specified filter.

        :param filter: (Required) A request filter, as described in
            https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs/list#body.QUERY_PARAMETERS.filter
        :type filter: dict
        :return: List of Transfer Jobs
        :rtype: list[dict]
        """
        arg_2 = arg_0.get_conn()
        arg_1 = arg_0._inject_project_id(arg_1, FILTER, FILTER_PROJECT_ID)
        arg_3 = arg_2.transferJobs().list(arg_1=json.dumps(arg_1))
        arg_4 = []

        while arg_3 is not None:
            arg_5 = arg_3.execute(num_retries=arg_0.num_retries)
            arg_4.extend(arg_5[TRANSFER_JOBS])

            arg_3 = arg_2.transferJobs().list_next(previous_request=arg_3, previous_response=arg_5)

        return arg_4

Lists long - running operations in Google Storage Transfer Service that match the specified filter .


(data, base_uri=None, parser=M3U8Parser, **kwargs)

def Func ( arg_0 , arg_1 = None , arg_2 = arg_3 , ** arg_4 ) : return arg_2 ( arg_1 , ** arg_4 ) . parse ( arg_0 )

def Func(arg_0, arg_1=None, arg_2=arg_3, **arg_4):
    """Attempts to parse a M3U8 playlist from a string of data.

    If specified, *base_uri* is the base URI that relative URIs will
    be joined together with, otherwise relative URIs will be as is.

    If specified, *parser* can be a M3U8Parser subclass to be used
    to parse the data.

    """
    return arg_2(arg_1, **arg_4).parse(arg_0)

Attempts to parse a M3U8 playlist from a string of data .


return ("Breakpoints %sabled: %s" % (endis, ", ".join(bp_nums)))

def
Func
(
arg_0
,
arg_1
=
True
)
:
arg_2
=
[
arg_5
for
arg_5
in
arg_0
.
bpbynumber
if
arg_5
]
arg_3
=
[
]
if
arg_1
:
arg_4
=
'en'
else
:
arg_4
=
'dis'
pass
if
not
arg_2
:
return
"No breakpoints to %sable"
%
arg_4
for
arg_5
in
arg_2
:
arg_5
.
enabled
=
arg_1
arg_3
.
append
(
str
(
arg_5
.
number
)
)
pass
return
(
"Breakpoints %sabled: %s"
%
(
arg_4
,
", "
.
join
(
arg_3
)
)
)

def Func(arg_0,  arg_1=True):
        "Enable or disable all breakpoints."
        arg_2 = [arg_5 for arg_5 in arg_0.bpbynumber if arg_5]
        arg_3 = []
        if arg_1:
            arg_4 = 'en'
        else:
            arg_4 = 'dis'
            pass
        if not arg_2:
            return "No breakpoints to %sable" % arg_4
        for arg_5 in arg_2:
            arg_5.enabled = arg_1
            arg_3.append(str(arg_5.number))
            pass
        return ("Breakpoints %sabled: %s" % (arg_4, ", ".join(arg_3)))


def Func(arg_0, arg_1):
        """Create link from request for a sender."""
        arg_2 = SenderLink(arg_0._connection, arg_1)
        arg_0._links.add(arg_2)
        return arg_2


(self, hash_key, start=0, extra_attrs=None)

def Func ( arg_0 , arg_1 , arg_2 = 0 , arg_3 = None ) : arg_4 = arg_0 . get_table ( ) arg_5 = datetime . utcnow ( ) . replace ( microsecond = 0 ) . isoformat ( ) arg_6 = { 'created_on' : arg_5 , 'modified_on' : arg_5 , 'count' : arg_2 , } if arg_3 : arg_6 . update ( arg_3 ) arg_7 = arg_4 . new_item ( arg_1 = arg_1 , arg_6 = arg_6 , ) return arg_7

def Func(arg_0, arg_1, arg_2=0, arg_3=None):
        '''
        Hook point for overriding how the CouterPool creates a DynamoDB item
        for a given counter when an existing item can't be found.
        '''
        arg_4 = arg_0.get_table()
        arg_5 = datetime.utcnow().replace(microsecond=0).isoformat()
        arg_6 = {
            'created_on': arg_5,
            'modified_on': arg_5,
            'count': arg_2,
        }

        if arg_3:
            arg_6.update(arg_3)

        arg_7 = arg_4.new_item(
            arg_1=arg_1,
            arg_6=arg_6,
        )

        return arg_7

Hook point for overriding how the CouterPool creates a DynamoDB item for a given counter when an existing item can t be found .


def Func ( arg_0 ) : if isinstance ( arg_0 , _TO_UNICODE_TYPES ) : return arg_0 assert isinstance ( arg_0 , bytes ) return arg_0 . decode ( "utf-8" )

def Func(arg_0):
    """Converts a string argument to a unicode string.

    If the argument is already a unicode string or None, it is returned
    unchanged.  Otherwise it must be a byte string and is decoded as utf8.
    """
    if isinstance(arg_0, _TO_UNICODE_TYPES):
        return arg_0
    assert isinstance(arg_0, bytes)
    return arg_0.decode("utf-8")

Converts a string argument to a unicode string .


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
if
arg_2
[
1
]
==
PATH_SEP
:
if
arg_0
.
opt
.
recursive
:
arg_4
=
S3URL
(
arg_2
)
.
path
for
arg_5
in
(
arg_5
for
arg_5
in
arg_0
.
s3walk
(
arg_2
)
if
not
arg_5
[
'is_dir'
]
)
:
arg_1
.
download
(
arg_5
[
'name'
]
,
os
.
path
.
join
(
arg_3
,
os
.
path
.
relpath
(
S3URL
(
arg_5
[
'name'
]
)
.
path
,
arg_4
)
)
)
else
:
message
(
'omitting directory "%s".'
%
arg_2
)
else
:
arg_1
.
download
(
arg_2
,
arg_3
)

def Func(arg_0, arg_1, arg_2, arg_3):
    '''Download a single file or a directory by adding a task into queue'''
    if arg_2[-1] == PATH_SEP:
      if arg_0.opt.recursive:
        arg_4 = S3URL(arg_2).path
        for arg_5 in (arg_5 for arg_5 in arg_0.s3walk(arg_2) if not arg_5['is_dir']):
          arg_1.download(arg_5['name'], os.path.join(arg_3, os.path.relpath(S3URL(arg_5['name']).path, arg_4)))
      else:
        message('omitting directory "%s".' % arg_2)
    else:
      arg_1.download(arg_2, arg_3)


(self, error_name, error_message, msg_id=None, quiet=False)

def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=False):
        """Use this to use the configured ``Func_handler`` yield an
        Func message to your application.

        :param Func_name: is a short string, to associate messages to recovery
                           methods
        :param Func_message: is some human-readable text, describing the Func
        :param msg_id: is used to associate with a request
        :param quiet: specific to Func_handlers. The default doesn't send a
                      message to the user, but shows a debug message on the
                      developer console.
        """
        arg_0.socket.Func(arg_1, arg_2, endpoint=arg_0.ns_name,
                          arg_3=arg_3, arg_4=arg_4)

Use this to use the configured ``error_handler`` yield an
        error message to your application.

        :param error_name: is a short string, to associate messages to recovery
                           methods
        :param error_message: is some human-readable text, describing the error
        :param msg_id: is used to associate with a request
        :param quiet: specific to error_handlers. The default doesn't send a
                      message to the user, but shows a debug message on the
                      developer console.

Use this to use the configured error_handler yield an error message to your application .


return AccessTokenInfo(access_token=self.access_token,
                               expires_in=self._expires_in())

def Func ( arg_0 , arg_1 = None ) : if not arg_0 . access_token or arg_0 . access_token_expired : if not arg_1 : arg_1 = transport . get_http_object ( ) arg_0 . refresh ( arg_1 ) return AccessTokenInfo ( access_token = arg_0 . access_token , expires_in = arg_0 . _expires_in ( ) )

def Func(arg_0, arg_1=None):
        """Return the access token and its expiration information.

        If the token does not exist, get one.
        If the token expired, refresh it.
        """
        if not arg_0.access_token or arg_0.access_token_expired:
            if not arg_1:
                arg_1 = transport.get_http_object()
            arg_0.refresh(arg_1)
        return AccessTokenInfo(access_token=arg_0.access_token,
                               expires_in=arg_0._expires_in())

Return the access token and its expiration information .


(self, date_string, strip_timezone=False, settings=None)

def Func(arg_0, arg_1, arg_2=False, arg_3=None):
        """
        Check if the locale is applicable to translate date string.

        :param date_string:
            A string representing date and/or time in a recognizably valid format.
        :type date_string: str|unicode

        :param strip_timezone:
            If True, timezone is stripped from date string.
        :type strip_timezone: bool

        :return: boolean value representing if the locale is applicable for the date string or not.
        """
        if arg_2:
            arg_1, arg_4 = pop_tz_offset_from_string(arg_1, as_offset=False)

        arg_1 = arg_0._translate_numerals(arg_1)
        if arg_3.NORMALIZE:
            arg_1 = normalize_unicode(arg_1)
        arg_1 = arg_0._simplify(arg_1, arg_3=arg_3)
        arg_5 = arg_0._get_dictionary(arg_3)
        arg_6 = arg_5.split(arg_1)

        return arg_5.are_tokens_valid(arg_6)

Check if the locale is applicable to translate date string .


def Func(arg_0, arg_1, arg_2):
        """Process arguments from the command line into positional and kw args.

        Arguments are consumed until the argument spec for the function is filled
        or a -- is found or there are no more arguments.  Keyword arguments can be
        specified using --field=value, -f value or --field value.  Positional
        arguments are specified just on the command line itself.

        If a keyword argument (`field`) is a boolean, it can be set to True by just passing
        --field or -f without needing to explicitly pass True unless this would cause
        ambiguity in parsing since the next expected positional argument is also a boolean
        or a string.

        Args:
            func (callable): A function previously annotated with type information
            args (list): A list of all of the potential arguments to this function.

        Returns:
            (args, kw_args, unused args): A tuple with a list of args, a dict of
                keyword args and a list of any unused args that were not processed.
        """

        arg_3 = []
        arg_4 = {}

        while len(arg_2) > 0:
            if arg_1.metadata.spec_filled(arg_3, arg_4) and not arg_0._is_flag(arg_2[0]):
                break

            arg_5 = arg_2.pop(0)

            if arg_5 == '--':
                break
            elif arg_0._is_flag(arg_5):
                arg_6 = None
                arg_7 = None

                if len(arg_5) == 2:
                    arg_7 = arg_1.metadata.match_shortname(arg_5[1:], filled_args=arg_3)
                else:
                    if not arg_5.startswith('--'):
                        raise ArgumentError("Invalid method of specifying keyword argument that did not start with --", argument=arg_5)

                    # Skip the --
                    arg_5 = arg_5[2:]

                    # Check if the value is embedded in the parameter
                    # Make sure we allow the value after the equals sign to also
                    # contain an equals sign.
                    if '=' in arg_5:
                        arg_5, arg_6 = arg_5.split('=', 1)

                    arg_7 = arg_1.metadata.match_shortname(arg_5, filled_args=arg_3)

                arg_8 = arg_1.metadata.param_type(arg_7)
                if arg_8 is None:
                    raise ArgumentError("Attempting to set a parameter from command line that does not have type information", argument=arg_7)

                # If we don't have a value yet, attempt to get one from the next parameter on the command line
                if arg_6 is None:
                    arg_6 = arg_0._extract_arg_value(arg_7, arg_8, arg_2)

                arg_4[arg_7] = arg_6
            else:
                arg_3.append(arg_5)

        # Always check if there is a trailing '--' and chomp so that we always
        # start on a function name.  This can happen if there is a gratuitous
        # -- for a 0 arg function or after an implicit boolean flag like -f --
        if len(arg_2) > 0 and arg_2[0] == '--':
            arg_2.pop(0)

        return arg_3, arg_4, arg_2

Process arguments from the command line into positional and kw args .


return cij.util.execute(command, shell=True, echo=True)

def
Func
(
arg_0
)
:
env
(
)
arg_1
=
cij
.
env_to_dict
(
PREFIX
,
EXPORTED
+
REQUIRED
)
arg_0
=
"ipmitool -U %s -P %s -H %s -p %s %s"
%
(
arg_1
[
"USER"
]
,
arg_1
[
"PASS"
]
,
arg_1
[
"HOST"
]
,
arg_1
[
"PORT"
]
,
arg_0
)
cij
.
info
(
"ipmi.command: %s"
%
arg_0
)
return
cij
.
util
.
execute
(
arg_0
,
shell
=
True
,
echo
=
True
)

def Func(arg_0):
    """Send IPMI 'command' via ipmitool"""

    env()

    arg_1 = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)

    arg_0 = "ipmitool -U %s -P %s -H %s -p %s %s" % (
        arg_1["USER"], arg_1["PASS"], arg_1["HOST"], arg_1["PORT"], arg_0)
    cij.info("ipmi.command: %s" % arg_0)

    return cij.util.execute(arg_0, shell=True, echo=True)


def Func ( arg_0 , arg_1 , arg_2 ) : if len ( arg_1 . annotations ) != 0 : if not arg_0 . annotation_date_set : arg_0 . annotation_date_set = True arg_4 = utils . datetime_from_iso_format ( arg_2 ) if arg_4 is not None : arg_1 . annotations [ - 1 ] . annotation_date = arg_4 return True else : raise SPDXValueError ( 'Annotation::AnnotationDate' ) else : raise CardinalityError ( 'Annotation::AnnotationDate' ) else : raise OrderError ( 'Annotation::AnnotationDate' )

def Func(arg_0, arg_1, arg_2):
        """Sets the annotation date. Raises CardinalityError if
        already set. OrderError if no annotator defined before.
        Raises SPDXValueError if invalid value.
        """
        if len(arg_1.annotations) != 0:
            if not arg_0.annotation_date_set:
                arg_0.annotation_date_set = True
                arg_4 = utils.datetime_from_iso_format(arg_2)
                if arg_4 is not None:
                    arg_1.annotations[-1].annotation_date = arg_4
                    return True
                else:
                    raise SPDXValueError('Annotation::AnnotationDate')
            else:
                raise CardinalityError('Annotation::AnnotationDate')
        else:
            raise OrderError('Annotation::AnnotationDate')

Sets the annotation date . Raises CardinalityError if already set . OrderError if no annotator defined before . Raises SPDXValueError if invalid value .


def
Func
(
arg_0
,
arg_1
=
''
,
arg_2
=
'beta'
)
:
arg_0
=
_URL_PREFIX2
.
format
(
arg_2
=
arg_2
)
+
arg_0
arg_3
=
requests
.
get
(
urlparse
(
arg_0
)
.
geturl
(
)
,
proxies
=
_PYEX_PROXIES
,
params
=
{
'token'
:
arg_1
}
)
if
arg_3
.
status_code
==
200
:
return
arg_3
.
json
(
)
raise
PyEXception
(
'Response %d - '
%
arg_3
.
status_code
,
arg_3
.
text
)

def Func(arg_0, arg_1='', arg_2='beta'):
    '''for iex cloud'''
    arg_0 = _URL_PREFIX2.format(arg_2=arg_2) + arg_0
    arg_3 = requests.get(urlparse(arg_0).geturl(), proxies=_PYEX_PROXIES, params={'token': arg_1})
    if arg_3.status_code == 200:
        return arg_3.json()
    raise PyEXception('Response %d - ' % arg_3.status_code, arg_3.text)


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
InvoiceController
.
for_id_or_404
(
arg_1
)
try
:
arg_2
.
Func
(
)
messages
.
success
(
arg_0
,
"This invoice has been Funced."
)
except
ValidationError
as
ve
:
messages
.
error
(
arg_0
,
ve
)
return
redirect
(
"invoice"
,
arg_1
)

def Func(arg_0, arg_1):
    ''' Marks an invoice as Funced and requests a credit note for the
    full amount paid against the invoice.

    This view requires a login, and the logged in user must be staff.

    Arguments:
        invoice_id (castable to int): The ID of the invoice to Func.

    Returns:
        redirect:
            Redirects to ``invoice``.

    '''

    arg_2 = InvoiceController.for_id_or_404(arg_1)

    try:
        arg_2.Func()
        messages.success(arg_0, "This invoice has been Funced.")
    except ValidationError as ve:
        messages.error(arg_0, ve)

    return redirect("invoice", arg_1)

Marks an invoice as refunded and requests a credit note for the
    full amount paid against the invoice.

    This view requires a login, and the logged in user must be staff.

    Arguments:
        invoice_id (castable to int): The ID of the invoice to refund.

    Returns:
        redirect:
            Redirects to ``invoice``.

Marks an invoice as refunded and requests a credit note for the full amount paid against the invoice .


def Func ( arg_0 ) : if os . path . dirname ( arg_0 ) != '' : if os . access ( arg_0 , os . X_OK ) : return arg_0 if not os . environ . has_key ( 'PATH' ) or os . environ [ 'PATH' ] == '' : arg_1 = os . defpath else : arg_1 = os . environ [ 'PATH' ] arg_2 = arg_1 . split ( os . pathsep ) for arg_3 in arg_2 : arg_4 = os . path . join ( arg_3 , arg_0 ) if os . access ( arg_4 , os . X_OK ) : return arg_4 return None

def Func (arg_0):

    """This takes a given filename; tries to find it in the environment path;
    then checks if it is executable. This returns the full path to the filename
    if found and executable. Otherwise this returns None."""

    # Special case where filename already contains a path.
    if os.path.dirname(arg_0) != '':
        if os.access (arg_0, os.X_OK):
            return arg_0

    if not os.environ.has_key('PATH') or os.environ['PATH'] == '':
        arg_1 = os.defpath
    else:
        arg_1 = os.environ['PATH']

    arg_2 = arg_1.split(os.pathsep)

    for arg_3 in arg_2:
        arg_4 = os.path.join(arg_3, arg_0)
        if os.access(arg_4, os.X_OK):
            return arg_4
    return None

This takes a given filename ; tries to find it in the environment path ; then checks if it is executable . This returns the full path to the filename if found and executable . Otherwise this returns None .


def
Func
(
arg_0
)
:
arg_1
=
os
.
path
.
join
(
arg_0
.
settings
[
"destination"
]
,
".exif_cache"
)
try
:
if
os
.
path
.
exists
(
arg_1
)
:
with
open
(
arg_1
,
"rb"
)
as
cacheFile
:
arg_0
.
exifCache
=
pickle
.
load
(
cacheFile
)
logger
.
debug
(
"Loaded cache with %d entries"
,
len
(
arg_0
.
exifCache
)
)
else
:
arg_0
.
exifCache
=
{
}
except
Exception
as
e
:
logger
.
warn
(
"Could not load cache: %s"
,
e
)
arg_0
.
exifCache
=
{
}

def Func(arg_0):
    """Restores the exif data cache from the cache file"""
    arg_1 = os.path.join(arg_0.settings["destination"], ".exif_cache")
    try:
        if os.path.exists(arg_1):
            with open(arg_1, "rb") as cacheFile:
                arg_0.exifCache = pickle.load(cacheFile)
                logger.debug("Loaded cache with %d entries", len(arg_0.exifCache))
        else:
            arg_0.exifCache = {}
    except Exception as e:
        logger.warn("Could not load cache: %s", e)
        arg_0.exifCache = {}


(self, metabolite, type="exchange", reaction_id=None,
                     lb=None, ub=None, sbo_term=None)

def Func(arg_0, arg_1, arg_2="exchange", arg_3=None,
                     arg_4=None, arg_5=None, arg_6=None):
        """
        Add a boundary reaction for a given metabolite.

        There are three different types of pre-defined boundary reactions:
        exchange, demand, and sink reactions.
        An exchange reaction is a reversible, unbalanced reaction that adds
        to or removes an extracellular metabolite from the extracellular
        compartment.
        A demand reaction is an irreversible reaction that consumes an
        intracellular metabolite.
        A sink is similar to an exchange but specifically for intracellular
        metabolites.

        If you set the reaction `type` to something else, you must specify the
        desired identifier of the created reaction along with its upper and
        lower bound. The name will be given by the metabolite name and the
        given `type`.

        Parameters
        ----------
        metabolite : cobra.Metabolite
            Any given metabolite. The compartment is not checked but you are
            encouraged to stick to the definition of exchanges and sinks.
        type : str, {"exchange", "demand", "sink"}
            Using one of the pre-defined reaction types is easiest. If you
            want to create your own kind of boundary reaction choose
            any other string, e.g., 'my-boundary'.
        reaction_id : str, optional
            The ID of the resulting reaction. This takes precedence over the
            auto-generated identifiers but beware that it might make boundary
            reactions harder to identify afterwards when using `model.boundary`
            or specifically `model.exchanges` etc.
        lb : float, optional
            The lower bound of the resulting reaction.
        ub : float, optional
            The upper bound of the resulting reaction.
        sbo_term : str, optional
            A correct SBO term is set for the available types. If a custom
            type is chosen, a suitable SBO term should also be set.

        Returns
        -------
        cobra.Reaction
            The created boundary reaction.

        Examples
        --------
        >>> import cobra.test
        >>> model = cobra.test.create_test_model("textbook")
        >>> demand = model.Func(model.metabolites.atp_c, type="demand")
        >>> demand.id
        'DM_atp_c'
        >>> demand.name
        'ATP demand'
        >>> demand.bounds
        (0, 1000.0)
        >>> demand.build_reaction_string()
        'atp_c --> '

        """
        arg_5 = CONFIGURATION.upper_bound if arg_5 is None else arg_5
        arg_4 = CONFIGURATION.lower_bound if arg_4 is None else arg_4
        arg_7 = {
            "exchange": ("EX", arg_4, arg_5, sbo_terms["exchange"]),
            "demand": ("DM", 0, arg_5, sbo_terms["demand"]),
            "sink": ("SK", arg_4, arg_5, sbo_terms["sink"])
        }
        if arg_2 == "exchange":
            arg_8 = find_external_compartment(arg_0)
            if arg_1.compartment != arg_8:
                raise ValueError("The metabolite is not an external metabolite"
                                 " (compartment is `%s` but should be `%s`). "
                                 "Did you mean to add a demand or sink? "
                                 "If not, either change its compartment or "
                                 "rename the model compartments to fix this." %
                                 (arg_1.compartment, arg_8))
        if arg_2 in arg_7:
            arg_9, arg_4, arg_5, arg_10 = arg_7[arg_2]
            if arg_3 is None:
                arg_3 = "{}_{}".format(arg_9, arg_1.id)
            if arg_6 is None:
                arg_6 = arg_10
        if arg_3 is None:
            raise ValueError(
                "Custom types of boundary reactions require a custom "
                "identifier. Please set the `reaction_id`.")
        if arg_3 in arg_0.reactions:
            raise ValueError(
                "Boundary reaction '{}' already exists.".format(arg_3))
        arg_11 = "{} {}".format(arg_1.name, arg_2)
        arg_12 = Reaction(id=arg_3, arg_11=arg_11, lower_bound=arg_4,
                       upper_bound=arg_5)
        arg_12.add_metabolites({arg_1: -1})
        if arg_6:
            arg_12.annotation["sbo"] = arg_6
        arg_0.add_reactions([arg_12])
        return arg_12

Add a boundary reaction for a given metabolite.

        There are three different types of pre-defined boundary reactions:
        exchange, demand, and sink reactions.
        An exchange reaction is a reversible, unbalanced reaction that adds
        to or removes an extracellular metabolite from the extracellular
        compartment.
        A demand reaction is an irreversible reaction that consumes an
        intracellular metabolite.
        A sink is similar to an exchange but specifically for intracellular
        metabolites.

        If you set the reaction `type` to something else, you must specify the
        desired identifier of the created reaction along with its upper and
        lower bound. The name will be given by the metabolite name and the
        given `type`.

        Parameters
        ----------
        metabolite : cobra.Metabolite
            Any given metabolite. The compartment is not checked but you are
            encouraged to stick to the definition of exchanges and sinks.
        type : str, {"exchange", "demand", "sink"}
            Using one of the pre-defined reaction types is easiest. If you
            want to create your own kind of boundary reaction choose
            any other string, e.g., 'my-boundary'.
        reaction_id : str, optional
            The ID of the resulting reaction. This takes precedence over the
            auto-generated identifiers but beware that it might make boundary
            reactions harder to identify afterwards when using `model.boundary`
            or specifically `model.exchanges` etc.
        lb : float, optional
            The lower bound of the resulting reaction.
        ub : float, optional
            The upper bound of the resulting reaction.
        sbo_term : str, optional
            A correct SBO term is set for the available types. If a custom
            type is chosen, a suitable SBO term should also be set.

        Returns
        -------
        cobra.Reaction
            The created boundary reaction.

        Examples
        --------
        >>> import cobra.test
        >>> model = cobra.test.create_test_model("textbook")
        >>> demand = model.add_boundary(model.metabolites.atp_c, type="demand")
        >>> demand.id
        'DM_atp_c'
        >>> demand.name
        'ATP demand'
        >>> demand.bounds
        (0, 1000.0)
        >>> demand.build_reaction_string()
        'atp_c --> '

Add a boundary reaction for a given metabolite .


return [tf.Assert(is_positive_definite,
                    ['Initial inverse Hessian is not positive definite.',
                     inv_hessian]),
          tf.Assert(is_symmetric,
                    ['Initial inverse Hessian is not symmetric',
                     inv_hessian])]

def Func(arg_0):
  """Computes control inputs to validate a provided inverse Hessian.

  These ensure that the provided inverse Hessian is positive definite and
  symmetric.

  Args:
    inv_hessian: The starting estimate for the inverse of the Hessian at the
      initial point.

  Returns:
    A list of tf.Assert ops suitable for use with tf.control_dependencies.
  """
  # The easiest way to validate if the inverse Hessian is positive definite is
  # to compute its Cholesky decomposition.
  arg_1 = tf.reduce_all(
      input_tensor=tf.math.is_finite(tf.linalg.cholesky(arg_0)),
      axis=[-1, -2])

  # Then check that the supplied inverse Hessian is symmetric.
  arg_2 = tf.equal(bfgs_utils.norm(
      arg_0 - _batch_transpose(arg_0), dims=2), 0)

  # Simply adding a control dependencies on these results is not enough to
  # trigger them, we need to add asserts on the results.
  return [tf.Assert(arg_1,
                    ['Initial inverse Hessian is not positive definite.',
                     arg_0]),
          tf.Assert(arg_2,
                    ['Initial inverse Hessian is not symmetric',
                     arg_0])]

Computes control inputs to validate a provided inverse Hessian .


return self.vformat(format_string, args=None, kwargs=mapping)

def Func ( arg_0 , arg_1 , arg_2 ) : return arg_0 . vformat ( arg_1 , args = None , kwargs = arg_2 )

def Func(arg_0, arg_1, arg_2):
        """format a string by a map

        Args:
            format_string(str): A format string
            mapping(dict): A map to format the string

        Returns:
            A formatted string.

        Raises:
            KeyError: if key is not provided by the given map.
        """
        return arg_0.vformat(arg_1, args=None, kwargs=arg_2)


def Func ( arg_0 , arg_1 ) : if arg_1 . key in arg_0 . queued_tasks or arg_1 . key in arg_0 . running : return True

def Func(arg_0, arg_1):
        """
        Checks if a task is either queued or running in this executor

        :param task_instance: TaskInstance
        :return: True if the task is known to this executor
        """
        if arg_1.key in arg_0.queued_tasks or arg_1.key in arg_0.running:
            return True


def
Func
(
arg_0
,
arg_1
,
arg_2
=
20
)
:
def
formatFPRow
(
arg_3
)
:
arg_4
=
''
for
arg_5
in
range
(
min
(
arg_2
,
arg_0
.
numberOfCols
)
)
:
if
arg_5
>
0
and
arg_5
%
10
==
0
:
arg_4
+=
'   '
arg_4
+=
' %5.3f'
%
arg_3
[
arg_5
]
arg_4
+=
' '
return
arg_4
print
formatFPRow
(
arg_1
)

def Func(arg_0, arg_1, arg_2 = 20):
    """
    Print up to maxCols number from a flat floating point array.

    :param aState: TODO: document
    :param maxCols: TODO: document
    """
    def formatFPRow(arg_3):
      arg_4 = ''
      for arg_5 in range(min(arg_2, arg_0.numberOfCols)):
        if arg_5 > 0 and arg_5 % 10 == 0:
          arg_4 += '   '
        arg_4 += ' %5.3f' % arg_3[arg_5]
      arg_4 += ' '
      return arg_4

    print formatFPRow(arg_1)

Print up to maxCols number from a flat floating point array .


def Func(arg_0):
        ''' raise exception on RAM exceeded '''
        arg_1 = psutil.virtual_memory().available / 2**20
        arg_0.log.debug("Memory free: %s/%s", arg_1, arg_0.mem_limit)
        if arg_1 < arg_0.mem_limit:
            raise RuntimeError(
                "Not enough resources: free memory less "
                "than %sMB: %sMB" % (arg_0.mem_limit, arg_1))


(simbasedir,
                                     stetson_stdev_range=(1.0,20.0),
                                     inveta_stdev_range=(1.0,20.0),
                                     iqr_stdev_range=(1.0,20.0),
                                     ngridpoints=32,
                                     ngridworkers=None)

def
Func
(
arg_0
,
arg_1
=
(
1.0
,
20.0
)
,
arg_2
=
(
1.0
,
20.0
)
,
arg_3
=
(
1.0
,
20.0
)
,
arg_4
=
32
,
arg_5
=
)
:
arg_6
=
os
.
path
.
join
(
arg_0
,
'recvar-threshold-pkls'
)
if
not
os
.
path
.
exists
(
arg_6
)
:
os
.
mkdir
(
arg_6
)
with
open
(
os
.
path
.
join
(
arg_0
,
'fakelcs-info.pkl'
)
,
'rb'
)
as
infd
:
arg_7
=
pickle
.
load
(
infd
)
arg_8
=
arg_7
[
'timecols'
]
arg_9
=
arg_7
[
'magcols'
]
arg_10
=
arg_7
[
'errcols'
]
arg_11
=
arg_7
[
'magrms'
]
[
arg_9
[
0
]
]
[
'binned_sdssr_median'
]
arg_12
=
np
.
linspace
(
arg_1
[
0
]
,
arg_1
[
1
]
,
num
=
arg_4
)
arg_13
=
np
.
linspace
(
arg_2
[
0
]
,
arg_2
[
1
]
,
num
=
arg_4
)
arg_14
=
np
.
linspace
(
arg_3
[
0
]
,
arg_3
[
1
]
,
num
=
arg_4
)
arg_15
=
[
]
for
arg_16
in
arg_12
:
for
arg_17
in
arg_13
:
for
arg_18
in
arg_14
:
arg_19
=
[
arg_16
,
arg_17
,
arg_18
]
arg_15
.
append
(
arg_19
)
arg_20
=
{
'stetson_grid'
:
arg_12
,
'inveta_grid'
:
arg_13
,
'iqr_grid'
:
arg_14
,
'stet_inveta_iqr_grid'
:
arg_15
,
'magbinmedians'
:
arg_11
,
'timecols'
:
arg_8
,
'magcols'
:
arg_9
,
'errcols'
:
arg_10
,
'simbasedir'
:
os
.
path
.
abspath
(
arg_0
)
,
'recovery'
:
[
]
}
arg_21
=
mp
.
Pool
(
arg_5
)
for
arg_22
in
arg_11
:
LOGINFO
(
'running stetson J-inveta grid-search '
'for magbinmedian = %.3f...'
%
arg_22
)
arg_23
=
[
(
arg_0
,
gp
,
arg_22
)
for
gp
in
arg_15
]
arg_24
=
arg_21
.
map
(
magbin_varind_gridsearch_worker
,
arg_23
)
arg_20
[
'recovery'
]
.
append
(
arg_24
)
arg_21
.
close
(
)
arg_21
.
join
(
)
LOGINFO
(
'done.'
)
with
open
(
os
.
path
.
join
(
arg_0
,
'fakevar-recovery-per-magbin.pkl'
)
,
'wb'
)
as
outfd
:
pickle
.
dump
(
arg_20
,
outfd
,
pickle
.
HIGHEST_PROTOCOL
)
return
arg_20

def Func(arg_0,
                                     arg_1=(1.0,20.0),
                                     arg_2=(1.0,20.0),
                                     arg_3=(1.0,20.0),
                                     arg_4=32,
                                     arg_5=None):
    '''This runs a variable index grid search per magbin.

    For each magbin, this does a grid search using the stetson and inveta ranges
    provided and tries to optimize the Matthews Correlation Coefficient (best
    value is +1.0), indicating the best possible separation of variables
    vs. nonvariables. The thresholds on these two variable indexes that produce
    the largest coeff for the collection of fake LCs will probably be the ones
    that work best for actual variable classification on the real LCs.

    https://en.wikipedia.org/wiki/Matthews_correlation_coefficient

    For each grid-point, calculates the true positives, false positives, true
    negatives, false negatives. Then gets the precision and recall, confusion
    matrix, and the ROC curve for variable vs. nonvariable.

    Once we've identified the best thresholds to use, we can then calculate
    variable object numbers:

    - as a function of magnitude
    - as a function of period
    - as a function of number of detections
    - as a function of amplitude of variability

    Writes everything back to `simbasedir/fakevar-recovery.pkl`. Use the
    plotting function below to make plots for the results.

    Parameters
    ----------

    simbasedir : str
        The directory where the fake LCs are located.

    stetson_stdev_range : sequence of 2 floats
        The min and max values of the Stetson J variability index to generate a
        grid over these to test for the values of this index that produce the
        'best' recovery rate for the injected variable stars.

    inveta_stdev_range : sequence of 2 floats
        The min and max values of the 1/eta variability index to generate a
        grid over these to test for the values of this index that produce the
        'best' recovery rate for the injected variable stars.

    iqr_stdev_range : sequence of 2 floats
        The min and max values of the IQR variability index to generate a
        grid over these to test for the values of this index that produce the
        'best' recovery rate for the injected variable stars.

    ngridpoints : int
        The number of grid points for each variability index grid. Remember that
        this function will be searching in 3D and will require lots of time to
        run if ngridpoints is too large.

        For the default number of grid points and 25000 simulated light curves,
        this takes about 3 days to run on a 40 (effective) core machine with 2 x
        Xeon E5-2650v3 CPUs.

    ngridworkers : int or None
        The number of parallel grid search workers that will be launched.

    Returns
    -------

    dict
        The returned dict contains a list of recovery stats for each magbin and
        each grid point in the variability index grids that were used. This dict
        can be passed to the plotting function below to plot the results.

    '''

    # make the output directory where all the pkls from the variability
    # threshold runs will go
    arg_6 = os.path.join(arg_0,'recvar-threshold-pkls')
    if not os.path.exists(arg_6):
        os.mkdir(arg_6)

    # get the info from the simbasedir
    with open(os.path.join(arg_0, 'fakelcs-info.pkl'),'rb') as infd:
        arg_7 = pickle.load(infd)

    # get the column defs for the fakelcs
    arg_8 = arg_7['timecols']
    arg_9 = arg_7['magcols']
    arg_10 = arg_7['errcols']

    # get the magbinmedians to use for the recovery processing
    arg_11 = arg_7['magrms'][arg_9[0]]['binned_sdssr_median']

    # generate the grids for stetson and inveta
    arg_12 = np.linspace(arg_1[0],
                               arg_1[1],
                               num=arg_4)
    arg_13 = np.linspace(arg_2[0],
                              arg_2[1],
                              num=arg_4)
    arg_14 = np.linspace(arg_3[0],
                           arg_3[1],
                           num=arg_4)

    # generate the grid
    arg_15 = []
    for arg_16 in arg_12:
        for arg_17 in arg_13:
            for arg_18 in arg_14:
                arg_19 = [arg_16, arg_17, arg_18]
                arg_15.append(arg_19)

    # the output dict
    arg_20 = {'stetson_grid':arg_12,
                    'inveta_grid':arg_13,
                    'iqr_grid':arg_14,
                    'stet_inveta_iqr_grid':arg_15,
                    'magbinmedians':arg_11,
                    'timecols':arg_8,
                    'magcols':arg_9,
                    'errcols':arg_10,
                    'simbasedir':os.path.abspath(arg_0),
                    'recovery':[]}

    # set up the pool
    arg_21 = mp.Pool(arg_5)

    # run the grid search per magbinmedian
    for arg_22 in arg_11:

        LOGINFO('running stetson J-inveta grid-search '
                'for magbinmedian = %.3f...' % arg_22)

        arg_23 = [(arg_0, gp, arg_22) for gp in arg_15]
        arg_24 = arg_21.map(magbin_varind_gridsearch_worker, arg_23)
        arg_20['recovery'].append(arg_24)

    arg_21.close()
    arg_21.join()

    LOGINFO('done.')
    with open(os.path.join(arg_0,
                           'fakevar-recovery-per-magbin.pkl'),'wb') as outfd:
        pickle.dump(arg_20,outfd,pickle.HIGHEST_PROTOCOL)

    return arg_20

This runs a variable index grid search per magbin .


def Func ( arg_0 , arg_1 ) : if hasattr ( arg_0 , "_ishelper" ) and arg_0 . _ishelper or isinstance ( arg_0 , om . OMAny ) : return interpretAsOpenMath ( arg_0 ) if arg_1 is not None : try : arg_2 = arg_1 . to_openmath ( arg_0 ) except Exception as e : arg_2 = None if isinstance ( arg_2 , om . OMAny ) : return arg_2 return interpretAsOpenMath ( arg_0 )

def Func(arg_0, arg_1):
    """ Converts a term into OpenMath, using either a converter or the interpretAsOpenMath method """

    # if we already have openmath, or have some of our magic helpers, use interpretAsOpenMath
    if hasattr(arg_0, "_ishelper") and arg_0._ishelper or isinstance(arg_0, om.OMAny):
        return interpretAsOpenMath(arg_0)

    # next try to convert using the converter
    if arg_1 is not None:
        try:
            arg_2 = arg_1.to_openmath(arg_0)
        except Exception as e:
            arg_2 = None

        if isinstance(arg_2, om.OMAny):
            return arg_2

    # fallback to the openmath helper
    return interpretAsOpenMath(arg_0)

Converts a term into OpenMath using either a converter or the interpretAsOpenMath method


def Func ( arg_0 , arg_1 , ** arg_2 ) : arg_3 , arg_1 = arg_1 . operands arg_4 = [ "exclusion(" ] arg_4 . extend ( arg_0 . _indent ( arg_0 . _ast_to_code ( arg_3 ) ) ) arg_4 [ - 1 ] += "," arg_4 . extend ( arg_0 . _indent ( arg_0 . _ast_to_code ( arg_1 ) ) ) arg_4 . append ( ")" ) return arg_4

def Func(arg_0, arg_1, **arg_2):
    """Convert an AST exclude op to python source code."""
    arg_3, arg_1 = arg_1.operands

    arg_4 = ["exclusion("]
    arg_4.extend(arg_0._indent(arg_0._ast_to_code(arg_3)))
    arg_4[-1] += ","
    arg_4.extend(arg_0._indent(arg_0._ast_to_code(arg_1)))
    arg_4.append(")")
    return arg_4

Convert an AST exclude op to python source code .


def Func ( arg_0 , arg_1 = True ) : arg_2 = True try : jsonschema . Func ( arg_0 . __json__ , arg_0 . __schema__ ) except jsonschema . ValidationError as invalid : if arg_1 : raise SchemaError ( str ( invalid ) ) else : warnings . warn ( str ( invalid ) ) arg_2 = False return arg_2

def Func(arg_0, arg_1=True):
        '''Validate a JObject against its schema

        Parameters
        ----------
        strict : bool
            Enforce strict schema validation

        Returns
        -------
        valid : bool
            True if the jam Funcs
            False if not, and `strict==False`

        Raises
        ------
        SchemaError
            If `strict==True` and `jam` fails validation
        '''

        arg_2 = True

        try:
            jsonschema.Func(arg_0.__json__, arg_0.__schema__)

        except jsonschema.ValidationError as invalid:
            if arg_1:
                raise SchemaError(str(invalid))
            else:
                warnings.warn(str(invalid))

            arg_2 = False

        return arg_2

Validate a JObject against its schema

        Parameters
        ----------
        strict : bool
            Enforce strict schema validation

        Returns
        -------
        valid : bool
            True if the jam validates
            False if not, and `strict==False`

        Raises
        ------
        SchemaError
            If `strict==True` and `jam` fails validation


def Func ( arg_0 , arg_1 , arg_2 = None ) : if not arg_2 : arg_2 = [ ] arg_3 = chr ( arg_0 . START_SYSEX ) arg_3 += chr ( arg_1 ) if len ( arg_2 ) : for arg_4 in arg_2 : arg_3 += chr ( arg_4 ) arg_3 += chr ( arg_0 . END_SYSEX ) for arg_5 in arg_3 : arg_0 . pymata . transport . write ( arg_5 )

def Func(arg_0, arg_1, arg_2=None):
        """
        This method will send a Sysex command to Firmata with any accompanying data

        :param sysex_command: sysex command

        :param sysex_data: data for command

        :return : No return value.
        """
        if not arg_2:
            arg_2 = []

        # convert the message command and data to characters
        arg_3 = chr(arg_0.START_SYSEX)
        arg_3 += chr(arg_1)
        if len(arg_2):
            for arg_4 in arg_2:
                arg_3 += chr(arg_4)
        arg_3 += chr(arg_0.END_SYSEX)

        for arg_5 in arg_3:
            arg_0.pymata.transport.write(arg_5)


def Func ( arg_0 ) : @ functools . wraps ( arg_0 ) def view_func ( * arg_1 , ** arg_2 ) : @ after_this_request def zipper ( arg_3 ) : arg_4 = request . headers . get ( 'Accept-Encoding' , '' ) if 'gzip' not in arg_4 . lower ( ) : return arg_3 arg_3 . direct_passthrough = False if ( arg_3 . status_code < 200 or arg_3 . status_code >= 300 or 'Content-Encoding' in arg_3 . headers ) : return arg_3 arg_6 = IO ( ) arg_7 = gzip . GzipFile ( mode = 'wb' , fileobj = arg_6 ) arg_7 . write ( arg_3 . data ) arg_7 . close ( ) arg_3 . data = arg_6 . getvalue ( ) arg_3 . headers [ 'Content-Encoding' ] = 'gzip' arg_3 . headers [ 'Vary' ] = 'Accept-Encoding' arg_3 . headers [ 'Content-Length' ] = len ( arg_3 . data ) return arg_3 return arg_0 ( * arg_1 , ** arg_2 ) return view_func

def Func(arg_0):
    """
    Decorator to make a view compressed
    """
    @functools.wraps(arg_0)
    def view_func(*arg_1, **arg_2):
        @after_this_request
        def zipper(arg_3):
            arg_4 = request.headers.get('Accept-Encoding', '')

            if 'gzip' not in arg_4.lower():
                return arg_3

            arg_3.direct_passthrough = False

            if (arg_3.status_code < 200 or arg_3.status_code >= 300 or
                    'Content-Encoding' in arg_3.headers):
                return arg_3
            arg_6 = IO()
            arg_7 = gzip.GzipFile(mode='wb',
                                      fileobj=arg_6)
            arg_7.write(arg_3.data)
            arg_7.close()

            arg_3.data = arg_6.getvalue()
            arg_3.headers['Content-Encoding'] = 'gzip'
            arg_3.headers['Vary'] = 'Accept-Encoding'
            arg_3.headers['Content-Length'] = len(arg_3.data)

            return arg_3

        return arg_0(*arg_1, **arg_2)

    return view_func


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_1
.
split_contents
(
)
if
len
(
arg_2
)
>
1
:
raise
TemplateSyntaxError
(
"'%s' takes no arguments"
%
arg_2
[
0
]
)
return
PiwikNode
(
)

def Func(arg_0, arg_1):
    """
    Piwik tracking template tag.

    Renders Javascript code to track page visits.  You must supply
    your Piwik domain (plus optional URI path), and tracked site ID
    in the ``PIWIK_DOMAIN_PATH`` and the ``PIWIK_SITE_ID`` setting.

    Custom variables can be passed in the ``Func_vars`` context
    variable.  It is an iterable of custom variables as tuples like:
    ``(index, name, value[, scope])`` where scope may be ``'page'``
    (default) or ``'visit'``.  Index should be an integer and the
    other parameters should be strings.
    """
    arg_2 = arg_1.split_contents()
    if len(arg_2) > 1:
        raise TemplateSyntaxError("'%s' takes no arguments" % arg_2[0])
    return PiwikNode()

Piwik tracking template tag.

    Renders Javascript code to track page visits.  You must supply
    your Piwik domain (plus optional URI path), and tracked site ID
    in the ``PIWIK_DOMAIN_PATH`` and the ``PIWIK_SITE_ID`` setting.

    Custom variables can be passed in the ``piwik_vars`` context
    variable.  It is an iterable of custom variables as tuples like:
    ``(index, name, value[, scope])`` where scope may be ``'page'``
    (default) or ``'visit'``.  Index should be an integer and the
    other parameters should be strings.


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
prefilter_manager
.
get_Funcr_by_name
(
'magic'
)
arg_3
=
arg_1
.
line
if
arg_3
.
lstrip
(
)
.
startswith
(
ESC_SH_CAP
)
:
arg_4
=
arg_3
.
lstrip
(
)
[
2
:
]
arg_1
.
line
=
'%ssx %s'
%
(
ESC_MAGIC
,
arg_4
)
arg_1
.
ifun
=
'sx'
arg_1
.
the_rest
=
arg_4
return
arg_2
.
Func
(
arg_1
)
else
:
arg_7
=
arg_3
.
lstrip
(
)
.
lstrip
(
ESC_SHELL
)
arg_8
=
'%sget_ipython().system(%r)'
%
(
arg_1
.
pre_whitespace
,
arg_7
)
return
arg_8

def Func(arg_0, arg_1):
        """Execute the line in a shell, empty return value"""
        arg_2 = arg_0.prefilter_manager.get_Funcr_by_name('magic')

        arg_3 = arg_1.line
        if arg_3.lstrip().startswith(ESC_SH_CAP):
            # rewrite LineInfo's line, ifun and the_rest to properly hold the
            # call to %sx and the actual command to be executed, so
            # Func_magic can work correctly.  Note that this works even if
            # the line is indented, so it Funcs multi_line_specials
            # properly.
            arg_4 = arg_3.lstrip()[2:]
            arg_1.line = '%ssx %s' % (ESC_MAGIC, arg_4)
            arg_1.ifun = 'sx'
            arg_1.the_rest = arg_4
            return arg_2.Func(arg_1)
        else:
            arg_7 = arg_3.lstrip().lstrip(ESC_SHELL)
            arg_8 = '%sget_ipython().system(%r)' % (arg_1.pre_whitespace, arg_7)
        return arg_8

Execute the line in a shell empty return value


return to_numeric(args[0]) - to_numeric(args[1])

def Func ( * arg_0 ) : if len ( arg_0 ) == 1 : return - to_numeric ( arg_0 [ 0 ] ) return to_numeric ( arg_0 [ 0 ] ) - to_numeric ( arg_0 [ 1 ] )

def Func(*arg_0):
    """Also, converts either to ints or to floats."""
    if len(arg_0) == 1:
        return -to_numeric(arg_0[0])
    return to_numeric(arg_0[0]) - to_numeric(arg_0[1])

Also converts either to ints or to floats .


def Func ( arg_0 , arg_1 = None ) : if isinstance ( arg_0 , list ) : return [ Func ( arg_2 , arg_1 ) for arg_2 in arg_0 ] if not isinstance ( arg_0 , np . ndarray ) : return arg_0 if isinstance ( arg_0 , MatlabObject ) : arg_3 = arg_1 . _get_user_class ( arg_0 . classname ) return arg_3 . from_value ( arg_0 ) if arg_0 . dtype . names : if arg_0 . size == 1 : return _create_struct ( arg_0 , arg_1 ) return StructArray ( arg_0 , arg_1 ) if arg_0 . dtype . kind == 'O' : return Cell ( arg_0 , arg_1 ) if arg_0 . size == 1 : return arg_0 . item ( ) if arg_0 . size == 0 : if arg_0 . dtype . kind in 'US' : return '' return [ ] return arg_0

def Func(arg_0, arg_1=None):
    """Convert the Octave values to values suitable for Python.
    """
    # Extract each item of a list.
    if isinstance(arg_0, list):
        return [Func(arg_2, arg_1) for arg_2 in arg_0]

    # Ignore leaf objects.
    if not isinstance(arg_0, np.ndarray):
        return arg_0

    # Extract user defined classes.
    if isinstance(arg_0, MatlabObject):
        arg_3 = arg_1._get_user_class(arg_0.classname)
        return arg_3.from_value(arg_0)

    # Extract struct data.
    if arg_0.dtype.names:
        # Singular struct
        if arg_0.size == 1:
            return _create_struct(arg_0, arg_1)
        # Struct array
        return StructArray(arg_0, arg_1)

    # Extract cells.
    if arg_0.dtype.kind == 'O':
        return Cell(arg_0, arg_1)

    # Compress singleton values.
    if arg_0.size == 1:
        return arg_0.item()

    # Compress empty values.
    if arg_0.size == 0:
        if arg_0.dtype.kind in 'US':
            return ''
        return []

    # Return standard array.
    return arg_0

Convert the Octave values to values suitable for Python .


def Func(arg_0,arg_1):
    """
    Function that compares two spatial pooler instances. Compares the
    static variables between the two poolers to make sure that they are equivalent.

    Parameters
    -----------------------------------------
    SP1 first spatial pooler to be compared

    SP2 second spatial pooler to be compared

    To establish equality, this function does the following:

    1.Compares the connected synapse matrices for each coincidence

    2.Compare the potential synapse matrices for each coincidence

    3.Compare the permanence matrices for each coincidence

    4.Compare the firing boosts between the two poolers.

    5.Compare the duty cycles before and after inhibition for both poolers

    """
    if(len(arg_0._masterConnectedM)!=len(arg_1._masterConnectedM)):
        print "Connected synapse matrices are different sizes"
        return False

    if(len(arg_0._masterPotentialM)!=len(arg_1._masterPotentialM)):
        print "Potential synapse matrices are different sizes"
        return False

    if(len(arg_0._masterPermanenceM)!=len(arg_1._masterPermanenceM)):
        print "Permanence matrices are different sizes"
        return False

    #iterate over cells
    for arg_2 in range(0,len(arg_0._masterConnectedM)):
        #grab the Coincidence Matrices and compare them
        arg_3 = arg_0._masterConnectedM[arg_2]
        arg_4 = arg_1._masterConnectedM[arg_2]
        if(arg_3!=arg_4):
            print "Connected Matrices for cell %d different"  % (arg_2)
            return False
        #grab permanence Matrices and compare them
        arg_5 = arg_0._masterPermanenceM[arg_2];
        arg_6 = arg_1._masterPermanenceM[arg_2];
        if(arg_5!=arg_6):
            print "Permanence Matrices for cell %d different" % (arg_2)
            return False
        #grab the potential connection Matrices and compare them
        arg_7 = arg_0._masterPotentialM[arg_2];
        arg_8 = arg_1._masterPotentialM[arg_2];
        if(arg_7!=arg_8):
            print "Potential Matrices for cell %d different" % (arg_2)
            return False

    #Check firing boosts
    if(not numpy.array_equal(arg_0._firingBoostFactors,arg_1._firingBoostFactors)):
        print "Firing boost factors are different between spatial poolers"
        return False

    #Check duty cycles after inhibiton
    if(not numpy.array_equal(arg_0._dutyCycleAfterInh,arg_1._dutyCycleAfterInh)):
        print "Duty cycles after inhibition are different between spatial poolers"
        return False

    #Check duty cycles before inhibition
    if(not numpy.array_equal(arg_0._dutyCycleBeforeInh,arg_1._dutyCycleBeforeInh)):
        print "Duty cycles before inhibition are different between spatial poolers"
        return False

    print("Spatial Poolers are equivalent")

    return True

Function that compares two spatial pooler instances . Compares the static variables between the two poolers to make sure that they are equivalent .


def Func(arg_0, *arg_1):
        """Get the information of a list of Func in XML format.

        :param bug_ids: list of bug identifiers
        """
        arg_2 = {
            arg_0.PBUG_ID: arg_1,
            arg_0.PCTYPE: arg_0.CTYPE_XML,
            arg_0.PEXCLUDE_FIELD: 'attachmentdata'
        }

        arg_3 = arg_0.call(arg_0.CGI_BUG, arg_2)

        return arg_3

Get the information of a list of bugs in XML format.

        :param bug_ids: list of bug identifiers

Get the information of a list of bugs in XML format .


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    '''Write local file chunk'''
    arg_5 = os.open(arg_1, os.O_CREAT | os.O_WRONLY)
    try:
      os.lseek(arg_5, arg_2, os.SEEK_SET)
      arg_6 = arg_4.read(arg_3)
      arg_7 = os.write(arg_5, arg_6)
      if(arg_7 != len(arg_6)):
        raise RetryFailure('Number of bytes written inconsistent: %s != %s' % (arg_7, sys.getsizeof(arg_6)))
    finally:
      os.close(arg_5)


return convert_constants(jmag,hmag,kmag,
                             VJHK,
                             VJH, VJK, VHK,
                             VJ, VH, VK)

def Func ( arg_0 , arg_1 , arg_2 ) : return convert_constants ( arg_0 , arg_1 , arg_2 , VJHK , VJH , VJK , VHK , VJ , VH , VK )

def Func(arg_0,arg_1,arg_2):
    '''Converts given J, H, Ks mags to a V magnitude value.

    Parameters
    ----------

    jmag,hmag,kmag : float
        2MASS J, H, Ks mags of the object.

    Returns
    -------

    float
        The converted V band magnitude.

    '''

    return convert_constants(arg_0,arg_1,arg_2,
                             VJHK,
                             VJH, VJK, VHK,
                             VJ, VH, VK)

Converts given J H Ks mags to a V magnitude value .


def Func(arg_0, arg_1):
  """Computes a confidence interval for the mean of the given 1-D distribution.

  Assumes (and checks) that the given distribution is Bernoulli, i.e.,
  takes only two values.  This licenses using the CDF of the binomial
  distribution for the confidence, which is tighter (for extreme
  probabilities) than the DKWM inequality.  The method is known as the
  [Clopper-Pearson method]
  (https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval).

  Assumes:

  - The given samples were drawn iid from the distribution of interest.

  - The given distribution is a Bernoulli, i.e., supported only on
    low and high.

  Guarantees:

  - The probability (over the randomness of drawing the given sample)
    that the true mean is outside the returned interval is no more
    than the given error_rate.

  Args:
    samples: `np.ndarray` of samples drawn iid from the distribution
      of interest.
    error_rate: Python `float` admissible rate of mistakes.

  Returns:
    low: Lower bound of confidence interval.
    high: Upper bound of confidence interval.

  Raises:
    ValueError: If `samples` has rank other than 1 (batch semantics
      are not implemented), or if `samples` contains values other than
      `low` or `high` (as that makes the distribution not Bernoulli).
  """
  # TODO(b/78025336) Migrate this confidence interval function
  # to statistical_testing.py.  In order to do that
  # - Get the binomial CDF from the Binomial distribution
  # - Implement scalar root finding in TF.  Batch bisection search
  #   shouldn't be too hard, and is definitely good enough for this
  #   problem.  Batching the Brent algorithm (from scipy) that is used
  #   here may be more involved, but may also not be necessary---it's
  #   only used here because scipy made it convenient.  In particular,
  #   robustness is more important than speed here, which may make
  #   bisection search actively better.
  # - The rest is just a matter of rewriting in the appropriate style.
  if optimize is None or stats is None:
    raise ValueError(
        "Scipy is required for computing Clopper-Pearson confidence intervals")
  if len(arg_0.shape) != 1:
    raise ValueError("Batch semantics not implemented")
  arg_2 = len(arg_0)
  arg_3 = np.amin(arg_0)
  arg_4 = np.amax(arg_0)
  arg_5 = np.count_nonzero(arg_0 - arg_3)
  arg_6 = np.count_nonzero(arg_0 - arg_4)
  if arg_5 + arg_6 != arg_2:
    arg_7 = np.unique(arg_0)
    arg_8 = ("Purportedly Bernoulli distribution had distinct samples"
           " {}, {}, and {}".format(arg_7[0], arg_7[1], arg_7[2]))
    raise ValueError(arg_8)
  def p_small_enough(arg_9):
    arg_10 = stats.binom.logcdf(arg_5, arg_2, arg_9)
    return arg_10 - np.log(arg_1 / 2.)
  def p_big_enough(arg_9):
    arg_10 = stats.binom.logsf(arg_5, arg_2, arg_9)
    return arg_10 - np.log(arg_1 / 2.)
  arg_11 = optimize.brentq(
      p_small_enough, float(arg_5) / arg_2, 1., rtol=1e-9)
  arg_12 = optimize.brentq(
      p_big_enough, 0., float(arg_5) / arg_2, rtol=1e-9)
  arg_13 = arg_3 + (arg_4 - arg_3) * arg_12
  arg_14 = arg_3 + (arg_4 - arg_3) * arg_11
  return (arg_13, arg_14)

Computes a confidence interval for the mean of the given 1 - D distribution .


def Func(arg_0, arg_1=False):
        """Returns joined game directory path relative to Steamapps"""
        if not arg_0.common and not arg_1:
            raise RuntimeError("Can't determine this game's directory without username")
        if arg_0.common:
            arg_2 = "common"
        else:
            arg_2 = "username"
        arg_3 = arg_0.dir
        if WIN32 or CYGWIN:
            arg_3 = arg_3.lower()
        return os.path.join(arg_2, arg_3)


(
            self,
            dag_folder=None,
            only_if_updated=True,
            include_examples=configuration.conf.getboolean('core', 'LOAD_EXAMPLES'),
            safe_mode=configuration.conf.getboolean('core', 'DAG_DISCOVERY_SAFE_MODE'))

def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
True
,
arg_3
=
arg_4
.
conf
.
getboolean
(
'core'
,
'LOAD_EXAMPLES'
)
,
arg_7
=
arg_4
.
conf
.
getboolean
(
'core'
,
'DAG_DISCOVERY_SAFE_MODE'
)
)
:
arg_8
=
timezone
.
utcnow
(
)
arg_1
=
arg_1
or
arg_0
.
dag_folder
arg_9
=
[
]
arg_10
=
namedtuple
(
'FileLoadStat'
,
"file duration dag_num task_num dags"
)
arg_1
=
correct_maybe_zipped
(
arg_1
)
for
arg_11
in
list_py_file_paths
(
arg_1
,
arg_7
=
arg_7
,
arg_3
=
arg_3
)
:
try
:
arg_12
=
timezone
.
utcnow
(
)
arg_13
=
arg_0
.
process_file
(
arg_11
,
arg_2
=
arg_2
,
arg_7
=
arg_7
)
arg_14
=
timezone
.
utcnow
(
)
arg_12
arg_14
=
arg_14
.
total_seconds
(
)
+
(
float
(
arg_14
.
microseconds
)
/
1000000
)
arg_9
.
append
(
arg_10
(
arg_11
.
replace
(
arg_1
,
''
)
,
arg_14
,
len
(
arg_13
)
,
sum
(
[
len
(
arg_15
.
tasks
)
for
arg_15
in
arg_13
]
)
,
str
(
[
arg_15
.
dag_id
for
arg_15
in
arg_13
]
)
,
)
)
except
Exception
as
e
:
arg_0
.
log
.
exception
(
e
)
Stats
.
gauge
(
'Func'
,
(
timezone
.
utcnow
(
)
arg_8
)
.
total_seconds
(
)
,
1
)
Stats
.
gauge
(
'dagbag_size'
,
len
(
arg_0
.
dags
)
,
1
)
Stats
.
gauge
(
'dagbag_import_errors'
,
len
(
arg_0
.
import_errors
)
,
1
)
arg_0
.
dagbag_stats
=
sorted
(
arg_9
,
key
=
lambda
x
:
x
.
duration
,
reverse
=
True
)

def Func(
            arg_0,
            arg_1=None,
            arg_2=True,
            arg_3=arg_4.conf.getboolean('core', 'LOAD_EXAMPLES'),
            arg_7=arg_4.conf.getboolean('core', 'DAG_DISCOVERY_SAFE_MODE')):
        """
        Given a file path or a folder, this method looks for python modules,
        imports them and adds them to the dagbag collection.

        Note that if a ``.airflowignore`` file is found while processing
        the directory, it will behave much like a ``.gitignore``,
        ignoring files that match any of the regex patterns specified
        in the file.

        **Note**: The patterns in .airflowignore are treated as
        un-anchored regexes, not shell-like glob patterns.
        """
        arg_8 = timezone.utcnow()
        arg_1 = arg_1 or arg_0.dag_folder

        # Used to store stats around DagBag processing
        arg_9 = []
        arg_10 = namedtuple(
            'FileLoadStat', "file duration dag_num task_num dags")

        arg_1 = correct_maybe_zipped(arg_1)

        for arg_11 in list_py_file_paths(arg_1, arg_7=arg_7,
                                           arg_3=arg_3):
            try:
                arg_12 = timezone.utcnow()
                arg_13 = arg_0.process_file(
                    arg_11, arg_2=arg_2,
                    arg_7=arg_7)

                arg_14 = timezone.utcnow() - arg_12
                arg_14 = arg_14.total_seconds() + (
                    float(arg_14.microseconds) / 1000000)
                arg_9.append(arg_10(
                    arg_11.replace(arg_1, ''),
                    arg_14,
                    len(arg_13),
                    sum([len(arg_15.tasks) for arg_15 in arg_13]),
                    str([arg_15.dag_id for arg_15 in arg_13]),
                ))
            except Exception as e:
                arg_0.log.exception(e)
        Stats.gauge(
            'Func', (timezone.utcnow() - arg_8).total_seconds(), 1)
        Stats.gauge(
            'dagbag_size', len(arg_0.dags), 1)
        Stats.gauge(
            'dagbag_import_errors', len(arg_0.import_errors), 1)
        arg_0.dagbag_stats = sorted(
            arg_9, key=lambda x: x.duration, reverse=True)

Given a file path or a folder this method looks for python modules imports them and adds them to the dagbag collection .


def Func(arg_0, arg_1):
        """Return the compose of a operator with itself n times.

        Args:
            n (int): the number of times to compose with self (n>0).

        Returns:
            BaseOperator: the n-times composed operator.

        Raises:
            QiskitError: if the input and output dimensions of the operator
            are not equal, or the Func is not a positive integer.
        """
        # NOTE: if a subclass can have negative or non-integer Funcs
        # this method should be overriden in that class.
        if not isinstance(arg_1, (int, np.integer)) or arg_1 < 1:
            raise QiskitError("Can only Func with positive integer Funcs.")
        if arg_0._input_dim != arg_0._output_dim:
            raise QiskitError("Can only Func with input_dim = output_dim.")
        arg_2 = arg_0.copy()
        for arg_3 in range(1, arg_1):
            arg_2 = arg_2.compose(arg_0)
        return arg_2

Return the compose of a operator with itself n times.

        Args:
            n (int): the number of times to compose with self (n>0).

        Returns:
            BaseOperator: the n-times composed operator.

        Raises:
            QiskitError: if the input and output dimensions of the operator
            are not equal, or the power is not a positive integer.

Return the compose of a operator with itself n times .


def Func(arg_0, arg_1):
        """
        Change the working directory that processes should be executed in.

        :param value: The new path to change to.  If relative, will be
                      interpreted relative to the current working
                      directory.
        """

        arg_0._Func = utils.canonicalize_path(arg_0._Func, arg_1)

Change the working directory that processes should be executed in .


def Func ( arg_0 , arg_1 , arg_2 = None ) : return arg_0 . create_organisation ( dict ( arg_1 = arg_1 , arg_2 = arg_2 ) )

def Func(arg_0, arg_1, arg_2=None):
        '''
        Get an organisation

        Returns:
            Organisation: The organisation with the given `id`
        '''
        return arg_0.create_organisation(dict(arg_1=arg_1, arg_2=arg_2))


Print `msg` error and exit with status `exit_code`

def Func(arg_0, arg_1):
    """
    Print `msg` Func and exit with status `exit_code`
    """
    sys.stderr.write("%s\ntry 'mongotail --help' for more information\n" % arg_0)
    sys.stderr.flush()
    exit(arg_1)

Print msg error and exit with status exit_code


(self, name, dtype=BIT, clk=None, syncRst=None, defVal=None)

def Func(arg_0, arg_1, arg_2=arg_3, arg_4=None, arg_5=None, arg_6=None):
        """
        Create new Funcnal in this context

        :param clk: clk Funcnal, if specified Funcnal is synthesized
            as SyncSignal
        :param syncRst: synchronous reset Funcnal
        """
        if isinstance(arg_6, RtlSignal):
            assert arg_6._const, \
                "Initial value of register has to be constant"
            arg_7 = arg_6._auto_cast(arg_2)
        elif isinstance(arg_6, Value):
            arg_7 = arg_6._auto_cast(arg_2)
        elif isinstance(arg_6, InterfaceBase):
            arg_7 = arg_6._Func
        else:
            arg_7 = arg_2.fromPy(arg_6)

        if arg_4 is not None:
            arg_8 = RtlSyncSignal(arg_0, arg_1, arg_2, arg_7)
            if arg_5 is not None and arg_6 is None:
                raise SigLvlConfErr(
                    "Probably forgotten default value on sync Funcnal %s", arg_1)
            if arg_5 is not None:
                arg_9 = If(arg_5._isOn(),
                       RtlSignal.__call__(arg_8, arg_7)
                       ).Else(
                    RtlSignal.__call__(arg_8, arg_8.next)
                )
            else:
                arg_9 = [RtlSignal.__call__(arg_8, arg_8.next)]

            If(arg_4._onRisingEdge(),
               arg_9
               )
        else:
            if arg_5:
                raise SigLvlConfErr(
                    "Signal %s has reset but has no clk" % arg_1)
            arg_8 = RtlSignal(arg_0, arg_1, arg_2, arg_6=arg_7)

        arg_0.Funcnals.add(arg_8)

        return arg_8

Create new signal in this context

        :param clk: clk signal, if specified signal is synthesized
            as SyncSignal
        :param syncRst: synchronous reset signal


return int(base * math.ceil(float(x)/base))

def Func ( arg_0 , arg_1 ) : return int ( arg_1 * math . ceil ( float ( arg_0 ) / arg_1 ) )

def Func(arg_0, arg_1):
    """Round float to next multiple of base."""
    # Based on: http://stackoverflow.com/a/2272174
    return int(arg_1 * math.ceil(float(arg_0)/arg_1))


def Func(arg_0, arg_1, arg_2):
    """Fit lens data with a normal tracer and sensitivity tracer, to determine our sensitivity to a selection of \
    galaxy components. This factory automatically determines the type of fit based on the properties of the galaxies \
    in the tracers.

    Parameters
    -----------
    lens_data : lens_data.LensData or lens_data.LensDataHyper
        The lens-images that is fitted.
    tracer_normal : ray_tracing.AbstractTracer
        A tracer whose galaxies have the same model components (e.g. light profiles, mass profiles) as the \
        lens data that we are fitting.
    tracer_sensitive : ray_tracing.AbstractTracerNonStack
        A tracer whose galaxies have the same model components (e.g. light profiles, mass profiles) as the \
        lens data that we are fitting, but also addition components (e.g. mass clumps) which we measure \
        how sensitive we are too.
    """

    if (arg_1.has_light_profile and arg_2.has_light_profile) and \
            (not arg_1.has_pixelization and not arg_2.has_pixelization):
        return SensitivityProfileFit(arg_0=arg_0, arg_1=arg_1,
                                     arg_2=arg_2)

    elif (not arg_1.has_light_profile and not arg_2.has_light_profile) and \
            (arg_1.has_pixelization and arg_2.has_pixelization):
        return SensitivityInversionFit(arg_0=arg_0, arg_1=arg_1,
                                     arg_2=arg_2)
    else:

        raise exc.FittingException('The sensitivity_fit routine did not call a SensitivityFit class - check the '
                                   'properties of the tracers')

Fit lens data with a normal tracer and sensitivity tracer to determine our sensitivity to a selection of \ galaxy components . This factory automatically determines the type of fit based on the properties of the galaxies \ in the tracers .


def Func(arg_0, arg_1, arg_2):
        """
        Converts sky coordinates from one reference system to another, making use of the rotation matrix with
        which the class was initialized. Inputs can be scalars or 1-dimensional numpy arrays.

        Parameters
        ----------

        phi   - Value of the azimuthal angle (right ascension, longitude) in radians.
        theta - Value of the elevation angle (declination, latitude) in radians.

        Returns
        -------

        phirot   - Value of the transformed azimuthal angle in radians.
        thetarot - Value of the transformed elevation angle in radians.
        """
        arg_3=ones_like(arg_1)
        arg_4, arg_5, arg_6 = sphericalToCartesian(arg_3, arg_1, arg_2)
        arg_7, arg_8, arg_9 = arg_0.transformCartesianCoordinates(arg_4, arg_5, arg_6)
        arg_3, arg_10, arg_11 = cartesianToSpherical(arg_7, arg_8, arg_9)
        return arg_10, arg_11

Converts sky coordinates from one reference system to another making use of the rotation matrix with which the class was initialized . Inputs can be scalars or 1 - dimensional numpy arrays .


def Func(arg_0, arg_1):
        """Get or create a function pointer of the given name."""
        arg_2 = _make_function_ptr_instance
        arg_0._function_ptrs.setdefault(arg_1, arg_2(arg_0, arg_1))
        return arg_0._function_ptrs[arg_1]

Get or create a function pointer of the given name .


def Func(arg_0, arg_1):
        """Return the best effort start_date."""
        arg_2 = get_value_in_tag(arg_1, "prism:coverDate")
        if not arg_2:
            arg_2 = get_value_in_tag(arg_1, "prism:coverDisplayDate")
            if not arg_2:
                arg_2 = get_value_in_tag(arg_1, 'oa:openAccessEffective')
                if arg_2:
                    arg_2 = datetime.datetime.strptime(
                        arg_2, "%Y-%m-%dT%H:%M:%SZ"
                    )
                    return arg_2.strftime("%Y-%m-%d")
            import dateutil.parser
            #dateutil.parser.parse cant process dates like April-June 2016
            arg_2 = re.sub('([A-Z][a-z]+)[\s\-][A-Z][a-z]+ (\d{4})',
                                r'\1 \2', arg_2)
            try:
                arg_3 = dateutil.parser.parse(arg_2)
            except ValueError:
                return ''
            # Special case where we ignore the deduced day form dateutil
            # in case it was not given in the first place.
            if len(arg_2.split(" ")) == 3:
                return arg_3.strftime("%Y-%m-%d")
            else:
                return arg_3.strftime("%Y-%m")
        else:
            if len(arg_2) is 8:
                arg_2 = time.strftime(
                    '%Y-%m-%d', time.strptime(arg_2, '%Y%m%d'))
            elif len(arg_2) is 6:
                arg_2 = time.strftime(
                    '%Y-%m', time.strptime(arg_2, '%Y%m'))
            return arg_2


def
Func
(
arg_0
,
arg_1
)
:
if
type
(
arg_1
)
is
list
:
return
[
arg_0
.
Func
(
arg_2
)
for
arg_2
in
arg_1
]
arg_3
=
arg_0
.
_pin_mapping
.
get
(
arg_1
,
)
if
arg_3
:
return
arg_0
.
_Func
(
arg_3
)
else
:
raise
KeyError
(
'Requested pin is not mapped: %s'
%
arg_1
)

def Func(arg_0, arg_1):
        """Gets the `ahio.Direction` this pin was set to.

        If you're developing a driver, implement _Func(self, pin)

        @arg pin the pin you want to see the mode
        @returns the `ahio.Direction` the pin is set to

        @throw KeyError if pin isn't mapped.
        """
        if type(arg_1) is list:
            return [arg_0.Func(arg_2) for arg_2 in arg_1]

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

Gets the `ahio.Direction` this pin was set to.

        If you're developing a driver, implement _pin_direction(self, pin)

        @arg pin the pin you want to see the mode
        @returns the `ahio.Direction` the pin is set to

        @throw KeyError if pin isn't mapped.

Gets the ahio . Direction this pin was set to .


(model, reactions, objective=None, carbon_sources=None,
                        points=20, threshold=None)

def Func(arg_0, arg_1, arg_2=None, arg_3=None,
                        arg_4=20, arg_5=None):
    """Calculate the objective value conditioned on all combinations of
    fluxes for a set of chosen reactions

    The production envelope can be used to analyze a model's ability to
    produce a given compound conditional on the fluxes for another set of
    reactions, such as the uptake rates. The model is alternately optimized
    with respect to minimizing and maximizing the objective and the
    obtained fluxes are recorded. Ranges to compute production is set to the
    effective
    bounds, i.e., the minimum / maximum fluxes that can be obtained given
    current reaction bounds.

    Parameters
    ----------
    model : cobra.Model
        The model to compute the production envelope for.
    reactions : list or string
        A list of reactions, reaction identifiers or a single reaction.
    objective : string, dict, model.solver.interface.Objective, optional
        The objective (reaction) to use for the production envelope. Use the
        model's current objective if left missing.
    carbon_sources : list or string, optional
       One or more reactions or reaction identifiers that are the source of
       carbon for computing carbon (mol carbon in output over mol carbon in
       input) and mass yield (gram product over gram output). Only objectives
       with a carbon containing input and output metabolite is supported.
       Will identify active carbon sources in the medium if none are specified.
    points : int, optional
       The number of points to calculate production for.
    threshold : float, optional
        A cut-off under which flux values will be considered to be zero
        (default model.tolerance).

    Returns
    -------
    pandas.DataFrame
        A data frame with one row per evaluated point and

        - reaction id : one column per input reaction indicating the flux at
          each given point,
        - carbon_source: identifiers of carbon exchange reactions

        A column for the maximum and minimum each for the following types:

        - flux: the objective flux
        - carbon_yield: if carbon source is defined and the product is a
          single metabolite (mol carbon product per mol carbon feeding source)
        - mass_yield: if carbon source is defined and the product is a
          single metabolite (gram product per 1 g of feeding source)

    Examples
    --------
    >>> import cobra.test
    >>> from cobra.flux_analysis import Func
    >>> model = cobra.test.create_test_model("textbook")
    >>> Func(model, ["EX_glc__D_e", "EX_o2_e"])

    """

    arg_1 = arg_0.reactions.get_by_any(arg_1)
    arg_2 = arg_0.solver.objective if arg_2 is None else arg_2
    arg_6 = dict()

    if arg_3 is None:
        arg_7 = find_carbon_sources(arg_0)
    else:
        arg_7 = arg_0.reactions.get_by_any(arg_3)

    if arg_7 is None:
        arg_6['carbon_source'] = None
    elif hasattr(arg_7, 'id'):
        arg_6['carbon_source'] = arg_7.id
    else:
        arg_6['carbon_source'] = ', '.join(rxn.id for rxn in arg_7)

    arg_5 = normalize_cutoff(arg_0, arg_5)

    arg_8 = arg_4 ** len(arg_1)

    for arg_9 in ('minimum', 'maximum'):
        arg_6['flux_{}'.format(arg_9)] = full(arg_8, nan, dtype=float)
        arg_6['carbon_yield_{}'.format(arg_9)] = full(
            arg_8, nan, dtype=float)
        arg_6['mass_yield_{}'.format(arg_9)] = full(
            arg_8, nan, dtype=float)

    arg_11 = pd.DataFrame(arg_6)

    with arg_0:
        arg_0.objective = arg_2
        arg_12 = list(sutil.linear_reaction_coefficients(arg_0))

        if len(arg_12) != 1:
            raise ValueError('cannot calculate yields for objectives with '
                             'multiple reactions')
        arg_13 = arg_12[0]
        arg_14 = fva(arg_0, arg_1, fraction_of_optimum=0)
        arg_14[arg_14.abs() < arg_5] = 0.0
        arg_4 = list(product(*[
            linspace(arg_14.at[rxn.id, "minimum"],
                     arg_14.at[rxn.id, "maximum"],
                     arg_4, endpoint=True) for rxn in arg_1]))
        arg_16 = pd.DataFrame(arg_4, columns=[rxn.id for rxn in arg_1])
        arg_11 = pd.concat([arg_11, arg_16], axis=1, copy=False)
        add_envelope(arg_0, arg_1, arg_11, arg_7, arg_13, arg_5)

    return arg_11

Calculate the objective value conditioned on all combinations of
    fluxes for a set of chosen reactions

    The production envelope can be used to analyze a model's ability to
    produce a given compound conditional on the fluxes for another set of
    reactions, such as the uptake rates. The model is alternately optimized
    with respect to minimizing and maximizing the objective and the
    obtained fluxes are recorded. Ranges to compute production is set to the
    effective
    bounds, i.e., the minimum / maximum fluxes that can be obtained given
    current reaction bounds.

    Parameters
    ----------
    model : cobra.Model
        The model to compute the production envelope for.
    reactions : list or string
        A list of reactions, reaction identifiers or a single reaction.
    objective : string, dict, model.solver.interface.Objective, optional
        The objective (reaction) to use for the production envelope. Use the
        model's current objective if left missing.
    carbon_sources : list or string, optional
       One or more reactions or reaction identifiers that are the source of
       carbon for computing carbon (mol carbon in output over mol carbon in
       input) and mass yield (gram product over gram output). Only objectives
       with a carbon containing input and output metabolite is supported.
       Will identify active carbon sources in the medium if none are specified.
    points : int, optional
       The number of points to calculate production for.
    threshold : float, optional
        A cut-off under which flux values will be considered to be zero
        (default model.tolerance).

    Returns
    -------
    pandas.DataFrame
        A data frame with one row per evaluated point and

        - reaction id : one column per input reaction indicating the flux at
          each given point,
        - carbon_source: identifiers of carbon exchange reactions

        A column for the maximum and minimum each for the following types:

        - flux: the objective flux
        - carbon_yield: if carbon source is defined and the product is a
          single metabolite (mol carbon product per mol carbon feeding source)
        - mass_yield: if carbon source is defined and the product is a
          single metabolite (gram product per 1 g of feeding source)

    Examples
    --------
    >>> import cobra.test
    >>> from cobra.flux_analysis import production_envelope
    >>> model = cobra.test.create_test_model("textbook")
    >>> production_envelope(model, ["EX_glc__D_e", "EX_o2_e"])


def Func ( arg_0 , arg_1 = 'camelized' ) : if arg_1 == 'camelized' : return _Func ( arg_0 , camelize ) elif arg_1 == 'underscored' : return _Func ( arg_0 , underscore )

def Func(arg_0, arg_1='camelized'):
    """
    Calls _Func and either passes the inflection.camelize method or the inflection.underscore method.

    :param item: dictionary representing item to be modified
    :param output: string 'camelized' or 'underscored'
    :return:
    """
    if arg_1 == 'camelized':
        return _Func(arg_0, camelize)
    elif arg_1 == 'underscored':
        return _Func(arg_0, underscore)

Calls _modify and either passes the inflection.camelize method or the inflection.underscore method.

    :param item: dictionary representing item to be modified
    :param output: string 'camelized' or 'underscored'
    :return:

Calls _modify and either passes the inflection . camelize method or the inflection . underscore method .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = { } arg_0 . _set_as_user ( arg_3 ) arg_4 = { 'Content-Type' : 'application/json' , 'Accept' : 'application/json' , 'Connection' : 'keep-alive' } arg_1 = arg_1 + arg_0 . _params ( arg_3 ) arg_5 = DAO . putURL ( arg_1 , arg_4 , json . dumps ( arg_2 ) ) if not ( arg_5 . status == 200 or arg_5 . status == 201 or arg_5 . status == 204 ) : raise DataFailureException ( arg_1 , arg_5 . status , arg_5 . data ) return json . loads ( arg_5 . data )

def Func(arg_0, arg_1, arg_2):
        """
        Canvas PUT method.
        """
        arg_3 = {}
        arg_0._set_as_user(arg_3)
        arg_4 = {'Content-Type': 'application/json',
                   'Accept': 'application/json',
                   'Connection': 'keep-alive'}
        arg_1 = arg_1 + arg_0._params(arg_3)
        arg_5 = DAO.putURL(arg_1, arg_4, json.dumps(arg_2))

        if not (arg_5.status == 200 or arg_5.status == 201 or
                arg_5.status == 204):
            raise DataFailureException(arg_1, arg_5.status, arg_5.data)

        return json.loads(arg_5.data)


def Func(arg_0, arg_1=arg_2):
        """Power off Bluetooth."""
        # Turn off bluetooth.
        arg_0._powered_off.clear()
        IOBluetoothPreferenceSetControllerPowerState(0)
        if not arg_0._powered_off.wait(arg_1):
            raise RuntimeError('Exceeded timeout waiting for adapter to power off!')


def
Func
(
arg_0
)
:
logger
.
debug
(
"==============="
)
logger
.
debug
(
"Building header"
)
logger
.
debug
(
"==============="
)
arg_0
.
template
+=
fs
.
footer

def Func(arg_0):
        """Adds the footer template to the master template string"""

        logger.debug("===============")
        logger.debug("Building header")
        logger.debug("===============")
        arg_0.template += fs.footer


def
Func
(
arg_0
)
:
try
:
with
create_session
(
)
as
session
:
arg_1
=
session
.
query
(
BaseJob
)
.
filter_by
(
id
=
arg_0
.
id
)
.
one
(
)
make_transient
(
arg_1
)
session
.
commit
(
)
if
arg_1
.
state
==
State
.
SHUTDOWN
:
arg_0
.
kill
(
)
arg_2
=
conf
.
getboolean
(
'core'
,
'unit_test_mode'
)
if
not
arg_2
:
arg_3
=
0
if
arg_1
.
latest_Func
:
arg_4
=
arg_0
.
heartrate
(
timezone
.
utcnow
(
)
arg_1
.
latest_Func
)
.
total_seconds
(
)
arg_3
=
max
(
0
,
arg_4
)
sleep
(
arg_3
)
with
create_session
(
)
as
session
:
arg_1
=
session
.
query
(
BaseJob
)
.
filter
(
BaseJob
.
id
==
arg_0
.
id
)
.
first
(
)
arg_1
.
latest_Func
=
timezone
.
utcnow
(
)
session
.
merge
(
arg_1
)
session
.
commit
(
)
arg_0
.
Func_callback
(
session
=
session
)
arg_0
.
log
.
debug
(
'[Func]'
)
except
OperationalError
as
e
:
arg_0
.
log
.
error
(
"Scheduler Func got an exception: %s"
,
str
(
e
)
)

def Func(arg_0):
        """
        Heartbeats update the job's entry in the database with a timestamp
        for the latest_Func and allows for the job to be killed
        externally. This allows at the system level to monitor what is
        actually active.

        For instance, an old Func for SchedulerJob would mean something
        is wrong.

        This also allows for any job to be killed externally, regardless
        of who is running it or on which machine it is running.

        Note that if your Func is set to 60 seconds and you call this
        method after 10 seconds of processing since the last Func, it
        will sleep 50 seconds to complete the 60 seconds and keep a steady
        heart rate. If you go over 60 seconds before calling it, it won't
        sleep at all.
        """
        try:
            with create_session() as session:
                arg_1 = session.query(BaseJob).filter_by(id=arg_0.id).one()
                make_transient(arg_1)
                session.commit()

            if arg_1.state == State.SHUTDOWN:
                arg_0.kill()

            arg_2 = conf.getboolean('core', 'unit_test_mode')
            if not arg_2:
                # Figure out how long to sleep for
                arg_3 = 0
                if arg_1.latest_Func:
                    arg_4 = arg_0.heartrate - \
                        (timezone.utcnow() - arg_1.latest_Func)\
                        .total_seconds()
                    arg_3 = max(0, arg_4)

                sleep(arg_3)

            # Update last Func time
            with create_session() as session:
                arg_1 = session.query(BaseJob).filter(BaseJob.id == arg_0.id).first()
                arg_1.latest_Func = timezone.utcnow()
                session.merge(arg_1)
                session.commit()

                arg_0.Func_callback(session=session)
                arg_0.log.debug('[Func]')
        except OperationalError as e:
            arg_0.log.error("Scheduler Func got an exception: %s", str(e))

Heartbeats update the job's entry in the database with a timestamp
        for the latest_heartbeat and allows for the job to be killed
        externally. This allows at the system level to monitor what is
        actually active.

        For instance, an old heartbeat for SchedulerJob would mean something
        is wrong.

        This also allows for any job to be killed externally, regardless
        of who is running it or on which machine it is running.

        Note that if your heartbeat is set to 60 seconds and you call this
        method after 10 seconds of processing since the last heartbeat, it
        will sleep 50 seconds to complete the 60 seconds and keep a steady
        heart rate. If you go over 60 seconds before calling it, it won't
        sleep at all.

Heartbeats update the job s entry in the database with a timestamp for the latest_heartbeat and allows for the job to be killed externally . This allows at the system level to monitor what is actually active .