Skip to content

Commit d22d599

Browse files
committed
mypy on github ...
1 parent dff4f6c commit d22d599

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

OMPython/OMCSession.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def size(self) -> int:
415415

416416
if sys.version_info < (3, 12):
417417

418-
class OMCPathCompatibility:
418+
class OMCPathCompatibility(pathlib.PurePath):
419419
"""
420420
Compatibility class for OMCPath in Python < 3.12. This allows to run all code which uses OMCPath (mainly
421421
ModelicaSystem) on these Python versions. There is one remaining limitation: only OMCProcessLocal will work as
@@ -438,7 +438,10 @@ def size(self) -> int:
438438
"""
439439
Needed compatibility function to have the same interface as OMCPathReal
440440
"""
441-
return self.stat().st_size
441+
if hasattr(self, stat) and callable(self.stat):
442+
return self.stat().st_size
443+
444+
raise OMCSessionException("Missing stat()")
442445

443446
class OMCPathCompatibilityPosix(pathlib.PosixPath, OMCPathCompatibility):
444447
pass

0 commit comments

Comments
 (0)