Modernize python and update pylint (#5096)

Update code to conform to the newer version of pylint available in
ubuntu-22.04, with few exceptions:
    - disabled `import-outside-toplevel` for `main()` in
      `jerry_client.py`
    - disabled `consider-using-with` for the logfile of `TestSuite` in
      `test262-harness.py` as using `with` is not practical in that case

Update test262-harness.py to use argparse instead of the now deprecated
optparse

Rename variables in jerry_client_main.py that redefined python builtins
or shadowed variables from an outer scope

Update python files to use f-stirngs

Add minimum python versions (3.6 and 3.8) to the CI jobs: without it the
default python version did not support the `with` statement for
`subprocess.Popen` used in `build.py` on macos, or in some cases f-stirngs

Remove `from __future__` imports that are no-ops in python 3

Remove shebang from non executable files

Re-enable most pylint checkers, except `missing-docstring`

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
This commit is contained in:
Máté Tokodi
2023-10-25 17:32:14 +02:00
committed by GitHub
parent a588e49661
commit bc408b159b
26 changed files with 469 additions and 503 deletions
+2 -4
View File
@@ -1,5 +1,3 @@
#!/usr/bin/env python
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,7 +16,7 @@ import socket
import select
# pylint: disable=too-many-arguments,superfluous-parens
class Socket(object):
class Socket:
""" Create a new socket using the given address family, socket type and protocol number. """
def __init__(self, address, socket_family=socket.AF_INET, socket_type=socket.SOCK_STREAM, proto=0, fileno=None):
self.address = address
@@ -29,7 +27,7 @@ class Socket(object):
Connect to a remote socket at address (host, port).
The format of address depends on the address family.
"""
print("Connecting to: %s:%s" % (self.address[0], self.address[1]))
print(f"Connecting to: {self.address[0]}:{self.address[1]}")
self.socket.connect(self.address)
def close(self):