diff options
author | Martin Robinson <mrobinson@igalia.com> | 2023-05-29 13:56:03 +0200 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2023-05-29 13:56:03 +0200 |
commit | faa8c0e967cd9e3526c05e4eac34c679cb14ed5f (patch) | |
tree | 79fb6d27505cf33d185a1a95de93b28b764ee44d /python/tidy/servo_tidy/tidy.py | |
parent | 9a93c218675374eb4d57fa2d55f1bdadb831ac8d (diff) | |
download | servo-faa8c0e967cd9e3526c05e4eac34c679cb14ed5f.tar.gz servo-faa8c0e967cd9e3526c05e4eac34c679cb14ed5f.zip |
Remove more Python 2 compatibility code
- os.environ is always `str` in Python 3.
- The only string type is `str` so we can stop using `six.str_types`.
- `iteritems()` isn't necessary because dicts have the `items()` method.
Diffstat (limited to 'python/tidy/servo_tidy/tidy.py')
-rw-r--r-- | python/tidy/servo_tidy/tidy.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 9cd704727ac..7c45bb63d93 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -20,12 +20,10 @@ import subprocess import sys import colorama -import six import toml import voluptuous import yaml from .licenseck import OLD_MPL, MPL, APACHE, COPYRIGHT, licenses_toml, licenses_dep_toml -from six import iteritems topdir = os.path.abspath(os.path.dirname(sys.argv[0])) wpt = os.path.join(topdir, "tests", "wpt") @@ -121,7 +119,7 @@ def is_iter_empty(iterator): def normilize_paths(paths): - if isinstance(paths, six.string_types): + if isinstance(paths, str): return os.path.join(*paths.split('/')) else: return [os.path.join(*path.split('/')) for path in paths] @@ -374,7 +372,7 @@ def check_lock(file_name, contents): if name not in packages_by_name: yield (1, "duplicates are allowed for `{}` but it is not a dependency".format(name)) - for (name, packages) in iteritems(packages_by_name): + for (name, packages) in packages_by_name.items(): has_duplicates = len(packages) > 1 duplicates_allowed = name in exceptions @@ -419,7 +417,7 @@ def check_lock(file_name, contents): visited_whitelisted_packages[dependency_name][package_name] = True # Check if all the exceptions to blocked packages actually depend on the blocked package - for dependency_name, package_names in iteritems(blocked_packages): + for dependency_name, package_names in blocked_packages.items(): for package_name in package_names: if not visited_whitelisted_packages[dependency_name].get(package_name): fmt = "Package {} is not required to be an exception of blocked package {}." |