8000 Allow an optional separator splitting the value and unit of the result of `ByteSize.human_readable`. by jks15satoshi · Pull Request #8706 · pydantic/pydantic · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@jks15satoshi
Copy link
Contributor
@jks15satoshi jks15satoshi commented Feb 2, 2024

Change Summary

Allow splitting the value and unit of the result of ByteSize.human_readable with a separator providing by the argument separator.

>>> size = ByteSize(12345678)
>>> size.human_readable()
'11.8MiB'
>>> size.human_readable(separator=' ')
'11.8 MiB'

Related issue number

fix #8668

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @adriangb

@codspeed-hq
Copy link
codspeed-hq bot commented Feb 2, 2024

CodSpeed Performance Report

Merging #8706 will not alter performance

Comparing jks15satoshi:main (c3c007c) with main (8898b8f)

Summary

✅ 10 untouched benchmarks

@jks15satoshi
Copy link
Contributor Author

Please review

Copy link
Contributor
@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

@jks15satoshi,

I think it'd make more sense to support a str type separator, which is an empty string by default. Could you please use that approach instead?

Thanks for your work here. Looking forward to having this new feature.

@pydantic-hooky pydantic-hooky bot added awaiting author revision awaiting changes from the PR author and removed ready for review labels Feb 2, 2024
@pydantic-hooky pydantic-hooky bot assigned jks15satoshi and unassigned adriangb Feb 2, 2024
@jks15satoshi
Copy link
Contributor Author

@jks15satoshi,

I think it'd make more sense to support a str type separator, which is an empty string by default. Could you please use that approach instead?

Thanks for your work here. Looking forward to having this new feature.

OK. Changes committed.

@jks15satoshi jks15satoshi changed the title Allow optionally separating the value and unit of the result of ByteSize.human_readable by a space character. Allow an optional separator splitting the value and unit of the result of ByteSize.human_readable. Feb 3, 2024
Copy link
Contributor
@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

Looks great, thanks! So excited to have this as a new feature in our upcoming minor release :).

@sydney-runkle sydney-runkle merged commit 28ed33f into pydantic:main Feb 6, 2024
@jks15satoshi
Copy link
Contributor Author

Looks great, thanks! So excited to have this as a new feature in our upcoming minor release :).

Thanks so much! It's my pleasure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting author revision awaiting changes from the PR author relnotes-feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ByteSize.human_readable with an optional separator (e.g. whitespace) between value and unit

3 participants

0