def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
def
get_experiment_Func
(
)
:
try
:
arg_3
=
PolyaxonClient
(
)
.
experiment
.
get_Func
(
arg_6
,
arg_7
,
arg_8
,
arg_2
=
arg_2
)
except
(
PolyaxonHTTPError
,
PolyaxonShouldExitError
,
PolyaxonClientException
)
as
e
:
Printer
.
print_error
(
'Could get status for experiment `{}`.'
.
format
(
arg_8
)
)
Printer
.
print_error
(
'Error message `{}`.'
.
format
(
e
)
)
sys
.
exit
(
1
)
arg_4
=
get_meta_response
(
arg_3
)
if
arg_4
:
Printer
.
print_header
(
'Statuses for experiment `{}`.'
.
format
(
arg_8
)
)
Printer
.
print_header
(
'Navigation:'
)
dict_tabulate
(
arg_4
)
else
:
Printer
.
print_header
(
'No Func found for experiment `{}`.'
.
format
(
arg_8
)
)
arg_5
=
list_dicts_to_tabulate
(
[
Printer
.
add_status_color
(
o
.
to_light_dict
(
humanize_values
=
True
)
,
status_key
=
'status'
)
for
o
in
arg_3
[
'results'
]
]
)
if
arg_5
:
Printer
.
print_header
(
"Statuses:"
)
arg_5
.
pop
(
'experiment'
,
)
dict_tabulate
(
arg_5
,
is_list_dict
=
True
)
def
get_experiment_job_Func
(
)
:
try
:
arg_3
=
PolyaxonClient
(
)
.
experiment_job
.
get_Func
(
arg_6
,
arg_7
,
arg_8
,
arg_9
,
arg_2
=
arg_2
)
except
(
PolyaxonHTTPError
,
PolyaxonShouldExitError
,
PolyaxonClientException
)
as
e
:
Printer
.
print_error
(
'Could not get status for job `{}`.'
.
format
(
arg_1
)
)
Printer
.
print_error
(
'Error message `{}`.'
.
format
(
e
)
)
sys
.
exit
(
1
)
arg_4
=
get_meta_response
(
arg_3
)
if
arg_4
:
Printer
.
print_header
(
'Statuses for Job `{}`.'
.
format
(
arg_9
)
)
Printer
.
print_header
(
'Navigation:'
)
dict_tabulate
(
arg_4
)
else
:
Printer
.
print_header
(
'No Func found for job `{}`.'
.
format
(
arg_9
)
)
arg_5
=
list_dicts_to_tabulate
(
[
Printer
.
add_status_color
(
o
.
to_light_dict
(
humanize_values
=
True
)
,
status_key
=
'status'
)
for
o
in
arg_3
[
'results'
]
]
)
if
arg_5
:
Printer
.
print_header
(
"Statuses:"
)
arg_5
.
pop
(
'job'
,
)
dict_tabulate
(
arg_5
,
is_list_dict
=
True
)
arg_2
=
arg_2
or
1
arg_6
,
arg_7
,
arg_8
=
get_project_experiment_or_local
(
arg_0
.
obj
.
get
(
'project'
)
,
arg_0
.
obj
.
get
(
'experiment'
)
)
if
arg_1
:
arg_9
=
get_experiment_job_or_local
(
arg_1
)
get_experiment_job_Func
(
)
else
:
get_experiment_Func
(
)

def Func(arg_0, arg_1, arg_2):
    """Get experiment or experiment job Func.

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

    Examples getting experiment Func:

    \b
    ```bash
    $ polyaxon experiment Func
    ```

    \b
    ```bash
    $ polyaxon experiment -xp 1 Func
    ```

    Examples getting experiment job Func:

    \b
    ```bash
    $ polyaxon experiment Func -j 3
    ```

    \b
    ```bash
    $ polyaxon experiment -xp 1 Func --job 1
    ```
    """

    def get_experiment_Func():
        try:
            arg_3 = PolyaxonClient().experiment.get_Func(
                arg_6, arg_7, arg_8, arg_2=arg_2)
        except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
            Printer.print_error('Could get status for experiment `{}`.'.format(arg_8))
            Printer.print_error('Error message `{}`.'.format(e))
            sys.exit(1)

        arg_4 = get_meta_response(arg_3)
        if arg_4:
            Printer.print_header('Statuses for experiment `{}`.'.format(arg_8))
            Printer.print_header('Navigation:')
            dict_tabulate(arg_4)
        else:
            Printer.print_header('No Func found for experiment `{}`.'.format(arg_8))

        arg_5 = list_dicts_to_tabulate(
            [Printer.add_status_color(o.to_light_dict(humanize_values=True), status_key='status')
             for o in arg_3['results']])
        if arg_5:
            Printer.print_header("Statuses:")
            arg_5.pop('experiment', None)
            dict_tabulate(arg_5, is_list_dict=True)

    def get_experiment_job_Func():
        try:
            arg_3 = PolyaxonClient().experiment_job.get_Func(arg_6,
                                                                    arg_7,
                                                                    arg_8,
                                                                    arg_9,
                                                                    arg_2=arg_2)
        except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
            Printer.print_error('Could not get status for job `{}`.'.format(arg_1))
            Printer.print_error('Error message `{}`.'.format(e))
            sys.exit(1)

        arg_4 = get_meta_response(arg_3)
        if arg_4:
            Printer.print_header('Statuses for Job `{}`.'.format(arg_9))
            Printer.print_header('Navigation:')
            dict_tabulate(arg_4)
        else:
            Printer.print_header('No Func found for job `{}`.'.format(arg_9))

        arg_5 = list_dicts_to_tabulate(
            [Printer.add_status_color(o.to_light_dict(humanize_values=True), status_key='status')
             for o in arg_3['results']])
        if arg_5:
            Printer.print_header("Statuses:")
            arg_5.pop('job', None)
            dict_tabulate(arg_5, is_list_dict=True)

    arg_2 = arg_2 or 1

    arg_6, arg_7, arg_8 = get_project_experiment_or_local(arg_0.obj.get('project'),
                                                                      arg_0.obj.get('experiment'))

    if arg_1:
        arg_9 = get_experiment_job_or_local(arg_1)
        get_experiment_job_Func()
    else:
        get_experiment_Func()

Get experiment or experiment job statuses.

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

    Examples getting experiment statuses:

    \b
    ```bash
    $ polyaxon experiment statuses
    ```

    \b
    ```bash
    $ polyaxon experiment -xp 1 statuses
    ```

    Examples getting experiment job statuses:

    \b
    ```bash
    $ polyaxon experiment statuses -j 3
    ```

    \b
    ```bash
    $ polyaxon experiment -xp 1 statuses --job 1
    ```

Get experiment or experiment job statuses .


(params, w_name, scope_name, inputs, layers, weights, names)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
,
arg_6
)
:
print
(
'Converting softmax ...'
)
if
arg_6
==
'short'
:
arg_7
=
'SMAX'
+
random_string
(
4
)
elif
arg_6
==
'keep'
:
arg_7
=
arg_1
else
:
arg_7
=
arg_1
+
str
(
random
.
random
(
)
)
def
target_layer
(
arg_8
,
arg_9
=
arg_0
[
'dim'
]
)
:
import
keras
return
keras
.
activations
.
softmax
(
arg_8
,
axis
=
arg_9
)
arg_10
=
keras
.
layers
.
Lambda
(
target_layer
)
arg_4
[
arg_2
]
=
arg_10
(
arg_4
[
arg_3
[
0
]
]
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):
    """
    Convert softmax layer.

    Args:
        params: dictionary with layer parameters
        w_name: name prefix in state_dict
        scope_name: pytorch scope name
        inputs: pytorch node inputs
        layers: dictionary with keras tensors
        weights: pytorch state_dict
        names: use short names for keras layers
    """
    print('Converting softmax ...')

    if arg_6 == 'short':
        arg_7 = 'SMAX' + random_string(4)
    elif arg_6 == 'keep':
        arg_7 = arg_1
    else:
        arg_7 = arg_1 + str(random.random())

    def target_layer(arg_8, arg_9=arg_0['dim']):
        import keras
        return keras.activations.softmax(arg_8, axis=arg_9)

    arg_10 = keras.layers.Lambda(target_layer)
    arg_4[arg_2] = arg_10(arg_4[arg_3[0]])


