summaryrefslogtreecommitdiff
path: root/events.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2021-05-31 08:36:28 +0200
committerAnthon van der Neut <anthon@mnt.org>2021-05-31 08:36:28 +0200
commitea3d878ef8635120354cd59a1f31b97b05a3e09b (patch)
tree75883248966af6cd241cbcd75bc40ba1bc856b6d /events.py
parent35b81abf32f2567feba5957bc7c9d31782af3b1c (diff)
downloadruamel.yaml-ea3d878ef8635120354cd59a1f31b97b05a3e09b.tar.gz
fix 385 (missing attribute) and mypy issues0.17.6
Diffstat (limited to 'events.py')
-rw-r--r--events.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/events.py b/events.py
index 7a02a29..2a895ff 100644
--- a/events.py
+++ b/events.py
@@ -32,7 +32,10 @@ class Event:
if True:
arguments = []
if hasattr(self, 'value'):
- arguments.append(repr(self.value))
+ # if you use repr(getattr(self, 'value')) then flake8 complains about
+ # abuse of getattr with a constant. When you change to self.value
+ # then mypy throws an error
+ arguments.append(repr(self.value)) # type: ignore
for key in ['anchor', 'tag', 'implicit', 'flow_style', 'style']:
v = getattr(self, key, None)
if v is not None:
@@ -48,7 +51,7 @@ class Event:
self.end_mark.column,
)
)
- arguments = ', '.join(arguments)
+ arguments = ', '.join(arguments) # type: ignore
else:
attributes = [
key
@@ -150,6 +153,7 @@ class AliasEvent(NodeEvent):
__slots__ = 'style'
def __init__(self, anchor, start_mark=None, end_mark=None, style=None, comment=None):
+ # type: (Any, Any, Any, Any, Any) -> None
NodeEvent.__init__(self, anchor, start_mark, end_mark, comment)
self.style = style