Skip to content

Commit 2a5598a

Browse files
authored
Merge pull request #89 from TaekyungHeo/docstring-jun
Update docstring to comply with coding style and max column length
2 parents 2795e98 + dea4a9e commit 2a5598a

29 files changed

+86
-139
lines changed

src/cloudai/_core/base_system_parser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ class BaseSystemParser(ABC):
2525
Parses system configuration data and creates system objects.
2626
2727
Methods
28-
parse: Abstract method to parse configuration data and return a
29-
System object.
28+
parse: Abstract method to parse configuration data and return a System object.
3029
"""
3130

3231
@abstractmethod

src/cloudai/_core/grader.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ class Grader:
2727
2828
Attributes
2929
output_path (str): The path where the performance results are stored.
30-
logger (logging.Logger): Logger for the class, used to log messages
31-
related to the grading process.
30+
logger (logging.Logger): Logger for the class, used to log messages related to the grading process.
3231
"""
3332

3433
def __init__(self, output_path: str) -> None:
@@ -42,8 +41,7 @@ def grade(self, test_scenario: TestScenario) -> str:
4241
generates a comprehensive weighted report.
4342
4443
Args:
45-
test_scenario (TestScenario): The test scenario containing multiple
46-
tests to grade.
44+
test_scenario (TestScenario): The test scenario containing multiple tests to grade.
4745
4846
Returns:
4947
str: A report summarizing the weighted performance grades.
@@ -94,8 +92,7 @@ def _generate_report(self, test_perfs: Dict[str, List[float]], overall_avg: floa
9492
Generate a human-readable report from test performance metrics.
9593
9694
Args:
97-
test_perfs (Dict[str, List[float]]): The performance metrics for
98-
each test.
95+
test_perfs (Dict[str, List[float]]): The performance metrics for each test.
9996
overall_avg (float): The overall average performance.
10097
10198
Returns:

src/cloudai/_core/grading_strategy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ def grade(self, directory_path: str, ideal_perf: float) -> float:
2626
Grades the performance of a test.
2727
2828
Args:
29-
directory_path (str): Path to the directory containing the
30-
test's output.
29+
directory_path (str): Path to the directory containing the test's output.
3130
ideal_perf (float): The ideal performance value for comparison.
3231
3332
Returns:

src/cloudai/_core/parser.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ def parse(self) -> Tuple[System, List[TestTemplate], TestScenario]:
8181
Parse configurations for system, test templates, and test scenarios.
8282
8383
Returns
84-
Tuple[System, List[TestTemplate], TestScenario]: A tuple containing
85-
the system object, a list of test template objects, and the test scenario
86-
object.
84+
Tuple[System, List[TestTemplate], TestScenario]: A tuple containing the system object, a list of test
85+
template objects, and the test scenario object.
8786
"""
8887
system_parser = SystemParser(self.system_config_path)
8988
system = system_parser.parse()

src/cloudai/_core/system.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ class System(ABC):
2222
2323
Attributes
2424
name (str): Unique name of the system.
25-
scheduler (str): Type of scheduler used by the system, determining
26-
the specific subclass of System to be used.
25+
scheduler (str): Type of scheduler used by the system, determining the specific subclass of System to be used.
2726
output_path (str): Path to the output directory.
2827
monitor_interval (int): Interval in seconds for monitoring jobs.
2928
"""
@@ -54,12 +53,10 @@ def __repr__(self) -> str:
5453
Provide a detailed string representation of the System instance, including all its attributes.
5554
5655
Returns
57-
str: String representation of the system including name, scheduler,
58-
output_path, and monitor_interval.
56+
str: String representation of the system including name, scheduler, output_path, and monitor_interval.
5957
"""
6058
return (
61-
f"System(name='{self.name}', scheduler='{self.scheduler}', "
62-
f"output_path='{self.output_path}', "
59+
f"System(name='{self.name}', scheduler='{self.scheduler}', output_path='{self.output_path}', "
6360
f"monitor_interval={self.monitor_interval})"
6461
)
6562

src/cloudai/_core/system_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class SystemParser:
2525
Parser for parsing system configurations.
2626
2727
Attributes
28-
_parsers (Dict[str, Type[BaseSystemParser]]): A mapping from system
29-
types to their corresponding parser classes.
28+
_parsers (Dict[str, Type[BaseSystemParser]]): A mapping from system types to their corresponding parser
29+
classes.
3030
file_path (str): The file path to the system configuration file.
3131
"""
3232

src/cloudai/_core/test_parser.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ class TestParser(BaseMultiFileParser):
2424
Parser for Test objects.
2525
2626
Attributes
27-
test_template_mapping (Dict[str, TestTemplate]): Mapping of test template
28-
names to TestTemplate objects.
27+
test_template_mapping (Dict[str, TestTemplate]): Mapping of test template names to TestTemplate objects.
2928
"""
3029

3130
__test__ = False
@@ -40,8 +39,7 @@ def __init__(
4039
4140
Args:
4241
directory_path (str): Path to the directory containing test data.
43-
test_template_mapping (Dict[str, TestTemplate]): Mapping of test
44-
template names to TestTemplate objects.
42+
test_template_mapping (Dict[str, TestTemplate]): Mapping of test template names to TestTemplate objects.
4543
"""
4644
super().__init__(directory_path)
4745
self.test_template_mapping: Dict[str, TestTemplate] = test_template_mapping
@@ -99,12 +97,11 @@ def _flatten_template_dict_keys(self, nested_args: Dict[str, Any], parent_key: s
9997
"""
10098
Recursively flattens the nested dictionary structure from the test template.
10199
102-
Includes keys with 'default' and 'values' as valid keys, while ignoring
103-
keys that specifically end with 'default' or 'values'.
100+
Includes keys with 'default' and 'values' as valid keys, while ignoring keys that specifically end with
101+
'default' or 'values'.
104102
105103
Args:
106-
nested_args (Dict[str, Any]): Nested argument structure from the test
107-
template.
104+
nested_args (Dict[str, Any]): Nested argument structure from the test template.
108105
parent_key (str): Parent key for nested arguments.
109106
110107
Returns:
@@ -132,8 +129,7 @@ def _validate_args(self, args: Dict[str, Any], valid_keys: Set[str]) -> None:
132129
133130
Args:
134131
args (Dict[str, Any]): Arguments provided in the TOML configuration.
135-
valid_keys (Set[str]): Set of valid keys from the flattened template
136-
arguments.
132+
valid_keys (Set[str]): Set of valid keys from the flattened template arguments.
137133
138134
Raises:
139135
ValueError: If an argument is not defined in the TestTemplate's arguments.

src/cloudai/_core/test_scenario.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ def pretty_print(self) -> str:
6060
for dep_type, dependency in test.dependencies.items():
6161
if dependency:
6262
s += (
63-
f" {dep_type.replace('_', ' ').title()}: "
64-
f"{dependency.test.section_name}, "
63+
f" {dep_type.replace('_', ' ').title()}: {dependency.test.section_name}, "
6564
f"Time: {dependency.time} seconds"
6665
)
6766
else:

src/cloudai/_core/test_scenario_parser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ def _parse_dependencies_for_test(
138138
Args:
139139
section (str): Section name of the test.
140140
test_info (Dict[str, Any]): Information of the test.
141-
section_tests (Dict[str, Test]): Mapping of section names to Test
142-
objects.
141+
section_tests (Dict[str, Test]): Mapping of section names to Test objects.
143142
144143
Returns:
145144
Dict[str, Optional[TestDependency]]: Parsed dependencies for the test.

src/cloudai/_core/test_template_strategy.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ def _override_env_vars(
129129
130130
Args:
131131
default_env_vars (Dict[str, str]): The default environment variables.
132-
provided_env_vars (Dict[str, str]): The provided environment variables
133-
to override defaults.
132+
provided_env_vars (Dict[str, str]): The provided environment variables to override defaults.
134133
135134
Returns:
136135
Dict[str, str]: A dictionary of environment variables with overrides applied.
@@ -149,8 +148,7 @@ def _override_cmd_args(
149148
150149
Args:
151150
default_cmd_args (Dict[str, str]): The default command-line arguments.
152-
provided_cmd_args (Dict[str, str]): The provided command-line arguments
153-
to override defaults.
151+
provided_cmd_args (Dict[str, str]): The provided command-line arguments to override defaults.
154152
155153
Returns:
156154
Dict[str, str]: A dictionary of command-line arguments with overrides applied.

0 commit comments

Comments
 (0)