(self, token, folder_id, dest_folder_id)

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Move a folder to the destination folder.

        :param token: A valid token for the user in question.
        :type token: string
        :param folder_id: The id of the folder to be moved.
        :type folder_id: int | long
        :param dest_folder_id: The id of destination (new parent) folder.
        :type dest_folder_id: int | long
        :returns: Dictionary containing the details of the moved folder.
        :rtype: dict
        """
        arg_4 = dict()
        arg_4['token'] = arg_1
        arg_4['id'] = arg_2
        arg_4['dstfolderid'] = arg_3
        arg_5 = arg_0.request('midas.folder.move', arg_4)
        return arg_5

Move a folder to the destination folder .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = { 'order_by' : 'updated_at' , 'sort' : 'asc' , 'per_page' : PER_PAGE } arg_4 = urijoin ( arg_1 , str ( arg_2 ) , GitLabClient . NOTES ) return arg_0 . fetch_items ( arg_4 , arg_3 )

def Func(arg_0, arg_1, arg_2):
        """Get the Func from pagination"""

        arg_3 = {
            'order_by': 'updated_at',
            'sort': 'asc',
            'per_page': PER_PAGE
        }

        arg_4 = urijoin(arg_1, str(arg_2), GitLabClient.NOTES)

        return arg_0.fetch_items(arg_4, arg_3)


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = timezone . now ( ) . replace ( microsecond = 0 , second = 0 ) for arg_4 in range ( arg_2 + 1 ) : yield hashlib . sha1 ( '%s:%s:%s:%s:%s' % ( arg_3 - datetime . timedelta ( minutes = arg_4 ) , arg_0 . password , arg_1 , arg_0 . pk , settings . SECRET_KEY , ) , ) . hexdigest ( )

def Func(arg_0, arg_1, arg_2):
    """
    Generate auth tokens tied to user and specified purpose.

    The hash expires at midnight on the minute of now + minutes_valid, such
    that when minutes_valid=1 you get *at least* 1 minute to use the token.
    """
    arg_3 = timezone.now().replace(microsecond=0, second=0)
    for arg_4 in range(arg_2 + 1):
        yield hashlib.sha1(
            '%s:%s:%s:%s:%s' % (
                arg_3 - datetime.timedelta(minutes=arg_4),
                arg_0.password,
                arg_1,
                arg_0.pk,
                settings.SECRET_KEY,
            ),
        ).hexdigest()

Generate auth tokens tied to user and specified purpose .


def Func ( arg_0 ) : arg_1 = posixpath . dirname arg_0 = arg_0 . strip ( '/' ) arg_2 = [ ] while arg_0 != '' : arg_0 = arg_1 ( arg_0 ) arg_2 . append ( arg_0 ) return reversed ( arg_2 )

def Func(arg_0):
    """
    Return an iterable of all prefix directories of path, descending from root.
    """
    arg_1 = posixpath.dirname
    arg_0 = arg_0.strip('/')
    arg_2 = []
    while arg_0 != '':
        arg_0 = arg_1(arg_0)
        arg_2.append(arg_0)
    return reversed(arg_2)

Return an iterable of all prefix directories of path descending from root .


def
Func
(
arg_0
)
:
arg_1
=
[
]
for
arg_2
,
arg_3
in
sorted
(
arg_0
.
items
(
)
)
:
if
isinstance
(
arg_3
,
StringCounter
)
:
arg_3
=
[
u'%s: %d'
%
(
k
,
v
)
for
(
k
,
v
)
in
arg_3
.
most_common
(
)
]
arg_3
=
u'\n\t'
+
u'\n\t'
.
join
(
arg_3
)
arg_1
.
append
(
arg_2
+
u': '
+
arg_3
)
return
u'\n'
.
join
(
arg_1
)

def Func(arg_0):
    '''construct a nice looking string for an FC
    '''
    arg_1 = []
    for arg_2, arg_3 in sorted(arg_0.items()):
        if isinstance(arg_3, StringCounter):
            arg_3 = [u'%s: %d' % (k, v)
                       for (k,v) in arg_3.most_common()]
            arg_3 = u'\n\t' + u'\n\t'.join(arg_3)
        arg_1.append(arg_2 + u': ' + arg_3)
    return u'\n'.join(arg_1)


def
Func
(
arg_0
,
arg_1
)
:
if
not
arg_0
:
return
(
""
,
""
)
arg_0
=
[
_get_indent_length
(
indent
)
for
indent
in
arg_0
]
arg_1
=
_get_indent_length
(
arg_1
)
arg_2
=
""
arg_3
=
[
(
pos
,
"|"
)
for
pos
in
arg_0
]
if
len
(
arg_3
)
==
1
:
arg_4
=
arg_3
[
0
]
[
0
]
arg_5
=
abs
(
arg_4
arg_1
)
arg_6
=
"add"
if
arg_4
>
arg_1
else
"remove"
arg_2
=
_CONTINUATION_HINT_MESSAGE
%
(
arg_6
,
arg_5
,
"s"
if
arg_5
>
1
else
""
,
)
arg_3
.
append
(
(
arg_1
,
"^"
)
)
arg_3
.
sort
(
)
arg_7
=
[
" "
]
*
(
arg_3
[
1
]
[
0
]
+
1
)
for
arg_8
,
arg_9
in
arg_3
:
arg_7
[
arg_8
]
=
arg_9
return
(
""
.
join
(
arg_7
)
,
arg_2
)

def Func(arg_0, arg_1):
    """Return a line with |s for each of the positions in the given lists."""
    if not arg_0:
        return ("", "")
    # TODO tabs should not be replaced by some random (8) number of spaces
    arg_0 = [_get_indent_length(indent) for indent in arg_0]
    arg_1 = _get_indent_length(arg_1)
    arg_2 = ""
    arg_3 = [(pos, "|") for pos in arg_0]
    if len(arg_3) == 1:
        # if we have only one marker we'll provide an extra hint on how to fix
        arg_4 = arg_3[0][0]
        arg_5 = abs(arg_4 - arg_1)
        arg_6 = "add" if arg_4 > arg_1 else "remove"
        arg_2 = _CONTINUATION_HINT_MESSAGE % (
            arg_6,
            arg_5,
            "s" if arg_5 > 1 else "",
        )
    arg_3.append((arg_1, "^"))
    arg_3.sort()
    arg_7 = [" "] * (arg_3[-1][0] + 1)
    for arg_8, arg_9 in arg_3:
        arg_7[arg_8] = arg_9
    return ("".join(arg_7), arg_2)

Return a line with |s for each of the positions in the given lists .


def Func ( arg_0 ) -> str : if arg_0 . _idx < StreamReader . DEFAULT_INDEX : arg_0 . _idx += 1 else : arg_1 = arg_0 . _stream . read ( 1 ) arg_0 . _update_loc ( arg_1 ) arg_0 . _buffer . append ( arg_1 ) return arg_0 . peek ( )

def Func(arg_0) -> str:
        """Advance the stream forward by one character and return the
        next token in the stream."""
        if arg_0._idx < StreamReader.DEFAULT_INDEX:
            arg_0._idx += 1
        else:
            arg_1 = arg_0._stream.read(1)
            arg_0._update_loc(arg_1)
            arg_0._buffer.append(arg_1)
        return arg_0.peek()

Advance the stream forward by one character and return the next token in the stream .


def Func ( arg_0 ) : try : return int ( binascii . hexlify ( socket . inet_aton ( arg_0 ) ) , 16 ) except socket . error : return int ( binascii . hexlify ( socket . inet_pton ( socket . AF_INET6 , arg_0 ) ) , 16 )

def Func(arg_0):
    """
    Wrapper function for IPv4 and IPv6 converters.

    :arg ip: IPv4 or IPv6 address
    """
    try:
        return int(binascii.hexlify(socket.inet_aton(arg_0)), 16)
    except socket.error:
        return int(binascii.hexlify(socket.inet_pton(socket.AF_INET6, arg_0)), 16)

Wrapper function for IPv4 and IPv6 converters .


def Func(arg_0, arg_1):
        """Gets the command class and matching responder function for the
        given command name.

        """
        # DISGUSTING IMPLEMENTATION DETAIL EXPLOITING HACK
        arg_2 = arg_0._remote.boxReceiver.locator
        arg_3 = arg_2.locateResponder(arg_1)
        arg_4 = arg_3.func_closure[1].cell_contents
        arg_5 = arg_3.func_closure[2].cell_contents
        return arg_5, arg_4

Gets the command class and matching responder function for the given command name .


def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
LOG
.
info
(
"Running scout load Func"
)
arg_4
=
arg_0
.
obj
[
'adapter'
]
if
arg_1
:
if
not
arg_2
:
arg_5
=
arg_1
.
split
(
'-'
)
if
len
(
arg_5
)
>
1
:
arg_6
=
arg_4
.
institute
(
arg_5
[
0
]
)
if
arg_6
:
arg_2
=
arg_6
[
'_id'
]
arg_1
=
arg_5
[
1
]
arg_7
=
arg_4
.
case
(
institute_id
=
arg_2
,
arg_1
=
arg_1
)
if
arg_7
is
:
LOG
.
warning
(
"No matching case found"
)
arg_0
.
abort
(
)
else
:
arg_8
=
[
arg_7
]
else
:
arg_8
=
arg_4
.
cases
(
Func_requested
=
True
)
arg_9
=
8
arg_10
=
False
for
arg_7
in
arg_8
:
if
arg_3
or
arg_7
[
'Func_requested'
]
:
if
arg_7
[
'vcf_files'
]
.
get
(
'vcf_snv_Func'
)
:
arg_10
=
True
arg_4
.
delete_variants
(
arg_1
=
arg_7
[
'_id'
]
,
variant_type
=
'Func'
,
category
=
'snv'
)
LOG
.
info
(
"Load Func SNV for: %s"
,
arg_7
[
'_id'
]
)
arg_4
.
load_variants
(
arg_7
=
arg_7
,
variant_type
=
'Func'
,
category
=
'snv'
,
rank_threshold
=
arg_9
,
)
if
arg_7
[
'vcf_files'
]
.
get
(
'vcf_sv_Func'
)
:
arg_10
=
True
arg_4
.
delete_variants
(
arg_1
=
arg_7
[
'_id'
]
,
variant_type
=
'Func'
,
category
=
'sv'
)
LOG
.
info
(
"Load Func SV for: %s"
,
arg_7
[
'_id'
]
)
arg_4
.
load_variants
(
arg_7
=
arg_7
,
variant_type
=
'Func'
,
category
=
'sv'
,
rank_threshold
=
arg_9
,
)
if
arg_7
[
'vcf_files'
]
.
get
(
'vcf_cancer_Func'
)
:
arg_10
=
True
arg_4
.
delete_variants
(
arg_1
=
arg_7
[
'_id'
]
,
variant_type
=
'Func'
,
category
=
'cancer'
)
LOG
.
info
(
"Load Func cancer for: %s"
,
arg_7
[
'_id'
]
)
arg_4
.
load_variants
(
arg_7
=
arg_7
,
variant_type
=
'Func'
,
category
=
'cancer'
,
rank_threshold
=
arg_9
,
)
if
not
arg_10
:
LOG
.
warning
(
"No Func files found for case %s"
,
arg_1
)
arg_0
.
abort
(
)
arg_7
[
'is_Func'
]
=
True
arg_7
[
'Func_requested'
]
=
False
arg_4
.
update_case
(
arg_7
)
else
:
LOG
.
warn
(
"Func not requested, use '--force'"
)

def Func(arg_0, arg_1, arg_2, arg_3):
    """Upload Func variants to cases

        If a case is specified, all variants found for that case will be
        uploaded.

        If no cases are specified then all cases that have 'Func_requested'
        will have there Func variants uploaded
    """
    LOG.info("Running scout load Func")
    arg_4 = arg_0.obj['adapter']

    if arg_1:
        if not arg_2:
            # There was an old way to create case ids so we need a special case to handle this
            # Assume institute-case combo
            arg_5 = arg_1.split('-')
            # Check if first part is institute, then we know it is the old format
            if len(arg_5) > 1:
                arg_6 = arg_4.institute(arg_5[0])
                if arg_6:
                    arg_2 = arg_6['_id']
                    arg_1 = arg_5[1]
        arg_7 = arg_4.case(institute_id=arg_2, arg_1=arg_1)
        if arg_7 is None:
            LOG.warning("No matching case found")
            arg_0.abort()
        else:
            arg_8 = [arg_7]
    else:
        # Fetch all cases that have requested Func
        arg_8 = arg_4.cases(Func_requested=True)

    arg_9 = 8
    arg_10 = False
    for arg_7 in arg_8:
        if arg_3 or arg_7['Func_requested']:
            # Test to upload Func snvs
            if arg_7['vcf_files'].get('vcf_snv_Func'):
                arg_10 = True
                arg_4.delete_variants(arg_1=arg_7['_id'],
                                        variant_type='Func',
                                        category='snv')

                LOG.info("Load Func SNV for: %s", arg_7['_id'])
                arg_4.load_variants(
                    arg_7=arg_7,
                    variant_type='Func',
                    category='snv',
                    rank_threshold=arg_9,
                    )

            # Test to upload Func svs
            if arg_7['vcf_files'].get('vcf_sv_Func'):
                arg_10 = True
                arg_4.delete_variants(arg_1=arg_7['_id'],
                                        variant_type='Func',
                                        category='sv')
                LOG.info("Load Func SV for: %s", arg_7['_id'])
                arg_4.load_variants(
                    arg_7=arg_7,
                    variant_type='Func',
                    category='sv',
                    rank_threshold=arg_9,
                    )

            # Test to upload Func cancer variants
            if arg_7['vcf_files'].get('vcf_cancer_Func'):
                arg_10 = True
                arg_4.delete_variants(arg_1=arg_7['_id'],
                                        variant_type='Func',
                                        category='cancer')

                LOG.info("Load Func cancer for: %s", arg_7['_id'])
                arg_4.load_variants(
                    arg_7=arg_7,
                    variant_type='Func',
                    category='cancer',
                    rank_threshold=arg_9,
                    )
            if not arg_10:
                LOG.warning("No Func files found for case %s", arg_1)
                arg_0.abort()
            arg_7['is_Func'] = True
            arg_7['Func_requested'] = False
            arg_4.update_case(arg_7)
        else:
            LOG.warn("Func not requested, use '--force'")

Upload research variants to cases

        If a case is specified, all variants found for that case will be
        uploaded.

        If no cases are specified then all cases that have 'research_requested'
        will have there research variants uploaded


return {'resname':gmx_resname, 'resid':gmx_resid, 'atomname':gmx_atomname}

def
Func
(
arg_0
,
arg_1
,
arg_2
=
'CA'
)
:
arg_3
=
arg_0
.
RESIDUE
.
match
(
arg_1
)
if
not
arg_3
:
arg_4
=
"Selection {selection!r} is not valid."
.
format
(
**
vars
(
)
)
logger
.
error
(
arg_4
)
raise
ValueError
(
arg_4
)
arg_5
=
arg_0
.
gmx_resid
(
int
(
arg_3
.
group
(
'resid'
)
)
)
arg_6
=
arg_3
.
group
(
'aa'
)
if
len
(
arg_6
)
==
1
:
arg_7
=
utilities
.
convert_aa_code
(
arg_6
)
else
:
arg_7
=
arg_6
arg_8
=
arg_3
.
group
(
'atom'
)
if
arg_8
is
:
arg_8
=
arg_2
return
{
'resname'
:
arg_7
,
'resid'
:
arg_5
,
'atomname'
:
arg_8
}

def Func(arg_0, arg_1, arg_2='CA'):
        """Translate selection for a single res to make_ndx syntax."""
        arg_3 = arg_0.RESIDUE.match(arg_1)
        if not arg_3:
            arg_4 = "Selection {selection!r} is not valid.".format(**vars())
            logger.error(arg_4)
            raise ValueError(arg_4)

        arg_5 = arg_0.gmx_resid(int(arg_3.group('resid')))    # magic offset correction
        arg_6 = arg_3.group('aa')
        if len(arg_6) == 1:
            arg_7 = utilities.convert_aa_code(arg_6) # only works for AA
        else:
            arg_7 = arg_6                            # use 3-letter for any resname

        arg_8 = arg_3.group('atom')
        if arg_8 is None:
            arg_8 = arg_2

        return {'resname':arg_7, 'resid':arg_5, 'atomname':arg_8}

Translate selection for a single res to make_ndx syntax .


Search through lines for match.
            Raise an Exception if a match

(self, subsetLines, offsetOfSubset, fileName)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
for
(
arg_4
,
arg_5
)
in
enumerate
(
arg_1
)
:
for
arg_6
in
arg_0
.
regex
:
arg_7
=
arg_6
.
Regex
.
search
(
arg_5
)
if
arg_7
!=
:
arg_8
=
arg_4
+
arg_2
_logger
.
debug
(
'Found Func on line {}'
.
format
(
str
(
arg_8
+
1
)
)
)
_logger
.
debug
(
'Line is {}'
.
format
(
arg_5
)
)
arg_0
.
failed
=
True
arg_0
.
FuncLocation
=
CheckFileParser
.
FileLocation
(
arg_3
,
arg_8
+
1
)
raise
DirectiveException
(
arg_0
)

def Func(arg_0, arg_1, arg_2, arg_3):
        """
            Search through lines for Func.
            Raise an Exception if a Func
        """
        for (arg_4,arg_5) in enumerate(arg_1):
            for arg_6 in arg_0.regex:
                arg_7 = arg_6.Regex.search(arg_5)
                if arg_7 != None:
                    arg_8 = arg_4 + arg_2
                    _logger.debug('Found Func on line {}'.format(str(arg_8+ 1)))
                    _logger.debug('Line is {}'.format(arg_5))
                    arg_0.failed = True
                    arg_0.FuncLocation = CheckFileParser.FileLocation(arg_3, arg_8 +1)
                    raise DirectiveException(arg_0)

Search through lines for match . Raise an Exception if a match


def Func ( arg_0 , arg_1 ) : arg_0 . touched = True arg_0 . iter = int ( arg_1 ) arg_0 . t_Func = time . time ( )

def Func(arg_0, arg_1):
        """Start the progress bar.

        Parameters:
            iterations (int): Number of iterations.
        """
        arg_0.touched = True
        arg_0.iter = int(arg_1)
        arg_0.t_Func = time.time()


def Func ( arg_0 ) : arg_1 = 0 for arg_2 , arg_3 in enumerate ( arg_0 ) : if isinstance ( arg_3 , SessionHandler ) : arg_1 = arg_2 break if arg_1 : arg_0 [ : arg_1 + 1 ] = [ arg_0 [ arg_1 ] ] + arg_0 [ : arg_1 ]

def Func(arg_0):
    """Find a SessionHandler instance in the list and move it to the beginning.
    """
    arg_1 = 0
    for arg_2, arg_3 in enumerate(arg_0):
        if isinstance(arg_3, SessionHandler):
            arg_1 = arg_2
            break
    if arg_1:
        arg_0[:arg_1 + 1] = [arg_0[arg_1]] + arg_0[:arg_1]

Find a SessionHandler instance in the list and move it to the beginning .


def Func ( arg_0 ) : @ wraps ( arg_0 ) def inner ( * arg_1 , ** arg_2 ) : arg_3 = arg_0 ( * arg_1 , ** arg_2 ) if arg_3 is False : if "TMC_TESTING" in os . environ : raise TMCExit ( ) else : sys . exit ( - 1 ) return arg_3 return inner

def Func(arg_0):
    """
    If func returns False the program exits immediately.
    """
    @wraps(arg_0)
    def inner(*arg_1, **arg_2):
        arg_3 = arg_0(*arg_1, **arg_2)
        if arg_3 is False:
            if "TMC_TESTING" in os.environ:
                raise TMCExit()
            else:
                sys.exit(-1)
        return arg_3
    return inner

If func returns False the program exits immediately .


def Func ( arg_0 , arg_1 = arg_2 ) : with open ( arg_0 ) as fh : return load ( fh , arg_1 )

def Func(arg_0, arg_1=arg_2):
    """Open a file, read it and return its contents."""
    with open(arg_0) as fh:
        return load(fh, arg_1)

Open a file read it and return its contents .


def
Func
(
arg_0
)
:
try
:
return
arg_0
.
json
(
)
except
ValueError
as
e
:
six
.
raise_from
(
InvalidJSONError
(
"Invalid JSON was received from "
+
arg_0
.
request
.
url
)
,
e
)

def Func(arg_0):
    """
    Factors out some JSON parse code with error handling, to hopefully improve
    error messages.

    :param resp: A "requests" library response
    :return: Parsed JSON.
    :raises: InvalidJSONError If JSON parsing failed.
    """
    try:
        return arg_0.json()
    except ValueError as e:
        # Maybe better to report the original request URL?
        six.raise_from(InvalidJSONError(
            "Invalid JSON was received from " + arg_0.request.url
        ), e)

Factors out some JSON parse code with error handling to hopefully improve error messages .


def Func ( arg_0 , ** arg_1 ) : for arg_2 in arg_1 : if type ( arg_1 [ arg_2 ] ) == str : arg_0 . _children [ arg_2 ] = Directory ( arg_1 [ arg_2 ] ) else : arg_0 . _children [ arg_2 ] = arg_1 [ arg_2 ] arg_0 . _children [ arg_2 ] . _env = arg_0 arg_0 . _children [ arg_2 ] . apply_config ( ConfigApplicator ( arg_0 . config ) ) arg_0 . _children [ arg_2 ] . prepare ( )

def Func(arg_0, **arg_1):
        """
        Add objects to the environment.
        """
        for arg_2 in arg_1:
            if type(arg_1[arg_2]) == str:
                arg_0._children[arg_2] = Directory(arg_1[arg_2])
            else:
                arg_0._children[arg_2] = arg_1[arg_2]
            arg_0._children[arg_2]._env = arg_0
            arg_0._children[arg_2].apply_config(ConfigApplicator(arg_0.config))
            arg_0._children[arg_2].prepare()


def Func ( arg_0 , arg_1 = True , arg_2 = True ) : arg_3 = [ ] if arg_1 and arg_0 . last_task is not None : try : arg_4 = Task . Iterator ( arg_0 . last_task , Task . READY ) arg_5 = next ( arg_4 ) except StopIteration : arg_5 = None arg_0 . last_task = None if arg_5 is not None : if not ( arg_2 and arg_5 . task_spec . manual ) : if arg_5 . complete ( ) : arg_0 . last_task = arg_5 return True arg_3 . append ( arg_5 ) for arg_5 in Task . Iterator ( arg_0 . task_tree , Task . READY ) : for arg_7 in arg_3 : if arg_5 . _is_descendant_of ( arg_7 ) : continue if not ( arg_2 and arg_5 . task_spec . manual ) : if arg_5 . complete ( ) : arg_0 . last_task = arg_5 return True arg_3 . append ( arg_5 ) for arg_5 in Task . Iterator ( arg_0 . task_tree , Task . WAITING ) : arg_5 . task_spec . _update ( arg_5 ) if not arg_5 . _has_state ( Task . WAITING ) : arg_0 . last_task = arg_5 return True return False

def Func(arg_0, arg_1=True, arg_2=True):
        """
        Runs the next task.
        Returns True if completed, False otherwise.

        :type  pick_up: bool
        :param pick_up: When True, this method attempts to choose the next
                        task not by searching beginning at the root, but by
                        searching from the position at which the last call
                        of Func() left off.
        :type  halt_on_manual: bool
        :param halt_on_manual: When True, this method will not attempt to
                        complete any tasks that have manual=True.
                        See :meth:`SpiffWorkflow.specs.TaskSpec.__init__`
        :rtype:  bool
        :returns: True if all tasks were completed, False otherwise.
        """
        # Try to pick up where we left off.
        arg_3 = []
        if arg_1 and arg_0.last_task is not None:
            try:
                arg_4 = Task.Iterator(arg_0.last_task, Task.READY)
                arg_5 = next(arg_4)
            except StopIteration:
                arg_5 = None
            arg_0.last_task = None
            if arg_5 is not None:
                if not (arg_2 and arg_5.task_spec.manual):
                    if arg_5.complete():
                        arg_0.last_task = arg_5
                        return True
                arg_3.append(arg_5)

        # Walk through all ready tasks.
        for arg_5 in Task.Iterator(arg_0.task_tree, Task.READY):
            for arg_7 in arg_3:
                if arg_5._is_descendant_of(arg_7):
                    continue
            if not (arg_2 and arg_5.task_spec.manual):
                if arg_5.complete():
                    arg_0.last_task = arg_5
                    return True
            arg_3.append(arg_5)

        # Walk through all waiting tasks.
        for arg_5 in Task.Iterator(arg_0.task_tree, Task.WAITING):
            arg_5.task_spec._update(arg_5)
            if not arg_5._has_state(Task.WAITING):
                arg_0.last_task = arg_5
                return True
        return False

Runs the next task.
        Returns True if completed, False otherwise.

        :type  pick_up: bool
        :param pick_up: When True, this method attempts to choose the next
                        task not by searching beginning at the root, but by
                        searching from the position at which the last call
                        of complete_next() left off.
        :type  halt_on_manual: bool
        :param halt_on_manual: When True, this method will not attempt to
                        complete any tasks that have manual=True.
                        See :meth:`SpiffWorkflow.specs.TaskSpec.__init__`
        :rtype:  bool
        :returns: True if all tasks were completed, False otherwise.

Runs the next task . Returns True if completed False otherwise .


def Func ( arg_0 ) : arg_1 = [ arg_2 for arg_2 in arg_0 . py_tree . iter_funcdefs ( ) ] + [ arg_2 for cls in arg_0 . py_tree . iter_classdefs ( ) for arg_2 in cls . iter_funcdefs ( ) ] for arg_2 in arg_1 : for arg_3 in arg_2 . get_decorators ( ) : if arg_3 . children [ 1 ] . value == 'step' : yield arg_2 , arg_3 break

def Func(arg_0):
        """Find functions with step decorator in parsed file"""
        arg_1 = [arg_2 for arg_2 in arg_0.py_tree.iter_funcdefs()] + [arg_2 for cls in arg_0.py_tree.iter_classdefs() for arg_2 in cls.iter_funcdefs()]
        for arg_2 in arg_1:
            for arg_3 in arg_2.get_decorators():
                if arg_3.children[1].value == 'step':
                    yield arg_2, arg_3
                    break


def Func ( arg_0 , arg_1 , arg_2 = None ) : check_rdd ( arg_1 , { 'X' : ( sp . spmatrix , np . ndarray ) , 'y' : ( sp . spmatrix , np . ndarray ) } ) arg_3 = arg_1 [ : , [ 'X' , 'y' ] ] . map ( lambda X_y : arg_0 . partial_Func ( X_y [ 0 ] , X_y [ 1 ] , arg_2 ) ) arg_4 = arg_3 . reduce ( operator . add ) arg_0 . __dict__ . update ( arg_4 . __dict__ ) return arg_0

def Func(arg_0, arg_1, arg_2=None):
        """Fit Gaussian Naive Bayes according to X, y

        Parameters
        ----------
        X : array-like, shape (n_samples, n_features)
            Training vectors, where n_samples is the number of samples
            and n_features is the number of features.

        y : array-like, shape (n_samples,)
            Target values.

        Returns
        -------
        self : object
            Returns self.
        """
        check_rdd(arg_1, {'X': (sp.spmatrix, np.ndarray), 'y': (sp.spmatrix, np.ndarray)})
        arg_3 = arg_1[:, ['X', 'y']].map(
            lambda X_y: arg_0.partial_Func(X_y[0], X_y[1], arg_2))
        arg_4 = arg_3.reduce(operator.add)
        arg_0.__dict__.update(arg_4.__dict__)
        return arg_0

Fit Gaussian Naive Bayes according to X y


def Func ( arg_0 , arg_1 ) : arg_0 . execute ( 'it%s=iter(%s)' % ( arg_1 , arg_1 ) , block = True ) while True : try : arg_2 = arg_0 . apply_sync ( lambda x : x . next ( ) , Reference ( 'it' + arg_1 ) ) except RemoteError as e : if e . ename == 'StopIteration' : raise StopIteration else : raise e else : yield arg_2

def Func(arg_0,arg_1):
    """Return an iterator on an object living on a remote engine.
    """
    arg_0.execute('it%s=iter(%s)'%(arg_1,arg_1), block=True)
    while True:
        try:
            arg_2 = arg_0.apply_sync(lambda x: x.next(), Reference('it'+arg_1))
        # This causes the StopIteration exception to be raised.
        except RemoteError as e:
            if e.ename == 'StopIteration':
                raise StopIteration
            else:
                raise e
        else:
            yield arg_2

Return an iterator on an object living on a remote engine .


async
def
Func
(
arg_0
,
arg_1
=
)
:
arg_0
.
running
=
False
if
arg_0
.
error
:
return
if
isinstance
(
arg_1
,
ServiceBusError
)
:
arg_0
.
error
=
arg_1
elif
arg_1
:
arg_0
.
error
=
ServiceBusError
(
str
(
arg_1
)
)
else
:
arg_0
.
error
=
ServiceBusError
(
"This message handler is now Funcd."
)
await
arg_0
.
_handler
.
Func_async
(
)

async def Func(arg_0, arg_1=None):
        """Close down the handler connection.

        If the handler has already Funcd,
        this operation will do nothing. An optional exception can be passed in to
        indicate that the handler was shutdown due to error.
        It is recommended to open a handler within a context manager as
        opposed to calling the method directly.

        .. note:: This operation is not thread-safe.

        :param exception: An optional exception if the handler is closing
         due to an error.
        :type exception: Exception

        Example:
            .. literalinclude:: ../examples/async_examples/test_examples_async.py
                :start-after: [START open_Func_sender_directly]
                :end-before: [END open_Func_sender_directly]
                :language: python
                :dedent: 4
                :caption: Explicitly open and Func a Sender.

        """
        arg_0.running = False
        if arg_0.error:
            return
        if isinstance(arg_1, ServiceBusError):
            arg_0.error = arg_1
        elif arg_1:
            arg_0.error = ServiceBusError(str(arg_1))
        else:
            arg_0.error = ServiceBusError("This message handler is now Funcd.")
        await arg_0._handler.Func_async()

Close down the handler connection.

        If the handler has already closed,
        this operation will do nothing. An optional exception can be passed in to
        indicate that the handler was shutdown due to error.
        It is recommended to open a handler within a context manager as
        opposed to calling the method directly.

        .. note:: This operation is not thread-safe.

        :param exception: An optional exception if the handler is closing
         due to an error.
        :type exception: Exception

        Example:
            .. literalinclude:: ../examples/async_examples/test_examples_async.py
                :start-after: [START open_close_sender_directly]
                :end-before: [END open_close_sender_directly]
                :language: python
                :dedent: 4
                :caption: Explicitly open and close a Sender.


return "http://%s:%d/filedata/log-files/%s.log.0?offset=%s&length=%s" % \
    (host, shell_port, instance_id, offset, length)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
  """
  Make the url for log-file data in heron-shell
  from the info stored in stmgr.
  """
  return "http://%s:%d/filedata/log-files/%s.log.0?offset=%s&length=%s" % \
    (arg_0, arg_1, arg_2, arg_3, arg_4)

Make the url for log - file data in heron - shell from the info stored in stmgr .


return self.list(request, *args, **kwargs)

def Func ( arg_0 , arg_1 , * arg_2 , ** arg_3 ) : arg_0 . queryset = arg_0 . queryset . order_by ( 'name' ) arg_5 = arg_0 . request . query_params . get ( 'enterprise_id' , None ) arg_6 = arg_0 . request . query_params . get ( 'enterprise_slug' , None ) arg_7 = arg_0 . request . query_params . get ( 'search' , None ) if arg_5 is not None : arg_0 . queryset = arg_0 . queryset . filter ( uuid = arg_5 ) elif arg_6 is not None : arg_0 . queryset = arg_0 . queryset . filter ( slug = arg_6 ) elif arg_7 is not None : arg_0 . queryset = arg_0 . queryset . filter ( name__icontains = arg_7 ) return arg_0 . list ( arg_1 , * arg_2 , ** arg_3 )

def Func(arg_0, arg_1, *arg_2, **arg_3):  # pylint: disable=invalid-name,unused-argument
        """
        Returns the list of enterprise customers the user has a specified group permission access to.
        """
        arg_0.queryset = arg_0.queryset.order_by('name')
        arg_5 = arg_0.request.query_params.get('enterprise_id', None)
        arg_6 = arg_0.request.query_params.get('enterprise_slug', None)
        arg_7 = arg_0.request.query_params.get('search', None)

        if arg_5 is not None:
            arg_0.queryset = arg_0.queryset.filter(uuid=arg_5)
        elif arg_6 is not None:
            arg_0.queryset = arg_0.queryset.filter(slug=arg_6)
        elif arg_7 is not None:
            arg_0.queryset = arg_0.queryset.filter(name__icontains=arg_7)
        return arg_0.list(arg_1, *arg_2, **arg_3)

Returns the list of enterprise customers the user has a specified group permission access to .


def Func ( arg_0 , arg_1 ) : for arg_2 in iterkeys ( arg_1 ) : if arg_0 . exists ( arg_2 ) : return False return arg_0 . _rc_mset ( arg_1 )

def Func(arg_0, arg_1):
        """
        Sets each key in the ``mapping`` dict to its corresponding value if
        none of the keys are already set
        """
        for arg_2 in iterkeys(arg_1):
            if arg_0.exists(arg_2):
                return False

        return arg_0._rc_mset(arg_1)

Sets each key in the mapping dict to its corresponding value if none of the keys are already set


def
Func
(
arg_0
)
:
arg_1
=
max
(
len
(
i
)
for
i
in
arg_0
)
arg_2
=
5
arg_3
=
[
name
+
" "
*
(
arg_1
len
(
name
)
+
arg_2
)
for
name
in
arg_0
]
arg_4
=
"//"
+
" "
*
(
arg_1
2
+
arg_2
)
return
np
.
array
(
arg_3
)
,
arg_4

def Func(arg_0):
    """ pads names for loci output """

    ## get longest name
    arg_1 = max(len(i) for i in arg_0)
    ## Padding distance between name and seq.
    arg_2 = 5
    ## add pad to names
    arg_3 = [name + " " * (arg_1 - len(name)+ arg_2) \
              for name in arg_0]
    arg_4 = "//" + " " * (arg_1 - 2 + arg_2)
    return np.array(arg_3), arg_4


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . getAccounts ( ) for arg_3 in arg_2 : if arg_3 [ "name" ] == arg_1 : arg_0 . store . delete ( arg_3 [ "pubkey" ] )

def Func(arg_0, arg_1):
        """ Remove all keys associated with a given account
        """
        arg_2 = arg_0.getAccounts()
        for arg_3 in arg_2:
            if arg_3["name"] == arg_1:
                arg_0.store.delete(arg_3["pubkey"])


def Func ( arg_0 ) : for arg_1 in arg_0 . m_blk_a : arg_2 = arg_1 . upper ( ) if not "RESERVED" in arg_2 and not "CRC" in arg_2 : arg_0 . m_req [ arg_1 ] = arg_0 . m_blk_a [ arg_1 ] for arg_1 in arg_0 . m_blk_b : arg_2 = arg_1 . upper ( ) if not "RESERVED" in arg_2 and not "CRC" in arg_2 : arg_0 . m_req [ arg_1 ] = arg_0 . m_blk_b [ arg_1 ] pass

def Func(arg_0):
        """ Munge A and B reads into single serial block with only unique fields."""
        for arg_1 in arg_0.m_blk_a:
            arg_2 = arg_1.upper()
            if not "RESERVED" in arg_2 and not "CRC" in arg_2:
                arg_0.m_req[arg_1] = arg_0.m_blk_a[arg_1]
        for arg_1 in arg_0.m_blk_b:
            arg_2 = arg_1.upper()
            if not "RESERVED" in arg_2 and not "CRC" in arg_2:
                arg_0.m_req[arg_1] = arg_0.m_blk_b[arg_1]
        pass

Munge A and B reads into single serial block with only unique fields .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
qregs
+
arg_0
.
cregs
arg_3
=
arg_1
.
qregs
+
arg_1
.
cregs
for
arg_4
in
arg_2
:
for
arg_5
in
arg_3
:
if
arg_5
.
name
==
arg_4
.
name
:
if
arg_4
!=
arg_5
:
raise
QiskitError
(
"circuits are not compatible"
)

def Func(arg_0, arg_1):
        """Raise exception if the circuits are defined on incompatible registers"""
        arg_2 = arg_0.qregs + arg_0.cregs
        arg_3 = arg_1.qregs + arg_1.cregs
        for arg_4 in arg_2:
            for arg_5 in arg_3:
                if arg_5.name == arg_4.name:
                    if arg_4 != arg_5:
                        raise QiskitError("circuits are not compatible")


def Func ( arg_0 , arg_1 , arg_2 ) : if arg_0 . has_package ( arg_1 ) and arg_0 . has_file ( arg_1 ) : if not arg_0 . file_chksum_set : arg_0 . file_chksum_set = True arg_0 . file ( arg_1 ) . chk_sum = checksum . Algorithm ( 'SHA1' , arg_2 ) return True else : raise CardinalityError ( 'File::CheckSum' ) else : raise OrderError ( 'File::CheckSum' )

def Func(arg_0, arg_1, arg_2):
        """Sets the file check sum, if not already set.
        chk_sum - A string
        Raises CardinalityError if already defined.
        Raises OrderError if no package previously defined.
        """
        if arg_0.has_package(arg_1) and arg_0.has_file(arg_1):
            if not arg_0.file_chksum_set:
                arg_0.file_chksum_set = True
                arg_0.file(arg_1).chk_sum = checksum.Algorithm('SHA1', arg_2)
                return True
            else:
                raise CardinalityError('File::CheckSum')
        else:
            raise OrderError('File::CheckSum')

Sets the file check sum if not already set . chk_sum - A string Raises CardinalityError if already defined . Raises OrderError if no package previously defined .


def
Func
(
arg_0
,
arg_1
=
,
**
arg_2
)
:
if
arg_2
.
pop
(
'include_debug_header'
,
True
)
:
debug
.
log
(
'Getting the role record.'
,
header
=
'details'
)
arg_3
,
arg_0
.
endpoint
=
arg_0
.
data_endpoint
(
arg_2
)
arg_5
=
arg_0
.
read
(
arg_1
=
arg_1
,
fail_on_no_results
=
True
,
fail_on_multiple_results
=
True
,
**
arg_3
)
arg_6
=
arg_5
[
'results'
]
[
0
]
arg_0
.
configure_display
(
arg_6
)
return
arg_6

def Func(arg_0, arg_1=None, **arg_2):
        """Get information about a role.

        =====API DOCS=====
        Retrieve one and exactly one object.

        :param pk: Primary key of the resource to be read. Tower CLI will only attempt to read *that* object
                   if ``pk`` is provided (not ``None``).
        :type pk: int
        :param `**kwargs`: Keyword arguments used to look up resource object to retrieve if ``pk`` is not provided.
        :returns: loaded JSON of the retrieved resource object.
        :rtype: dict

        =====API DOCS=====
        """
        if arg_2.pop('include_debug_header', True):
            debug.log('Getting the role record.', header='details')
        arg_3, arg_0.endpoint = arg_0.data_endpoint(arg_2)
        arg_5 = arg_0.read(arg_1=arg_1, fail_on_no_results=True,
                             fail_on_multiple_results=True, **arg_3)
        arg_6 = arg_5['results'][0]
        arg_0.configure_display(arg_6)
        return arg_6


def Func(arg_0, arg_1):
        """
        Computes priorities according to loss.

        Args:
            loss_per_instance:

        """
        if arg_0.batch_indices is None:
            raise TensorForceError("Need to call get_batch before each Func call.")
        # if len(loss_per_instance) != len(self.batch_indices):
        #     raise TensorForceError("For all instances a loss value has to be provided.")

        for arg_2, arg_3 in zip(arg_0.batch_indices, arg_1):
            # Sampling priority is proportional to the largest absolute temporal difference error.
            arg_4 = (np.abs(arg_3) + arg_0.prioritization_constant) ** arg_0.prioritization_weight
            arg_0.observations._move(arg_2, arg_4)
            arg_0.none_priority_index += 1


def Func ( arg_0 , arg_1 = 'R' ) : arg_2 = arg_0 . get_doc ( ) arg_3 = ( arg_2 ( 'table#Func' ) if arg_1 == 'R' else arg_2 ( 'table#Func_playoffs' ) ) arg_4 = sportsref . utils . parse_table ( arg_3 ) return arg_4

def Func(arg_0, arg_1='R'):
        """Gets yearly Func stats for the player.

        :kind: One of 'R', 'P', or 'B'. Case-insensitive; defaults to 'R'.
        :returns: Pandas DataFrame with Func stats.
        """
        arg_2 = arg_0.get_doc()
        arg_3 = (arg_2('table#Func') if arg_1 == 'R' else
                 arg_2('table#Func_playoffs'))
        arg_4 = sportsref.utils.parse_table(arg_3)
        return arg_4

Gets yearly passing stats for the player.

        :kind: One of 'R', 'P', or 'B'. Case-insensitive; defaults to 'R'.
        :returns: Pandas DataFrame with passing stats.

Gets yearly passing stats for the player .


def Func ( arg_0 = None ) : arg_1 = get_directory ( ) terminate_server ( ) arg_2 . clear ( ) if arg_0 : arg_2 [ 'language_check_dir' ] = arg_0 try : get_jar_info ( ) except Error : arg_2 [ 'language_check_dir' ] = arg_1 raise

def Func(arg_0=None):
    """Set LanguageTool directory."""
    arg_1 = get_directory()
    terminate_server()
    arg_2.clear()
    if arg_0:
        arg_2['language_check_dir'] = arg_0
        try:
            get_jar_info()
        except Error:
            arg_2['language_check_dir'] = arg_1
            raise


return map(lambda x: x.replace("&", "&"), urls)

def Func ( arg_0 ) : arg_1 = arg_0 . get_subfields ( "856" , "u" , i1 = "4" , i2 = "2" ) return map ( lambda x : x . replace ( "&" , "&" ) , arg_1 )

def Func(arg_0):
        """
        Content of field ``856u42``. Typically URL pointing to producers
        homepage.

        Returns:
            list: List of URLs defined by producer.
        """
        arg_1 = arg_0.get_subfields("856", "u", i1="4", i2="2")

        return map(lambda x: x.replace("&", "&"), arg_1)

Content of field 856u42 . Typically URL pointing to producers homepage .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 , arg_4 = institute_and_case ( store , arg_0 , arg_1 ) arg_5 = store . variant ( arg_2 ) arg_6 = store . user ( current_user . email ) arg_7 = url_for ( 'variants.variant' , arg_0 = arg_0 , arg_1 = arg_1 , arg_2 = arg_2 ) if request . form [ 'action' ] == 'ADD' : store . Func ( arg_3 , arg_4 , arg_6 , arg_7 , arg_5 ) elif request . form [ 'action' ] == 'DELETE' : store . unFunc ( arg_3 , arg_4 , arg_6 , arg_7 , arg_5 ) arg_8 = url_for ( '.case' , arg_0 = arg_0 , arg_1 = arg_1 ) return redirect ( arg_8 )

def Func(arg_0, arg_1, arg_2):
    """Mark a variant as confirmed causative."""
    arg_3, arg_4 = institute_and_case(store, arg_0, arg_1)
    arg_5 = store.variant(arg_2)
    arg_6 = store.user(current_user.email)
    arg_7 = url_for('variants.variant', arg_0=arg_0, arg_1=arg_1,
                   arg_2=arg_2)
    if request.form['action'] == 'ADD':
        store.Func(arg_3, arg_4, arg_6, arg_7, arg_5)
    elif request.form['action'] == 'DELETE':
        store.unFunc(arg_3, arg_4, arg_6, arg_7, arg_5)

    # send the user back to the case that was marked as solved
    arg_8 = url_for('.case', arg_0=arg_0, arg_1=arg_1)
    return redirect(arg_8)


def Func ( arg_0 , arg_1 , arg_2 ) : if arg_2 : arg_1 . ext_document_references [ - 1 ] . check_sum = checksum . Algorithm ( 'SHA1' , arg_2 ) else : raise SPDXValueError ( 'ExternalDocumentRef::Checksum' )

def Func(arg_0, arg_1, arg_2):
        """
        Sets the external document reference's check sum, if not already set.
        chk_sum - The checksum value in the form of a string.
        """
        if arg_2:
            arg_1.ext_document_references[-1].check_sum = checksum.Algorithm(
                'SHA1', arg_2)
        else:
            raise SPDXValueError('ExternalDocumentRef::Checksum')

Sets the external document reference s check sum if not already set . chk_sum - The checksum value in the form of a string .


Shorthand for creating a Giphy api wrapper with the given api key
    and then calling the translate method.

(term=None, phrase=None, api_key=GIPHY_PUBLIC_KEY, strict=False,
              rating=None)

return Giphy(api_key=api_key, strict=strict).translate(
        term=term, phrase=phrase, rating=rating)

def Func(arg_0=None, arg_1=None, arg_2=arg_3, arg_4=False,
              arg_5=None):
    """
    Shorthand for creating a Giphy api wrapper with the given api key
    and then calling the Func method.
    """
    return Giphy(arg_2=arg_2, arg_4=arg_4).Func(
        arg_0=arg_0, arg_1=arg_1, arg_5=arg_5)

Shorthand for creating a Giphy api wrapper with the given api key and then calling the translate method .


def Func ( arg_0 , arg_1 ) : arg_2 = Parser ( arg_1 ) try : return arg_2 . parse ( arg_0 ) except SelectorSyntaxError as e : log . exception ( e ) return False

def Func(arg_0, arg_1):
    """Appy Funcor to obj and return matching nodes.

    If only one node is found, return it, otherwise return a list of matches.
    Returns False on syntax error. None if no results found.
    """

    arg_2 = Parser(arg_1)
    try:
        return arg_2.parse(arg_0)
    except SelectorSyntaxError as e:
        log.exception(e)
        return False

Appy selector to obj and return matching nodes.

    If only one node is found, return it, otherwise return a list of matches.
    Returns False on syntax error. None if no results found.

Appy selector to obj and return matching nodes .


def Func ( arg_0 = ( ) , arg_1 = None , arg_2 = None ) : if arg_1 is None : arg_1 = Counter ( ) if arg_2 is not None : arg_1 = _StopAfterWrapper ( arg_1 = arg_1 , limit = arg_2 ) arg_3 = ObjectLocator ( ) arg_4 = ( case for test in arg_0 for loader in arg_3 . locate_by_name ( name = test ) for case in loader . load ( ) ) arg_5 = unittest . TestSuite ( arg_4 ) getattr ( arg_1 , "startTestRun" , lambda : None ) ( ) arg_5 . Func ( arg_1 ) getattr ( arg_1 , "stopTestRun" , lambda : None ) ( ) return arg_1

def Func(arg_0=(), arg_1=None, arg_2=None):
    """
    Run the tests that are loaded by each of the strings provided.

    Arguments:

        tests (iterable):

            the collection of tests (specified as `str` s) to Func

        reporter (Reporter):

            a `Reporter` to use for the Func. If unprovided, the default
            is to return a `virtue.reporters.Counter` (which produces no
            output).

        stop_after (int):

            a number of non-successful tests to allow before stopping the Func.

    """

    if arg_1 is None:
        arg_1 = Counter()
    if arg_2 is not None:
        arg_1 = _StopAfterWrapper(arg_1=arg_1, limit=arg_2)

    arg_3 = ObjectLocator()
    arg_4 = (
        case
        for test in arg_0
        for loader in arg_3.locate_by_name(name=test)
        for case in loader.load()
    )
    arg_5 = unittest.TestSuite(arg_4)
    getattr(arg_1, "startTestRun", lambda: None)()
    arg_5.Func(arg_1)
    getattr(arg_1, "stopTestRun", lambda: None)()
    return arg_1

Run the tests that are loaded by each of the strings provided.

    Arguments:

        tests (iterable):

            the collection of tests (specified as `str` s) to run

        reporter (Reporter):

            a `Reporter` to use for the run. If unprovided, the default
            is to return a `virtue.reporters.Counter` (which produces no
            output).

        stop_after (int):

            a number of non-successful tests to allow before stopping the run.

Run the tests that are loaded by each of the strings provided .


def Func ( arg_0 ) : if six . PY2 and isinstance ( arg_0 , __unicode__ ) : return arg_0 . encode ( 'utf-8' ) return arg_0

def Func(arg_0):
    """
    Return a utf-8 encoded string from a valid unicode string.

    :param unicode_str: Unicode string.

    :return: str
    """
    if six.PY2 and isinstance(arg_0, __unicode__):
        return arg_0.encode('utf-8')

    return arg_0

Return a utf - 8 encoded string from a valid unicode string .


return np.nanstd(a) / np.sqrt(sum(np.isfinite(a)))

def Func ( arg_0 ) : return np . nanstd ( arg_0 ) / np . sqrt ( sum ( np . isfinite ( arg_0 ) ) )

def Func(arg_0):
    """
    Calculate the standard error of a.
    """
    return np.nanstd(arg_0) / np.sqrt(sum(np.isfinite(arg_0)))


def Func(arg_0, arg_1):
        "returns class._on_msg_unsafe, use x.im_self to get class"
        assert isinstance(arg_1, bytes) and len(arg_1) == 20
        assert arg_0.is_instance_address(arg_1)
        arg_2 = arg_0.native_contract_address_prefix + arg_1[-4:]
        return arg_0.native_contracts[arg_2]

returns class . _on_msg_unsafe use x . im_self to get class


(self, name=None, attrs={}, text=None,
                             limit=None, **kwargs)

return self._findAll(name, attrs, text, limit,
                             self.previousSiblingGenerator, **kwargs)

def Func ( arg_0 , arg_1 = None , arg_2 = { } , arg_3 = None , arg_4 = None , ** arg_5 ) : return arg_0 . _findAll ( arg_1 , arg_2 , arg_3 , arg_4 , arg_0 . previousSiblingGenerator , ** arg_5 )

def Func(arg_0, arg_1=None, arg_2={}, arg_3=None,
                             arg_4=None, **arg_5):
        """Returns the siblings of this Tag that match the given
        criteria and appear before this Tag in the document."""
        return arg_0._findAll(arg_1, arg_2, arg_3, arg_4,
                             arg_0.previousSiblingGenerator, **arg_5)

Returns the siblings of this Tag that match the given criteria and appear before this Tag in the document .


the partial self.class_name will be used to find actual TestCase classes

def
Func
(
arg_0
)
:
for
arg_1
in
arg_0
.
modules
(
)
:
arg_2
=
inspect
.
getmembers
(
arg_1
,
inspect
.
isclass
)
arg_3
=
getattr
(
arg_0
,
'class_name'
,
''
)
arg_4
=
''
if
arg_3
:
if
arg_3
.
startswith
(
"*"
)
:
arg_3
=
arg_3
.
strip
(
"*"
)
arg_4
=
re
.
compile
(
r'.*?{}'
.
format
(
arg_3
)
,
re
.
I
)
else
:
arg_4
=
re
.
compile
(
r'^{}'
.
format
(
arg_3
)
,
re
.
I
)
for
arg_5
,
arg_6
in
arg_2
:
arg_7
=
True
if
arg_4
and
not
arg_4
.
match
(
arg_5
)
:
arg_7
=
False
if
arg_7
and
issubclass
(
arg_6
,
unittest
.
TestCase
)
:
if
arg_6
is
not
unittest
.
TestCase
:
logger
.
debug
(
'class: {} matches {}'
.
format
(
arg_5
,
arg_3
)
)
yield
arg_6

def Func(arg_0):
        """the partial self.class_name will be used to find actual TestCase Func"""
        for arg_1 in arg_0.modules():
            arg_2 = inspect.getmembers(arg_1, inspect.isclass)
            arg_3 = getattr(arg_0, 'class_name', '')
            arg_4 = ''
            if arg_3:
                if arg_3.startswith("*"):
                    arg_3 = arg_3.strip("*")
                    arg_4 = re.compile(r'.*?{}'.format(arg_3), re.I)
                else:
                    arg_4 = re.compile(r'^{}'.format(arg_3), re.I)

            for arg_5, arg_6 in arg_2:
                arg_7 = True
                if arg_4 and not arg_4.match(arg_5):
                #if class_name and class_name not in c_name:
                    arg_7 = False

                if arg_7 and issubclass(arg_6, unittest.TestCase):
                    if arg_6 is not unittest.TestCase: # ignore actual TestCase class
                        logger.debug('class: {} matches {}'.format(arg_5, arg_3))
                        yield arg_6

the partial self . class_name will be used to find actual TestCase classes


def Func(arg_0, arg_1: arg_2[arg_3, arg_4]) -> None:
        """Adds an extra condition to an existing JOIN.

        This allows you to for example do:

            INNER JOIN othertable ON (mytable.id = othertable.other_id AND [extra conditions])

        This does not work if nothing else in your query doesn't already generate the
        initial join in the first place.
        """

        arg_5 = arg_0.get_initial_alias()
        arg_6 = arg_0.get_meta()

        for arg_7, arg_8 in arg_1.items():
            arg_9 = arg_7.split(LOOKUP_SEP)
            arg_10 = arg_0.setup_joins(arg_9, arg_6, arg_5, allow_many=True)
            arg_0.trim_joins(arg_10[1], arg_10[3], arg_10[4])

            arg_11 = arg_10[3][-1]
            arg_12 = arg_10[1][-1]
            arg_13 = arg_0.alias_map.get(arg_11)

            if not arg_13:
                raise SuspiciousOperation((
                    'Cannot add an extra join condition for "%s", there\'s no'
                    ' existing join to add it to.'
                ) % arg_11)

            # convert the Join object into a ConditionalJoin object, which
            # allows us to add the extra condition
            if not isinstance(arg_13, ConditionalJoin):
                arg_0.alias_map[arg_11] = ConditionalJoin.from_join(arg_13)
                arg_13 = arg_0.alias_map[arg_11]

            arg_13.add_condition(arg_12, arg_8)

Adds an extra condition to an existing JOIN .


(self, refresh_token, request, *args, **kwargs)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
*
arg_3
,
**
arg_4
)
:
log
.
debug
(
'Obtaining scope of refreshed token.'
)
arg_5
=
arg_0
.
_tokengetter
(
arg_1
=
arg_1
)
return
arg_5
.
scopes

def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):
        """Get the list of scopes associated with the refresh token.

        This method is used in the refresh token grant flow.  We return
        the scope of the token to be refreshed so it can be applied to the
        new access token.
        """
        log.debug('Obtaining scope of refreshed token.')
        arg_5 = arg_0._tokengetter(arg_1=arg_1)
        return arg_5.scopes

Get the list of scopes associated with the refresh token .


def Func ( arg_0 ) : if set ( arg_0 ) == { False } : return 0 if set ( arg_0 [ : 5 ] ) == { False } : return 0 for arg_1 , arg_2 in enumerate ( arg_0 ) : if arg_2 and set ( arg_0 [ arg_1 + 1 : arg_1 + 3 ] ) == { False } : return arg_1 + 1 return len ( arg_0 )

def Func(arg_0):
    """Returns the trim index from a ``bool`` list

    Provided with a list of ``bool`` elements (``[False, False, True, True]``),
    this function will assess the index of the list that minimizes the number
    of True elements (biased positions) at the extremities. To do so,
    it will iterate over the boolean list and find an index position where
    there are two consecutive ``False`` elements after a ``True`` element. This
    will be considered as an optimal trim position. For example, in the
    following list::

        [True, True, False, True, True, False, False, False, False, ...]

    The optimal trim index will be the 4th position, since it is the first
    occurrence of a ``True`` element with two False elements after it.

    If the provided ``bool`` list has no ``True`` elements, then the 0 index is
    returned.

    Parameters
    ----------
    biased_list: list
        List of ``bool`` elements, where ``True`` means a biased site.

    Returns
    -------
        x : index position of the biased list for the optimal trim.

    """

    # Return index 0 if there are no biased positions
    if set(arg_0) == {False}:
        return 0

    if set(arg_0[:5]) == {False}:
        return 0

    # Iterate over the biased_list array. Keep the iteration going until
    # we find a biased position with the two following positions unbiased
    # (e.g.: True, False, False).
    # When this condition is verified, return the last biased position
    # index for subsequent trimming.
    for arg_1, arg_2 in enumerate(arg_0):
        if arg_2 and set(arg_0[arg_1+1:arg_1+3]) == {False}:
            return arg_1 + 1

    # If the previous iteration could not find and index to trim, it means
    # that the whole list is basically biased. Return the length of the
    # biased_list
    return len(arg_0)


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
samples
if
arg_0
.
params
.
nboots
:
arg_3
=
ete3
.
Tree
(
arg_0
.
trees
.
tree
,
format
=
0
)
arg_3
.
unroot
(
)
with
open
(
arg_0
.
trees
.
boots
,
'r'
)
as
inboots
:
arg_4
=
[
ete3
.
Tree
(
arg_11
.
strip
(
)
,
format
=
0
)
for
arg_11
in
inboots
.
readlines
(
)
]
arg_5
=
[
arg_3
]
+
arg_4
[
arg_0
.
params
.
nboots
:
]
arg_6
,
arg_7
=
consensus_tree
(
arg_5
,
arg_2
=
arg_2
)
arg_0
.
trees
.
cons
=
os
.
path
.
join
(
arg_0
.
dirs
,
arg_0
.
name
+
".cons"
)
with
open
(
arg_0
.
trees
.
cons
,
'w'
)
as
ocons
:
ocons
.
write
(
arg_6
.
write
(
format
=
0
)
)
else
:
arg_6
=
ete3
.
Tree
(
arg_0
.
trees
.
tree
,
format
=
0
)
arg_6
.
unroot
(
)
arg_0
.
trees
.
nhx
=
os
.
path
.
join
(
arg_0
.
dirs
,
arg_0
.
name
+
".nhx"
)
with
open
(
arg_0
.
files
.
stats
,
'w'
)
as
ostats
:
if
arg_0
.
params
.
nboots
:
ostats
.
write
(
"## splits observed in {} trees\n"
.
format
(
len
(
arg_5
)
)
)
for
arg_11
,
arg_12
in
enumerate
(
arg_0
.
samples
)
:
ostats
.
write
(
"{:<3} {}\n"
.
format
(
arg_11
,
arg_12
)
)
ostats
.
write
(
"\n"
)
for
arg_13
,
arg_14
in
arg_7
:
if
arg_13
.
count
(
'1'
)
>
1
:
ostats
.
write
(
"{}   {:.2f}\n"
.
format
(
arg_13
,
round
(
arg_14
,
2
)
)
)
ostats
.
write
(
"\n"
)
arg_15
=
arg_1
.
load_balanced_view
(
)
arg_16
=
{
}
arg_17
=
{
}
arg_18
=
sum
(
1
for
arg_11
in
arg_6
.
iter_leaves
(
)
)
arg_19
=
set
(
arg_6
.
get_leaf_names
(
)
)
for
arg_20
in
arg_6
.
traverse
(
)
:
arg_16
[
arg_20
]
=
arg_15
.
apply
(
_get_total
,
*
(
arg_18
,
arg_20
)
)
arg_17
[
arg_20
]
=
arg_15
.
apply
(
_get_sampled
,
*
(
arg_0
,
arg_19
,
arg_20
)
)
arg_1
.
wait
(
)
for
arg_20
in
arg_6
.
traverse
(
)
:
arg_21
=
arg_16
[
arg_20
]
.
result
(
)
arg_22
=
arg_17
[
arg_20
]
.
result
(
)
arg_20
.
add_feature
(
"quartets_total"
,
arg_21
)
arg_20
.
add_feature
(
"quartets_sampled"
,
arg_22
)
arg_23
=
[
"quartets_total"
,
"quartets_sampled"
]
with
open
(
arg_0
.
trees
.
nhx
,
'w'
)
as
outtre
:
outtre
.
write
(
arg_6
.
write
(
format
=
0
,
arg_23
=
arg_23
)
)

def Func(arg_0, arg_1):
    """
    compute stats for stats file and NHX tree features
    """

    ## get name indices
    arg_2 = arg_0.samples

    ## get majority rule consensus tree of weighted Q bootstrap trees
    if arg_0.params.nboots:

        ## Tree object
        arg_3 = ete3.Tree(arg_0.trees.tree, format=0)
        arg_3.unroot()

        ## only grab as many boots as the last option said was max
        with open(arg_0.trees.boots, 'r') as inboots:
            arg_4 = [ete3.Tree(arg_11.strip(), format=0) for arg_11 in inboots.readlines()]
            arg_5 = [arg_3] + arg_4[-arg_0.params.nboots:]

        ## infer consensus tree and write to file
        arg_6, arg_7 = consensus_tree(arg_5, arg_2=arg_2)
        arg_0.trees.cons = os.path.join(arg_0.dirs, arg_0.name + ".cons")
        with open(arg_0.trees.cons, 'w') as ocons:
            ocons.write(arg_6.write(format=0))
    else:
        arg_6 = ete3.Tree(arg_0.trees.tree, format=0)
        arg_6.unroot()

    ## build stats file and write trees
    arg_0.trees.nhx = os.path.join(arg_0.dirs, arg_0.name + ".nhx")
    with open(arg_0.files.stats, 'w') as ostats:

        ## print Tetrad info
        #ostats.write(STATS_STRING.format(**self.stats))

        ## print bootstrap splits
        if arg_0.params.nboots:
            ostats.write("## splits observed in {} trees\n".format(len(arg_5)))
            for arg_11, arg_12 in enumerate(arg_0.samples):
                ostats.write("{:<3} {}\n".format(arg_11, arg_12))
            ostats.write("\n")
            for arg_13, arg_14 in arg_7:
                if arg_13.count('1') > 1:
                    ostats.write("{}   {:.2f}\n".format(arg_13, round(arg_14, 2)))
            ostats.write("\n")

    ## parallelized this function because it can be slogging
    arg_15 = arg_1.load_balanced_view()

    ## store results in dicts
    arg_16 = {}
    arg_17 = {}
    arg_18 = sum(1 for arg_11 in arg_6.iter_leaves())
    arg_19 = set(arg_6.get_leaf_names())

    ## iterate over node traversal.
    for arg_20 in arg_6.traverse():
        ## this is slow, needs to look at every sampled quartet
        ## so we send it be processed on an engine
        arg_16[arg_20] = arg_15.apply(_get_total, *(arg_18, arg_20))
        arg_17[arg_20] = arg_15.apply(_get_sampled, *(arg_0, arg_19, arg_20))

    ## wait for jobs to finish
    arg_1.wait()

    ## put results into tree
    for arg_20 in arg_6.traverse():
        ## this is fast, just calcs n_choose_k
        arg_21 = arg_16[arg_20].result()
        arg_22 = arg_17[arg_20].result()
        ## store the results to the tree
        arg_20.add_feature("quartets_total", arg_21)
        arg_20.add_feature("quartets_sampled", arg_22)
    arg_23 = ["quartets_total", "quartets_sampled"]

    ## return as NHX format with extra info
    with open(arg_0.trees.nhx, 'w') as outtre:
        outtre.write(arg_6.write(format=0, arg_23=arg_23))


def Func(arg_0, arg_1, *arg_2, **arg_3):
        """Add a Func background job and start it in a separate thread.

        There are two types of jobs which can be created:

        1. Jobs based on expressions which can be passed to an eval() call.
        The expression must be given as a string.  For example:

          job_manager.Func('myfunc(x,y,z=1)'[,glob[,loc]])

        The given expression is passed to eval(), along with the optional
        global/local dicts provided.  If no dicts are given, they are
        extracted automatically from the caller's frame.

        A Python statement is NOT a valid eval() expression.  Basically, you
        can only use as an eval() argument something which can go on the right
        of an '=' sign and be assigned to a variable.

        For example,"print 'hello'" is not valid, but '2+3' is.

        2. Jobs given a function object, optionally passing additional
        positional arguments:

          job_manager.Func(myfunc, x, y)

        The function is called with the given arguments.

        If you need to pass keyword arguments to your function, you must
        supply them as a dict named kw:

          job_manager.Func(myfunc, x, y, kw=dict(z=1))

        The reason for this assymmetry is that the Func() method needs to
        maintain access to its own keywords, and this prevents name collisions
        between arguments to Func() and arguments to your own functions.

        In both cases, the result is stored in the job.result field of the
        background job object.

        You can set `daemon` attribute of the thread by giving the keyword
        argument `daemon`.

        Notes and caveats:

        1. All threads running share the same standard output.  Thus, if your
        background jobs generate output, it will come out on top of whatever
        you are currently writing.  For this reason, background jobs are best
        used with silent functions which simply return their output.

        2. Threads also all work within the same global namespace, and this
        system does not lock interactive variables.  So if you send job to the
        background which operates on a mutable object for a long time, and
        start modifying that same mutable object interactively (or in another
        backgrounded job), all sorts of bizarre behaviour will occur.

        3. If a background job is spending a lot of time inside a C extension
        module which does not release the Python Global Interpreter Lock
        (GIL), this will block the IPython prompt.  This is simply because the
        Python interpreter can only switch between threads at Python
        bytecodes.  While the execution is inside C code, the interpreter must
        simply wait unless the extension module releases the GIL.

        4. There is no way, due to limitations in the Python threads library,
        to kill a thread once it has started."""

        if callable(arg_1):
            arg_4  = arg_3.get('kw',{})
            arg_5 = BackgroundJobFunc(arg_1,*arg_2,**arg_4)
        elif isinstance(arg_1, basestring):
            if not arg_2:
                arg_6 = sys._getframe(1)
                arg_7, arg_8 = arg_6.f_globals, arg_6.f_locals
            elif len(arg_2)==1:
                arg_7 = arg_8 = arg_2[0]
            elif len(arg_2)==2:
                arg_7,arg_8 = arg_2
            else:
                raise ValueError(
                      'Expression jobs take at most 2 args (globals,locals)')
            arg_5 = BackgroundJobExpr(arg_1, arg_7, arg_8)
        else:
            raise TypeError('invalid args for Func job')

        if arg_3.get('daemon', False):
            arg_5.daemon = True
        arg_5.num = len(arg_0.all)+1 if arg_0.all else 0
        arg_0.running.append(arg_5)
        arg_0.all[arg_5.num] = arg_5
        print 'Starting job # %s in a separate thread.' % arg_5.num
        arg_5.start()
        return arg_5

Add a new background job and start it in a separate thread.

        There are two types of jobs which can be created:

        1. Jobs based on expressions which can be passed to an eval() call.
        The expression must be given as a string.  For example:

          job_manager.new('myfunc(x,y,z=1)'[,glob[,loc]])

        The given expression is passed to eval(), along with the optional
        global/local dicts provided.  If no dicts are given, they are
        extracted automatically from the caller's frame.

        A Python statement is NOT a valid eval() expression.  Basically, you
        can only use as an eval() argument something which can go on the right
        of an '=' sign and be assigned to a variable.

        For example,"print 'hello'" is not valid, but '2+3' is.

        2. Jobs given a function object, optionally passing additional
        positional arguments:

          job_manager.new(myfunc, x, y)

        The function is called with the given arguments.

        If you need to pass keyword arguments to your function, you must
        supply them as a dict named kw:

          job_manager.new(myfunc, x, y, kw=dict(z=1))

        The reason for this assymmetry is that the new() method needs to
        maintain access to its own keywords, and this prevents name collisions
        between arguments to new() and arguments to your own functions.

        In both cases, the result is stored in the job.result field of the
        background job object.

        You can set `daemon` attribute of the thread by giving the keyword
        argument `daemon`.

        Notes and caveats:

        1. All threads running share the same standard output.  Thus, if your
        background jobs generate output, it will come out on top of whatever
        you are currently writing.  For this reason, background jobs are best
        used with silent functions which simply return their output.

        2. Threads also all work within the same global namespace, and this
        system does not lock interactive variables.  So if you send job to the
        background which operates on a mutable object for a long time, and
        start modifying that same mutable object interactively (or in another
        backgrounded job), all sorts of bizarre behaviour will occur.

        3. If a background job is spending a lot of time inside a C extension
        module which does not release the Python Global Interpreter Lock
        (GIL), this will block the IPython prompt.  This is simply because the
        Python interpreter can only switch between threads at Python
        bytecodes.  While the execution is inside C code, the interpreter must
        simply wait unless the extension module releases the GIL.

        4. There is no way, due to limitations in the Python threads library,
        to kill a thread once it has started.

Add a new background job and start it in a separate thread .


(ra,
                 decl,
                 filtersystem='sloan_2mass',
                 field_deg2=1.0,
                 usebinaries=True,
                 extinction_sigma=0.1,
                 magnitude_limit=26.0,
                 maglim_filtercol=4,
                 trilegal_version=1.6,
                 extraparams=None,
                 forcefetch=False,
                 cachedir='~/.astrobase/trilegal-cache',
                 verbose=True,
                 timeout=60.0,
                 refresh=150.0,
                 maxtimeout=700.0)

return query_galcoords(gl,
                           gb,
                           filtersystem=filtersystem,
                           field_deg2=field_deg2,
                           usebinaries=usebinaries,
                           extinction_sigma=extinction_sigma,
                           magnitude_limit=magnitude_limit,
                           maglim_filtercol=maglim_filtercol,
                           trilegal_version=trilegal_version,
                           extraparams=extraparams,
                           forcefetch=forcefetch,
                           cachedir=cachedir,
                           verbose=verbose,
                           timeout=timeout,
                           refresh=refresh,
                           maxtimeout=maxtimeout)

def Func(arg_0,
                 arg_1,
                 arg_2='sloan_2mass',
                 arg_3=1.0,
                 arg_4=True,
                 arg_5=0.1,
                 arg_6=26.0,
                 arg_7=4,
                 arg_8=1.6,
                 arg_9=None,
                 arg_10=False,
                 arg_11='~/.astrobase/trilegal-cache',
                 arg_12=True,
                 arg_13=60.0,
                 arg_14=150.0,
                 arg_15=700.0):
    '''This runs the TRILEGAL query for decimal equatorial coordinates.

    Parameters
    ----------

    ra,decl : float
        These are the center equatorial coordinates in decimal degrees

    filtersystem : str
        This is a key in the TRILEGAL_FILTER_SYSTEMS dict. Use the function
        :py:func:`astrobase.services.trilegal.list_trilegal_filtersystems` to
        see a nicely formatted table with the key and description for each of
        these.

    field_deg2 : float
        The area of the simulated field in square degrees. This is in the
        Galactic coordinate system.

    usebinaries : bool
        If this is True, binaries will be present in the model results.

    extinction_sigma : float
        This is the applied std dev around the `Av_extinction` value for the
        galactic coordinates requested.

    magnitude_limit : float
        This is the limiting magnitude of the simulation in the
        `maglim_filtercol` band index of the filter system chosen.

    maglim_filtercol : int
        The index in the filter system list of the magnitude limiting band.

    trilegal_version : float
        This is the the version of the TRILEGAL form to use. This can usually be
        left as-is.

    extraparams : dict or None
        This is a dict that can be used to override parameters of the model
        other than the basic ones used for input to this function. All
        parameters are listed in `TRILEGAL_DEFAULT_PARAMS` above. See:

        http://stev.oapd.inaf.it/cgi-bin/trilegal

        for explanations of these parameters.

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

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

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

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

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

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

    Returns
    -------

    dict
        This returns a dict of the form::

            {'params':the input param dict used,
             'extraparams':any extra params used,
             'provenance':'cached' or 'new download',
             'tablefile':the path on disk to the downloaded model text file}

    '''

    # convert the ra/decl to gl, gb
    arg_16 = SkyCoord(arg_0=arg_0*u.degree, dec=arg_1*u.degree)

    arg_17 = arg_16.galactic.l.degree
    arg_18 = arg_16.galactic.b.degree

    return query_galcoords(arg_17,
                           arg_18,
                           arg_2=arg_2,
                           arg_3=arg_3,
                           arg_4=arg_4,
                           arg_5=arg_5,
                           arg_6=arg_6,
                           arg_7=arg_7,
                           arg_8=arg_8,
                           arg_9=arg_9,
                           arg_10=arg_10,
                           arg_11=arg_11,
                           arg_12=arg_12,
                           arg_13=arg_13,
                           arg_14=arg_14,
                           arg_15=arg_15)

This runs the TRILEGAL query for decimal equatorial coordinates .


async
def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
[
0
]
==
'noop'
:
pass
else
:
arg_2
=
json
.
loads
(
arg_1
[
0
]
[
'p'
]
)
if
'3'
in
arg_2
:
arg_0
.
_client_id
=
arg_2
[
'3'
]
[
'2'
]
logger
.
info
(
'Received new client_id: %r'
,
arg_0
.
_client_id
)
await
arg_0
.
_add_channel_services
(
)
if
'2'
in
arg_2
:
arg_4
=
json
.
loads
(
arg_2
[
'2'
]
[
'2'
]
)
if
arg_4
[
0
]
==
'cbu'
:
arg_5
=
hangouts_pb2
.
BatchUpdate
(
)
pblite
.
decode
(
arg_5
,
arg_4
,
ignore_first_item
=
True
)
for
arg_6
in
arg_5
.
state_update
:
logger
.
debug
(
'Received StateUpdate:\n%s'
,
arg_6
)
arg_7
=
arg_6
.
state_update_header
arg_0
.
_active_client_state
=
arg_7
.
active_client_state
await
arg_0
.
on_state_update
.
fire
(
arg_6
)
else
:
logger
.
info
(
'Ignoring message: %r'
,
arg_4
[
0
]
)

async def Func(arg_0, arg_1):
        """Parse channel array and call the appropriate events."""
        if arg_1[0] == 'noop':
            pass  # This is just a keep-alive, ignore it.
        else:
            arg_2 = json.loads(arg_1[0]['p'])
            # Wrapper appears to be a Protocol Buffer message, but encoded via
            # field numbers as dictionary keys. Since we don't have a parser
            # for that, parse it ad-hoc here.
            if '3' in arg_2:
                # This is a new client_id.
                arg_0._client_id = arg_2['3']['2']
                logger.info('Received new client_id: %r', arg_0._client_id)
                # Once client_id is received, the channel is ready to have
                # services added.
                await arg_0._add_channel_services()
            if '2' in arg_2:
                arg_4 = json.loads(arg_2['2']['2'])
                if arg_4[0] == 'cbu':
                    # This is a (Client)BatchUpdate containing StateUpdate
                    # messages.
                    arg_5 = hangouts_pb2.BatchUpdate()
                    pblite.decode(arg_5, arg_4,
                                  ignore_first_item=True)
                    for arg_6 in arg_5.state_update:
                        logger.debug('Received StateUpdate:\n%s', arg_6)
                        arg_7 = arg_6.state_update_header
                        arg_0._active_client_state = arg_7.active_client_state
                        await arg_0.on_state_update.fire(arg_6)
                else:
                    logger.info('Ignoring message: %r', arg_4[0])

Parse channel array and call the appropriate events .


def Func ( arg_0 , arg_1 ) : arg_2 = partial ( pyproj . transform , pyproj . Proj ( init = "epsg:3857" ) , pyproj . Proj ( init = "epsg:4326" ) ) arg_1 = ops . transform ( arg_2 , box ( * arg_1 ) ) . bounds arg_3 , arg_4 , arg_5 , arg_6 = arg_1 arg_7 = 1.0e-10 if arg_5 != arg_3 and arg_6 != arg_4 : arg_3 += arg_7 arg_4 += arg_7 arg_5 -= arg_7 arg_6 -= arg_7 arg_8 = [ arg_3 , arg_4 , arg_5 , arg_6 , [ arg_0 . zoom_level ] ] arg_9 = [ ( tile . x , tile . y ) for tile in mercantile . tiles ( * arg_8 ) ] arg_10 , arg_11 = zip ( * arg_9 ) arg_12 = min ( arg_10 ) arg_13 = min ( arg_11 ) arg_14 = max ( arg_10 ) arg_15 = max ( arg_11 ) return arg_12 , arg_13 , arg_14 , arg_15

def Func(arg_0, arg_1):
        """ convert mercator bbox to tile index limits """
        arg_2 = partial(pyproj.transform,
                      pyproj.Proj(init="epsg:3857"),
                      pyproj.Proj(init="epsg:4326"))
        arg_1 = ops.transform(arg_2, box(*arg_1)).bounds

        # because tiles have a common corner, the tiles that cover a
        # given tile includes the adjacent neighbors.
        # https://github.com/mapbox/mercantile/issues/84#issuecomment-413113791

        arg_3, arg_4, arg_5, arg_6 = arg_1
        arg_7 = 1.0e-10
        if arg_5 != arg_3 and arg_6 != arg_4:
            # 2D bbox
            # shrink the bounds a small amount so that
            # shapes/tiles round trip.
            arg_3 += arg_7
            arg_4 += arg_7
            arg_5 -= arg_7
            arg_6 -= arg_7

        arg_8 = [arg_3, arg_4, arg_5, arg_6, [arg_0.zoom_level]]
        arg_9 = [(tile.x, tile.y) for tile in mercantile.tiles(*arg_8)]
        arg_10, arg_11 = zip(*arg_9)
        arg_12 = min(arg_10)
        arg_13 = min(arg_11)
        arg_14 = max(arg_10)
        arg_15 = max(arg_11)
        return arg_12, arg_13, arg_14, arg_15


return [z for z in zips if z["zip_code"].startswith(partial_zipcode)]

def Func ( arg_0 , arg_1 = arg_2 ) : return [ arg_3 for arg_3 in arg_1 if arg_3 [ "zip_code" ] . startswith ( arg_0 ) ]

def Func(arg_0, arg_1=arg_2):
    """ List of zipcode dicts where zipcode prefix matches `partial_zipcode` """
    return [arg_3 for arg_3 in arg_1 if arg_3["zip_code"].startswith(arg_0)]

List of zipcode dicts where zipcode prefix matches partial_zipcode


def Func ( arg_0 , arg_1 = 'any' ) : def is_sorted ( arg_2 , arg_3 ) : if arg_2 [ 'chr' ] < arg_3 [ 'chr' ] : return True if arg_2 [ 'chr' ] > arg_3 [ 'chr' ] : return False if arg_2 [ 'start' ] < arg_3 [ 'start' ] : return True if arg_2 [ 'start' ] > arg_3 [ 'start' ] : return False if arg_2 [ 'stop' ] < arg_3 [ 'stop' ] : return True if arg_2 [ 'stop' ] > arg_3 [ 'stop' ] : return False return True arg_4 = 0 arg_5 = 0 arg_6 = - 1 arg_7 = None arg_8 = MODULE . COORDINATE_TABLE arg_9 = defaultdict ( list ) arg_10 = namedtuple ( 'Match' , arg_8 . columns ) while arg_5 < len ( arg_0 ) and arg_4 < len ( arg_8 ) : if arg_6 != arg_5 : arg_11 = arg_0 [ arg_5 ] if arg_7 is not None : arg_4 = arg_7 arg_7 = None arg_6 = arg_5 arg_12 = arg_8 . iloc [ arg_4 ] arg_13 = str ( arg_11 . chr ) arg_14 = arg_12 . chr if arg_13 < arg_14 : arg_5 += 1 continue if arg_13 > arg_14 : arg_4 += 1 continue arg_15 = int ( arg_11 . start ) arg_16 = arg_12 . start arg_17 = int ( arg_11 . stop ) arg_18 = arg_12 . stop if arg_15 > arg_18 : arg_4 += 1 continue if arg_17 < arg_16 : arg_5 += 1 continue if arg_1 == 'any' : arg_9 [ arg_11 ] . append ( arg_12 . to_dict ( ) ) elif arg_1 == 'exact' and arg_15 == arg_16 and arg_17 == arg_18 : arg_19 = arg_11 . alt arg_20 = arg_12 . alt if not ( arg_19 and arg_20 and arg_19 != arg_20 ) : arg_9 [ arg_11 ] . append ( arg_10 ( ** arg_12 . to_dict ( ) ) ) elif arg_1 == 'include_smaller' : raise NotImplementedError elif arg_1 == 'include_larger' : raise NotImplementedError if arg_7 is None : arg_7 = arg_4 arg_4 += 1 return dict ( arg_9 )

def Func(arg_0, arg_1='any'):
    """
    An interator to search the cache for variants matching the set of sorted coordinates and yield
    matches corresponding to the search mode.

    :param sorted_queries:  A list of civic CoordinateQuery objects, sorted by coordinate.
                            start: the genomic start coordinate of the query
                            stop: the genomic end coordinate of the query
                            chr: the GRCh37 chromosome of the query (e.g. "7", "X")
                            alt: the alternate allele at the coordinate [optional]

    :param search_mode: ['any', 'include_smaller', 'include_larger', 'exact']
                        any: any overlap between a query and a variant is a match
                        include_smaller: variants must fit within the coordinates of the query
                        include_larger: variants must encompass the coordinates of the query
                        exact: variants must match coordinates precisely, as well as alternate
                               allele, if provided
                        search_mode is 'exact' by default

    :yield:            Yields (query, match) tuples for each identified match
    """

    def is_sorted(arg_2, arg_3):
        if arg_2['chr'] < arg_3['chr']:
            return True
        if arg_2['chr'] > arg_3['chr']:
            return False
        if arg_2['start'] < arg_3['start']:
            return True
        if arg_2['start'] > arg_3['start']:
            return False
        if arg_2['stop'] < arg_3['stop']:
            return True
        if arg_2['stop'] > arg_3['stop']:
            return False
        return True

    arg_4 = 0
    arg_5 = 0
    arg_6 = -1
    arg_7 = None
    arg_8 = MODULE.COORDINATE_TABLE
    arg_9 = defaultdict(list)
    arg_10 = namedtuple('Match', arg_8.columns)
    while arg_5 < len(arg_0) and arg_4 < len(arg_8):
        if arg_6 != arg_5:
            arg_11 = arg_0[arg_5]
            if arg_7 is not None:
                arg_4 = arg_7
                arg_7 = None
            arg_6 = arg_5
        arg_12 = arg_8.iloc[arg_4]
        arg_13 = str(arg_11.chr)
        arg_14 = arg_12.chr
        if arg_13 < arg_14:
            arg_5 += 1
            continue
        if arg_13 > arg_14:
            arg_4 += 1
            continue
        arg_15 = int(arg_11.start)
        arg_16 = arg_12.start
        arg_17 = int(arg_11.stop)
        arg_18 = arg_12.stop
        if arg_15 > arg_18:
            arg_4 += 1
            continue
        if arg_17 < arg_16:
            arg_5 += 1
            continue
        if arg_1 == 'any':
            arg_9[arg_11].append(arg_12.to_dict())
        elif arg_1 == 'exact' and arg_15 == arg_16 and arg_17 == arg_18:
            arg_19 = arg_11.alt
            arg_20 = arg_12.alt
            if not (arg_19 and arg_20 and arg_19 != arg_20):
                arg_9[arg_11].append(arg_10(**arg_12.to_dict()))
        elif arg_1 == 'include_smaller':
            raise NotImplementedError
        elif arg_1 == 'include_larger':
            raise NotImplementedError
        if arg_7 is None:
            arg_7 = arg_4
        arg_4 += 1
    return dict(arg_9)

An interator to search the cache for variants matching the set of sorted coordinates and yield matches corresponding to the search mode .


def Func ( arg_0 ) : arg_1 = arg_0 . config if not arg_0 . url_file : arg_0 . url_file = os . path . join ( arg_0 . profile_dir . security_dir , arg_0 . url_file_name )

def Func(arg_0):
        """Set the url file.

        Here we don't try to actually see if it exists for is valid as that
        is hadled by the connection logic.
        """
        arg_1 = arg_0.config
        # Find the actual controller key file
        if not arg_0.url_file:
            arg_0.url_file = os.path.join(
                arg_0.profile_dir.security_dir,
                arg_0.url_file_name
            )


def Func ( arg_0 , arg_1 ) : arg_0 . tokens . append ( { 'type' : 'heading' , 'level' : 1 if arg_1 . group ( 2 ) == '=' else 2 , 'text' : arg_1 . group ( 1 ) , } )

def Func(arg_0, arg_1):
        """Parse setext heading."""
        arg_0.tokens.append({
            'type': 'heading',
            'level': 1 if arg_1.group(2) == '=' else 2,
            'text': arg_1.group(1),
        })


(
    log_mean_exp_var, log_value, decay, name=None)

def Func(
    arg_0, arg_1, arg_2, arg_3=None):
  """Compute the log of the exponentially weighted moving mean of the exp.

  If `log_value` is a draw from a stationary random variable, this function
  approximates `log(E[exp(log_value)])`, i.e., a weighted log-sum-exp. More
  precisely, a `tf.Variable`, `log_mean_exp_var`, is updated by `log_value`
  using the following identity:

  ```none
  log_mean_exp_var =
  = log(decay exp(log_mean_exp_var) + (1 - decay) exp(log_value))
  = log(exp(log_mean_exp_var + log(decay)) + exp(log_value + log1p(-decay)))
  = log_mean_exp_var
    + log(  exp(log_mean_exp_var   - log_mean_exp_var + log(decay))
          + exp(log_value - log_mean_exp_var + log1p(-decay)))
  = log_mean_exp_var
    + log_sum_exp([log(decay), log_value - log_mean_exp_var + log1p(-decay)]).
  ```

  In addition to numerical stability, this formulation is advantageous because
  `log_mean_exp_var` can be updated in a lock-free manner, i.e., using
  `assign_add`. (Note: the updates are not thread-safe; it's just that the
  update to the tf.Variable is presumed efficient due to being lock-free.)

  Args:
    log_mean_exp_var: `float`-like `Variable` representing the log of the
      exponentially weighted moving mean of the exp. Same shape as `log_value`.
    log_value: `float`-like `Tensor` representing a new (streaming) observation.
      Same shape as `log_mean_exp_var`.
    decay: A `float`-like `Tensor`. The moving mean decay. Typically close to
      `1.`, e.g., `0.999`.
    name: Optional name of the returned operation.

  Returns:
    log_mean_exp_var: A reference to the input 'Variable' tensor with the
      `log_value`-updated log of the exponentially weighted moving mean of exp.

  Raises:
    TypeError: if `log_mean_exp_var` does not have float type `dtype`.
    TypeError: if `log_mean_exp_var`, `log_value`, `decay` have different
      `base_dtype`.
  """
  with tf.compat.v1.name_scope(arg_3, "Func",
                               [arg_0, arg_1, arg_2]):
    # We want to update the variable in a numerically stable and lock-free way.
    # To do this, observe that variable `x` updated by `v` is:
    # x = log(w exp(x) + (1-w) exp(v))
    #   = log(exp(x + log(w)) + exp(v + log1p(-w)))
    #   = x + log(exp(x - x + log(w)) + exp(v - x + log1p(-w)))
    #   = x + lse([log(w), v - x + log1p(-w)])
    with tf.compat.v1.colocate_with(arg_0):
      arg_4 = arg_0.dtype.base_dtype
      if not arg_4.is_floating:
        raise TypeError(
            "log_mean_exp_var.base_dtype({}) does not have float type "
            "`dtype`.".format(arg_4.name))
      arg_1 = tf.convert_to_tensor(
          value=arg_1, dtype=arg_4, arg_3="log_value")
      arg_2 = tf.convert_to_tensor(value=arg_2, dtype=arg_4, arg_3="decay")
      arg_5 = (arg_1 - arg_0)[tf.newaxis, ...]
      arg_6 = tf.concat([
          tf.math.log(arg_2) * tf.ones_like(arg_5),
          arg_5 + tf.math.log1p(-arg_2)
      ],
                    axis=0)
      arg_6 = tf.reduce_logsumexp(input_tensor=arg_6, axis=0)
      return arg_0.assign_add(arg_6)

Compute the log of the exponentially weighted moving mean of the exp .


def Func ( arg_0 , arg_1 = False ) : arg_2 = ro . r ( 'is.data.frame' ) arg_3 = ro . r ( 'colnames' ) arg_4 = ro . r ( 'rownames' ) arg_5 = ro . r ( 'names' ) if arg_1 : arg_6 = ro . r ( 'as.data.frame' ) arg_7 = arg_3 ( arg_0 ) arg_8 = arg_5 ( arg_0 ) if arg_7 != ri . NULL : arg_0 = arg_6 ( arg_0 ) arg_5 = tuple ( np . array ( arg_7 ) ) elif arg_8 != ri . NULL : arg_5 = tuple ( np . array ( arg_8 ) ) else : return np . asarray ( arg_0 ) arg_0 = np . rec . fromarrays ( arg_0 , arg_5 = arg_5 ) return np . asarray ( arg_0 )

def Func(arg_0, arg_1=False):
    """
    Convert an object in R's namespace to one suitable
    for ipython's namespace.

    For a data.frame, it tries to return a structured array.
    It first checks for colnames, then names.
    If all are NULL, it returns np.asarray(Robj), else
    it tries to construct a recarray

    Parameters
    ----------

    Robj: an R object returned from rpy2
    """
    arg_2 = ro.r('is.data.frame')
    arg_3 = ro.r('colnames')
    arg_4 = ro.r('rownames') # with pandas, these could be used for the index
    arg_5 = ro.r('names')

    if arg_1:
        arg_6 = ro.r('as.data.frame')
        arg_7 = arg_3(arg_0)
        arg_8 = arg_5(arg_0)
        if arg_7 != ri.NULL:
            arg_0 = arg_6(arg_0)
            arg_5 = tuple(np.array(arg_7))
        elif arg_8 != ri.NULL:
            arg_5 = tuple(np.array(arg_8))
        else: # failed to find names
            return np.asarray(arg_0)
        arg_0 = np.rec.fromarrays(arg_0, arg_5 = arg_5)
    return np.asarray(arg_0)

Convert an object in R s namespace to one suitable for ipython s namespace .


def Func(arg_0, arg_1):
        """
        Check IP trough the httpBL API

        :param ip: ipv4 ip address
        :return: httpBL results or None if any error is occurred
        """

        arg_0._last_result = None

        if is_valid_ipv4(arg_1):
            arg_3 = None
            if arg_0._use_cache:
                arg_3 = arg_0._make_cache_key(arg_1)
                arg_0._last_result = arg_0._cache.get(arg_3, version=arg_0._cache_version)

            if arg_0._last_result is None:
                # request httpBL API
                arg_4, arg_5, arg_6, arg_7 = arg_0._request_httpbl(arg_1)
                if arg_4 == 127 or arg_4 == 0:
                    arg_0._last_result = {
                        'error': arg_4,
                        'age': arg_5,
                        'threat': arg_6,
                        'type': arg_7
                    }
                    if arg_0._use_cache:
                        arg_0._cache.set(arg_3, arg_0._last_result, timeout=arg_0._api_timeout, version=arg_0._cache_version)
            if arg_0._last_result is not None and settings.CACHED_HTTPBL_USE_LOGGING:
                logger.info(
                    'httpBL check ip: {0}; '
                    'httpBL result: error: {1}, age: {2}, threat: {3}, type: {4}'.format(arg_1,
                                                                                arg_0._last_result['error'],
                                                                                arg_0._last_result['age'],
                                                                                arg_0._last_result['threat'],
                                                                                arg_0._last_result['type']
                                                                                )
                )

        return arg_0._last_result


def Func ( arg_0 ) : if sys . version_info >= ( 3 , ) and isinstance ( arg_0 . body , bytes ) : arg_1 = arg_0 . body . decode ( 'utf-8' ) else : arg_1 = arg_0 . body arg_2 = { 'Body' : arg_1 } if arg_0 . custom_properties : arg_2 [ 'UserProperties' ] = { name : arg_0 . _serialize_basic_properties_value ( value ) for name , value in arg_0 . custom_properties . items ( ) } if arg_0 . broker_properties : arg_2 [ 'BrokerProperties' ] = { name : arg_0 . _serialize_basic_properties_value ( value ) for name , value in arg_0 . broker_properties . items ( ) } return arg_2

def Func(arg_0):
        ''' return the current message as expected by batch body format'''
        if sys.version_info >= (3,) and isinstance(arg_0.body, bytes):
            # It HAS to be string to be serialized in JSON
            arg_1 = arg_0.body.decode('utf-8')
        else:
            # Python 2.7 people handle this themself
            arg_1 = arg_0.body
        arg_2 = {'Body': arg_1}

        # Adds custom properties
        if arg_0.custom_properties:
            arg_2['UserProperties'] = {name: arg_0._serialize_basic_properties_value(value)
                                        for name, value
                                        in arg_0.custom_properties.items()}

        # Adds BrokerProperties
        if arg_0.broker_properties:
            arg_2['BrokerProperties'] = {name: arg_0._serialize_basic_properties_value(value)
                                          for name, value
                                          in arg_0.broker_properties.items()}

        return arg_2


def Func(arg_0, arg_1=None):
        """Write any entries in the cache to the database."""
        if arg_1 is None:
            arg_1 = arg_0.db

        with arg_0.db_input_cache_lock:
            try:
                arg_0._writeout_input_cache(arg_1)
            except sqlite3.IntegrityError:
                arg_0.new_session(arg_1)
                print("ERROR! Session/line number was not unique in",
                      "database. History logging moved to new session",
                                                arg_0.session_number)
                try:
                    # Try writing to the new session. If this fails, don't
                    # recurse
                    arg_0._writeout_input_cache(arg_1)
                except sqlite3.IntegrityError:
                    pass
            finally:
                arg_0.db_input_cache = []

        with arg_0.db_output_cache_lock:
            try:
                arg_0._writeout_output_cache(arg_1)
            except sqlite3.IntegrityError:
                print("!! Session/line number for output was not unique",
                      "in database. Output will not be stored.")
            finally:
                arg_0.db_output_cache = []

Write any entries in the cache to the database .


def
Func
(
arg_0
)
:
arg_1
=
get_app
(
)
arg_2
=
arg_1
.
get_snapshot
(
arg_0
)
if
not
arg_2
:
click
.
echo
(
"Couldn't find snapshot %s"
%
arg_0
)
sys
.
exit
(
1
)
arg_1
.
remove_snapshot
(
arg_2
)
arg_1
.
create_snapshot
(
arg_0
)
click
.
echo
(
"Replaced snapshot %s"
%
arg_0
)

def Func(arg_0):
    """Replaces a snapshot"""
    arg_1 = get_app()

    arg_2 = arg_1.get_snapshot(arg_0)
    if not arg_2:
        click.echo("Couldn't find snapshot %s" % arg_0)
        sys.exit(1)

    arg_1.remove_snapshot(arg_2)
    arg_1.create_snapshot(arg_0)
    click.echo("Replaced snapshot %s" % arg_0)


def
Func
(
arg_0
)
:
arg_1
=
arg_0
.
document
.
tag
.
lower
(
)
if
arg_1
in
allowed_request_types
[
arg_0
.
params
[
'service'
]
]
:
arg_0
.
params
[
"request"
]
=
arg_1
else
:
raise
OWSInvalidParameterValue
(
"Request type %s is not supported"
%
arg_1
,
arg_1
=
"request"
)
return
arg_0
.
params
[
"request"
]

def Func(arg_0):
        """Find requested request type in POST request."""
        arg_1 = arg_0.document.tag.lower()
        if arg_1 in allowed_request_types[arg_0.params['service']]:
            arg_0.params["request"] = arg_1
        else:
            raise OWSInvalidParameterValue("Request type %s is not supported" % arg_1, arg_1="request")
        return arg_0.params["request"]

Find requested request type in POST request .