Skip to content

Commit

Permalink
Windows (partial) compat
Browse files Browse the repository at this point in the history
  • Loading branch information
Fischer David (DIN) committed Jun 20, 2024
1 parent e1b72c7 commit 5af1fb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pytoolbox/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
import copy
import datetime
import errno
import grp
import os
import pwd
import re
import shutil
import tempfile
Expand Down Expand Up @@ -619,6 +617,7 @@ def to_user_id(user: int | str | None):
-1
"""
if isinstance(user, str):
import pwd # pylint:disable=import-outside-toplevel
return pwd.getpwnam(user).pw_uid
return -1 if user is None else user

Expand All @@ -637,6 +636,7 @@ def to_group_id(group):
-1
"""
if isinstance(group, str):
import grp # pylint:disable=import-outside-toplevel
return grp.getgrnam(group).gr_gid
return -1 if group is None else group

Expand Down

0 comments on commit 5af1fb1

Please sign in to comment.