diff --git a/docs/docsite/rst/dev_guide/developing_python_3.rst b/docs/docsite/rst/dev_guide/developing_python_3.rst index 577e487acb1..23b94767ad8 100644 --- a/docs/docsite/rst/dev_guide/developing_python_3.rst +++ b/docs/docsite/rst/dev_guide/developing_python_3.rst @@ -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 `_ + Python documentation on format strings: + + - `format strings in 2.6 `_ + - `format strings in 3.x `_ 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 `_ + Python documentation on `percent formatting `_ .. _testing_modules_python_3: diff --git a/docs/docsite/rst/user_guide/playbooks_filters.rst b/docs/docsite/rst/user_guide/playbooks_filters.rst index 5614b671d4d..bd85fe49a68 100644 --- a/docs/docsite/rst/user_guide/playbooks_filters.rst +++ b/docs/docsite/rst/user_guide/playbooks_filters.rst @@ -1250,7 +1250,7 @@ is an XPath expression used to get the attributes of the ``vlan`` tag in output .. note:: - For more information on supported XPath expressions, see `XPath Support `_. + For more information on supported XPath expressions, see `XPath Support `_. Network VLAN filters -------------------- diff --git a/docs/docsite/rst/user_guide/playbooks_prompts.rst b/docs/docsite/rst/user_guide/playbooks_prompts.rst index 856f7037735..b44fc421455 100644 --- a/docs/docsite/rst/user_guide/playbooks_prompts.rst +++ b/docs/docsite/rst/user_guide/playbooks_prompts.rst @@ -81,7 +81,7 @@ of size 8. .. versionadded:: 2.7 -If you do not have Passlib installed, Ansible uses the `crypt `_ 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 `_ 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 diff --git a/docs/docsite/rst/user_guide/playbooks_vars_facts.rst b/docs/docsite/rst/user_guide/playbooks_vars_facts.rst index 1b5a9837307..7b03ff06942 100644 --- a/docs/docsite/rst/user_guide/playbooks_vars_facts.rst +++ b/docs/docsite/rst/user_guide/playbooks_vars_facts.rst @@ -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: diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index a3948833f6e..11c409eb683 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -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}, diff --git a/lib/ansible/module_utils/common/text/converters.py b/lib/ansible/module_utils/common/text/converters.py index b3fe99a0afb..5b25df47a18 100644 --- a/lib/ansible/module_utils/common/text/converters.py +++ b/lib/ansible/module_utils/common/text/converters.py @@ -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 `_ + handler `_ 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 `_ + handler `_ may be specified. We support three additional error strategies specifically aimed at helping people to port code: diff --git a/lib/ansible/modules/assemble.py b/lib/ansible/modules/assemble.py index 1e5fa64b6ef..c94d267765a 100644 --- a/lib/ansible/modules/assemble.py +++ b/lib/ansible/modules/assemble.py @@ -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: diff --git a/lib/ansible/modules/get_url.py b/lib/ansible/modules/get_url.py index 314f7e1d40e..985fa6a642b 100644 --- a/lib/ansible/modules/get_url.py +++ b/lib/ansible/modules/get_url.py @@ -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: diff --git a/lib/ansible/modules/replace.py b/lib/ansible/modules/replace.py index 09600f61324..76804749f89 100644 --- a/lib/ansible/modules/replace.py +++ b/lib/ansible/modules/replace.py @@ -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" diff --git a/lib/ansible/modules/wait_for.py b/lib/ansible/modules/wait_for.py index 428ff9bd278..ac2dbd63412 100644 --- a/lib/ansible/modules/wait_for.py +++ b/lib/ansible/modules/wait_for.py @@ -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: diff --git a/lib/ansible/plugins/filter/core.py b/lib/ansible/plugins/filter/core.py index 643f30f6cb7..8c1c55b337a 100644 --- a/lib/ansible/plugins/filter/core.py +++ b/lib/ansible/plugins/filter/core.py @@ -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) diff --git a/lib/ansible/plugins/inventory/ini.py b/lib/ansible/plugins/inventory/ini.py index be9ec2fce96..6518f8a3c1d 100644 --- a/lib/ansible/plugins/inventory/ini.py +++ b/lib/ansible/plugins/inventory/ini.py @@ -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). diff --git a/lib/ansible/plugins/lookup/pipe.py b/lib/ansible/plugins/lookup/pipe.py index d6bce2cd5af..f7ca725b0fc 100644 --- a/lib/ansible/plugins/lookup/pipe.py +++ b/lib/ansible/plugins/lookup/pipe.py @@ -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 diff --git a/test/lib/ansible_test/_data/sanity/pylint/plugins/unwanted.py b/test/lib/ansible_test/_data/sanity/pylint/plugins/unwanted.py index 5e818c26b34..3d9877e6a3e 100644 --- a/test/lib/ansible_test/_data/sanity/pylint/plugins/unwanted.py +++ b/test/lib/ansible_test/_data/sanity/pylint/plugins/unwanted.py @@ -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',