mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Add sanity-check exception
Found by mypy while adding types.
This commit is contained in:
@@ -105,6 +105,9 @@ class Script:
|
||||
self.path = path.absolute() if path else None
|
||||
|
||||
if code is None:
|
||||
if path is None:
|
||||
raise ValueError("Must provide at least one of code or path")
|
||||
|
||||
# TODO add a better warning than the traceback!
|
||||
with open(path, 'rb') as f:
|
||||
code = f.read()
|
||||
|
||||
Reference in New Issue
Block a user