Pyupgrade 3.6: Update syntax with Python 3.6+ features (#23305)

Updated Python code with Python 3.6+ features:
- utf-8 encoding is now the default (PEP 3120)
- Replace list comprehensions by Generator Expressions (PEP 289)
- Replace yield loop by yield from (PEP 380)
- Remove the (object) subclass when defining a class
- Replace the IOError alias by OSError (PEP 3151)
- Define sets with curly braces {} instead of set()
- Remove "r" parameter from open function, which is default

Co-Authored-By: Adeeb Shihadeh <8762862+adeebshihadeh@users.noreply.github.com>
Co-Authored-By: GregorKikelj <96022003+GregorKikelj@users.noreply.github.com>

Co-authored-by: Adeeb Shihadeh <8762862+adeebshihadeh@users.noreply.github.com>
Co-authored-by: GregorKikelj <96022003+GregorKikelj@users.noreply.github.com>
old-commit-hash: 332f568a8241fba9459cb70c76840b9670e6993a
This commit is contained in:
Ewout ter Hoeven
2021-12-24 20:18:39 +01:00
committed by GitHub
parent 6cd96b07e7
commit f206ebd054
39 changed files with 62 additions and 67 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ except ImportError:
from cereal import log as capnp_log
# this is an iterator itself, and uses private variables from LogReader
class MultiLogIterator(object):
class MultiLogIterator:
def __init__(self, log_paths, wraparound=False):
self._log_paths = log_paths
self._wraparound = wraparound
@@ -74,7 +74,7 @@ class MultiLogIterator(object):
return True
class LogReader(object):
class LogReader:
def __init__(self, fn, canonicalize=True, only_union_types=False):
data_version = None
_, ext = os.path.splitext(urllib.parse.urlparse(fn).path)