Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for a one-line representation in mf_pformat_dict() #1667

Merged
merged 3 commits into from
Feb 10, 2025
Merged

Conversation

plypaul
Copy link
Contributor

@plypaul plypaul commented Feb 7, 2025

This PR enables small objects with a short string representation to be formatted on one line.

@cla-bot cla-bot bot added the cla:yes label Feb 7, 2025
@plypaul plypaul marked this pull request as ready for review February 7, 2025 02:55
@plypaul plypaul requested a review from a team as a code owner February 7, 2025 02:55
total_value_length += len(value_str)

one_line_length = (
len(description or "") + 1 + 2 + 2 * len(str_converted_dict) + total_key_length + total_value_length

Choose a reason for hiding this comment

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

what is this + 1 + 2 + 2? what do you think about making them variables or constants to make it clear what is their purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They're the lengths of the required () and , . But seeing as it's hard to read, I've updated it to a simpler approach.

Base automatically changed from p--misc--02 to main February 10, 2025 20:43
@plypaul plypaul merged commit d7d8be9 into main Feb 10, 2025
11 checks passed
@plypaul plypaul deleted the p--misc--03 branch February 10, 2025 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants