diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d174849..31d9d64 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,3 +23,8 @@ repos: hooks: - id: hacking additional_dependencies: [] + - repo: https://github.com/asottile/pyupgrade + rev: v3.18.0 + hooks: + - id: pyupgrade + args: [--py3-only] diff --git a/doc/source/conf.py b/doc/source/conf.py index d49c70d..a8a4de6 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/whereto/__init__.py b/whereto/__init__.py index 134dc68..fd0f7b8 100644 --- a/whereto/__init__.py +++ b/whereto/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at diff --git a/whereto/app.py b/whereto/app.py index 387e602..dd76a68 100644 --- a/whereto/app.py +++ b/whereto/app.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - # Copyright 2010-2011 OpenStack Foundation # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # @@ -16,7 +14,6 @@ # under the License. import argparse -import io import logging import sys @@ -188,12 +185,12 @@ def main(): ruleset = rules.RuleSet() log.debug('reading redirects from {}'.format(args.htaccess_file)) - with io.open(args.htaccess_file, 'r', encoding='utf-8') as f: + with open(args.htaccess_file, encoding='utf-8') as f: for linenum, params in parser.parse_rules(f): ruleset.add(linenum, *params) log.debug('reading tests from {}'.format(args.htaccess_file)) - with io.open(args.test_file, 'r', encoding='utf-8') as f: + with open(args.test_file, encoding='utf-8') as f: tests = [ (linenum,) + tuple(params) for linenum, params in parser.parse_tests(f) diff --git a/whereto/parser.py b/whereto/parser.py index 6ce9ab0..0600cc0 100644 --- a/whereto/parser.py +++ b/whereto/parser.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - # Copyright 2010-2011 OpenStack Foundation # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # diff --git a/whereto/rules.py b/whereto/rules.py index d70e671..0d09002 100644 --- a/whereto/rules.py +++ b/whereto/rules.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - # Copyright 2010-2011 OpenStack Foundation # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # @@ -23,7 +21,7 @@ import re LOG = logging.getLogger() -class Rule(object): +class Rule: "Base class for rules." def __init__(self, linenum, *params): @@ -74,7 +72,7 @@ class RedirectMatch(Rule): _group_subst = re.compile(r'(?