Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions geetools/ee_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,20 @@ def _to_dict(self, input: str) -> dict:
else desc, # Description can have multiple words
}

# The default splitting splits the description and only takes
# the first word so we need to join the trailing words dropped by the zip.
fix_description = False
if headers[-1] == "Description":
fix_description = True
Comment on lines +97 to +99
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be done in 1 line:

Suggested change
fix_description = False
if headers[-1] == "Description":
fix_description = True
fix_description = headers[-1] == "Description"

# Process each line of data after the header
for line in lines[1:]:
# Split the line by spaces, considering multiple spaces as a separator
# Handle missing values denoted by "-"
parts = line.split()
part_result = dict(zip(headers, parts))

if fix_description:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the evaluation of the fix_description could actually be done directly in the if statement with the comment associated so it's clear it's only necessary there.

part_result["Description"] = " ".join(parts[len(headers) - 1 :])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually open question, if we join them all, the other should not be affected as they are a 1 item list right ? So you might be able to simply add this mechanism to all part_results instead of just the description, avoiding the all if statement in the process.

# Populate the dictionary with values for each column
for head in headers:
result[head].append(process[head](part_result[head]))
Expand Down