terminal: remove unused union arm in WarningReport.fslocation
This commit is contained in:
parent
89dcfbf293
commit
73586be08f
|
@ -285,15 +285,13 @@ class WarningReport:
|
||||||
User friendly message about the warning.
|
User friendly message about the warning.
|
||||||
:ivar str|None nodeid:
|
:ivar str|None nodeid:
|
||||||
nodeid that generated the warning (see ``get_location``).
|
nodeid that generated the warning (see ``get_location``).
|
||||||
:ivar tuple|py.path.local fslocation:
|
:ivar tuple fslocation:
|
||||||
File system location of the source of the warning (see ``get_location``).
|
File system location of the source of the warning (see ``get_location``).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
message = attr.ib(type=str)
|
message = attr.ib(type=str)
|
||||||
nodeid = attr.ib(type=Optional[str], default=None)
|
nodeid = attr.ib(type=Optional[str], default=None)
|
||||||
fslocation = attr.ib(
|
fslocation = attr.ib(type=Optional[Tuple[str, int]], default=None)
|
||||||
type=Optional[Union[Tuple[str, int], py.path.local]], default=None
|
|
||||||
)
|
|
||||||
count_towards_summary = True
|
count_towards_summary = True
|
||||||
|
|
||||||
def get_location(self, config: Config) -> Optional[str]:
|
def get_location(self, config: Config) -> Optional[str]:
|
||||||
|
@ -301,14 +299,9 @@ class WarningReport:
|
||||||
if self.nodeid:
|
if self.nodeid:
|
||||||
return self.nodeid
|
return self.nodeid
|
||||||
if self.fslocation:
|
if self.fslocation:
|
||||||
if isinstance(self.fslocation, tuple) and len(self.fslocation) >= 2:
|
filename, linenum = self.fslocation
|
||||||
filename, linenum = self.fslocation[:2]
|
relpath = bestrelpath(config.invocation_params.dir, absolutepath(filename))
|
||||||
relpath = bestrelpath(
|
|
||||||
config.invocation_params.dir, absolutepath(filename)
|
|
||||||
)
|
|
||||||
return f"{relpath}:{linenum}"
|
return f"{relpath}:{linenum}"
|
||||||
else:
|
|
||||||
return str(self.fslocation)
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue