Skip to content

Commit

Permalink
#573: verified that no bug is actually present but made stylistic cha…
Browse files Browse the repository at this point in the history
…nges nonetheless
  • Loading branch information
ppebay committed Dec 26, 2024
1 parent c575f9b commit 10383a9
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/lbaf/IO/lbsVTDataReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ def __init__(

def _get_n_ranks(self):
"""Determine the number of ranks automatically.
This use the first applicable method in the following methods:
List all data file names matching {file_prefix}.{rank_id}.{file_suffix} pattern and return max(rank_id) + 1.
This uses the first applicable method in the following methods:
List all data file names matching {file_prefix}.{rank_id}.{file_suffix}
pattern and return max(rank_id) + 1.
"""

# or default detect data files with pattern
Expand Down Expand Up @@ -198,7 +198,7 @@ def _load_vt_file(self, rank_id: int):

# Return rank ID and data dictionary
return rank_id, decompressed_dict

Check notice on line 201 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Trailing whitespace (trailing-whitespace)
def _populate_rank(self, phase_id: int, rank_id: int) -> Tuple[Rank,dict]:

Check notice on line 202 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Too many local variables (38/15) (too-many-locals)

Check notice on line 202 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Too many branches (18/12) (too-many-branches)

Check notice on line 202 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Too many statements (63/50) (too-many-statements)
""" Populate rank and its communicator in phase using the JSON content."""

Expand All @@ -224,9 +224,9 @@ def _populate_rank(self, phase_id: int, rank_id: int) -> Tuple[Rank,dict]:
self.__logger.debug(
f"Loading phase {curr_phase_id} for rank {rank_id}")

# Add communications to the object
# Add communications when available
rank_comm = {}
if (communications := phase.get("communications")): # pylint:disable=W0631:undefined-loop-variable
if (communications := phase.get("communications")):

Check warning on line 229 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Using possibly undefined loop variable 'phase' (undefined-loop-variable)
if phase_id in self.__communications_dict:
self.__communications_dict[phase_id][rank_id] = communications
else:
Expand Down Expand Up @@ -263,6 +263,7 @@ def _populate_rank(self, phase_id: int, rank_id: int) -> Tuple[Rank,dict]:
for k, v in comm.items():
self.__logger.debug(f"{k}: {v}")
else:
# No communications for this phase
self.__communications_dict.setdefault(phase_id, {rank_id: {}})

# Instantiante rank for current phase
Expand All @@ -273,11 +274,11 @@ def _populate_rank(self, phase_id: int, rank_id: int) -> Tuple[Rank,dict]:
rank_blocks, task_user_defined = {}, {}

# Iterate over tasks
for task in phase.get("tasks", []): # pylint:disable=W0631:undefined-loop-variable
for task in phase.get("tasks", []):

Check warning on line 277 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Using possibly undefined loop variable 'phase' (undefined-loop-variable)
# Retrieve required values
task_entity = task.get("entity")
task_id = task_entity.get("id", None)
task_seq_id = task_entity.get("seq_id", None)
task_id = task_entity.get("id")
task_seq_id = task_entity.get("seq_id")
task_load = task.get("time")
task_user_defined = task.get("user_defined", {})
subphases = task.get("subphases")
Expand Down

0 comments on commit 10383a9

Please sign in to comment.