Skip to content

Commit 3873dfd

Browse files
committed
return non for owner and group fsobject methods on Windows
1 parent 0f54b20 commit 3873dfd

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

fileformats/core/mixin.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,10 +626,11 @@ def register_converter(
626626
f"from a generic type or similarly classified type, not {source_format}"
627627
)
628628
else:
629-
if cls.wildcard_classifiers() != source_format.wildcard_classifiers(): # type: ignore[attr-defined]
629+
source_wildcard_classifiers = source_format.wildcard_classifiers() # type: ignore[attr-defined]
630+
if cls.wildcard_classifiers() != source_wildcard_classifiers:
630631
raise FormatDefinitionError(
631632
f"Mismatching wildcards between source format, {source_format} "
632-
f"({list(source_format.wildcard_classifiers())}), and target " # type: ignore[attr-defined]
633+
f"({list(source_wildcard_classifiers)}), and target "
633634
f"{cls} ({cls.wildcard_classifiers()})"
634635
)
635636
prev_registered = [

fileformats/generic/fsobject.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ def drive(self) -> str:
5858
def exists(self) -> bool:
5959
return True
6060

61-
def group(self) -> str:
62-
return self.fspath.group()
61+
def group(self) -> ty.Optional[str]:
62+
try:
63+
return self.fspath.group()
64+
except AttributeError:
65+
return None
6366

6467
def is_dir(self) -> bool:
6568
return self.fspath.is_dir()
@@ -71,8 +74,11 @@ def is_file(self) -> bool:
7174
def name(self) -> str:
7275
return self.fspath.name
7376

74-
def owner(self) -> str:
75-
return self.fspath.owner()
77+
def owner(self) -> ty.Optional[str]:
78+
try:
79+
return self.fspath.owner()
80+
except AttributeError:
81+
return None
7682

7783
@property
7884
def parent(self) -> Path:

0 commit comments

Comments
 (0)