Skip to content

Commit 3fa97b0

Browse files
committed
[OMCPath] try to make mypy happy ...
1 parent 84c73be commit 3fa97b0

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

OMPython/OMCSession.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def getClassNames(self, className=None, recursive=False, qualified=False, sort=F
271271
return self._ask(question='getClassNames', opt=opt)
272272

273273

274-
class OMCPath(pathlib.PurePosixPath):
274+
class OMCPathReal(pathlib.PurePosixPath):
275275
"""
276276
Implementation of a basic Path object which uses OMC as backend. The connection to OMC is provided via a
277277
OMCSessionZMQ session object.
@@ -423,13 +423,16 @@ def size(self) -> int:
423423
stacklevel=1,
424424
)
425425

426-
class OMCPathCompatibility(pathlib.Path):
426+
class OMCPathCompatibility(pathlib.PosixPath):
427427

428428
def size(self) -> int:
429429
return self.stat().st_size
430430

431431
OMCPath = OMCPathCompatibility # noqa: F811
432432

433+
else:
434+
OMCPath = OMCPathReal
435+
433436

434437
class OMCSessionZMQ:
435438

@@ -494,8 +497,8 @@ def omcpath(self, *path) -> OMCPath:
494497
if sys.version_info < (3, 12):
495498
# noinspection PyArgumentList
496499
return OMCPath(*path)
497-
498-
return OMCPath(*path, session=self)
500+
else:
501+
return OMCPath(*path, session=self)
499502

500503
def omcpath_tempdir(self) -> OMCPath:
501504
"""

0 commit comments

Comments
 (0)