mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +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
|
self.path = path.absolute() if path else None
|
||||||
|
|
||||||
if code is 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!
|
# TODO add a better warning than the traceback!
|
||||||
with open(path, 'rb') as f:
|
with open(path, 'rb') as f:
|
||||||
code = f.read()
|
code = f.read()
|
||||||
|
|||||||
Reference in New Issue
Block a user