summaryrefslogtreecommitdiff
path: root/logilab/common/optik_ext.py
diff options
context:
space:
mode:
Diffstat (limited to 'logilab/common/optik_ext.py')
-rw-r--r--logilab/common/optik_ext.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/logilab/common/optik_ext.py b/logilab/common/optik_ext.py
index 3f321b5..222f48b 100644
--- a/logilab/common/optik_ext.py
+++ b/logilab/common/optik_ext.py
@@ -58,11 +58,10 @@ from os.path import exists
from logilab.common import attrdict
from typing import Any, Union, List, Optional, Tuple, Dict
-from optparse import Values, IndentedHelpFormatter, OptionGroup
from _io import StringIO
# python >= 2.3
-from optparse import (
+from optparse import ( # noqa
OptionParser as BaseParser,
Option as BaseOption,
OptionGroup,
@@ -71,8 +70,8 @@ from optparse import (
OptionError,
Values,
HelpFormatter,
- NO_DEFAULT,
SUPPRESS_HELP,
+ NO_DEFAULT,
)
try:
@@ -179,7 +178,7 @@ def check_date(option, opt, value):
def check_color(option, opt, value):
"""check a color value and returns it
- /!\ does *not* check color labels (like 'red', 'green'), only
+ /!\\ does *not* check color labels (like 'red', 'green'), only
checks hexadecimal forms
"""
# Case (1) : color label, we trust the end-user
@@ -257,9 +256,9 @@ class Option(BaseOption):
elif not isinstance(self.choices, (tuple, list)): # type: ignore
raise OptionError(
"choices must be a list of strings ('%s' supplied)"
- % str(type(self.choices)).split("'")[1],
+ % str(type(self.choices)).split("'")[1], # type: ignore
self,
- ) # type: ignore
+ )
elif self.choices is not None: # type: ignore
raise OptionError("must not supply choices for type %r" % self.type, self)
@@ -331,8 +330,8 @@ def level_options(group: BaseParser, outputlevel: int) -> List[BaseOption]:
return [
option
for option in group.option_list
- if (getattr(option, "level", 0) or 0) <= outputlevel and not option.help is SUPPRESS_HELP
- ] # type: ignore
+ if (getattr(option, "level", 0) or 0) <= outputlevel and option.help is not SUPPRESS_HELP # type: ignore # noqa
+ ]
def format_option_help(self, formatter):
@@ -408,7 +407,7 @@ class ManHelpFormatter(HelpFormatter):
return '.TH %s %s "%s" %s' % (pgm, section, date, pgm)
def format_short_description(self, pgm: str, short_desc: str) -> str:
- return """.SH NAME
+ return r""".SH NAME
.B %s
\- %s
""" % (