mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Use Path instead of str if possible
This commit is contained in:
@@ -181,8 +181,6 @@ class InferenceState:
|
||||
|
||||
def parse_and_get_code(self, code=None, path=None,
|
||||
use_latest_grammar=False, file_io=None, **kwargs):
|
||||
if path is not None:
|
||||
path = str(path)
|
||||
if code is None:
|
||||
if file_io is None:
|
||||
file_io = FileIO(path)
|
||||
|
||||
@@ -2,6 +2,7 @@ import os
|
||||
import sys
|
||||
import subprocess
|
||||
from itertools import count
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -169,7 +170,7 @@ def module_injector():
|
||||
|
||||
def module_injector(inference_state, names, code):
|
||||
assert isinstance(names, tuple)
|
||||
file_io = KnownContentFileIO('/foo/bar/module-injector-%s.py' % next(counter), code)
|
||||
file_io = KnownContentFileIO(Path('/foo/bar/module-injector-%s.py') % next(counter), code)
|
||||
v = _load_python_module(inference_state, file_io, names)
|
||||
inference_state.module_cache.add(names, ValueSet([v]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user