diff --git a/tests/test_app_path.py b/tests/test_app_path.py index 6ec525a..8f878ef 100644 --- a/tests/test_app_path.py +++ b/tests/test_app_path.py @@ -13,27 +13,27 @@ def test_all(): print("-- app dirs (with optional 'version')") - dirs = app_path.AppPath(_app_name, _app_author, app_version="1.0") + dirs = app_path.AppPath(_app_name, _app_author, app_version="1.0", ensure_existence=False) for prop in props: print("%s: %s" % (prop, getattr(dirs, prop))) def test_no_ver(): print("\n-- app dirs (without optional 'version')") - dirs = app_path.AppPath(_app_name, _app_author) + dirs = app_path.AppPath(_app_name, _app_author, ensure_existence=False) for prop in props: print("%s: %s" % (prop, getattr(dirs, prop))) def test_author(): print("\n-- app dirs (without optional '_app_author')") - dirs = app_path.AppPath(_app_name) + dirs = app_path.AppPath(_app_name, ensure_existence=False) for prop in props: print("%s: %s" % (prop, getattr(dirs, prop))) def test_no_author(): print("\n-- app dirs (with disabled '_app_author')") - dirs = app_path.AppPath(_app_name, app_author=False) + dirs = app_path.AppPath(_app_name, app_author=False, ensure_existence=False) for prop in props: print("%s: %s" % (prop, getattr(dirs, prop))) diff --git a/warg/app_path.py b/warg/app_path.py index 68e3719..8e05288 100644 --- a/warg/app_path.py +++ b/warg/app_path.py @@ -37,7 +37,7 @@ def ensure_existence(enabled, out): out.mkdir(parents=True) @property - def user_data(self): + def user_data(self) -> pathlib.Path: out = self.user_data_path( self._app_name, self._app_author, version=self._app_version, roaming=self._roaming ) @@ -46,7 +46,7 @@ def user_data(self): return out @property - def site_data(self): + def site_data(self) -> pathlib.Path: out = self.site_data_path( self._app_name, self._app_author, version=self._app_version, multi_path=self._multi_path ) @@ -56,7 +56,7 @@ def site_data(self): return out @property - def user_config(self): + def user_config(self) -> pathlib.Path: out = self.user_config_path( self._app_name, self._app_author, version=self._app_version, roaming=self._roaming ) @@ -64,7 +64,7 @@ def user_config(self): return out @property - def site_config(self): + def site_config(self) -> pathlib.Path: out = self.site_config_path( self._app_name, self._app_author, version=self._app_version, multi_path=self._multi_path ) @@ -72,25 +72,25 @@ def site_config(self): return out @property - def user_cache(self): + def user_cache(self) -> pathlib.Path: out = self.user_cache_path(self._app_name, self._app_author, version=self._app_version) self.ensure_existence(self._ensure_existence, out) return out @property - def user_state(self): + def user_state(self) -> pathlib.Path: out = self.user_state_path(self._app_name, self._app_author, version=self._app_version) self.ensure_existence(self._ensure_existence, out) return out @property - def user_log(self): + def user_log(self) -> pathlib.Path: out = self.user_log_path(self._app_name, self._app_author, version=self._app_version) self.ensure_existence(self._ensure_existence, out) return out @staticmethod - def user_data_path(app_name=None, app_author=None, version=None, roaming=False): + def user_data_path(app_name=None, app_author=None, version=None, roaming=False) -> pathlib.Path: r"""Return full path to the user-specific data dir for this application. "app_name" is the name of application. @@ -154,7 +154,7 @@ def user_data_path(app_name=None, app_author=None, version=None, roaming=False): return path @staticmethod - def site_data_path(app_name=None, app_author=None, version=None, multi_path=False): + def site_data_path(app_name=None, app_author=None, version=None, multi_path=False) -> pathlib.Path: r"""Return full path to the user-shared data dir for this application. "app_name" is the name of application. @@ -221,7 +221,7 @@ def site_data_path(app_name=None, app_author=None, version=None, multi_path=Fals return path @staticmethod - def user_config_path(app_name=None, app_author=None, version=None, roaming=False): + def user_config_path(app_name=None, app_author=None, version=None, roaming=False) -> pathlib.Path: r"""Return full path to the user-specific config dir for this application. "app_name" is the name of application. @@ -265,7 +265,7 @@ def user_config_path(app_name=None, app_author=None, version=None, roaming=False return path @staticmethod - def site_config_path(app_name=None, app_author=None, version=None, multi_path=False): + def site_config_path(app_name=None, app_author=None, version=None, multi_path=False) -> pathlib.Path: r"""Return full path to the user-shared data dir for this application. "app_name" is the name of application. @@ -322,7 +322,7 @@ def site_config_path(app_name=None, app_author=None, version=None, multi_path=Fa return path @staticmethod - def user_cache_path(app_name=None, app_author=None, version=None, opinion=True): + def user_cache_path(app_name=None, app_author=None, version=None, opinion=True) -> pathlib.Path: r"""Return full path to the user-specific cache dir for this application. "appname" is the name of application. @@ -380,7 +380,7 @@ def user_cache_path(app_name=None, app_author=None, version=None, opinion=True): return path @staticmethod - def user_state_path(app_name=None, app_author=None, version=None, roaming=False): + def user_state_path(app_name=None, app_author=None, version=None, roaming=False) -> pathlib.Path: r"""Return full path to the user-specific state dir for this application. "app_name" is the name of application. @@ -422,7 +422,7 @@ def user_state_path(app_name=None, app_author=None, version=None, roaming=False) return path @staticmethod - def user_log_path(app_name=None, app_author=None, version=None, opinion=True): + def user_log_path(app_name=None, app_author=None, version=None, opinion=True) -> pathlib.Path: r"""Return full path to the user-specific log dir for this application. "app_name" is the name of application. @@ -478,24 +478,22 @@ def user_log_path(app_name=None, app_author=None, version=None, opinion=True): props = ("user_data", "user_config", "user_cache", "user_state", "user_log", "site_data", "site_config") - print("-- app dirs %s --" % __version__) - print("-- app dirs (with optional 'version')") - dirs = AppPath(_app_name, _app_author, app_version="1.0") + dirs = AppPath(_app_name, _app_author, app_version="1.0", ensure_existence=False) for prop in props: print("%s: %s" % (prop, getattr(dirs, prop))) print("\n-- app dirs (without optional 'version')") - dirs = AppPath(_app_name, _app_author) + dirs = AppPath(_app_name, _app_author, ensure_existence=False) for prop in props: print("%s: %s" % (prop, getattr(dirs, prop))) print("\n-- app dirs (without optional '_app_author')") - dirs = AppPath(_app_name) + dirs = AppPath(_app_name, ensure_existence=False) for prop in props: print("%s: %s" % (prop, getattr(dirs, prop))) print("\n-- app dirs (with disabled '_app_author')") - dirs = AppPath(_app_name, app_author=False) + dirs = AppPath(_app_name, app_author=False, ensure_existence=False) for prop in props: print("%s: %s" % (prop, getattr(dirs, prop))) diff --git a/warg/version.py b/warg/version.py index 42381dd..609a5cd 100644 --- a/warg/version.py +++ b/warg/version.py @@ -5,7 +5,7 @@ from warnings import warn __author__ = "cnheider" -__version__ = "0.1.2" +__version__ = "0.1.4" __version_info__ = tuple(int(segment) for segment in __version__.split(".")) __doc__ = """ Created on 27/04/2019