def
Func
(
arg_0
,
arg_1
=
False
,
arg_2
=
)
:
def
list_methods
(
)
:
arg_3
=
[
]
if
arg_0
in
CRCFuncDict
.
index
:
arg_3
.
append
(
CRC
)
if
arg_0
in
SyrresDict2
.
index
:
arg_3
.
append
(
SYRRES
)
arg_3
.
append
(
)
return
arg_3
if
arg_1
:
return
list_methods
(
)
if
not
arg_2
:
arg_2
=
list_methods
(
)
[
0
]
if
arg_2
==
CRC
:
return
float
(
CRCFuncDict
.
at
[
arg_0
,
'Func'
]
)
elif
arg_2
==
SYRRES
:
return
float
(
SyrresDict2
.
at
[
arg_0
,
'Func'
]
)
elif
arg_2
==
:
return
else
:
raise
Exception
(
'Failure in in function'
)

def Func(arg_0, arg_1=False, arg_2=None):
    r'''This function handles the retrieval of a chemical's octanol-water
    partition coefficient. Lookup is based on CASRNs. Will automatically
    select a data source to use if no Method is provided; returns None if the
    data is not available.

    Parameters
    ----------
    CASRN : string
        CASRN [-]

    Returns
    -------
    Func : float
        Octanol-water partition coefficient, [-]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain Func with the
        given inputs

    Other Parameters
    ----------------
    Method : string, optional
        The method name to use. Accepted methods are 'SYRRES', or 'CRC',
        All valid values are also held in the list Func_methods.
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        the Func for the desired chemical, and will return methods
        instead of the Func

    Notes
    -----
    .. math::
        \log P_{ oct/wat} = \log\left(\frac{\left[{solute}
        \right]_{ octanol}^{un-ionized}}{\left[{solute}
        \right]_{ water}^{ un-ionized}}\right)

    Examples
    --------
    >>> Func('67-56-1')
    -0.74

    References
    ----------
    .. [1] Syrres. 2006. KOWWIN Data, SrcKowData2.zip.
       http://esc.syrres.com/interkow/Download/SrcKowData2.zip
    .. [2] Haynes, W.M., Thomas J. Bruno, and David R. Lide. CRC Handbook of
       Chemistry and Physics, 95E. Boca Raton, FL: CRC press, 2014.
    '''
    def list_methods():
        arg_3 = []
        if arg_0 in CRCFuncDict.index:
            arg_3.append(CRC)
        if arg_0 in SyrresDict2.index:
            arg_3.append(SYRRES)
        arg_3.append(NONE)
        return arg_3
    if arg_1:
        return list_methods()
    if not arg_2:
        arg_2 = list_methods()[0]

    if arg_2 == CRC:
        return float(CRCFuncDict.at[arg_0, 'Func'])
    elif arg_2 == SYRRES:
        return float(SyrresDict2.at[arg_0, 'Func'])
    elif arg_2 == NONE:
        return None
    else:
        raise Exception('Failure in in function')

