Fix code at head, pytype errors, and small Event refactoring
Code was broken at head after yesterday's Event dataclass refactoring.
pytype would have caught this error. So I fixed all the outstanding pytype errors in anticipation of (hopefully) adding some automated pytype checking to the repo.
Ended up fixing this as well here: https://github.com/callebtc/python-nostr/pull/5.
The from_dict() method is needed or the Event() argument error will probably happen again some time.
This is a great PR. LGTM.
Thanks @callebtc
@jeffthibault WDYT?
could be three separate prs:
- Fix Event call (equivalent to https://github.com/callebtc/python-nostr/pull/5)
- Event to_/from_dict refactor
- Fix all pytype annotations
Looking for feedback before doing anything else here
FWIW, here is the relevant pytype failures wrt the Event() breakage:
File "/private/tmp/python-nostr/nostr/relay.py", line 117, in _is_valid_message: Function Event.__init__ expects 1 arg(s), got 8 [wrong-arg-count]
Expected: (self, content, public_key, created_at, kind, tags, signature)
Actually passed: (self, content, public_key, created_at, kind, tags, signature, _)
File "/private/tmp/python-nostr/nostr/message_pool.py", line 58, in _process_message: Function Event.__init__ expects 1 arg(s), got 8 [wrong-arg-count]
Expected: (self, content, public_key, created_at, kind, tags, signature)
Actually passed: (self, content, public_key, created_at, kind, tags, signature, _)
I'm a big fan of using pytype to catch these breakages.
Bumping this one, would love to see it get merged.
been 2 months since a merge. guessing @jeffthibault is asleep. thinking either (a) fork or (b) ask jeff to promote a couple maintainers... clearly no lack of people want to help