Skip to content

Commit 47cd27c

Browse files
committed
Improve docstrings
1 parent e94b88e commit 47cd27c

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

src/zeusops_bot/errors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,30 @@ class ZeusopsBotException(Exception):
88

99

1010
class ZeusopsBotConfigException(ZeusopsBotException):
11-
"""The bot's config itself is wrong somehow"""
11+
"""The Discord bot config itself is wrong somehow"""
1212

1313
pass
1414

1515

1616
class BadConfigFileException(ZeusopsBotException):
17-
"""The config file given is incorrect somehow"""
17+
"""The Reforger config file given is incorrect somehow"""
1818

1919
pass
2020

2121

2222
class ConfigFileNotFound(BadConfigFileException):
23-
"""The config file was not found at given path"""
23+
"""The Reforger config file was not found at given path"""
2424

2525
pass
2626

2727

2828
class ConfigFileInvalidJson(BadConfigFileException):
29-
"""The config file was found but isn't valid JSON"""
29+
"""The Reforger config file was found but isn't valid JSON"""
3030

3131
pass
3232

3333

3434
class ConfigPatchingError(BadConfigFileException):
35-
"""The config file patching didn't work"""
35+
"""The Reforger config file patching didn't work"""
3636

3737
pass

src/zeusops_bot/reforger_config_gen.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ class ReforgerConfigGenerator:
2424
"""Manages Arma Reforger config.json for variations of modlist/scenario"""
2525

2626
def __init__(self, base_config_file: Path, target_folder: Path):
27-
"""Instantiate a config generator with the base config to use"""
27+
"""Instantiate a config generator with the base config to use
28+
29+
Args:
30+
base_config_file: The filename of a reference Reforger config
31+
target_folder: The folder to place generated config files in
32+
"""
2833
self.base_config = base_config_file
2934
self.target_dest = target_folder
3035

@@ -109,6 +114,10 @@ def current_mission(self) -> str:
109114
110115
Returns:
111116
Currently active mission name
117+
118+
Raises:
119+
ConfigFileNotFound: Mission symlink was found but points to a
120+
non-existent mission.
112121
"""
113122
symlink_path = self.target_dest / SYMLINK_FILENAME
114123
target = symlink_path.readlink()
@@ -145,7 +154,20 @@ def patch_file(source: dict, modlist: list[ModDetail] | None, scenario_id: str)
145154

146155

147156
def extract_mods(modlist: str | None) -> list[ModDetail] | None:
148-
"""Extracts a list of ModDetail entries from a mod list exported from Reforger."""
157+
"""Extracts a list of ModDetail entries from a mod list exported from Reforger
158+
159+
Args:
160+
modlist: A partial JSON string of mods to extract. Can be None if the
161+
user did not provide any mods, in which case the operation is a
162+
no-op.
163+
164+
Raises:
165+
pydantic.ValidationError: Generic error in validating the mod list
166+
ConfigFileInvalidJson: The input was not valid JSON
167+
168+
Returns:
169+
A list of ModDetail, or None if the input was None.
170+
"""
149171
if modlist is None:
150172
return None
151173
modlist = f"[{modlist}]"

0 commit comments

Comments
 (0)