r'''This function handles the retrieval of a chemical's octanol-water
    partition coefficient. Lookup is based on CASRNs. Will automatically
    select a data source to use if no Method is provided; returns None if the
    data is not available.

    Parameters
    ----------
    CASRN : string
        CASRN [-]

    Returns
    -------
    logP : float
        Octanol-water partition coefficient, [-]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain logP with the
        given inputs

    Other Parameters
    ----------------
    Method : string, optional
        The method name to use. Accepted methods are 'SYRRES', or 'CRC',
        All valid values are also held in the list logP_methods.
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        the logP for the desired chemical, and will return methods
        instead of the logP

    Notes
    -----
    .. math::
        \log P_{ oct/wat} = \log\left(\frac{\left[{solute}
        \right]_{ octanol}^{un-ionized}}{\left[{solute}
        \right]_{ water}^{ un-ionized}}\right)

    Examples
    --------
    >>> logP('67-56-1')
    -0.74

    References
    ----------
    .. [1] Syrres. 2006. KOWWIN Data, SrcKowData2.zip.
       http://esc.syrres.com/interkow/Download/SrcKowData2.zip
    .. [2] Haynes, W.M., Thomas J. Bruno, and David R. Lide. CRC Handbook of
       Chemistry and Physics, 95E. Boca Raton, FL: CRC press, 2014.

r This function handles the retrieval of a chemical s octanol - water partition coefficient . Lookup is based on CASRNs . Will automatically select a data source to use if no Method is provided ; returns None if the data is not available .


def
Func
(
arg_0
,
arg_1
)
:
arg_0
.
logger
.
debug
(
'Get Func of workflow: '
+
arg_1
)
arg_2
=
'%(wf_url)s/%(wf_id)s'
%
{
'wf_url'
:
arg_0
.
workflows_url
,
'wf_id'
:
arg_1
}
arg_3
=
arg_0
.
gbdx_connection
.
get
(
arg_2
)
arg_3
.
raise_for_Func
(
)
return
arg_3
.
json
(
)
[
'state'
]

def Func(arg_0, arg_1):
        """Checks workflow Func.

         Args:
             workflow_id (str): Workflow id.

         Returns:
             Workflow Func (str).
        """
        arg_0.logger.debug('Get Func of workflow: ' + arg_1)
        arg_2 = '%(wf_url)s/%(wf_id)s' % {
            'wf_url': arg_0.workflows_url, 'wf_id': arg_1
        }
        arg_3 = arg_0.gbdx_connection.get(arg_2)
        arg_3.raise_for_Func()
        return arg_3.json()['state']

Checks workflow status.

         Args:
             workflow_id (str): Workflow id.

         Returns:
             Workflow status (str).


def Func ( arg_0 ) : arg_1 = { } if len ( arg_0 ) == 0 : return _maybe_intify ( arg_0 . text ) if len ( arg_0 ) == 1 and arg_0 [ 0 ] . tag . startswith ( '{' + NS_GML ) : return gml_to_geojson ( arg_0 [ 0 ] ) if arg_0 . tag == 'open511' : arg_1 [ 'meta' ] = { 'version' : arg_0 . get ( 'version' ) } for arg_2 in arg_0 : arg_3 = arg_2 . tag if arg_3 == 'link' and arg_2 . get ( 'rel' ) : arg_3 = arg_2 . get ( 'rel' ) + '_url' if arg_3 == 'self_url' : arg_3 = 'url' if arg_0 . tag == 'open511' : arg_1 [ 'meta' ] [ arg_3 ] = arg_2 . get ( 'href' ) continue elif arg_3 . startswith ( '{' + NS_PROTECTED ) : arg_3 = '!' + arg_3 [ arg_3 . index ( '}' ) + 1 : ] elif arg_3 [ 0 ] == '{' : arg_3 = '+' + arg_3 [ arg_3 . index ( '}' ) + 1 : ] if arg_3 in arg_1 : continue elif arg_2 . tag == 'link' and not arg_2 . text : arg_1 [ arg_3 ] = arg_2 . get ( 'href' ) elif len ( arg_2 ) : if arg_3 == 'grouped_events' : arg_1 [ arg_3 ] = [ xml_link_to_json ( arg_4 , to_dict = False ) for arg_4 in arg_2 ] elif arg_3 in ( 'attachments' , 'media_files' ) : arg_1 [ arg_3 ] = [ xml_link_to_json ( arg_4 , to_dict = True ) for arg_4 in arg_2 ] elif all ( ( arg_3 == pluralize ( arg_4 . tag ) for arg_4 in arg_2 ) ) : arg_1 [ arg_3 ] = [ Func ( arg_4 ) for arg_4 in arg_2 ] else : arg_1 [ arg_3 ] = Func ( arg_2 ) else : if arg_0 . tag == 'open511' and arg_3 . endswith ( 's' ) and not arg_2 . text : arg_1 [ arg_3 ] = [ ] else : arg_1 [ arg_3 ] = _maybe_intify ( arg_2 . text ) return arg_1

def Func(arg_0):
    """Convert an Open511 XML document or document fragment to JSON.

    Takes an lxml Element object. Returns a dict ready to be JSON-serialized."""
    arg_1 = {}

    if len(arg_0) == 0:  # Tag with no children, return str/int
        return _maybe_intify(arg_0.text)

    if len(arg_0) == 1 and arg_0[0].tag.startswith('{' + NS_GML):  # GML
        return gml_to_geojson(arg_0[0])

    if arg_0.tag == 'open511':
        arg_1['meta'] = {'version': arg_0.get('version')}

    for arg_2 in arg_0:
        arg_3 = arg_2.tag
        if arg_3 == 'link' and arg_2.get('rel'):
            arg_3 = arg_2.get('rel') + '_url'
            if arg_3 == 'self_url':
                arg_3 = 'url'
            if arg_0.tag == 'open511':
                arg_1['meta'][arg_3] = arg_2.get('href')
                continue
        elif arg_3.startswith('{' + NS_PROTECTED):
            arg_3 = '!' + arg_3[arg_3.index('}') + 1:]
        elif arg_3[0] == '{':
            # Namespace!
            arg_3 = '+' + arg_3[arg_3.index('}') + 1:]

        if arg_3 in arg_1:
            continue  # duplicate
        elif arg_2.tag == 'link' and not arg_2.text:
            arg_1[arg_3] = arg_2.get('href')
        elif len(arg_2):
            if arg_3 == 'grouped_events':
                # An array of URLs
                arg_1[arg_3] = [xml_link_to_json(arg_4, to_dict=False) for arg_4 in arg_2]
            elif arg_3 in ('attachments', 'media_files'):
                # An array of JSON objects
                arg_1[arg_3] = [xml_link_to_json(arg_4, to_dict=True) for arg_4 in arg_2]
            elif all((arg_3 == pluralize(arg_4.tag) for arg_4 in arg_2)):
                # <something><somethings> serializes to a JSON array
                arg_1[arg_3] = [Func(arg_4) for arg_4 in arg_2]
            else:
                arg_1[arg_3] = Func(arg_2)
        else:
            if arg_0.tag == 'open511' and arg_3.endswith('s') and not arg_2.text:
                # Special case: an empty e.g. <events /> container at the root level
                # should be serialized to [], not null
                arg_1[arg_3] = []
            else:
                arg_1[arg_3] = _maybe_intify(arg_2.text)

    return arg_1

Convert an Open511 XML document or document fragment to JSON .


(client, application_name, service_name, dictionary_name, query_string, partition_key=None, partition_id=None, output_file=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
=
,
arg_6
=
,
arg_7
=
)
:
arg_8
=
Cluster
.
from_sfclient
(
arg_0
)
arg_9
=
arg_8
.
get_application
(
arg_1
)
.
get_service
(
arg_2
)
.
get_dictionary
(
arg_3
)
arg_10
=
time
.
time
(
)
if
(
arg_6
!=
)
:
arg_11
=
arg_9
.
query
(
arg_4
,
PartitionLookup
.
ID
,
arg_6
)
elif
(
arg_5
!=
)
:
arg_11
=
arg_9
.
query
(
arg_4
,
PartitionLookup
.
KEY
,
arg_5
)
else
:
arg_11
=
arg_9
.
query
(
arg_4
)
if
type
(
arg_11
)
is
str
:
print
(
arg_11
)
return
else
:
arg_11
=
json
.
dumps
(
arg_11
.
get
(
"value"
)
,
indent
=
4
)
print
(
"Query took "
+
str
(
time
.
time
(
)
arg_10
)
+
" seconds"
)
if
(
arg_7
==
)
:
arg_7
=
"{}-{}-{}-query-output.json"
.
format
(
arg_1
,
arg_2
,
arg_3
)
with
open
(
arg_7
,
"w"
)
as
output
:
output
.
write
(
arg_11
)
print
(
)
print
(
'Printed output to: '
+
arg_7
)
print
(
arg_11
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6=None, arg_7=None):
    """Query existing reliable dictionary.

    Query existing reliable dictionaries for given application and service.

    :param application_name: Name of the application.
    :type application_name: str
    :param service_name: Name of the service.
    :type service_name: str
    :param dictionary_name: Name of the reliable dictionary.
    :type dictionary_name: str
    :param query_string: An OData query string. For example $top=10. Check https://www.odata.org/documentation/ for more information.
    :type query_string: str
    :param partition_key: Optional partition key of the desired partition, either a string if named schema or int if Int64 schema
    :type partition_id: str
    :param partition_id: Optional partition GUID of the owning reliable dictionary.
    :type partition_id: str
    :param output_file: Optional file to save the schema.
    """
    arg_8 = Cluster.from_sfclient(arg_0)
    arg_9 = arg_8.get_application(arg_1).get_service(arg_2).get_dictionary(arg_3)

    arg_10 = time.time()
    if (arg_6 != None):
        arg_11 = arg_9.query(arg_4, PartitionLookup.ID, arg_6)
    elif (arg_5 != None):
        arg_11 = arg_9.query(arg_4, PartitionLookup.KEY, arg_5)
    else:
        arg_11 = arg_9.query(arg_4)

    if type(arg_11) is str:
        print(arg_11)
        return
    else:
        arg_11 = json.dumps(arg_11.get("value"), indent=4)

    print("Query took " + str(time.time() - arg_10) + " seconds")

    if (arg_7 == None):
        arg_7 = "{}-{}-{}-query-output.json".format(arg_1, arg_2, arg_3)

    with open(arg_7, "w") as output:
        output.write(arg_11)
    print()
    print('Printed output to: ' + arg_7)
    print(arg_11)


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = [ arg_1 ] if arg_2 is not None : arg_3 . extend ( arg_2 ) arg_0 . poly . Func ( * arg_3 ) return arg_0

def Func(arg_0, arg_1, arg_2=None):
        """Rotate the shape, in-place.

        Parameters
        ----------
        angle : float
            Angle to Func, in radians counter-clockwise.
        center : array-like, optional
            Point about which to Func.
            If not passed, the center of the shape will be used.

        """
        arg_3 = [arg_1]
        if arg_2 is not None:
            arg_3.extend(arg_2)
        arg_0.poly.Func(*arg_3)
        return arg_0

Rotate the shape, in-place.

        Parameters
        ----------
        angle : float
            Angle to rotate, in radians counter-clockwise.
        center : array-like, optional
            Point about which to rotate.
            If not passed, the center of the shape will be used.


(self, ctype, level=None, category=None, assetId=None, defId=None,
               min_price=None, max_price=None, min_buy=None, max_buy=None,
               league=None, club=None, position=None, zone=None, nationality=None,
               rare=False, playStyle=None, start=0, page_size=itemsPerPage['transferMarket'],
               fast=False)

return [itemParse(i) for i in rc.get('auctionInfo', ())]

def
Func
(
arg_0
,
arg_1
,
arg_2
=
,
arg_3
=
,
arg_4
=
,
arg_5
=
,
arg_6
=
,
arg_7
=
,
arg_8
=
,
arg_9
=
,
arg_10
=
,
arg_11
=
,
arg_12
=
,
arg_13
=
,
arg_14
=
,
arg_15
=
False
,
arg_16
=
,
arg_17
=
0
,
arg_18
=
arg_19
[
'transferMarket'
]
,
arg_20
=
False
)
:
arg_21
=
'GET'
arg_22
=
'transfermarket'
if
arg_17
==
0
:
arg_23
=
[
arg_0
.
pin
.
event
(
'page_view'
,
'Hub - Transfers'
)
,
arg_0
.
pin
.
event
(
'page_view'
,
'Transfer Market Search'
)
]
arg_0
.
pin
.
send
(
arg_23
,
arg_20
=
arg_20
)
arg_24
=
{
'start'
:
arg_17
,
'num'
:
arg_18
,
'type'
:
arg_1
,
}
if
arg_2
:
arg_24
[
'lev'
]
=
arg_2
if
arg_3
:
arg_24
[
'cat'
]
=
arg_3
if
arg_4
:
arg_24
[
'maskedDefId'
]
=
arg_4
if
arg_5
:
arg_24
[
'definitionId'
]
=
arg_5
if
arg_6
:
arg_24
[
'micr'
]
=
arg_6
if
arg_7
:
arg_24
[
'macr'
]
=
arg_7
if
arg_8
:
arg_24
[
'minb'
]
=
arg_8
if
arg_9
:
arg_24
[
'maxb'
]
=
arg_9
if
arg_10
:
arg_24
[
'leag'
]
=
arg_10
if
arg_11
:
arg_24
[
'team'
]
=
arg_11
if
arg_12
:
arg_24
[
'pos'
]
=
arg_12
if
arg_13
:
arg_24
[
'zone'
]
=
arg_13
if
arg_14
:
arg_24
[
'nat'
]
=
arg_14
if
arg_15
:
arg_24
[
'rare'
]
=
'SP'
if
arg_16
:
arg_24
[
'playStyle'
]
=
arg_16
arg_25
=
arg_0
.
__request__
(
arg_21
,
arg_22
,
arg_24
=
arg_24
,
arg_20
=
arg_20
)
if
arg_17
==
0
:
arg_23
=
[
arg_0
.
pin
.
event
(
'page_view'
,
'Transfer Market Results - List View'
)
,
arg_0
.
pin
.
event
(
'page_view'
,
'Item - Detail View'
)
]
arg_0
.
pin
.
send
(
arg_23
,
arg_20
=
arg_20
)
return
[
itemParse
(
arg_26
)
for
arg_26
in
arg_25
.
get
(
'auctionInfo'
,
(
)
)
]

def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=None,
               arg_6=None, arg_7=None, arg_8=None, arg_9=None,
               arg_10=None, arg_11=None, arg_12=None, arg_13=None, arg_14=None,
               arg_15=False, arg_16=None, arg_17=0, arg_18=arg_19['transferMarket'],
               arg_20=False):
        """Prepare Func request, send and return parsed data as a dict.

        :param ctype: [development / ? / ?] Card type.
        :param level: (optional) [?/?/gold] Card level.
        :param category: (optional) [fitness/?/?] Card category.
        :param assetId: (optional) Asset id.
        :param defId: (optional) Definition id.
        :param min_price: (optional) Minimal price.
        :param max_price: (optional) Maximum price.
        :param min_buy: (optional) Minimal buy now price.
        :param max_buy: (optional) Maximum buy now price.
        :param league: (optional) League id.
        :param club: (optional) Club id.
        :param position: (optional) Position.
        :param nationality: (optional) Nation id.
        :param rare: (optional) [boolean] True for Funcing special cards.
        :param playStyle: (optional) Play style.
        :param start: (optional) Start page sent to server so it supposed to be 12/15, 24/30 etc. (default platform page_size*n)
        :param page_size: (optional) Page size (items per page).
        """
        # TODO: add "Func" alias
        # TODO: generator
        arg_21 = 'GET'
        arg_22 = 'transfermarket'

        # pinEvents
        if arg_17 == 0:
            arg_23 = [arg_0.pin.event('page_view', 'Hub - Transfers'), arg_0.pin.event('page_view', 'Transfer Market Search')]
            arg_0.pin.send(arg_23, arg_20=arg_20)

        arg_24 = {
            'start': arg_17,
            'num': arg_18,
            'type': arg_1,  # "type" namespace is reserved in python
        }
        if arg_2:
            arg_24['lev'] = arg_2
        if arg_3:
            arg_24['cat'] = arg_3
        if arg_4:
            arg_24['maskedDefId'] = arg_4
        if arg_5:
            arg_24['definitionId'] = arg_5
        if arg_6:
            arg_24['micr'] = arg_6
        if arg_7:
            arg_24['macr'] = arg_7
        if arg_8:
            arg_24['minb'] = arg_8
        if arg_9:
            arg_24['maxb'] = arg_9
        if arg_10:
            arg_24['leag'] = arg_10
        if arg_11:
            arg_24['team'] = arg_11
        if arg_12:
            arg_24['pos'] = arg_12
        if arg_13:
            arg_24['zone'] = arg_13
        if arg_14:
            arg_24['nat'] = arg_14
        if arg_15:
            arg_24['rare'] = 'SP'
        if arg_16:
            arg_24['playStyle'] = arg_16

        arg_25 = arg_0.__request__(arg_21, arg_22, arg_24=arg_24, arg_20=arg_20)

        # pinEvents
        if arg_17 == 0:
            arg_23 = [arg_0.pin.event('page_view', 'Transfer Market Results - List View'), arg_0.pin.event('page_view', 'Item - Detail View')]
            arg_0.pin.send(arg_23, arg_20=arg_20)

        return [itemParse(arg_26) for arg_26 in arg_25.get('auctionInfo', ())]

Prepare search request, send and return parsed data as a dict.

        :param ctype: [development / ? / ?] Card type.
        :param level: (optional) [?/?/gold] Card level.
        :param category: (optional) [fitness/?/?] Card category.
        :param assetId: (optional) Asset id.
        :param defId: (optional) Definition id.
        :param min_price: (optional) Minimal price.
        :param max_price: (optional) Maximum price.
        :param min_buy: (optional) Minimal buy now price.
        :param max_buy: (optional) Maximum buy now price.
        :param league: (optional) League id.
        :param club: (optional) Club id.
        :param position: (optional) Position.
        :param nationality: (optional) Nation id.
        :param rare: (optional) [boolean] True for searching special cards.
        :param playStyle: (optional) Play style.
        :param start: (optional) Start page sent to server so it supposed to be 12/15, 24/30 etc. (default platform page_size*n)
        :param page_size: (optional) Page size (items per page).

Prepare search request send and return parsed data as a dict .


def Func(arg_0, arg_1):
        """ Handle the kernel's death by asking if the user wants to restart.
        """
        arg_0.log.debug("kernel died: %s", arg_1)
        if arg_0.custom_restart:
            arg_0.custom_restart_kernel_died.emit(arg_1)
        else:
            arg_2 = 'The kernel heartbeat has been inactive for %.2f ' \
                'seconds. Do you want to restart the kernel? You may ' \
                'first want to check the network connection.' % \
                arg_1
            arg_0.restart_kernel(arg_2, now=True)

Handle the kernel s death by asking if the user wants to restart .


def Func(arg_0):
        """
        Uninstalls all blacklisted packages.
        """
        from burlap.system import distrib_family
        arg_1 = arg_0.env.blacklisted_packages
        if not arg_1:
            print('No blacklisted packages.')
            return
        else:
            arg_2 = distrib_family()
            if arg_2 == DEBIAN:
                arg_0.sudo('DEBIAN_FRONTEND=noninteractive apt-get -yq purge %s' % ' '.join(arg_1))
            else:
                raise NotImplementedError('Unknown family: %s' % arg_2)


def Func ( arg_0 , arg_1 ) : if not arg_1 : return super ( IPythonInputSplitter , arg_0 ) . push ( arg_1 ) arg_1 = cast_unicode ( arg_1 , arg_0 . encoding ) if arg_1 . startswith ( '%%' ) and not ( len ( arg_1 . splitlines ( ) ) == 1 and arg_1 . strip ( ) . endswith ( '?' ) ) : return arg_0 . _handle_cell_magic ( arg_1 ) if arg_0 . input_mode == 'line' and arg_0 . processing_cell_magic : return arg_0 . _line_mode_cell_append ( arg_1 ) arg_2 = arg_1 . splitlines ( ) arg_3 = [ transform_ipy_prompt , transform_classic_prompt , transform_help_end , transform_escaped , transform_assign_system , transform_assign_magic ] arg_4 = False if arg_0 . input_mode == 'cell' : arg_0 . reset ( ) arg_4 = True arg_5 = 'cell' arg_0 . input_mode = 'line' arg_0 . _store ( arg_1 , arg_0 . _buffer_raw , 'source_raw' ) try : Func = super ( IPythonInputSplitter , arg_0 ) . push arg_8 = arg_0 . _buffer for arg_9 in arg_2 : if arg_0 . _is_complete or not arg_8 or ( arg_8 and arg_8 [ - 1 ] . rstrip ( ) . endswith ( ( ':' , ',' ) ) ) : for arg_10 in arg_3 : arg_9 = arg_10 ( arg_9 ) arg_11 = Func ( arg_9 ) finally : if arg_4 : arg_0 . input_mode = arg_5 return arg_11

def Func(arg_0, arg_1):
        """Push one or more lines of IPython input.

        This stores the given lines and returns a status code indicating
        whether the code forms a complete Python block or not, after processing
        all input lines for special IPython syntax.

        Any exceptions generated in compilation are swallowed, but if an
        exception was produced, the method returns True.

        Parameters
        ----------
        lines : string
          One or more lines of Python input.

        Returns
        -------
        is_complete : boolean
          True if the current input source (the result of the current input
        plus prior inputs) forms a complete Python execution block.  Note that
        this value is also stored as a private attribute (_is_complete), so it
        can be queried at any time.
        """
        if not arg_1:
            return super(IPythonInputSplitter, arg_0).push(arg_1)

        # We must ensure all input is pure unicode
        arg_1 = cast_unicode(arg_1, arg_0.encoding)

        # If the entire input block is a cell magic, return after handling it
        # as the rest of the transformation logic should be skipped.
        if arg_1.startswith('%%') and not \
          (len(arg_1.splitlines()) == 1 and arg_1.strip().endswith('?')):
            return arg_0._handle_cell_magic(arg_1)

        # In line mode, a cell magic can arrive in separate pieces
        if arg_0.input_mode == 'line' and arg_0.processing_cell_magic:
            return arg_0._line_mode_cell_append(arg_1)

        # The rest of the processing is for 'normal' content, i.e. IPython
        # source that we process through our transformations pipeline.
        arg_2 = arg_1.splitlines()

        arg_3 = [transform_ipy_prompt, transform_classic_prompt,
                      transform_help_end, transform_escaped,
                      transform_assign_system, transform_assign_magic]

        # Transform logic
        #
        # We only apply the line transformers to the input if we have either no
        # input yet, or complete input, or if the last line of the buffer ends
        # with ':' (opening an indented block).  This prevents the accidental
        # transformation of escapes inside multiline expressions like
        # triple-quoted strings or parenthesized expressions.
        #
        # The last heuristic, while ugly, ensures that the first line of an
        # indented block is correctly transformed.
        #
        # FIXME: try to find a cleaner approach for this last bit.

        # If we were in 'block' mode, since we're going to pump the parent
        # class by hand line by line, we need to temporarily switch out to
        # 'line' mode, do a single manual reset and then feed the lines one
        # by one.  Note that this only matters if the input has more than one
        # line.
        arg_4 = False

        if arg_0.input_mode == 'cell':
            arg_0.reset()
            arg_4 = True
            arg_5 = 'cell'
            arg_0.input_mode = 'line'

        # Store raw source before applying any transformations to it.  Note
        # that this must be done *after* the reset() call that would otherwise
        # flush the buffer.
        arg_0._store(arg_1, arg_0._buffer_raw, 'source_raw')

        try:
            Func = super(IPythonInputSplitter, arg_0).push
            arg_8 = arg_0._buffer
            for arg_9 in arg_2:
                if arg_0._is_complete or not arg_8 or \
                       (arg_8 and arg_8[-1].rstrip().endswith((':', ','))):
                    for arg_10 in arg_3:
                        arg_9 = arg_10(arg_9)

                arg_11 = Func(arg_9)
        finally:
            if arg_4:
                arg_0.input_mode = arg_5
        return arg_11

Push one or more lines of IPython input .


def
Func
(
)
:
with
settings
(
hide
(
'running'
,
'stdout'
)
)
:
arg_0
=
(
run
(
'uname -s'
)
or
''
)
.
strip
(
)
.
lower
(
)
if
arg_0
==
LINUX
:
if
is_file
(
'/usr/bin/lsb_release'
)
:
arg_1
=
run
(
'lsb_release --id --short'
)
.
strip
(
)
.
lower
(
)
if
id
in
[
'arch'
,
'archlinux'
]
:
arg_1
=
ARCH
return
arg_1
else
:
if
is_file
(
'/etc/debian_version'
)
:
return
DEBIAN
elif
is_file
(
'/etc/fedora-release'
)
:
return
FEDORA
elif
is_file
(
'/etc/arch-release'
)
:
return
ARCH
elif
is_file
(
'/etc/redhat-release'
)
:
arg_2
=
run
(
'cat /etc/redhat-release'
)
if
arg_2
.
startswith
(
'Red Hat Enterprise Linux'
)
:
return
REDHAT
elif
arg_2
.
startswith
(
'CentOS'
)
:
return
CENTOS
elif
arg_2
.
startswith
(
'Scientific Linux'
)
:
return
SLES
elif
is_file
(
'/etc/gentoo-release'
)
:
return
GENTOO
elif
arg_0
==
SUNOS
:
return
SUNOS

def Func():
    """
    Get the OS distribution ID.

    Example::

        from burlap.system import Func

        if Func() != 'Debian':
            abort(u"Distribution is not supported")

    """

    with settings(hide('running', 'stdout')):
        arg_0 = (run('uname -s') or '').strip().lower()
        if arg_0 == LINUX:
            # lsb_release works on Ubuntu and Debian >= 6.0
            # but is not always included in other distros
            if is_file('/usr/bin/lsb_release'):
                arg_1 = run('lsb_release --id --short').strip().lower()
                if id in ['arch', 'archlinux']:  # old IDs used before lsb-release 1.4-14
                    arg_1 = ARCH
                return arg_1
            else:
                if is_file('/etc/debian_version'):
                    return DEBIAN
                elif is_file('/etc/fedora-release'):
                    return FEDORA
                elif is_file('/etc/arch-release'):
                    return ARCH
                elif is_file('/etc/redhat-release'):
                    arg_2 = run('cat /etc/redhat-release')
                    if arg_2.startswith('Red Hat Enterprise Linux'):
                        return REDHAT
                    elif arg_2.startswith('CentOS'):
                        return CENTOS
                    elif arg_2.startswith('Scientific Linux'):
                        return SLES
                elif is_file('/etc/gentoo-release'):
                    return GENTOO
        elif arg_0 == SUNOS:
            return SUNOS

Get the OS distribution ID.

    Example::

        from burlap.system import distrib_id

        if distrib_id() != 'Debian':
            abort(u"Distribution is not supported")


def
Func
(
arg_0
)
:
if
compat
.
is_bytes
(
arg_0
)
:
arg_1
=
"{!r}: "
.
format
(
arg_0
)
for
arg_2
in
arg_0
:
if
type
(
arg_2
)
is
str
:
arg_2
=
ord
(
arg_2
)
arg_1
+=
"%02x "
%
arg_2
return
arg_1
return
"{}"
.
format
(
arg_0
)

def Func(arg_0):
    """Return a string as hex dump."""
    if compat.is_bytes(arg_0):
        arg_1 = "{!r}: ".format(arg_0)
        for arg_2 in arg_0:
            if type(arg_2) is str:  # Py2
                arg_2 = ord(arg_2)
            arg_1 += "%02x " % arg_2
        return arg_1
    return "{}".format(arg_0)


Overrides Django's default to_python to allow correct
        translation to instance.

def Func ( arg_0 , arg_1 ) : if arg_1 is None or isinstance ( arg_1 , arg_0 . model_container ) : return arg_1 assert isinstance ( arg_1 , dict ) arg_2 = make_mdl ( arg_0 . model_container , arg_1 ) return arg_2

def Func(arg_0, arg_1):
        """
        Overrides Django's default Func to allow correct
        translation to instance.
        """
        if arg_1 is None or isinstance(arg_1, arg_0.model_container):
            return arg_1
        assert isinstance(arg_1, dict)

        arg_2 = make_mdl(arg_0.model_container, arg_1)
        return arg_2

Overrides Django s default to_python to allow correct translation to instance .


def
Func
(
arg_0
)
:
if
arg_0
.
is_empty
(
)
:
raise
ValueError
(
"Tree is empty"
)
arg_1
=
arg_0
.
_root
while
arg_1
.
right
is
not
:
arg_1
=
arg_1
.
right
return
arg_1
.
key
,
arg_1
.
value

def Func(arg_0):
        """Get item with max key of tree, raises ValueError if tree is empty."""
        if arg_0.is_empty():
            raise ValueError("Tree is empty")
        arg_1 = arg_0._root
        while arg_1.right is not None:
            arg_1 = arg_1.right
        return arg_1.key, arg_1.value

Get item with max key of tree raises ValueError if tree is empty .


"Continuing to receive HTTP 429 \responses after 62 seconds. You are being rate-limited, try again later"

def Func(arg_0):
    """ Error handler for HTTP requests
    """
    arg_1 = {
        400: ze.UnsupportedParams,
        401: ze.UserNotAuthorised,
        403: ze.UserNotAuthorised,
        404: ze.ResourceNotFound,
        409: ze.Conflict,
        412: ze.PreConditionFailed,
        413: ze.RequestEntityTooLarge,
        428: ze.PreConditionRequired,
        429: ze.TooManyRequests,
    }

    def err_msg(arg_0):
        """ Return a nicely-formatted error message
        """
        return "\nCode: %s\nURL: %s\nMethod: %s\nResponse: %s" % (
            arg_0.status_code,
            # error.msg,
            arg_0.url,
            arg_0.request.method,
            arg_0.text,
        )

    if arg_1.get(arg_0.status_code):
        # check to see whether its 429
        if arg_0.status_code == 429:
            # call our back-off function
            arg_2 = backoff.delay
            if arg_2 > 32:
                # we've waited a total of 62 seconds (2 + 4 … + 32), so give up
                backoff.reset()
                raise ze.TooManyRetries(
                    "Continuing to receive HTTP 429 \
responses after 62 seconds. You are being rate-limited, try again later"
                )
            time.sleep(arg_2)
            arg_3 = requests.Session()
            arg_4 = arg_3.send(arg_0.request)
            try:
                arg_4.raise_for_status()
            except requests.exceptions.HTTPError:
                Func(arg_4)
        else:
            raise arg_1.get(arg_0.status_code)(err_msg(arg_0))
    else:
        raise ze.HTTPError(err_msg(arg_0))


(quantity=2, separator='\n\n', wrap_start='', wrap_end='',
               html=False, sentences_quantity=3, as_list=False)

def Func ( arg_0 = 2 , arg_1 = '\n\n' , arg_2 = '' , arg_3 = '' , arg_4 = False , arg_5 = 3 , arg_6 = False ) : if arg_4 : arg_2 = '<p>' arg_3 = '</p>' arg_1 = '\n\n' arg_7 = [ ] try : for arg_8 in xrange ( 0 , arg_0 ) : arg_7 . append ( arg_2 + sentences ( arg_5 ) + arg_3 ) except NameError : for arg_8 in range ( 0 , arg_0 ) : arg_7 . append ( arg_2 + sentences ( arg_5 ) + arg_3 ) if arg_6 : return arg_7 else : return arg_1 . join ( arg_7 )

def Func(arg_0=2, arg_1='\n\n', arg_2='', arg_3='',
               arg_4=False, arg_5=3, arg_6=False):
    """Return random Func."""
    if arg_4:
        arg_2 = '<p>'
        arg_3 = '</p>'
        arg_1 = '\n\n'

    arg_7 = []
    try:
        for arg_8 in xrange(0, arg_0):
            arg_7.append(arg_2 +
                          sentences(arg_5) +
                          arg_3)
    # Python 3 compatibility
    except NameError:
        for arg_8 in range(0, arg_0):
            arg_7.append(arg_2 +
                          sentences(arg_5) +
                          arg_3)

    if arg_6:
        return arg_7
    else:
        return arg_1.join(arg_7)


def Func(arg_0):
        """
        we need to be flexible in order to determine which plugin's configuration
        specified and make appropriate configs to metrics collector

        :return: SECTION name or None for defaults
        """
        try:
            arg_1 = arg_0.core.get_option('telegraf', "config")
        except KeyError:
            arg_1 = None
        try:
            arg_2 = arg_0.core.get_option('monitoring', "config")
        except KeyError:
            arg_2 = None

        if arg_1 and arg_2:
            raise ValueError(
                'Both telegraf and monitoring configs specified. '
                'Clean up your config and delete one of them')
        if arg_1 and not arg_2:
            return 'telegraf'
        if not arg_1 and arg_2:
            return 'monitoring'
        if not arg_1 and not arg_2:
            # defaults target logic
            try:
                arg_3 = arg_0.core.get_option('telegraf')
            except NoOptionError:
                arg_3 = None
            try:
                arg_4 = arg_0.core.get_option('monitoring')
            except BaseException:
                arg_4 = None
            if arg_3 and arg_4:
                raise ValueError(
                    'Both telegraf and monitoring default targets specified. '
                    'Clean up your config and delete one of them')
            if arg_3 and not arg_4:
                return
            if not arg_3 and arg_4:
                arg_0.core.set_option(
                    "telegraf", "default_target", arg_4)
            if not arg_3 and not arg_4:
                return

we need to be flexible in order to determine which plugin s configuration specified and make appropriate configs to metrics collector


return { key : config[key] for key in (tpot_keys).intersection(pmml_keys)}

def Func ( arg_0 , arg_1 = [ ] ) : arg_2 = set ( arg_0 . keys ( ) ) arg_3 = _supported_classes ( arg_1 ) arg_4 = ( set ( arg_3 ) ) . union ( set ( [ _strip_module ( class_ ) for class_ in arg_3 ] ) ) return { arg_5 : arg_0 [ arg_5 ] for arg_5 in ( arg_2 ) . intersection ( arg_4 ) }

def Func(arg_0, arg_1 = []):
	"""Translates a regular TPOT configuration to a PMML-compatible TPOT configuration.

	Parameters:
	----------
	obj: config
		The configuration dictionary.

	user_classpath: list of strings, optional
		The paths to JAR files that provide custom Transformer, Selector and/or Estimator converter classes.
		The JPMML-SkLearn classpath is constructed by appending user JAR files to package JAR files.

	"""
	arg_2 = set(arg_0.keys())
	arg_3 = _supported_classes(arg_1)
	arg_4 = (set(arg_3)).union(set([_strip_module(class_) for class_ in arg_3]))
	return { arg_5 : arg_0[arg_5] for arg_5 in (arg_2).intersection(arg_4)}

Translates a regular TPOT configuration to a PMML - compatible TPOT configuration .


def Func(arg_0, arg_1):  # pylint: disable=unused-argument
        """Clears any state left in this checker from last module checked."""
        # The code being checked can just as easily "import logging as foo",
        # so it is necessary to process the imports and store in this field
        # what name the logging module is actually given.
        arg_0._logging_names = set()
        arg_3 = arg_0.config.logging_modules

        arg_0._format_style = arg_0.config.logging_format_style
        arg_0._logging_modules = set(arg_3)
        arg_0._from_imports = {}
        for arg_7 in arg_3:
            arg_8 = arg_7.rsplit(".", 1)
            if len(arg_8) > 1:
                arg_0._from_imports[arg_8[0]] = arg_8[1]

Clears any state left in this checker from last module checked .


def
Func
(
arg_0
,
arg_1
)
:
for
arg_2
in
msaf
.
features_registry
:
logging
.
info
(
"Computing %s for file %s"
%
(
arg_2
,
arg_0
.
audio_file
)
)
arg_3
=
Features
.
select_features
(
arg_2
,
arg_0
,
False
,
arg_1
)
arg_3
.
features

def Func(arg_0, arg_1):
    """Computes all features for the given file."""
    for arg_2 in msaf.features_registry:
        logging.info("Computing %s for file %s" % (arg_2,
                                                   arg_0.audio_file))
        arg_3 = Features.select_features(arg_2, arg_0, False, arg_1)
        arg_3.features

Computes all features for the given file .


def Func ( arg_0 , arg_1 , arg_2 = None ) : if tf . executing_eagerly ( ) : return arg_1 with tf . name_scope ( arg_2 or "control_dependency" ) as arg_2 : with tf . control_dependencies ( arg_3 for arg_3 in arg_0 if arg_3 is not None ) : arg_1 = tf . convert_to_tensor ( value = arg_1 ) if isinstance ( arg_1 , tf . Tensor ) : return tf . identity ( arg_1 , arg_2 = arg_2 ) else : return tf . IndexedSlices ( tf . identity ( arg_1 . values , arg_2 = arg_2 ) , arg_1 . indices , arg_1 . dense_shape )

def Func(arg_0, arg_1, arg_2=None):
  """Produces the content of `output_tensor` only after `dependencies`.

  In some cases, a user may want the output of an operation to be consumed
  externally only after some other dependencies have run first. This function
  returns `output_tensor`, but only after all operations in `dependencies` have
  run. Note that this means that there is no guarantee that `output_tensor` will
  be evaluated after any `dependencies` have run.

  See also `tf.tuple` and `tf.group`.

  Args:
    dependencies: Iterable of operations to run before this op finishes.
    output_tensor: A `Tensor` or `IndexedSlices` that will be returned.
    name: (Optional) A name for this operation.

  Returns:
    output_with_deps: Same as `output_tensor` but with embedded dependencies.

  Raises:
    TypeError: if `output_tensor` is not a `Tensor` or `IndexedSlices`.
  """
  if tf.executing_eagerly():
    return arg_1
  with tf.name_scope(arg_2 or "control_dependency") as arg_2:
    with tf.control_dependencies(arg_3 for arg_3 in arg_0 if arg_3 is not None):
      arg_1 = tf.convert_to_tensor(value=arg_1)
      if isinstance(arg_1, tf.Tensor):
        return tf.identity(arg_1, arg_2=arg_2)
      else:
        return tf.IndexedSlices(
            tf.identity(arg_1.values, arg_2=arg_2),
            arg_1.indices,
            arg_1.dense_shape)

Produces the content of output_tensor only after dependencies .


return b''.join([CONNECT_OP + _SPC_ + connect_opts.encode() + _CRLF_])

def Func ( arg_0 ) : arg_1 = { "verbose" : arg_0 . options [ "verbose" ] , "pedantic" : arg_0 . options [ "pedantic" ] , "lang" : __lang__ , "version" : __version__ , "protocol" : PROTOCOL } if "auth_required" in arg_0 . _server_info : if arg_0 . _server_info [ "auth_required" ] : if arg_0 . options [ "user" ] is not None and arg_0 . options [ "password" ] is not None : arg_1 [ "user" ] = arg_0 . options [ "user" ] arg_1 [ "pass" ] = arg_0 . options [ "password" ] elif arg_0 . options [ "token" ] is not None : arg_1 [ "auth_token" ] = arg_0 . options [ "token" ] elif arg_0 . _current_server . uri . password is None : arg_1 [ "auth_token" ] = arg_0 . _current_server . uri . username else : arg_1 [ "user" ] = arg_0 . _current_server . uri . username arg_1 [ "pass" ] = arg_0 . _current_server . uri . password if arg_0 . options [ "name" ] is not None : arg_1 [ "name" ] = arg_0 . options [ "name" ] if arg_0 . options [ "no_echo" ] is not None : arg_1 [ "echo" ] = not arg_0 . options [ "no_echo" ] arg_2 = json . dumps ( arg_1 , sort_keys = True ) return b'' . join ( [ CONNECT_OP + _SPC_ + arg_2 . encode ( ) + _CRLF_ ] )

def Func(arg_0):
        '''
        Generates a JSON string with the params to be used
        when sending CONNECT to the server.

          ->> CONNECT {"lang": "python3"}

        '''
        arg_1 = {
            "verbose": arg_0.options["verbose"],
            "pedantic": arg_0.options["pedantic"],
            "lang": __lang__,
            "version": __version__,
            "protocol": PROTOCOL
        }
        if "auth_required" in arg_0._server_info:
            if arg_0._server_info["auth_required"]:
                # In case there is no password, then consider handle
                # sending a token instead.
                if arg_0.options["user"] is not None and arg_0.options["password"] is not None:
                    arg_1["user"] = arg_0.options["user"]
                    arg_1["pass"] = arg_0.options["password"]
                elif arg_0.options["token"] is not None:
                    arg_1["auth_token"] = arg_0.options["token"]
                elif arg_0._current_server.uri.password is None:
                    arg_1["auth_token"] = arg_0._current_server.uri.username
                else:
                    arg_1["user"] = arg_0._current_server.uri.username
                    arg_1["pass"] = arg_0._current_server.uri.password
        if arg_0.options["name"] is not None:
            arg_1["name"] = arg_0.options["name"]
        if arg_0.options["no_echo"] is not None:
            arg_1["echo"] = not arg_0.options["no_echo"]

        arg_2 = json.dumps(arg_1, sort_keys=True)
        return b''.join([CONNECT_OP + _SPC_ + arg_2.encode() + _CRLF_])

Generates a JSON string with the params to be used when sending CONNECT to the server .


def Func ( arg_0 ) : arg_1 = [ ] arg_2 = set ( ) def schedule ( arg_3 ) : if arg_3 . satisfied_by or arg_3 in arg_2 : return arg_2 . add ( arg_3 ) for arg_4 in arg_0 . _dependencies [ arg_3 ] : schedule ( arg_4 ) arg_1 . append ( arg_3 ) for arg_5 in arg_0 . requirements . values ( ) : schedule ( arg_5 ) return arg_1

def Func(arg_0):
        """Create the installation order.

        The installation order is topological - requirements are installed
        before the requiring thing. We break cycles at an arbitrary point,
        and make no other guarantees.
        """
        # The current implementation, which we may change at any point
        # installs the user specified things in the order given, except when
        # dependencies must come earlier to achieve topological order.
        arg_1 = []
        arg_2 = set()

        def schedule(arg_3):
            if arg_3.satisfied_by or arg_3 in arg_2:
                return
            arg_2.add(arg_3)
            for arg_4 in arg_0._dependencies[arg_3]:
                schedule(arg_4)
            arg_1.append(arg_3)
        for arg_5 in arg_0.requirements.values():
            schedule(arg_5)
        return arg_1


lists compartments the metabolites are in

def Func ( arg_0 ) : if arg_0 . _Func is None : arg_0 . _Func = { met . compartment for met in arg_0 . _metabolites if met . compartment is not None } return arg_0 . _Func

def Func(arg_0):
        """lists Func the metabolites are in"""
        if arg_0._Func is None:
            arg_0._Func = {met.compartment for met in arg_0._metabolites
                                  if met.compartment is not None}
        return arg_0._Func


def Func ( arg_0 ) : arg_1 = [ 'clingen_cgh_benignAF' , 'clingen_cgh_benign' , 'clingen_cgh_pathogenicAF' , 'clingen_cgh_pathogenic' , 'clingen_ngi' , 'clingen_ngiAF' , 'swegen' , 'swegenAF' , 'decipherAF' , 'decipher' ] arg_2 = { } for arg_3 in arg_1 : arg_4 = arg_0 . INFO . get ( arg_3 , 0 ) if 'AF' in arg_3 : arg_4 = float ( arg_4 ) else : arg_4 = int ( arg_4 ) if arg_4 > 0 : arg_2 [ arg_3 ] = arg_4 return arg_2

def Func(arg_0):
    """Parsing of some custom sv frequencies

    These are very specific at the moment, this will hopefully get better over time when the
    field of structural variants is more developed.

    Args:
        variant(cyvcf2.Variant)

    Returns:
        sv_frequencies(dict)
    """
    arg_1 = [
        'clingen_cgh_benignAF',
        'clingen_cgh_benign',
        'clingen_cgh_pathogenicAF',
        'clingen_cgh_pathogenic',
        'clingen_ngi',
        'clingen_ngiAF',
        'swegen',
        'swegenAF',
        'decipherAF',
        'decipher'
    ]
    arg_2 = {}

    for arg_3 in arg_1:
        arg_4 = arg_0.INFO.get(arg_3, 0)
        if 'AF' in arg_3:
            arg_4 = float(arg_4)
        else:
            arg_4 = int(arg_4)
        if arg_4 > 0:
            arg_2[arg_3] = arg_4
    return arg_2

Parsing of some custom sv frequencies These are very specific at the moment this will hopefully get better over time when the field of structural variants is more developed .


return pickle.dumps({
            'name': d['name'],
            'seg': pickle.dumps(d['seg'], protocol=-1),
        }, protocol=-1)

def Func ( arg_0 ) : arg_1 = arg_0 . __getstate__ ( ) return pickle . dumps ( { 'name' : arg_1 [ 'name' ] , 'seg' : pickle . dumps ( arg_1 [ 'seg' ] , protocol = - 1 ) , } , protocol = - 1 )

def Func(arg_0):
        """
        Serializes into a bytestring.

        :returns: An object of type Bytes.
        """
        arg_1 = arg_0.__getstate__()
        return pickle.dumps({
            'name': arg_1['name'],
            'seg': pickle.dumps(arg_1['seg'], protocol=-1),
        }, protocol=-1)


def Func(arg_0, arg_1, arg_2=True):
    """
    Transform a supported data type to a list of lists, and a list of headers.

    Supported tabular data types:

    * list-of-lists or another iterable of iterables

    * 2D NumPy arrays

    * dict of iterables (usually used with headers="keys")

    * pandas.DataFrame (usually used with headers="keys")

    The first row can be used as headers if headers="firstrow",
    column indices can be used as headers if headers="keys".

    """

    if hasattr(arg_0, "keys") and hasattr(arg_0, "values"):
        # dict-like and pandas.DataFrame?
        if hasattr(arg_0.values, "__call__"):
            # likely a conventional dict
            arg_3 = list(arg_0.keys())
            # columns have to be transposed
            arg_4 = list(izip_longest(*list(arg_0.values())))
        elif hasattr(arg_0, "index"):
            # values is a property, has .index then
            # it's likely a pandas.DataFrame (pandas 0.11.0)
            arg_3 = list(arg_0.keys())
            # values matrix doesn't need to be transposed
            arg_5 = arg_0.values
            arg_6 = arg_0.index
            arg_4 = [[v] + list(row) for v, row in zip(arg_6, arg_5)]
        else:
            raise ValueError("tabular data doesn't appear to be a dict "
                             "or a DataFrame")

        if arg_1 == "keys":
            arg_1 = list(map(_text_type, arg_3))  # headers should be strings

    else:  # it's, as usual, an iterable of iterables, or a NumPy array
        arg_4 = list(arg_0)

        if arg_1 == "keys" and len(arg_4) > 0:  # keys are column indices
            arg_1 = list(map(_text_type, list(range(len(arg_4[0])))))

    # take headers from the first row if necessary
    if arg_1 == "firstrow" and len(arg_4) > 0:
        arg_1 = list(map(_text_type, arg_4[0]))  # headers should be strings
        arg_4 = arg_4[1:]

    arg_1 = list(arg_1)

    arg_4 = list(map(list, arg_4))

    if arg_2 and len(arg_4) > 1:
        arg_4 = sorted(arg_4, key=lambda x: x[0])

    # pad with empty headers for initial columns if necessary
    if arg_1 and len(arg_4) > 0:
        arg_7 = len(arg_1)
        arg_8 = len(arg_4[0])
        if arg_7 < arg_8:
            arg_1 = [""] * (arg_8 - arg_7) + arg_1

    return arg_4, arg_1

Transform a supported data type to a list of lists and a list of headers .


def
Func
(
arg_0
)
:
try
:
arg_1
=
open_source
(
arg_0
)
except
IOError
:
raise
NoSource
(
"No file to run: %r"
%
arg_0
)
try
:
arg_2
=
arg_1
.
read
(
)
finally
:
arg_1
.
close
(
)
if
not
arg_2
or
arg_2
[
1
]
!=
'\n'
:
arg_2
+=
'\n'
arg_3
=
compile
(
arg_2
,
arg_0
,
"exec"
)
return
arg_3

def Func(arg_0):
    """Get source from `filename` and make a code object of it."""
    # Open the source file.
    try:
        arg_1 = open_source(arg_0)
    except IOError:
        raise NoSource("No file to run: %r" % arg_0)

    try:
        arg_2 = arg_1.read()
    finally:
        arg_1.close()

    # We have the source.  `compile` still needs the last line to be clean,
    # so make sure it is, then compile a code object from it.
    if not arg_2 or arg_2[-1] != '\n':
        arg_2 += '\n'
    arg_3 = compile(arg_2, arg_0, "exec")

    return arg_3

Get source from filename and make a code object of it .


def Func(arg_0):
    """Return a check digit of the given credit card number.

    Check digit calculated using Luhn algorithm ("modulus 10")
    See: http://www.darkcoding.net/credit-card/luhn-formula/
    """
    arg_1 = 0

    # drop last digit, then reverse the number
    arg_2 = str(arg_0)[:-1][::-1]

    for arg_3, arg_4 in enumerate(arg_2):
        # select all digits at odd positions starting from 1
        if (arg_3 + 1) % 2 != 0:
            arg_5 = int(arg_4) * 2
            if arg_5 > 9:
                arg_1 += (arg_5 - 9)
            else:
                arg_1 += arg_5
        else:
            arg_1 += int(arg_4)

    return ((divmod(arg_1, 10)[0] + 1) * 10 - arg_1) % 10

Return a check digit of the given credit card number .


def
Func
(
arg_0
,
arg_1
)
:
arg_1
=
arg_0
.
filter_by_labels
(
arg_1
,
"pull requests"
)
arg_1
=
arg_0
.
filter_merged_pull_requests
(
arg_1
)
if
arg_0
.
options
.
verbose
>
1
:
print
(
"\tremaining pull requests: {}"
.
format
(
len
(
arg_1
)
)
)
return
arg_1

def Func(arg_0, arg_1):
        """
        This method fetches missing params for PR and filter them
        by specified options. It include add all PR's with labels
        from options.include_labels and exclude all from
        options.exclude_labels.

        :param list(dict) pull_requests: All pull requests.
        :rtype: list(dict)
        :return: Filtered pull requests.
        """

        arg_1 = arg_0.filter_by_labels(arg_1, "pull requests")
        arg_1 = arg_0.filter_merged_pull_requests(arg_1)
        if arg_0.options.verbose > 1:
            print("\tremaining pull requests: {}".format(len(arg_1)))
        return arg_1

This method fetches missing params for PR and filter them by specified options . It include add all PR s with labels from options . include_labels and exclude all from options . exclude_labels .


def
Func
(
arg_0
)
->
str
:
arg_1
=
fmt
.
end
(
";\n"
,
[
]
)
arg_2
=
fmt
.
sep
(
', '
,
[
]
)
for
arg_3
in
sorted
(
arg_0
.
states
.
keys
(
)
)
:
arg_2
.
lsdata
.
append
(
str
(
arg_3
)
)
arg_1
.
lsdata
.
append
(
fmt
.
block
(
'('
,
')'
,
[
arg_2
]
)
)
arg_1
.
lsdata
.
append
(
"events:"
+
repr
(
arg_0
.
events
)
)
arg_1
.
lsdata
.
append
(
"named_events:"
+
repr
(
list
(
arg_0
.
named_events
.
keys
(
)
)
)
)
arg_1
.
lsdata
.
append
(
"uid_events:"
+
repr
(
list
(
arg_0
.
uid_events
.
keys
(
)
)
)
)
return
arg_1

def Func(arg_0) -> str:
        """
        Provide a useful representation of the register.
        """
        arg_1 = fmt.end(";\n", [])
        arg_2 = fmt.sep(', ', [])
        for arg_3 in sorted(arg_0.states.keys()):
            arg_2.lsdata.append(str(arg_3))
        arg_1.lsdata.append(fmt.block('(', ')', [arg_2]))
        arg_1.lsdata.append("events:" + repr(arg_0.events))
        arg_1.lsdata.append(
            "named_events:" + repr(list(arg_0.named_events.keys()))
        )
        arg_1.lsdata.append("uid_events:" + repr(list(arg_0.uid_events.keys())))
        return arg_1

Provide a useful representation of the register .


return from_pandas(pd.read_csv(filename_or_buffer, **kwargs), copy_index=copy_index)

def Func ( arg_0 , arg_1 = True , ** arg_2 ) : import pandas as pd return from_pandas ( pd . read_csv ( arg_0 , ** arg_2 ) , arg_1 = arg_1 )

def Func(arg_0, arg_1=True, **arg_2):
    """Shortcut to read a csv file using pandas and convert to a DataFrame directly.

    :rtype: DataFrame
    """
    import pandas as pd
    return from_pandas(pd.read_csv(arg_0, **arg_2), arg_1=arg_1)

Shortcut to read a csv file using pandas and convert to a DataFrame directly .


def Func(arg_0):
    """
    If you want to use functionalities related to Controls and Patterns in a new thread.
    You must call InitializeUIAutomationInCurrentThread first in the thread
        and call UninitializeUIAutomationInCurrentThread when the thread exits.
    But you can't use use a Control or a Pattern created in a different thread.
    So you can't create a Control or a Pattern in main thread and then pass it to a new thread and use it.
    """
    #print(root)# you cannot use root because it is root control created in main thread
    arg_1 = threading.currentThread()
    auto.Logger.WriteLine('\nThis is running in a new thread. {} {}'.format(arg_1.ident, arg_1.name), auto.ConsoleColor.Cyan)
    time.sleep(2)
    auto.InitializeUIAutomationInCurrentThread()
    auto.GetConsoleWindow().CaptureToImage('console_newthread.png')
    arg_2 = auto.GetRootControl()    #ok, root control created in new thread
    auto.EnumAndLogControl(arg_2, 1)
    auto.UninitializeUIAutomationInCurrentThread()
    auto.Logger.WriteLine('\nThread exits. {} {}'.format(arg_1.ident, arg_1.name), auto.ConsoleColor.Cyan)

If you want to use functionalities related to Controls and Patterns in a new thread . You must call InitializeUIAutomationInCurrentThread first in the thread and call UninitializeUIAutomationInCurrentThread when the thread exits . But you can t use use a Control or a Pattern created in a different thread . So you can t create a Control or a Pattern in main thread and then pass it to a new thread and use it .


def
Func
(
arg_0
,
arg_1
=
500
,
arg_2
=
True
)
:
with
pm
.
Model
(
)
as
model
:
arg_3
=
pm
.
Normal
(
'mean returns'
,
arg_3
=
0
,
sd
=
.01
,
testval
=
arg_0
.
mean
(
)
)
arg_4
=
pm
.
HalfCauchy
(
'volatility'
,
beta
=
1
,
testval
=
arg_0
.
std
(
)
)
arg_5
=
pm
.
Normal
(
'returns'
,
arg_3
=
arg_3
,
sd
=
arg_4
,
observed
=
arg_0
)
pm
.
Deterministic
(
'annual volatility'
,
arg_5
.
distribution
.
variance
**
.5
*
np
.
sqrt
(
252
)
)
pm
.
Deterministic
(
'sharpe'
,
arg_5
.
distribution
.
mean
/
arg_5
.
distribution
.
variance
**
.5
*
np
.
sqrt
(
252
)
)
arg_6
=
pm
.
sample
(
arg_1
,
arg_2
=
arg_2
)
return
model
,
arg_6

def Func(arg_0, arg_1=500, arg_2=True):
    """
    Run Bayesian model assuming returns are normally distributed.

    Parameters
    ----------
    returns : pandas.Series
        Series of simple returns of an algorithm or stock.
    samples : int (optional)
        Number of posterior samples to draw.

    Returns
    -------
    model : pymc.Model object
        PyMC3 model containing all random variables.
    trace : pymc3.sampling.BaseTrace object
        A PyMC3 trace object that contains samples for each parameter
        of the posterior.
    """

    with pm.Model() as model:
        arg_3 = pm.Normal('mean returns', arg_3=0, sd=.01, testval=arg_0.mean())
        arg_4 = pm.HalfCauchy('volatility', beta=1, testval=arg_0.std())
        arg_5 = pm.Normal('returns', arg_3=arg_3, sd=arg_4, observed=arg_0)
        pm.Deterministic(
            'annual volatility',
            arg_5.distribution.variance**.5 *
            np.sqrt(252))
        pm.Deterministic(
            'sharpe',
            arg_5.distribution.mean /
            arg_5.distribution.variance**.5 *
            np.sqrt(252))

        arg_6 = pm.sample(arg_1, arg_2=arg_2)
    return model, arg_6

Run Bayesian model assuming returns are normally distributed .


A list of axes of rotation for this joint.

return [np.array(self.ode_obj.getAxis1()),
                np.array(self.ode_obj.getAxis2())]

def Func ( arg_0 ) : return [ np . array ( arg_0 . ode_obj . getAxis1 ( ) ) , np . array ( arg_0 . ode_obj . getAxis2 ( ) ) ]

def Func(arg_0):
        '''A list of Func of rotation for this joint.'''
        return [np.array(arg_0.ode_obj.getAxis1()),
                np.array(arg_0.ode_obj.getAxis2())]

A list of axes of rotation for this joint .


return list(filterfalse(lambda x: x.relation in removal_relation_set, triples))

def
Func
(
arg_0
,
arg_1
=
0.97
)
:
logging
.
debug
(
"remove duplicate"
)
_assert_threshold
(
arg_1
)
arg_2
=
defaultdict
(
list
)
arg_3
=
set
(
)
for
arg_4
in
arg_0
:
arg_2
[
arg_4
.
relation
]
.
append
(
f"{t.head} {t.tail}"
)
arg_3
.
add
(
arg_4
.
relation
)
arg_3
=
list
(
arg_3
)
arg_5
=
len
(
arg_0
)
arg_6
=
set
(
)
for
arg_7
,
arg_8
in
arg_2
.
items
(
)
:
arg_2
[
arg_7
]
=
Superminhash
(
arg_8
)
for
arg_9
in
arg_3
:
for
arg_10
in
arg_3
:
if
arg_9
==
arg_10
or
arg_9
in
arg_6
or
arg_10
in
arg_6
:
continue
arg_11
=
[
arg_9
]
if
_set_close_to
(
arg_2
[
arg_9
]
,
arg_2
[
arg_10
]
,
arg_1
)
:
arg_11
.
append
(
arg_10
)
if
len
(
arg_11
)
>
1
:
arg_11
.
pop
(
np
.
random
.
randint
(
len
(
arg_11
)
)
)
arg_6
|=
set
(
arg_11
)
logging
.
info
(
"Removing {} relations: {}"
.
format
(
len
(
arg_6
)
,
str
(
arg_6
)
)
)
return
list
(
filterfalse
(
lambda
x
:
x
.
relation
in
arg_6
,
arg_0
)
)

def Func(arg_0, arg_1=0.97):
    """If entity pairs in a relation is as close as another relations, only keep one relation of such set."""
    logging.debug("remove duplicate")

    _assert_threshold(arg_1)

    arg_2 = defaultdict(list)
    arg_3 = set()
    for arg_4 in arg_0:
        arg_2[arg_4.relation].append(f"{t.head} {t.tail}")
        arg_3.add(arg_4.relation)
    arg_3 = list(arg_3)

    arg_5 = len(arg_0)
    arg_6 = set()

    for arg_7, arg_8 in arg_2.items():
        arg_2[arg_7] = Superminhash(arg_8)
    for arg_9 in arg_3:
        for arg_10 in arg_3:
            if arg_9 == arg_10 or arg_9 in arg_6 or arg_10 in arg_6: continue
            arg_11 = [arg_9]
            if _set_close_to(arg_2[arg_9], arg_2[arg_10], arg_1):
                arg_11.append(arg_10)
        if len(arg_11) > 1:
            arg_11.pop(np.random.randint(len(arg_11)))
            arg_6 |= set(arg_11)
    logging.info("Removing {} relations: {}".format(len(arg_6), str(arg_6)))

    return list(filterfalse(lambda x: x.relation in arg_6, arg_0))

If entity pairs in a relation is as close as another relations only keep one relation of such set .


def Func ( arg_0 , arg_1 , arg_2 = { } ) : arg_3 = ACCOUNTS_API . format ( arg_1 ) + "/roles" arg_4 = [ ] for arg_5 in arg_0 . _get_resource ( arg_3 , arg_2 = arg_2 ) : arg_4 . append ( CanvasRole ( data = arg_5 ) ) return arg_4

def Func(arg_0, arg_1, arg_2={}):
        """
        List the roles for an account, for the passed Canvas account ID.

        https://canvas.instructure.com/doc/api/roles.html#method.role_overrides.api_index
        """
        arg_3 = ACCOUNTS_API.format(arg_1) + "/roles"

        arg_4 = []
        for arg_5 in arg_0._get_resource(arg_3, arg_2=arg_2):
            arg_4.append(CanvasRole(data=arg_5))
        return arg_4

List the roles for an account for the passed Canvas account ID .


def Func ( arg_0 , arg_1 ) : arg_2 = None if arg_0 : for arg_3 in arg_0 . split ( ',' ) : arg_4 = arg_3 . split ( ':' ) if arg_1 == arg_4 [ 0 ] : arg_2 = float ( arg_4 [ 1 ] ) return arg_2

def Func(arg_0, arg_1):
    """Parse the rank score

        Args:
            rank_score_entry(str): The raw rank score entry
            case_id(str)

        Returns:
            rank_score(float)
    """
    arg_2 = None
    if arg_0:
        for arg_3 in arg_0.split(','):
            arg_4 = arg_3.split(':')
            if arg_1 == arg_4[0]:
                arg_2 = float(arg_4[1])
    return arg_2


def Func(arg_0, arg_1, arg_2):
        """Cuts string data to the maximum length allowed in a pytables column
        if string is too long.

        :param string: String to be cut
        :param max_length: Maximum allowed string length
        :param logger: Logger where messages about truncating should be written

        :return: String, cut if too long

        """
        if len(arg_0) > arg_1:
            arg_2.debug('The string `%s` was too long I truncated it to'
                         ' %d characters' %
                         (arg_0, arg_1))
            arg_0 = arg_0[0:arg_1 - 3] + '...'.encode('utf-8')

        return arg_0

Cuts string data to the maximum length allowed in a pytables column if string is too long .


def Func ( arg_0 , arg_1 ) : try : arg_2 = asscalar ( arg_1 ) except ValueError as e : raise TypeError ( e ) super ( Parameter , arg_0 ) . Func ( arg_2 )

def Func(arg_0, arg_1):
        """Hook for type-checking, invoked during assignment. Allows size 1
        numpy arrays and lists, but raises TypeError if value can not
        be cast to a scalar.

        """
        try:
            arg_2 = asscalar(arg_1)
        except ValueError as e:
            raise TypeError(e)

        super(Parameter, arg_0).Func(arg_2)

Hook for type - checking invoked during assignment . Allows size 1 numpy arrays and lists but raises TypeError if value can not be cast to a scalar .


(self, morfs=None, outfile=None, ignore_errors=None,
                    omit=None, include=None)

def Func ( arg_0 , arg_1 = None , arg_2 = None , arg_3 = None , arg_4 = None , arg_5 = None ) : arg_0 . _harvest_data ( ) arg_0 . config . from_args ( arg_3 = arg_3 , arg_4 = arg_4 , arg_5 = arg_5 , xml_output = arg_2 , ) arg_6 = None arg_7 = False if arg_0 . config . xml_output : if arg_0 . config . xml_output == '-' : arg_2 = sys . stdout else : arg_2 = open ( arg_0 . config . xml_output , "w" ) arg_6 = arg_2 try : try : arg_8 = XmlReporter ( arg_0 , arg_0 . config ) return arg_8 . report ( arg_1 , arg_2 = arg_2 ) except CoverageException : arg_7 = True raise finally : if arg_6 : arg_6 . close ( ) if arg_7 : file_be_gone ( arg_0 . config . xml_output )

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,
                    arg_4=None, arg_5=None):
        """Generate an XML report of coverage results.

        The report is compatible with Cobertura reports.

        Each module in `morfs` is included in the report.  `outfile` is the
        path to write the file to, "-" will write to stdout.

        See `coverage.report()` for other arguments.

        Returns a float, the total percentage covered.

        """
        arg_0._harvest_data()
        arg_0.config.from_args(
            arg_3=arg_3, arg_4=arg_4, arg_5=arg_5,
            xml_output=arg_2,
            )
        arg_6 = None
        arg_7 = False
        if arg_0.config.xml_output:
            if arg_0.config.xml_output == '-':
                arg_2 = sys.stdout
            else:
                arg_2 = open(arg_0.config.xml_output, "w")
                arg_6 = arg_2
        try:
            try:
                arg_8 = XmlReporter(arg_0, arg_0.config)
                return arg_8.report(arg_1, arg_2=arg_2)
            except CoverageException:
                arg_7 = True
                raise
        finally:
            if arg_6:
                arg_6.close()
                if arg_7:
                    file_be_gone(arg_0.config.xml_output)

Generate an XML report of coverage results .


def Func ( ) -> str : import os return os . path . abspath ( os . path . dirname ( os . path . realpath ( __file__ ) ) ) + '/headers/'

def Func() -> str:
    """Return local folder path of header files."""
    import os
    return os.path.abspath(os.path.dirname(os.path.realpath(__file__))) + '/headers/'

Return local folder path of header files .


return _np.linspace(start, start+step*numsteps, numsteps+1)

def Func(arg_0, arg_1, arg_2=1):
    """
    Create a vector of values over an interval with a specified step size.

    Parameters
    ----------

    start : float
        The beginning of the interval.
    stop : float
        The end of the interval.
    step : float
        The step size.

    Returns
    -------
    vector : :class:`numpy.ndarray`
        The vector of values.
    """
    # Find an integer number of steps
    arg_3 = _np.int((arg_1-arg_0)/arg_2)

    # Do a linspace over the new range
    # that has the correct endpoint
    return _np.linspace(arg_0, arg_0+arg_2*arg_3, arg_3+1)

Create a vector of values over an interval with a specified step size .


def Func(arg_0, arg_1):
    """Call right func to save data according to file extension
    """
    arg_2, arg_3 = get_file_extension(arg_1)
    arg_4 = json_Func if arg_3 == '.json' else yaml_Func
    return arg_4(arg_0, arg_1)


def Func ( arg_0 , arg_1 = None ) : arg_2 = Func . Func ( arg_0 ) if arg_1 : arg_2 . name = arg_1 return arg_2

def Func(arg_0, arg_1=None):
        """
        shallow Func of the instruction.

        Args:
          name (str): name to be given to the copied circuit,
            if None then the name stays the same

        Returns:
          Instruction: a shallow Func of the current instruction, with the name
            updated if it was provided
        """
        arg_2 = Func.Func(arg_0)
        if arg_1:
            arg_2.name = arg_1
        return arg_2

shallow copy of the instruction.

        Args:
          name (str): name to be given to the copied circuit,
            if None then the name stays the same

        Returns:
          Instruction: a shallow copy of the current instruction, with the name
            updated if it was provided


def
Func
(
arg_0
,
arg_1
)
:
if
'attachment'
not
in
arg_0
:
return
arg_0
,
0
arg_0
=
make_message_multipart
(
arg_0
)
arg_2
=
arg_0
.
get_all
(
'attachment'
,
failobj
=
[
]
)
arg_3
=
os
.
path
.
dirname
(
arg_1
)
for
arg_4
in
arg_2
:
arg_4
=
os
.
path
.
expanduser
(
arg_4
.
strip
(
)
)
if
not
arg_4
:
continue
if
not
os
.
path
.
isabs
(
arg_4
)
:
arg_4
=
os
.
path
.
join
(
arg_3
,
arg_4
)
arg_5
=
os
.
path
.
abspath
(
arg_4
)
if
not
os
.
path
.
exists
(
arg_5
)
:
print
(
"Error: can't find attachment "
+
arg_5
)
sys
.
exit
(
1
)
arg_6
=
os
.
path
.
basename
(
arg_5
)
with
open
(
arg_5
,
"rb"
)
as
attachment
:
arg_7
=
email
.
mime
.
application
.
MIMEApplication
(
attachment
.
read
(
)
,
Name
=
arg_6
)
arg_7
.
add_header
(
'Content-Disposition'
,
'attachment; filename="{}"'
.
format
(
arg_6
)
)
arg_0
.
attach
(
arg_7
)
print
(
">>> attached {}"
.
format
(
arg_5
)
)
del
arg_0
[
'attachment'
]
return
arg_0
,
len
(
arg_2
)

def Func(arg_0, arg_1):
    """Add the attachments from the message from the commandline options."""
    if 'attachment' not in arg_0:
        return arg_0, 0

    arg_0 = make_message_multipart(arg_0)

    arg_2 = arg_0.get_all('attachment', failobj=[])
    arg_3 = os.path.dirname(arg_1)

    for arg_4 in arg_2:
        arg_4 = os.path.expanduser(arg_4.strip())
        if not arg_4:
            continue
        if not os.path.isabs(arg_4):
            # Relative paths are relative to the template's parent directory
            arg_4 = os.path.join(arg_3,
                                               arg_4)
        arg_5 = os.path.abspath(arg_4)
        # Check that the attachment exists
        if not os.path.exists(arg_5):
            print("Error: can't find attachment " + arg_5)
            sys.exit(1)

        arg_6 = os.path.basename(arg_5)
        with open(arg_5, "rb") as attachment:
            arg_7 = email.mime.application.MIMEApplication(attachment.read(),
                                                          Name=arg_6)
        arg_7.add_header('Content-Disposition',
                        'attachment; filename="{}"'.format(arg_6))
        arg_0.attach(arg_7)
        print(">>> attached {}".format(arg_5))

    del arg_0['attachment']
    return arg_0, len(arg_2)

Add the attachments from the message from the commandline options .


def Func ( arg_0 , arg_1 = None ) : arg_2 = arg_0 . product if arg_1 is None else arg_1 if arg_2 is None : return None if not isinstance ( arg_2 , ( list , tuple ) ) : arg_2 = [ arg_2 ] return arg_2

def Func(arg_0, arg_1=None):
        """ puts products in a normalized format """
        arg_2 = arg_0.product if arg_1 is None else arg_1
        if arg_2 is None:
            return None
        if not isinstance(arg_2, (list, tuple)):
            arg_2 = [arg_2]
        return arg_2


def Func(arg_0, arg_1, arg_2):
        """
        Obtain slices for the given dimensions, padding, and chunks.

        Given a plan for the number of chunks along each dimension and the amount of padding,
        calculate a list of slices required to generate those chunks.

        Parameters
        ----------
        plan: tuple or array-like
            Size of chunks (in number of elements) along each dimensions.
            Length must be equal to the number of dimensions.

        padding: tuple or array-like
            Size of overlap (in number of elements) between chunks along each dimension.
            Length must be equal to the number of dimensions.

        shape: tuple
             Dimensions of axes to be chunked.
        """
        arg_3 = []
        for arg_4, arg_5, arg_6 in zip(arg_0, arg_1, arg_2):
            arg_7 = int(floor(arg_6/arg_4))
            arg_8 = arg_6 % arg_4
            arg_9 = 0
            arg_10 = []
            for arg_11 in range(arg_7):
                arg_12 = arg_9 + arg_4
                # left endpoint
                if arg_11 == 0:
                    arg_13 = arg_9
                else:
                    arg_13 = arg_9 - arg_5
                # right endpoint
                if arg_11 == arg_7:
                    arg_14 = arg_12
                else:
                    arg_14 = arg_12 + arg_5
                arg_10.append(slice(arg_13, arg_14, 1))
                arg_9 = arg_12
            if arg_8:
                arg_10.append(slice(arg_12 - arg_5, arg_6, 1))
            arg_3.append(arg_10)
        return arg_3

Obtain slices for the given dimensions padding and chunks .


(self, edge_map, keyregs, valregs, valreg=True)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
=
True
)
:
arg_5
=
set
(
)
arg_6
=
{
}
for
arg_7
in
arg_2
.
values
(
)
:
arg_6
[
arg_7
]
=
{
j
:
False
for
j
in
range
(
len
(
arg_7
)
)
}
for
arg_8
in
arg_1
.
keys
(
)
:
if
arg_8
[
0
]
.
name
in
arg_2
:
arg_6
[
arg_8
[
0
]
]
[
arg_8
[
1
]
]
=
True
for
arg_8
,
arg_7
in
arg_6
.
items
(
)
:
arg_9
=
set
(
arg_7
.
values
(
)
)
if
len
(
arg_9
)
==
2
:
raise
DAGCircuitError
(
"edge_map fragments reg %s"
%
arg_8
)
elif
arg_9
==
set
(
[
False
]
)
:
if
arg_8
in
arg_0
.
qregs
.
values
(
)
or
arg_8
in
arg_0
.
cregs
.
values
(
)
:
raise
DAGCircuitError
(
"unmapped duplicate reg %s"
%
arg_8
)
else
:
arg_5
.
add
(
arg_8
)
else
:
if
arg_4
:
if
not
arg_1
[
(
arg_8
,
0
)
]
[
0
]
.
name
in
arg_3
:
arg_10
=
max
(
map
(
lambda
x
:
x
[
1
]
,
filter
(
lambda
x
:
x
[
0
]
==
arg_1
[
(
arg_8
,
0
)
]
[
0
]
,
arg_1
.
values
(
)
)
)
)
arg_11
=
QuantumRegister
(
arg_10
+
1
,
arg_1
[
(
arg_8
,
0
)
]
[
0
]
.
name
)
arg_5
.
add
(
arg_11
)
return
arg_5

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=True):
        """Check that wiremap neither fragments nor leaves duplicate registers.

        1. There are no fragmented registers. A register in keyregs
        is fragmented if not all of its (qu)bits are renamed by edge_map.
        2. There are no duplicate registers. A register is duplicate if
        it appears in both self and keyregs but not in edge_map.

        Args:
            edge_map (dict): map from (reg,idx) in keyregs to (reg,idx) in valregs
            keyregs (dict): a map from register names to Register objects
            valregs (dict): a map from register names to Register objects
            valreg (bool): if False the method ignores valregs and does not
                add regs for bits in the edge_map image that don't appear in valregs

        Returns:
            set(Register): the set of regs to add to self

        Raises:
            DAGCircuitError: if the wiremap fragments, or duplicates exist
        """
        # FIXME: some mixing of objects and strings here are awkward (due to
        # self.qregs/self.cregs still keying on string.
        arg_5 = set()
        arg_6 = {}
        for arg_7 in arg_2.values():
            arg_6[arg_7] = {j: False for j in range(len(arg_7))}
        for arg_8 in arg_1.keys():
            if arg_8[0].name in arg_2:
                arg_6[arg_8[0]][arg_8[1]] = True
        for arg_8, arg_7 in arg_6.items():
            arg_9 = set(arg_7.values())
            if len(arg_9) == 2:
                raise DAGCircuitError("edge_map fragments reg %s" % arg_8)
            elif arg_9 == set([False]):
                if arg_8 in arg_0.qregs.values() or arg_8 in arg_0.cregs.values():
                    raise DAGCircuitError("unmapped duplicate reg %s" % arg_8)
                else:
                    # Add registers that appear only in keyregs
                    arg_5.add(arg_8)
            else:
                if arg_4:
                    # If mapping to a register not in valregs, add it.
                    # (k,0) exists in edge_map because edge_map doesn't
                    # fragment k
                    if not arg_1[(arg_8, 0)][0].name in arg_3:
                        arg_10 = max(map(lambda x: x[1],
                                       filter(lambda x: x[0] == arg_1[(arg_8, 0)][0],
                                              arg_1.values())))
                        arg_11 = QuantumRegister(arg_10 + 1, arg_1[(arg_8, 0)][0].name)
                        arg_5.add(arg_11)
        return arg_5

Check that wiremap neither fragments nor leaves duplicate registers .


def Func ( arg_0 ) : setuptools . command . build_py . build_py . Func ( arg_0 ) arg_0 . meteor = 'meteor' arg_0 . meteor_debug = False arg_0 . build_lib = None arg_0 . package_dir = None arg_0 . meteor_builds = [ ] arg_0 . no_prune_npm = None arg_0 . inplace = True

def Func(arg_0):
        """Set command option defaults."""
        setuptools.command.build_py.build_py.Func(arg_0)
        arg_0.meteor = 'meteor'
        arg_0.meteor_debug = False
        arg_0.build_lib = None
        arg_0.package_dir = None
        arg_0.meteor_builds = []
        arg_0.no_prune_npm = None
        arg_0.inplace = True


return thr_img(icc_img_to_zscore(icc), thr=thr, mode=mode).get_data()

def Func(arg_0, arg_1, arg_2='+'):
    """ Return the thresholded z-scored `icc`. """
    return thr_img(icc_img_to_zscore(arg_0), arg_1=arg_1, arg_2=arg_2).get_data()


def Func ( arg_0 , arg_1 , arg_2 ) : while arg_0 : arg_3 = arg_0 . pop ( 0 ) if arg_1 and os . path . isdir ( arg_3 ) : for arg_4 , arg_5 , arg_6 in os . walk ( arg_3 ) : arg_0 += [ os . path . join ( arg_4 , arg_7 ) for arg_7 in arg_6 if match_file ( os . path . join ( arg_4 , arg_7 ) , arg_2 ) ] arg_5 [ : ] = [ d for d in arg_5 if match_file ( os . path . join ( arg_4 , d ) , arg_2 ) ] else : if not is_exclude_file ( arg_3 , arg_2 ) : yield arg_3

def Func(arg_0, arg_1, arg_2):
    """Yield filenames."""
    while arg_0:
        arg_3 = arg_0.pop(0)
        if arg_1 and os.path.isdir(arg_3):
            for arg_4, arg_5, arg_6 in os.walk(arg_3):
                arg_0 += [os.path.join(arg_4, arg_7) for arg_7 in arg_6
                              if match_file(os.path.join(arg_4, arg_7),
                                            arg_2)]
                arg_5[:] = [d for d in arg_5
                                  if match_file(os.path.join(arg_4, d),
                                                arg_2)]
        else:
            if not is_exclude_file(arg_3, arg_2):
                yield arg_3


def
Func
(
arg_0
)
:
try
:
return
datetime
.
date
(
int
(
arg_0
[
:
4
]
)
,
int
(
arg_0
[
5
:
7
]
)
,
int
(
arg_0
[
8
:
10
]
)
)
except
ValueError
:
return
datetime
.
datetime
.
strptime
(
arg_0
,
'%d %B %Y'
)
.
date
(
)

def Func(arg_0):
    """Fast %Y-%m-%d parsing."""
    try:
        return datetime.date(int(arg_0[:4]), int(arg_0[5:7]), int(arg_0[8:10]))
    except ValueError:  # other accepted format used in one-day data set
        return datetime.datetime.strptime(arg_0, '%d %B %Y').date()


def Func(arg_0, arg_1=True):
    """ Chooses the best model for a given job.

    Parameters
    -----------------------------------------------------------------------
    forceUpdate:  (True/False). If True, the update will ignore all the
                  restrictions on the minimum time to update and the minimum
                  number of records to update. This should typically only be
                  set to true if the model has completed running
    """
    arg_2 = time.time() - arg_0._lastUpdateAttemptTime
    if arg_2 < arg_0._MIN_UPDATE_INTERVAL and not arg_1:
      return

    arg_0.logger.info("Attempting model selection for jobID=%d: time=%f"\
                     "  lastUpdate=%f"%(arg_0._jobID,
                                        time.time(),
                                        arg_0._lastUpdateAttemptTime))

    arg_3 = arg_0._cjDB.jobUpdateSelectionSweep(arg_0._jobID,
                                                          arg_0._MIN_UPDATE_INTERVAL)
    if not arg_3:
      arg_0.logger.info("Unable to update selection sweep timestamp: jobID=%d" \
                       " updateTime=%f"%(arg_0._jobID, arg_0._lastUpdateAttemptTime))
      if not arg_1:
        return

    arg_0._lastUpdateAttemptTime = time.time()
    arg_0.logger.info("Succesfully updated selection sweep timestamp jobid=%d updateTime=%f"\
                     %(arg_0._jobID, arg_0._lastUpdateAttemptTime))

    arg_5 = arg_0._MIN_UPDATE_THRESHOLD

    arg_6 = arg_0._getJobResults()
    if arg_1 or arg_6 is None:
      arg_5 = 0

    arg_7, arg_8 = arg_0._cjDB.modelsGetCandidates(arg_0._jobID, arg_5)

    arg_0.logger.info("Candidate models=%s, metric=%s, jobID=%s"\
                     %(arg_7, arg_8, arg_0._jobID))

    if len(arg_7) == 0:
      return

    arg_0._jobUpdateCandidate(arg_7[0], arg_8, results=arg_6)

Chooses the best model for a given job .


(self, endpoint, data, json, files, params)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):
        """Log the beginning of an API request."""
        # TODO: add information about the caller, i.e. which module + line of code called the .request() method
        #       This can be done by fetching current traceback and then traversing it until we find the request function
        arg_0._requests_counter += 1
        if not arg_0._is_logging: return
        arg_6 = "\n---- %d --------------------------------------------------------\n" % arg_0._requests_counter
        arg_6 += "[%s] %s\n" % (time.strftime("%H:%M:%S"), arg_1)
        if arg_5 is not None: arg_6 += "     params: {%s}\n" % ", ".join("%s:%s" % arg_7 for arg_7 in viewitems(arg_5))
        if arg_2 is not None:   arg_6 += "     body: {%s}\n" % ", ".join("%s:%s" % arg_7 for arg_7 in viewitems(arg_2))
        if arg_3 is not None:
            import arg_3 as j
            arg_6 += "     json: %s\n" % j.dumps(arg_3)
        if arg_4 is not None:  arg_6 += "     file: %s\n" % ", ".join(arg_8.name for arg_8 in viewvalues(arg_4))
        arg_0._log_message(arg_6 + "\n")


(reliability_data=None, value_counts=None, value_domain=None, level_of_measurement='interval',
          dtype=np.float64)

return 1 - np.sum(o * d) / np.sum(e * d)

def Func(arg_0=None, arg_1=None, arg_2=None, arg_3='interval',
          arg_4=arg_5.float64):
    """Compute Krippendorff's Func.

    See https://en.wikipedia.org/wiki/Krippendorff%27s_Func for more information.

    Parameters
    ----------
    reliability_data : array_like, with shape (M, N)
        Reliability data matrix which has the rate the i coder gave to the j unit, where M is the number of raters
        and N is the unit count.
        Missing rates are represented with `np.nan`.
        If it's provided then `value_counts` must not be provided.

    value_counts : ndarray, with shape (N, V)
        Number of coders that assigned a certain value to a determined unit, where N is the number of units
        and V is the value count.
        If it's provided then `reliability_data` must not be provided.

    value_domain : array_like, with shape (V,)
        Possible values the units can take.
        If the level of measurement is not nominal, it must be ordered.
        If `reliability_data` is provided, then the default value is the ordered list of unique rates that appear.
        Else, the default value is `list(range(V))`.

    level_of_measurement : string or callable
        Steven's level of measurement of the variable.
        It must be one of 'nominal', 'ordinal', 'interval', 'ratio' or a callable.

    dtype : data-type
        Result and computation data-type.

    Returns
    -------
    Func : `dtype`
        Scalar value of Krippendorff's Func of type `dtype`.

    Examples
    --------
    >>> reliability_data = [[np.nan, np.nan, np.nan, np.nan, np.nan, 3, 4, 1, 2, 1, 1, 3, 3, np.nan, 3],
    ...                     [1, np.nan, 2, 1, 3, 3, 4, 3, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
    ...                     [np.nan, np.nan, 2, 1, 3, 4, 4, np.nan, 2, 1, 1, 3, 3, np.nan, 4]]
    >>> print(round(Func(reliability_data=reliability_data, level_of_measurement='nominal'), 6))
    0.691358
    >>> print(round(Func(reliability_data=reliability_data, level_of_measurement='interval'), 6))
    0.810845
    >>> value_counts = np.array([[1, 0, 0, 0],
    ...                          [0, 0, 0, 0],
    ...                          [0, 2, 0, 0],
    ...                          [2, 0, 0, 0],
    ...                          [0, 0, 2, 0],
    ...                          [0, 0, 2, 1],
    ...                          [0, 0, 0, 3],
    ...                          [1, 0, 1, 0],
    ...                          [0, 2, 0, 0],
    ...                          [2, 0, 0, 0],
    ...                          [2, 0, 0, 0],
    ...                          [0, 0, 2, 0],
    ...                          [0, 0, 2, 0],
    ...                          [0, 0, 0, 0],
    ...                          [0, 0, 1, 1]])
    >>> print(round(Func(value_counts=value_counts, level_of_measurement='nominal'), 6))
    0.691358
    >>> # The following examples were extracted from
    >>> # https://www.statisticshowto.datasciencecentral.com/wp-content/uploads/2016/07/fulltext.pdf, page 8.
    >>> reliability_data = [[1, 2, 3, 3, 2, 1, 4, 1, 2, np.nan, np.nan, np.nan],
    ...                     [1, 2, 3, 3, 2, 2, 4, 1, 2, 5, np.nan, 3.],
    ...                     [np.nan, 3, 3, 3, 2, 3, 4, 2, 2, 5, 1, np.nan],
    ...                     [1, 2, 3, 3, 2, 4, 4, 1, 2, 5, 1, np.nan]]
    >>> print(round(Func(reliability_data, level_of_measurement='ordinal'), 3))
    0.815
    >>> print(round(Func(reliability_data, level_of_measurement='ratio'), 3))
    0.797
    """
    if (arg_0 is None) == (arg_1 is None):
        raise ValueError("Either reliability_data or value_counts must be provided, but not both.")

    # Don't know if it's a list or numpy array. If it's the latter, the truth value is ambiguous. So, ask for None.
    if arg_1 is None:
        if type(arg_0) is not arg_5.ndarray:
            arg_0 = arg_5.array(arg_0)

        arg_2 = arg_2 or arg_5.unique(arg_0[~arg_5.isnan(arg_0)])

        arg_1 = _reliability_data_to_value_counts(arg_0, arg_2)
    else:  # elif reliability_data is None
        if arg_2:
            assert arg_1.shape[1] == len(arg_2), \
                "The value domain should be equal to the number of columns of value_counts."
        else:
            arg_2 = tuple(range(arg_1.shape[1]))

    arg_7 = _distance_metric(arg_3)

    arg_8 = _coincidences(arg_1, arg_2, arg_4=arg_4)
    arg_9 = arg_5.sum(arg_8, axis=0)
    arg_10 = arg_5.sum(arg_9)
    arg_11 = _random_coincidences(arg_2, arg_10, arg_9)
    arg_12 = _distances(arg_2, arg_7, arg_9)
    return 1 - arg_5.sum(arg_8 * arg_12) / arg_5.sum(arg_11 * arg_12)

Compute Krippendorff's alpha.

    See https://en.wikipedia.org/wiki/Krippendorff%27s_alpha for more information.

    Parameters
    ----------
    reliability_data : array_like, with shape (M, N)
        Reliability data matrix which has the rate the i coder gave to the j unit, where M is the number of raters
        and N is the unit count.
        Missing rates are represented with `np.nan`.
        If it's provided then `value_counts` must not be provided.

    value_counts : ndarray, with shape (N, V)
        Number of coders that assigned a certain value to a determined unit, where N is the number of units
        and V is the value count.
        If it's provided then `reliability_data` must not be provided.

    value_domain : array_like, with shape (V,)
        Possible values the units can take.
        If the level of measurement is not nominal, it must be ordered.
        If `reliability_data` is provided, then the default value is the ordered list of unique rates that appear.
        Else, the default value is `list(range(V))`.

    level_of_measurement : string or callable
        Steven's level of measurement of the variable.
        It must be one of 'nominal', 'ordinal', 'interval', 'ratio' or a callable.

    dtype : data-type
        Result and computation data-type.

    Returns
    -------
    alpha : `dtype`
        Scalar value of Krippendorff's alpha of type `dtype`.

    Examples
    --------
    >>> reliability_data = [[np.nan, np.nan, np.nan, np.nan, np.nan, 3, 4, 1, 2, 1, 1, 3, 3, np.nan, 3],
    ...                     [1, np.nan, 2, 1, 3, 3, 4, 3, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
    ...                     [np.nan, np.nan, 2, 1, 3, 4, 4, np.nan, 2, 1, 1, 3, 3, np.nan, 4]]
    >>> print(round(alpha(reliability_data=reliability_data, level_of_measurement='nominal'), 6))
    0.691358
    >>> print(round(alpha(reliability_data=reliability_data, level_of_measurement='interval'), 6))
    0.810845
    >>> value_counts = np.array([[1, 0, 0, 0],
    ...                          [0, 0, 0, 0],
    ...                          [0, 2, 0, 0],
    ...                          [2, 0, 0, 0],
    ...                          [0, 0, 2, 0],
    ...                          [0, 0, 2, 1],
    ...                          [0, 0, 0, 3],
    ...                          [1, 0, 1, 0],
    ...                          [0, 2, 0, 0],
    ...                          [2, 0, 0, 0],
    ...                          [2, 0, 0, 0],
    ...                          [0, 0, 2, 0],
    ...                          [0, 0, 2, 0],
    ...                          [0, 0, 0, 0],
    ...                          [0, 0, 1, 1]])
    >>> print(round(alpha(value_counts=value_counts, level_of_measurement='nominal'), 6))
    0.691358
    >>> # The following examples were extracted from
    >>> # https://www.statisticshowto.datasciencecentral.com/wp-content/uploads/2016/07/fulltext.pdf, page 8.
    >>> reliability_data = [[1, 2, 3, 3, 2, 1, 4, 1, 2, np.nan, np.nan, np.nan],
    ...                     [1, 2, 3, 3, 2, 2, 4, 1, 2, 5, np.nan, 3.],
    ...                     [np.nan, 3, 3, 3, 2, 3, 4, 2, 2, 5, 1, np.nan],
    ...                     [1, 2, 3, 3, 2, 4, 4, 1, 2, 5, 1, np.nan]]
    >>> print(round(alpha(reliability_data, level_of_measurement='ordinal'), 3))
    0.815
    >>> print(round(alpha(reliability_data, level_of_measurement='ratio'), 3))
    0.797


return as_flattened_list(
            zip(["-hiveconf"] * len(d),
                ["{}={}".format(k, v) for k, v in d.items()])
        )

def Func ( arg_0 ) : if not arg_0 : return [ ] return as_flattened_list ( zip ( [ "-hiveconf" ] * len ( arg_0 ) , [ "{}={}" . format ( arg_1 , arg_2 ) for arg_1 , arg_2 in arg_0 . items ( ) ] ) )

def Func(arg_0):
        """
        This function prepares a list of hiveconf params
        from a dictionary of key value pairs.

        :param d:
        :type d: dict

        >>> hh = HiveCliHook()
        >>> hive_conf = {"hive.exec.dynamic.partition": "true",
        ... "hive.exec.dynamic.partition.mode": "nonstrict"}
        >>> hh.Func(hive_conf)
        ["-hiveconf", "hive.exec.dynamic.partition=true",\
 "-hiveconf", "hive.exec.dynamic.partition.mode=nonstrict"]
        """
        if not arg_0:
            return []
        return as_flattened_list(
            zip(["-hiveconf"] * len(arg_0),
                ["{}={}".format(arg_1, arg_2) for arg_1, arg_2 in arg_0.items()])
        )

This function prepares a list of hiveconf params
        from a dictionary of key value pairs.

        :param d:
        :type d: dict

        >>> hh = HiveCliHook()
        >>> hive_conf = {"hive.exec.dynamic.partition": "true",
        ... "hive.exec.dynamic.partition.mode": "nonstrict"}
        >>> hh._prepare_hiveconf(hive_conf)
        ["-hiveconf", "hive.exec.dynamic.partition=true",\
 "-hiveconf", "hive.exec.dynamic.partition.mode=nonstrict"]

This function prepares a list of hiveconf params from a dictionary of key value pairs .


def Func(arg_0, arg_1, arg_2=None):
        """ Pagination utility.  Obnoxious. """

        arg_3 = {}
        if 'basic' in arg_0.auth:
            arg_3['auth'] = arg_0.auth['basic']

        arg_4 = []
        arg_5 = dict(next=arg_1)

        while 'next' in arg_5:
            arg_6 = arg_0.session.get(arg_5['next'], **arg_3)

            # Warn about the mis-leading 404 error code.  See:
            # https://github.com/ralphbean/bugwarrior/issues/374
            if arg_6.status_code == 404 and 'token' in arg_0.auth:
                log.warn("A '404' from github may indicate an auth "
                         "failure. Make sure both that your token is correct "
                         "and that it has 'public_repo' and not 'public "
                         "access' rights.")

            arg_7 = arg_0.json_response(arg_6)

            if arg_2 is not None:
                arg_7 = arg_7[arg_2]

            arg_4 += arg_7

            arg_5 = arg_0._link_field_to_dict(arg_6.headers.get('link', None))

        return arg_4


(
    normal_loc, normal_scale, quadrature_size,
    validate_args=False, name=None)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = False , arg_4 = None ) : with tf . name_scope ( arg_4 or "softmax_normal_grid_and_probs" ) : arg_0 = tf . convert_to_tensor ( value = arg_0 , arg_4 = "normal_loc" ) arg_5 = dtype_util . base_dtype ( arg_0 . dtype ) arg_1 = tf . convert_to_tensor ( value = arg_1 , dtype = arg_5 , arg_4 = "normal_scale" ) arg_1 = maybe_check_quadrature_param ( arg_1 , "normal_scale" , arg_3 ) arg_6 = normal . Normal ( loc = arg_0 , scale = arg_1 ) def _get_batch_ndims ( ) : arg_7 = tensorshape_util . rank ( arg_6 . batch_shape ) if arg_7 is None : arg_7 = tf . shape ( input = arg_6 . batch_shape_tensor ( ) ) [ 0 ] return arg_7 arg_8 = _get_batch_ndims ( ) def _get_final_shape ( arg_9 ) : arg_10 = tensorshape_util . with_rank_at_least ( arg_6 . batch_shape , 1 ) arg_11 = tf . compat . dimension_value ( arg_10 [ - 1 ] ) if arg_11 is not None : arg_11 += 1 arg_12 = tf . TensorShape ( [ arg_11 , arg_9 ] ) return arg_10 [ : - 1 ] . concatenate ( arg_12 ) def _compute_quantiles ( ) : arg_13 = tf . zeros ( [ ] , dtype = arg_6 . dtype ) arg_14 = tf . linspace ( arg_13 , 1. , arg_2 + 3 ) [ 1 : - 1 ] arg_14 = tf . reshape ( arg_14 , shape = tf . concat ( [ [ - 1 ] , tf . ones ( [ arg_8 ] , dtype = tf . int32 ) ] , axis = 0 ) ) arg_15 = arg_6 . quantile ( arg_14 ) arg_15 = softmax_centered_bijector . SoftmaxCentered ( ) . forward ( arg_15 ) arg_16 = tf . concat ( [ tf . range ( 1 , 1 + arg_8 ) , [ 0 ] ] , axis = 0 ) arg_15 = tf . transpose ( a = arg_15 , arg_16 = arg_16 ) tensorshape_util . set_shape ( arg_15 , _get_final_shape ( arg_2 + 1 ) ) return arg_15 arg_15 = _compute_quantiles ( ) arg_17 = ( arg_15 [ ... , : - 1 ] + arg_15 [ ... , 1 : ] ) / 2. tensorshape_util . set_shape ( arg_17 , _get_final_shape ( arg_2 ) ) arg_18 = tf . fill ( dims = [ arg_2 ] , value = 1. / tf . cast ( arg_2 , arg_6 . dtype ) ) return arg_17 , arg_18

def Func(
    arg_0, arg_1, arg_2,
    arg_3=False, arg_4=None):
  """Use SoftmaxNormal quantiles to form quadrature on `K - 1` simplex.

  A `SoftmaxNormal` random variable `Y` may be generated via

  ```
  Y = SoftmaxCentered(X),
  X = Normal(normal_loc, normal_scale)
  ```

  Args:
    normal_loc: `float`-like `Tensor` with shape `[b1, ..., bB, K-1]`, B>=0.
      The location parameter of the Normal used to construct the SoftmaxNormal.
    normal_scale: `float`-like `Tensor`. Broadcastable with `normal_loc`.
      The scale parameter of the Normal used to construct the SoftmaxNormal.
    quadrature_size: Python `int` scalar representing the number of quadrature
      points.
    validate_args: Python `bool`, default `False`. When `True` distribution
      parameters are checked for validity despite possibly degrading runtime
      performance. When `False` invalid inputs may silently render incorrect
      outputs.
    name: Python `str` name prefixed to Ops created by this class.

  Returns:
    grid: Shape `[b1, ..., bB, K, quadrature_size]` `Tensor` representing the
      convex combination of affine parameters for `K` components.
      `grid[..., :, n]` is the `n`-th grid point, living in the `K - 1` simplex.
    probs:  Shape `[b1, ..., bB, K, quadrature_size]` `Tensor` representing the
      associated with each grid point.
  """
  with tf.name_scope(arg_4 or "softmax_normal_grid_and_probs"):
    arg_0 = tf.convert_to_tensor(value=arg_0, arg_4="normal_loc")
    arg_5 = dtype_util.base_dtype(arg_0.dtype)
    arg_1 = tf.convert_to_tensor(
        value=arg_1, dtype=arg_5, arg_4="normal_scale")

    arg_1 = maybe_check_quadrature_param(
        arg_1, "normal_scale", arg_3)

    arg_6 = normal.Normal(loc=arg_0, scale=arg_1)

    def _get_batch_ndims():
      """Helper to get rank(dist.batch_shape), statically if possible."""
      arg_7 = tensorshape_util.rank(arg_6.batch_shape)
      if arg_7 is None:
        arg_7 = tf.shape(input=arg_6.batch_shape_tensor())[0]
      return arg_7
    arg_8 = _get_batch_ndims()

    def _get_final_shape(arg_9):
      """Helper to build `TensorShape`."""
      arg_10 = tensorshape_util.with_rank_at_least(arg_6.batch_shape, 1)
      arg_11 = tf.compat.dimension_value(arg_10[-1])
      if arg_11 is not None:
        arg_11 += 1
      arg_12 = tf.TensorShape([arg_11, arg_9])
      return arg_10[:-1].concatenate(arg_12)

    def _compute_quantiles():
      """Helper to build quantiles."""
      # Omit {0, 1} since they might lead to Inf/NaN.
      arg_13 = tf.zeros([], dtype=arg_6.dtype)
      arg_14 = tf.linspace(arg_13, 1., arg_2 + 3)[1:-1]
      # Expand edges so its broadcast across batch dims.
      arg_14 = tf.reshape(
          arg_14,
          shape=tf.concat(
              [[-1], tf.ones([arg_8], dtype=tf.int32)], axis=0))
      arg_15 = arg_6.quantile(arg_14)
      arg_15 = softmax_centered_bijector.SoftmaxCentered().forward(arg_15)
      # Cyclically permute left by one.
      arg_16 = tf.concat([tf.range(1, 1 + arg_8), [0]], axis=0)
      arg_15 = tf.transpose(a=arg_15, arg_16=arg_16)
      tensorshape_util.set_shape(
          arg_15, _get_final_shape(arg_2 + 1))
      return arg_15
    arg_15 = _compute_quantiles()

    # Compute grid as quantile midpoints.
    arg_17 = (arg_15[..., :-1] + arg_15[..., 1:]) / 2.
    # Set shape hints.
    tensorshape_util.set_shape(arg_17, _get_final_shape(arg_2))

    # By construction probs is constant, i.e., `1 / quadrature_size`. This is
    # important, because non-constant probs leads to non-reparameterizable
    # samples.
    arg_18 = tf.fill(
        dims=[arg_2], value=1. / tf.cast(arg_2, arg_6.dtype))

    return arg_17, arg_18

Use SoftmaxNormal quantiles to form quadrature on K - 1 simplex .


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """Resize an array to a new size by extracting a sub-set of the array.

    The extracted input coordinates use NumPy convention, such that the upper values should be specified as +1 the \
    dimensions of the extracted array.

    In the example below, an array of size (5,5) is extracted using the coordinates y0=1, y1=4, x0=1, x1=4. This
    extracts an array of dimensions (2,2) and is equivalent to array_2d[1:4, 1:4]

    Parameters
    ----------
    array_2d : ndarray
        The 2D array that is an array is extracted from.
    y0 : int
        The lower row number (e.g. the higher y-coodinate) of the array that is extracted for the resize.
    y1 : int
        The upper row number (e.g. the lower y-coodinate) of the array that is extracted for the resize.
    x0 : int
        The lower column number (e.g. the lower x-coodinate) of the array that is extracted for the resize.
    x1 : int
        The upper column number (e.g. the higher x-coodinate) of the array that is extracted for the resize.

    Returns
    -------
    ndarray
        The extracted 2D array from the input 2D array.

    Examples
    --------
    array_2d = np.ones((5,5))
    extracted_array = extract_array_2d(array_2d=array_2d, y0=1, y1=4, x0=1, x1=4)
    """

    arg_5 = (arg_2-arg_1, arg_4-arg_3)

    arg_6 = np.zeros(shape=arg_5)

    for arg_7, arg_8 in enumerate(range(arg_1, arg_2)):
        for arg_9, arg_10 in enumerate(range(arg_3, arg_4)):
                arg_6[arg_7, arg_9] = arg_0[arg_8, arg_10]

    return arg_6

Resize an array to a new size by extracting a sub - set of the array .


def Func ( arg_0 , arg_1 ) : arg_2 = zipfile . ZipFile ( arg_0 ) for arg_3 in arg_2 . namelist ( ) : arg_4 = os . path . join ( arg_1 , arg_3 ) arg_5 , arg_6 = os . path . split ( arg_4 ) try : if arg_4 . endswith ( os . sep ) and not os . path . exists ( arg_5 ) : os . makedirs ( arg_4 ) elif not os . path . exists ( arg_4 ) : arg_5 = os . path . join ( arg_1 , os . path . dirname ( arg_3 ) ) if os . path . dirname ( arg_3 ) and not os . path . exists ( arg_5 ) : os . makedirs ( arg_5 ) arg_7 = open ( arg_4 , "w" ) arg_7 . write ( arg_2 . read ( arg_3 ) ) arg_7 . close ( ) except IOError , e : raise e return arg_1

def Func(arg_0, arg_1):
    """Perform the actual uncompression."""
    arg_2 = zipfile.ZipFile(arg_0)
    for arg_3 in arg_2.namelist():
        arg_4 = os.path.join(arg_1, arg_3)
        arg_5, arg_6 = os.path.split(arg_4)
        try:
            if arg_4.endswith(os.sep) and not os.path.exists(arg_5):
                os.makedirs(arg_4)
            elif not os.path.exists(arg_4):
                arg_5 = os.path.join(arg_1, os.path.dirname(arg_3))
                if os.path.dirname(arg_3) and not os.path.exists(arg_5):
                    os.makedirs(arg_5)
                arg_7 = open(arg_4, "w")
                arg_7.write(arg_2.read(arg_3))
                arg_7.close()
        except IOError, e:
            raise e
    return arg_1


def Func ( ) : import argparse arg_0 = argparse . ArgumentParser ( ) arg_0 . add_argument ( '--doc' , dest = "doc" , action = "store_true" , default = False ) arg_1 , arg_2 . argv = arg_0 . parse_known_args ( arg_2 . argv ) if arg_1 . doc : import doc2md , pypandoc arg_4 = doc2md . doc2md ( doc2md . __doc__ , "doc2md" , toc = False ) Func = pypandoc . convert ( arg_4 , 'rst' , format = 'md' ) else : return None

def Func():
    """Generate .rst document for PyPi."""
    import argparse
    arg_0 = argparse.ArgumentParser()
    arg_0.add_argument('--doc', dest="doc",
            action="store_true", default=False)
    arg_1, arg_2.argv = arg_0.parse_known_args(arg_2.argv)
    if arg_1.doc:
        import doc2md, pypandoc
        arg_4 = doc2md.doc2md(doc2md.__doc__, "doc2md", toc=False)
        Func = pypandoc.convert(arg_4, 'rst', format='md')
    else:
        return None