docs: Update Python 2 doc links (#74633)

* docs: Update Python 2 doc links

Update links from Python 2 to Python 3

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* use docs.python.com/3/ everywhere, except onethat should remain 2.6

* refer to python 3 in module docs and comments

* format two python docs links as list

* updates links in unwanted.py test file

* per matt clay, this should link to python 2

Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com>
pull/74815/head
Abhijeet Kasurde 4 years ago committed by GitHub
parent 52430d4228
commit 870f943365
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -373,7 +373,10 @@ Python 2.6. Always remember to put numbers into the placeholders so the code
is compatible with Python 2.6.
.. seealso::
Python documentation on `format strings <https://docs.python.org/2/library/string.html#formatstrings>`_
Python documentation on format strings:
- `format strings in 2.6 <https://docs.python.org/2.6/library/string.html#formatstrings>`_
- `format strings in 3.x <https://docs.python.org/3/library/string.html#formatstrings>`_
Use percent format with byte strings
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -394,7 +397,7 @@ does have support for the older, percent-formatting.
Upgrade to Python 3.5 to test.
.. seealso::
Python documentation on `percent formatting <https://docs.python.org/2/library/stdtypes.html#string-formatting>`_
Python documentation on `percent formatting <https://docs.python.org/3/library/stdtypes.html#string-formatting>`_
.. _testing_modules_python_3:

@ -1250,7 +1250,7 @@ is an XPath expression used to get the attributes of the ``vlan`` tag in output
</rpc-reply>
.. note::
For more information on supported XPath expressions, see `XPath Support <https://docs.python.org/2/library/xml.etree.elementtree.html#xpath-support>`_.
For more information on supported XPath expressions, see `XPath Support <https://docs.python.org/3/library/xml.etree.elementtree.html#xpath-support>`_.
Network VLAN filters
--------------------

@ -81,7 +81,7 @@ of size 8.
.. versionadded:: 2.7
If you do not have Passlib installed, Ansible uses the `crypt <https://docs.python.org/2/library/crypt.html>`_ library as a fallback. Ansible supports at most four crypt schemes, depending on your platform at most the following crypt schemes are supported:
If you do not have Passlib installed, Ansible uses the `crypt <https://docs.python.org/3/library/crypt.html>`_ library as a fallback. Ansible supports at most four crypt schemes, depending on your platform at most the following crypt schemes are supported:
- *bcrypt* - BCrypt
- *md5_crypt* - MD5 Crypt

@ -572,8 +572,8 @@ The ansible_local namespace separates custom facts created by facts.d from syste
.. note:: The key part in the key=value pairs will be converted into lowercase inside the ansible_local variable. Using the example above, if the ini file contained ``XYZ=3`` in the ``[general]`` section, then you should expect to access it as: ``{{ ansible_local['preferences']['general']['xyz'] }}`` and not ``{{ ansible_local['preferences']['general']['XYZ'] }}``. This is because Ansible uses Python's `ConfigParser`_ which passes all option names through the `optionxform`_ method and this method's default implementation converts option names to lower case.
.. _ConfigParser: https://docs.python.org/2/library/configparser.html
.. _optionxform: https://docs.python.org/2/library/configparser.html#ConfigParser.RawConfigParser.optionxform
.. _ConfigParser: https://docs.python.org/3/library/configparser.html
.. _optionxform: https://docs.python.org/3/library/configparser.html#ConfigParser.RawConfigParser.optionxform
You can also use facts.d to execute a script on the remote host, generating dynamic custom facts to the ansible_local namespace. For example, you can generate a list of all users that exist on a remote host as a fact about that host. To generate dynamic custom facts using facts.d:

@ -1110,7 +1110,7 @@ class AnsibleModule(object):
rev_umask = umask ^ PERM_BITS
# Permission bits constants documented at:
# http://docs.python.org/2/library/stat.html#stat.S_ISUID
# https://docs.python.org/3/library/stat.html#stat.S_ISUID
if apply_X_permission:
X_perms = {
'u': {'X': stat.S_IXUSR},

@ -41,7 +41,7 @@ def to_bytes(obj, encoding='utf-8', errors=None, nonstring='simplerepr'):
a byte string. Defaults to using 'utf-8'.
:kwarg errors: The error handler to use if the text string is not
encodable using the specified encoding. Any valid `codecs error
handler <https://docs.python.org/2/library/codecs.html#codec-base-classes>`_
handler <https://docs.python.org/3/library/codecs.html#codec-base-classes>`_
may be specified. There are three additional error strategies
specifically aimed at helping people to port code. The first two are:
@ -158,7 +158,7 @@ def to_text(obj, encoding='utf-8', errors=None, nonstring='simplerepr'):
a text string. Defaults to using 'utf-8'.
:kwarg errors: The error handler to use if the byte string is not
decodable using the specified encoding. Any valid `codecs error
handler <https://docs.python.org/2/library/codecs.html#codec-base-classes>`_
handler <https://docs.python.org/3/library/codecs.html#codec-base-classes>`_
may be specified. We support three additional error strategies
specifically aimed at helping people to port code:

@ -59,7 +59,7 @@ options:
- Assemble files only if C(regex) matches the filename.
- If not set, all files are assembled.
- Every "\" (backslash) must be escaped as "\\" to comply to YAML syntax.
- Uses L(Python regular expressions,http://docs.python.org/2/library/re.html).
- Uses L(Python regular expressions,https://docs.python.org/3/library/re.html).
type: str
ignore_hidden:
description:

@ -47,7 +47,7 @@ options:
- Absolute path of where temporary file is downloaded to.
- When run on Ansible 2.5 or greater, path defaults to ansible's remote_tmp setting
- When run on Ansible prior to 2.5, it defaults to C(TMPDIR), C(TEMP) or C(TMP) env variables or a platform specific value.
- U(https://docs.python.org/2/library/tempfile.html#tempfile.tempdir)
- U(https://docs.python.org/3/library/tempfile.html#tempfile.tempdir)
type: path
version_added: '2.1'
force:

@ -35,7 +35,7 @@ options:
description:
- The regular expression to look for in the contents of the file.
- Uses Python regular expressions; see
U(http://docs.python.org/2/library/re.html).
U(https://docs.python.org/3/library/re.html).
- Uses MULTILINE mode, which means C(^) and C($) match the beginning
and end of the file, as well as the beginning and end respectively
of I(each line) of the file.
@ -60,7 +60,7 @@ options:
- If specified, only content after this match will be replaced/removed.
- Can be used in combination with C(before).
- Uses Python regular expressions; see
U(http://docs.python.org/2/library/re.html).
U(https://docs.python.org/3/library/re.html).
- Uses DOTALL, which means the C(.) special character I(can match newlines).
type: str
version_added: "2.4"
@ -69,7 +69,7 @@ options:
- If specified, only content before this match will be replaced/removed.
- Can be used in combination with C(after).
- Uses Python regular expressions; see
U(http://docs.python.org/2/library/re.html).
U(https://docs.python.org/3/library/re.html).
- Uses DOTALL, which means the C(.) special character I(can match newlines).
type: str
version_added: "2.4"

@ -201,13 +201,13 @@ elapsed:
type: int
sample: 23
match_groups:
description: Tuple containing all the subgroups of the match as returned by U(https://docs.python.org/2/library/re.html#re.MatchObject.groups)
description: Tuple containing all the subgroups of the match as returned by U(https://docs.python.org/3/library/re.html#re.MatchObject.groups)
returned: always
type: list
sample: ['match 1', 'match 2']
match_groupdict:
description: Dictionary containing all the named subgroups of the match, keyed by the subgroup name,
as returned by U(https://docs.python.org/2/library/re.html#re.MatchObject.groupdict)
as returned by U(https://docs.python.org/3/library/re.html#re.MatchObject.groupdict)
returned: always
type: dict
sample:

@ -83,7 +83,7 @@ def to_datetime(string, format="%Y-%m-%d %H:%M:%S"):
def strftime(string_format, second=None):
''' return a date string using string. See https://docs.python.org/2/library/time.html#time.strftime for format '''
''' return a date string using string. See https://docs.python.org/3/library/time.html#time.strftime for format '''
if second is not None:
try:
second = float(second)

@ -16,7 +16,7 @@ DOCUMENTATION = '''
- Anything found outside a section is considered an 'ungrouped' host.
- Values passed in the INI format using the ``key=value`` syntax are interpreted differently depending on where they are declared within your inventory.
- When declared inline with the host, INI values are processed by Python's ast.literal_eval function
(U(https://docs.python.org/2/library/ast.html#ast.literal_eval)) and interpreted as Python literal structures
(U(https://docs.python.org/3/library/ast.html#ast.literal_eval)) and interpreted as Python literal structures
(strings, numbers, tuples, lists, dicts, booleans, None). Host lines accept multiple C(key=value) parameters per line.
Therefore they need a way to indicate that a space is part of a value rather than a separator.
- When declared in a C(:vars) section, INI values are interpreted as strings. For example C(var=FALSE) would create a string equal to C(FALSE).

@ -57,7 +57,7 @@ class LookupModule(LookupBase):
ret = []
for term in terms:
'''
http://docs.python.org/2/library/subprocess.html#popen-constructor
https://docs.python.org/3/library/subprocess.html#popen-constructor
The shell argument (which defaults to False) specifies whether to use the
shell as the program to execute. If shell is True, it is recommended to pass

@ -96,7 +96,7 @@ class AnsibleUnwantedChecker(BaseChecker):
'/lib/ansible/module_utils/urls.py',
)),
# see https://docs.python.org/3.7/library/collections.abc.html
# see https://docs.python.org/3/library/collections.abc.html
collections=UnwantedEntry('ansible.module_utils.common._collections_compat',
ignore_paths=(
'/lib/ansible/module_utils/common/_collections_compat.py',
@ -119,7 +119,7 @@ class AnsibleUnwantedChecker(BaseChecker):
)
unwanted_functions = {
# see https://docs.python.org/2/library/tempfile.html#tempfile.mktemp
# see https://docs.python.org/3/library/tempfile.html#tempfile.mktemp
'tempfile.mktemp': UnwantedEntry('tempfile.mkstemp'),
'sys.exit': UnwantedEntry('exit_json or fail_json',

Loading…
Cancel
Save