Skip to content

Commit

Permalink
Fix some six lint warning on node.py
Browse files Browse the repository at this point in the history
o 'urlopen' in the try block with 'except ImportError' should also be defined in the except block
o Cannot find reference 'moves' in 'six.py'
  • Loading branch information
cgalibern committed Sep 24, 2021
1 parent e657f6d commit 953a6bd
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions opensvc/core/node/node.py
Expand Up @@ -56,14 +56,11 @@
from utilities.storage import Storage
from utilities.string import bdecode

try:
from foreign.six.moves.urllib.request import Request, urlopen
from foreign.six.moves.urllib.error import HTTPError
from foreign.six.moves.urllib.parse import urlencode
except ImportError:
# pylint false positive
pass

Request = six.moves.urllib.request.Request
urlopen = six.moves.urllib.request.urlopen
HTTPError = six.moves.urllib.error.HTTPError
urlencode = six.moves.urllib.parse.urlencode

if six.PY2:
BrokenPipeError = IOError
Expand Down Expand Up @@ -3005,7 +3002,6 @@ def print_comment(comment):
comment = re.sub(r"(\[.+://.+])", lambda m: get_href(m.group(1)), comment)
print(comment)

from foreign.six.moves import input
for key, default_val in env.items():
if key.endswith(".comment"):
continue
Expand All @@ -3015,7 +3011,7 @@ def print_comment(comment):
comment = env.get(comment_key)
if comment:
print_comment(comment)
newval = input("%s [%s] > " % (key, str(default_val)))
newval = six.moves.input("%s [%s] > " % (key, str(default_val)))
if newval != "":
env[key] = newval
return env
Expand Down

0 comments on commit 953a6bd

Please sign in to comment.