python-nostr icon indicating copy to clipboard operation
python-nostr copied to clipboard

Fix code at head, pytype errors, and small Event refactoring

Open jeremywhelchel opened this issue 2 years ago • 4 comments

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.

jeremywhelchel avatar Feb 06 '23 00:02 jeremywhelchel

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.

callebtc avatar Feb 07 '23 20:02 callebtc

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.

jeremywhelchel avatar Feb 08 '23 15:02 jeremywhelchel

Bumping this one, would love to see it get merged.

blankey1337 avatar Apr 16 '23 16:04 blankey1337

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

earonesty avatar Apr 21 '23 16:04 earonesty