Skip to content

Commit e350507

Browse files
authored
Remove flake8-polyfill (#199)
This library was used to maintain compatibility with flake8 2.x, but it's no longer needed now that we depend on flake8 3.9+.
1 parent 9c70655 commit e350507

File tree

3 files changed

+29
-43
lines changed

3 files changed

+29
-43
lines changed

run_tests.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import optparse
21
import os
32
import platform
43
import re
54
import sys
65

6+
from flake8.options.manager import OptionManager
77
import pep8ext_naming
88

99

@@ -69,20 +69,9 @@ def load_tests(lines):
6969
yield testcase, code, options
7070

7171

72-
class OptionsManager(optparse.OptionParser):
73-
"""A Flake8-2.x-compatible OptionsManager."""
74-
def __init__(self, *args, **kwargs):
75-
optparse.OptionParser.__init__(self, *args, **kwargs)
76-
self.config_options = []
77-
self.ignore = []
78-
79-
def extend_default_ignore(self, new_ignores):
80-
self.ignore += new_ignores
81-
82-
8372
def parse_options(checker, options):
8473
"""Parse the CLI-style flags from `options` and expose to `checker`"""
85-
options_manager = OptionsManager('flake8')
74+
options_manager = OptionManager('flake8', version=pep8ext_naming.__version__)
8675
options_manager.add_option('--select', default=[])
8776
options_manager.add_option('--extended-default-select', default=['N'])
8877
options_manager.add_option('--extend-select', default=[])

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def run_tests(self):
4242
license='Expat license',
4343
package_dir={'': 'src'},
4444
py_modules=['pep8ext_naming'],
45-
install_requires=['flake8>=3.9.1', 'flake8_polyfill>=1.0.2,<2'],
45+
install_requires=['flake8>=3.9.1'],
4646
zip_safe=False,
4747
entry_points={
4848
'flake8.extension': [

src/pep8ext_naming.py

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from itertools import chain
77

88
from flake8 import style_guide
9-
from flake8_polyfill import options
109

1110
try:
1211
import ast
@@ -128,34 +127,32 @@ def __init__(self, tree, filename):
128127

129128
@classmethod
130129
def add_options(cls, parser):
131-
options.register(parser, '--ignore-names',
132-
default=_default_ignore_names,
133-
action='store',
134-
type='string',
135-
parse_from_config=True,
136-
comma_separated_list=True,
137-
help='List of names or glob patterns the pep8-naming '
138-
'plugin should ignore. (Defaults to %default)')
139-
140-
options.register(parser, '--classmethod-decorators',
141-
default=_default_classmethod_decorators,
142-
action='store',
143-
type='string',
144-
parse_from_config=True,
145-
comma_separated_list=True,
146-
help='List of method decorators pep8-naming plugin '
147-
'should consider classmethods (Defaults to '
148-
'%default)')
149-
150-
options.register(parser, '--staticmethod-decorators',
151-
default=_default_staticmethod_decorators,
152-
action='store',
153-
type='string',
154-
parse_from_config=True,
155-
comma_separated_list=True,
156-
help='List of method decorators pep8-naming plugin '
157-
'should consider staticmethods (Defaults to '
158-
'%default)')
130+
parser.add_option(
131+
'--ignore-names',
132+
default=_default_ignore_names,
133+
parse_from_config=True,
134+
comma_separated_list=True,
135+
help='List of names or glob patterns the pep8-naming '
136+
'plugin should ignore. (Defaults to %default)',
137+
)
138+
parser.add_option(
139+
'--classmethod-decorators',
140+
default=_default_classmethod_decorators,
141+
parse_from_config=True,
142+
comma_separated_list=True,
143+
help='List of method decorators pep8-naming plugin '
144+
'should consider classmethods (Defaults to '
145+
'%default)',
146+
)
147+
parser.add_option(
148+
'--staticmethod-decorators',
149+
default=_default_staticmethod_decorators,
150+
parse_from_config=True,
151+
comma_separated_list=True,
152+
help='List of method decorators pep8-naming plugin '
153+
'should consider staticmethods (Defaults to '
154+
'%default)',
155+
)
159156
parser.extend_default_ignore(['N818'])
160157

161158
@classmethod

0 commit comments

Comments
 (0)