Closed nicholasjng closed 6 months ago
Repro:
from lakefs_spec import LakeFSFileSystem
def main():
fs = LakeFSFileSystem()
resource = "lakefs-spec-tests/main/data/"
res = fs.ls(resource)
res2 = fs.ls(resource, detail=False)
if __name__ == "__main__":
main()
On the PR branch, res2
is hinted as list[str]
, which is nicer than what we had before. Unfortunately, due to the absence of these hints on the base class, my Pycharm still complains on overload 2 due to no default argument.
EDIT: More links about return type specialization on booleans: https://github.com/python/mypy/issues/6113 https://github.com/python/mypy/issues/8634
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
e05103d
) 90.05% compared to head (7f29721
) 90.05%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Specializes the return type as
list[dict[str, Any]]
fordetail=True
, andlist[str]
fordetail=False
.Unfortunately, since the base class has a keyword argument default, the
Literal[False]
overload is still marked by the IDE.Furthermore, the typing is changed to
list[str] | list[dict[str, Any]]
, since that is only equivalent tolist[str | dict[str, Any]]
in case of a homogeneous list. This is our case, but the former list union type explicitly conveys type homogeneity.