Remove uneeded Python version compatibility checks. (#64076)

pull/65152/head
Mads Jensen 5 years ago committed by Sam Doran
parent da8ec327cc
commit 6a763d7133

@ -0,0 +1,2 @@
bugfixes:
- core - remove unneeded Python version checks.

@ -1285,14 +1285,7 @@ class Request:
else:
request.add_header(header, headers[header])
urlopen_args = [request, None]
if sys.version_info >= (2, 6, 0):
# urlopen in python prior to 2.6.0 did not
# have a timeout parameter
urlopen_args.append(timeout)
r = urllib_request.urlopen(*urlopen_args)
return r
return urllib_request.urlopen(request, None, timeout)
def get(self, url, **kwargs):
r"""Sends a GET request. Returns :class:`HTTPResponse` object.

@ -216,7 +216,6 @@ import os
import pwd
import re
import stat
import sys
import time
from ansible.module_utils.basic import AnsibleModule
@ -409,8 +408,7 @@ def main():
for npath in params['paths']:
npath = os.path.expanduser(os.path.expandvars(npath))
if os.path.isdir(npath):
''' ignore followlinks for python version < 2.6 '''
for root, dirs, files in (sys.version_info < (2, 6, 0) and os.walk(npath)) or os.walk(npath, followlinks=params['follow']):
for root, dirs, files in os.walk(npath, followlinks=params['follow']):
if params['depth']:
depth = root.replace(npath.rstrip(os.path.sep), '').count(os.path.sep)
if files or dirs:

Loading…
Cancel
Save