python/steamsync,steamutil: Remove trailing whitespace

master
Taeyeon Mori 3 years ago
parent d8d4401707
commit d118862292
  1. 2
      lib/python/propex.py
  2. 36
      lib/python/steamsync.py
  3. 4
      lib/python/steamutil.py

@ -74,7 +74,7 @@ class DictPathRoProperty(CustomProperty[T]):
self.path = path self.path = path
self.default = default self.default = default
self.type = type self.type = type
def _get_parent(self, obj: O, *, create=False) -> MutableMapping[str, Any]: def _get_parent(self, obj: O, *, create=False) -> MutableMapping[str, Any]:
d: MutableMapping[str, Any] = getattr(obj, self.source_member) d: MutableMapping[str, Any] = getattr(obj, self.source_member)
for pc in self.path[:-1]: for pc in self.path[:-1]:

@ -89,7 +89,7 @@ class SyncPath(Cloneable):
self.op = op self.op = op
self.local = Path(local) self.local = Path(local)
self.common = PurePath(common) self.common = PurePath(common)
@property @property
def path(self) -> Path: def path(self) -> Path:
return Path(self.local, self.common) return Path(self.local, self.common)
@ -97,12 +97,12 @@ class SyncPath(Cloneable):
def exists(self) -> bool: def exists(self) -> bool:
""" Chech whether local path exists """ """ Chech whether local path exists """
return self.path.exists() return self.path.exists()
## Change paths ## Change paths
def prefix(self: _SyncPath, component: PathOrStr) -> _SyncPath: def prefix(self: _SyncPath, component: PathOrStr) -> _SyncPath:
""" Return a new SyncPath that has a component prefixed to the local path """ """ Return a new SyncPath that has a component prefixed to the local path """
return self.clone(local=self.local/component) return self.clone(local=self.local/component)
def __truediv__(self: _SyncPath, component: PathOrStr) -> _SyncPath: def __truediv__(self: _SyncPath, component: PathOrStr) -> _SyncPath:
""" Return a new SyncPath that nas a component added """ """ Return a new SyncPath that nas a component added """
return self.clone(common=self.common/component) return self.clone(common=self.common/component)
@ -141,7 +141,7 @@ class _SyncSetCommon(metaclass=ABCMeta):
if resp.lower() in ("y", "yes", ""): if resp.lower() in ("y", "yes", ""):
return True return True
return False return False
@abstractmethod @abstractmethod
def commit(self, *, make_inconsistent=False) -> bool: ... def commit(self, *, make_inconsistent=False) -> bool: ...
@ -270,15 +270,15 @@ class SyncMultiSet(list, _SyncSetCommon):
@CachedProperty @CachedProperty
def files_from_local(self) -> Set[Path]: def files_from_local(self) -> Set[Path]:
return self._union_set("files_from_local") return self._union_set("files_from_local")
@CachedProperty @CachedProperty
def files_from_target(self) -> Set[Path]: def files_from_target(self) -> Set[Path]:
return self._union_set("files_from_target") return self._union_set("files_from_target")
@CachedProperty @CachedProperty
def files_unmodified(self) -> Set[Path]: def files_unmodified(self) -> Set[Path]:
return self._union_set("files_unmodified") return self._union_set("files_unmodified")
def commit(self, *, make_inconsistent=False) -> bool: def commit(self, *, make_inconsistent=False) -> bool:
res = True res = True
for sset in self: for sset in self:
@ -313,7 +313,7 @@ class AbstractCommonPaths:
@property @property
def home(self) -> P: def home(self) -> P:
return self._path_factory(self.parent.home_path) return self._path_factory(self.parent.home_path)
def from_(self, path: PathOrStr) -> P: def from_(self, path: PathOrStr) -> P:
return self._path_factory(path) return self._path_factory(path)
@ -335,7 +335,7 @@ class AbstractCommonPaths:
@property @property
def drive_c(self) -> P: def drive_c(self) -> P:
return self._path_factory("C:\\") return self._path_factory("C:\\")
@CachedProperty @CachedProperty
def my_documents(self) -> P: def my_documents(self) -> P:
""" Get the Windows "My Documents" folder """ """ Get the Windows "My Documents" folder """
@ -402,11 +402,11 @@ class AbstractCommonPaths:
raise FileNotFoundError(f"Could not detect userprofile path in wine prefix {self.wine_prefix}") raise FileNotFoundError(f"Could not detect userprofile path in wine prefix {self.wine_prefix}")
# XXX: be smarter? # XXX: be smarter?
return candidates[0] return candidates[0]
@property @property
def home(self) -> P: def home(self) -> P:
return self._path_factory(self._wine_prefix_userprofile) return self._path_factory(self._wine_prefix_userprofile)
@CachedProperty @CachedProperty
def my_documents(self) -> P: def my_documents(self) -> P:
""" Get the Windows "My Documents" folder """ """ Get the Windows "My Documents" folder """
@ -428,7 +428,7 @@ class AbstractCommonPaths:
@CachedProperty @CachedProperty
def xdg_config_dir(self) -> P: def xdg_config_dir(self) -> P:
raise NotImplementedError() raise NotImplementedError()
@CachedProperty @CachedProperty
def xdg_data_dir(self) -> P: def xdg_data_dir(self) -> P:
raise NotImplementedError() raise NotImplementedError()
@ -438,7 +438,7 @@ class CommonPaths:
class Mixin(AbstractCommonPaths.Common[Path]): class Mixin(AbstractCommonPaths.Common[Path]):
def _path_factory(self, p: PathOrStr) -> Path: def _path_factory(self, p: PathOrStr) -> Path:
return Path(p) return Path(p)
class LinuxPaths(AbstractCommonPaths.Linux[Path], Mixin): pass class LinuxPaths(AbstractCommonPaths.Linux[Path], Mixin): pass
class WindowsPaths(AbstractCommonPaths.Windows[Path], Mixin): pass class WindowsPaths(AbstractCommonPaths.Windows[Path], Mixin): pass
class WinePaths(AbstractCommonPaths.Wine[Path], Mixin): pass class WinePaths(AbstractCommonPaths.Wine[Path], Mixin): pass
@ -471,10 +471,10 @@ class CommonSyncPaths:
# Not sure why this complains. Maybe because of the **kwds? # Not sure why this complains. Maybe because of the **kwds?
super().__init__(parent=op.parent, **kwds) #type: ignore super().__init__(parent=op.parent, **kwds) #type: ignore
self.op = op self.op = op
def _path_factory(self, p: PathOrStr) -> SyncPath: def _path_factory(self, p: PathOrStr) -> SyncPath:
return SyncPath(self.op, p) return SyncPath(self.op, p)
class LinuxPaths(AbstractCommonPaths.Linux[SyncPath], Mixin): pass class LinuxPaths(AbstractCommonPaths.Linux[SyncPath], Mixin): pass
class WindowsPaths(AbstractCommonPaths.Windows[SyncPath], Mixin): pass class WindowsPaths(AbstractCommonPaths.Windows[SyncPath], Mixin): pass
class WinePaths(AbstractCommonPaths.Wine[SyncPath], Mixin): pass class WinePaths(AbstractCommonPaths.Wine[SyncPath], Mixin): pass
@ -502,7 +502,7 @@ class AbstractSyncOp(ISyncOp):
def __init__(self, parent: ISyncContext): def __init__(self, parent: ISyncContext):
self.parent = parent self.parent = parent
# Paths # Paths
@CachedProperty @CachedProperty
def paths(self) -> CommonSyncPaths.Paths: def paths(self) -> CommonSyncPaths.Paths:
@ -554,7 +554,7 @@ class SteamSyncOp(AbstractSyncOp):
def __init__(self, ssync, app): def __init__(self, ssync, app):
super().__init__(ssync) super().__init__(ssync)
self.app = app self.app = app
@CachedProperty @CachedProperty
def paths(self) -> CommonSyncPaths.Paths: def paths(self) -> CommonSyncPaths.Paths:
return CommonSyncPaths.create(self, self.app.compat_prefix if self.app.is_proton_app else None) return CommonSyncPaths.create(self, self.app.compat_prefix if self.app.is_proton_app else None)
@ -688,7 +688,7 @@ class NoSteamSync(ISyncContext):
if search_path.exists(): if search_path.exists():
return GenericFoundSyncOp(self, name, search_path) return GenericFoundSyncOp(self, name, search_path)
return AppNotFound return AppNotFound
def wine(self, name, prefixes: Sequence[PathOrStr], find: Callable[[CommonPaths.Paths], Path]) -> Union[WineSyncOp, GenericFoundSyncOp, SyncNoOp]: def wine(self, name, prefixes: Sequence[PathOrStr], find: Callable[[CommonPaths.Paths], Path]) -> Union[WineSyncOp, GenericFoundSyncOp, SyncNoOp]:
""" """
Works the same as .generic() on Windows, but additionally searches any number of Wine-Prefixes when not running on Windows Works the same as .generic() on Windows, but additionally searches any number of Wine-Prefixes when not running on Windows

@ -140,7 +140,7 @@ class App(AppInfo):
@CachedProperty @CachedProperty
def compat_path(self) -> Path: def compat_path(self) -> Path:
return self.steamapps_path / "compatdata" / str(self.appid) return self.steamapps_path / "compatdata" / str(self.appid)
@CachedProperty @CachedProperty
def compat_prefix(self) -> Path: def compat_prefix(self) -> Path:
return self.compat_path / "pfx" return self.compat_path / "pfx"
@ -463,7 +463,7 @@ class Steam:
def apps(self) -> Iterable[App]: def apps(self) -> Iterable[App]:
for lf in self.library_folders: for lf in self.library_folders:
yield from lf.apps yield from lf.apps
@overload @overload
def get_app(self, id: int, installed: Literal[True]=True) -> Optional[App]: ... def get_app(self, id: int, installed: Literal[True]=True) -> Optional[App]: ...
@overload @overload

Loading…
Cancel
Save