Skip to content

Commit

Permalink
πŸ§Žβ€β™€οΈ Genuflect to the types.
Browse files Browse the repository at this point in the history
Mypy was unhappy calling a method that it couldn't be confident would exist. Now abstractmethod promises to enforce that expectation.
  • Loading branch information
jaraco committed Dec 10, 2022
1 parent 356abc5 commit 907be5d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pip_run/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import tokenize
import json
import pathlib
import abc

import packaging.requirements

Expand Down Expand Up @@ -39,11 +40,18 @@ def _try_read(cls, script_path: pathlib.Path):
but return an empty list if unsuccessful.
"""
try:
reader = cls.load(script_path) # type: ignore
reader = cls.load(script_path)
return reader.read()
except Exception:
pass

@classmethod
@abc.abstractmethod
def load(cls, script: pathlib.Path):
"""
Construct a DepsReader from the script path.
"""

@classmethod
def search(cls, params):
"""
Expand Down

0 comments on commit 907be5d

Please sign in to comment.