Merge "Run pyupgrade to clean up Python 2 syntaxes"
This commit is contained in:
commit
95fab98d39
@ -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]
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2010-2011 OpenStack Foundation
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
|
@ -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'(?<!\\)\$([0-9])')
|
||||
|
||||
def __init__(self, linenum, *params):
|
||||
super(RedirectMatch, self).__init__(linenum, *params)
|
||||
super().__init__(linenum, *params)
|
||||
self.regex = pcre.compile(self.pattern)
|
||||
if self.target:
|
||||
self.target_repl = self._get_target_repl()
|
||||
@ -96,7 +94,7 @@ class RedirectMatch(Rule):
|
||||
return None
|
||||
|
||||
|
||||
class RuleSet(object):
|
||||
class RuleSet:
|
||||
"An ordered collection of rules."
|
||||
|
||||
_factories = {
|
||||
|
@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2010-2011 OpenStack Foundation
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
|
@ -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
|
||||
@ -20,7 +18,7 @@ from whereto.tests import base
|
||||
class TestProcessTests(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestProcessTests, self).setUp()
|
||||
super().setUp()
|
||||
self.ruleset = rules.RuleSet()
|
||||
|
||||
def test_zero_matches(self):
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -19,7 +17,7 @@ from whereto.tests import base
|
||||
class TestRedirect(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestRedirect, self).setUp()
|
||||
super().setUp()
|
||||
self.rule = rules.Redirect(
|
||||
1,
|
||||
'redirect', '301', '/path', '/new/path',
|
||||
@ -210,7 +208,7 @@ class TestRedirectMatch(base.TestCase):
|
||||
class TestRuleSet(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestRuleSet, self).setUp()
|
||||
super().setUp()
|
||||
self.ruleset = rules.RuleSet()
|
||||
|
||||
def test_add_redirect(self):
|
||||
|
Loading…
Reference in New Issue
Block a user