This file is indexed.

/usr/lib/python3/dist-packages/maascli/profile.py is in python3-maas-client 2.4.0~beta2-6865-gec43e47e6-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Copyright 2012-2015 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

"""Profile-related functionality."""

__all__ = [
    'get_profile',
    'select_profile',
    ]

from itertools import islice


class InvalidProfile(Exception):
    """Unknown profile specified."""


def get_profile(profiles, profile_name):
    """Look up the named profile in `profiles`.

    :param profiles: The result of `ProfileConfig.open()`.
    :param profile_name: The profile requested by the user.
    :return: The `ProfileConfig` option for the requested profile.
    :raise InvalidProfile: Requested profile was not found.
    """
    if profile_name not in profiles:
        raise InvalidProfile("'%s' is not an active profile." % profile_name)
    return profiles[profile_name]


def name_default_profile(profiles):
    """Return name of the default profile, or raise `NoDefaultProfile`.

    :param profiles: The result of `ProfileConfig.open()`.
    :return: The name of the default profile, or None if there is no
        reasonable default.
    """
    profiles_sample = list(islice(profiles, 2))
    if len(profiles_sample) == 1:
        # There's exactly one profile.  That makes a sensible default.
        return profiles_sample[0]

    return None


def select_profile(profiles, profile_name=None):
    """Return name for the applicable profile: the given name, or the default.

    :param profiles: The result of `ProfileConfig.open()`.
    :param profile_name: The profile requested by the user, if any.  This may
        be `None`, in which case `select_profile` will look for a sensible
        default to use.
    :return: Name of the applicable profile, or `None` if no profile was
        explicitly requested and no sensible default presents itself.
    """
    if profile_name is None:
        return name_default_profile(profiles)
    else:
        return profile_name