explosion / srsly

🦉 Modern high-performance serialization utilities for Python (JSON, MessagePack, Pickle)
MIT License
435 stars 31 forks source link

Relaxing type annotations a bit? #48

Closed willfrey closed 3 years ago

willfrey commented 3 years ago

Hi there!

I noticed a couple of places where type annotations could be relaxed.

  1. write_jsonl could be changed from Sequence to Iterable
  2. FilePath could be written as FilePath = Union[str, "os.PathLike[str]"]

The second change with os.PathLike could also come with some changes to force_path and force_string by removing some unnecessary isinstance(...) checks and usingos.fspath, respectively.

Would you be open to a PR with these changes? If so, I'd be happy to make the changes and open one.

Thanks!