The user's home and each kind of directory for an application
name: make builds one by a platform's rules, and
UserDirectoriesService(home=..., config=..., ...) from an effect and
four functions (a test double, say). Every operation fails with a
PlatformError: NotFound when the home it needs is not set,
Unknown when the ConfigProvider cannot be read.
Attributes#
| Attribute | Type | Description |
|---|---|---|
home | Effect[str, PlatformError] | The current user's home directory ( |
Functions#
__init__#
__init__(*, home, config, data, cache, state) -> None| Parameter | Type | Description |
|---|---|---|
home | Effect[str, PlatformError] | |
config | Callable[[str], Effect[str, PlatformError]] | |
data | Callable[[str], Effect[str, PlatformError]] | |
cache | Callable[[str], Effect[str, PlatformError]] | |
state | Callable[[str], Effect[str, PlatformError]] |
def __init__(
self,
*,
home: Effect[str, PlatformError],
config: Callable[[str], Effect[str, PlatformError]],
data: Callable[[str], Effect[str, PlatformError]],
cache: Callable[[str], Effect[str, PlatformError]],
state: Callable[[str], Effect[str, PlatformError]],
) -> None:
require_effect(home, "home")
self._home = home
self._config = config
self._data = data
self._cache = cache
self._state = stateconfig#
config(app_name) -> Effect[str, PlatformError]Where app_name keeps its settings.
| Parameter | Type | Description |
|---|---|---|
app_name | str |
Returns Effect[str, PlatformError]
def config(self, app_name: str) -> Effect[str, PlatformError]:
"""Where ``app_name`` keeps its settings."""
return self._config(app_name)data#
data(app_name) -> Effect[str, PlatformError]Where app_name keeps data it cannot regenerate.
| Parameter | Type | Description |
|---|---|---|
app_name | str |
Returns Effect[str, PlatformError]
def data(self, app_name: str) -> Effect[str, PlatformError]:
"""Where ``app_name`` keeps data it cannot regenerate."""
return self._data(app_name)cache#
cache(app_name) -> Effect[str, PlatformError]Where app_name keeps data it can regenerate.
| Parameter | Type | Description |
|---|---|---|
app_name | str |
Returns Effect[str, PlatformError]
def cache(self, app_name: str) -> Effect[str, PlatformError]:
"""Where ``app_name`` keeps data it can regenerate."""
return self._cache(app_name)state#
state(app_name) -> Effect[str, PlatformError]Where app_name keeps logs, history and other state that is
not user data.
| Parameter | Type | Description |
|---|---|---|
app_name | str |
Returns Effect[str, PlatformError]
def state(self, app_name: str) -> Effect[str, PlatformError]:
"""Where ``app_name`` keeps logs, history and other state that is
not user data."""
return self._state(app_name)