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

Merge pull request #605 from iKostanOrg/master #606

Merged
merged 8 commits into from
Jan 2, 2025
Merged

Merge pull request #605 from iKostanOrg/master #606

merged 8 commits into from
Jan 2, 2025

Conversation

ikostan
Copy link
Member

@ikostan ikostan commented Jan 2, 2025

  • Merge from master
  • Conversion between Kilobyte and KibiByte

Summary by Sourcery

New Features:

  • Implement conversion between kilobytes (kB) and kibibytes (KiB).

@ikostan ikostan added documentation Improvements or additions to documentation codewars kyu_6 labels Jan 2, 2025
@ikostan ikostan self-assigned this Jan 2, 2025
Copy link
Contributor

sourcery-ai bot commented Jan 2, 2025

Reviewer's Guide by Sourcery

This pull request implements the "Conversion between Kilobyte and KibiByte" kata and merges changes from the master branch. The implementation involves creating a conversion function that handles various memory size units (kB, MB, GB, TB, KiB, MiB, GiB, TiB) and performs the conversion with appropriate rounding. A helper function extracts the unit and conversion ratio from the input string. The solution also includes unit tests to verify the correctness of the implementation.

Sequence diagram for memory size conversion process

sequenceDiagram
    participant Client
    participant Converter
    participant UnitExtractor

    Client->>Converter: memorysize_conversion('10 KiB')
    Converter->>UnitExtractor: unit_extractor('10 KiB')
    UnitExtractor-->>Converter: return ('kB', 1.024)
    Converter->>Converter: Convert value using ratio
    Converter->>Converter: Format result
    Converter-->>Client: return '10.24 kB'
Loading

Class diagram for memory size conversion implementation

classDiagram
    class MemorySizeConverter {
        +UNITS: dict
        +memorysize_conversion(memory_size: str) -> str
        +unit_extractor(memory_size: str) -> tuple
    }
    note for MemorySizeConverter "UNITS dictionary maps between
KiB/kB units and their conversion ratios"
Loading

File-Level Changes

Change Details Files
Implementation of the "Conversion between Kilobyte and Kibibyte" kata.
  • Added memorysize_conversion function to convert between kB and KiB units.
  • Added unit_extractor helper function to extract unit and conversion ratio.
  • Created unit tests for the conversion function.
  • Added a README file explaining the kata and solution.
  • Added documentation files for the solution.
  • Updated the list of completed kata in the main README file to include the new kata and link to the solution on GitHub
kyu_6/conversion_between_kilobyte_and_kibibyte/solution.py
kyu_6/conversion_between_kilobyte_and_kibibyte/test_memory_size_conversion.py
kyu_6/conversion_between_kilobyte_and_kibibyte/README.md
kyu_6/conversion_between_kilobyte_and_kibibyte/__init__.py
docs/kyu_6/kyu_6.conversion_between_kilobyte_and_kibibyte.module.rst
docs/kyu_6/kyu_6.conversion_between_kilobyte_and_kibibyte.readme.rst
docs/kyu_6/kyu_6.conversion_between_kilobyte_and_kibibyte.rst
Merged changes from the master branch.
  • Updated the list of completed kata in the main README file to reflect the merge from master.
  • Added a new entry for the "Conversion between Kilobyte and KibiByte" kata to the list of completed kata in the main README file with a link to the solution on GitHub
kyu_6/README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

We have skipped reviewing this pull request. Here's why:

  • We don't review packaging changes - Let us know if you'd like us to change this.
  • All of the files are larger than we can process. We're working on it!

Copy link

codeclimate bot commented Jan 2, 2025

Code Climate has analyzed commit ffb0bdd and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 90.5% (0.0% change).

View more on Code Climate.

/kyu_6/conversion_between_kilobyte_and_kibibyte/solution.py:52:28: W292 no newline at end of file
    return units, convertor                           ^
./kyu_6/conversion_between_kilobyte_and_kibibyte/test_memory_size_conversion.py:65:17: E131 continuation line unaligned for hanging indent
                "<li>10 KiB -> 10.24 kB</li>"
                ^
./kyu_6/conversion_between_kilobyte_and_kibibyte/test_memory_size_conversion.py:65:46: W291 trailing whitespace
                "<li>10 KiB -> 10.24 kB</li>"
                                             ^
./kyu_6/conversion_between_kilobyte_and_kibibyte/test_memory_size_conversion.py:66:45: W291 trailing whitespace
                "<li>1 kB -> 0.977 KiB</li>"
                                            ^
./kyu_6/conversion_between_kilobyte_and_kibibyte/test_memory_size_conversion.py:67:46: W291 trailing whitespace
                "<li>10 TB -> 9.095 TiB</li>"
./kyu_6/conversion_between_kilobyte_and_kibibyte/test_memory_size_conversion.py:65:17: E131 continuation line unaligned for hanging indent
                "<li>10 KiB -> 10.24 kB</li>"
                ^
./kyu_6/conversion_between_kilobyte_and_kibibyte/test_memory_size_conversion.py:66:45: W291 trailing whitespace
                "<li>1 kB -> 0.977 KiB</li>"
Using config file /home/runner/work/codewars/codewars/.pylintrc
************* Module kyu_6.rotate_the_letters_of_each_element.group_cities
kyu_6/rotate_the_letters_of_each_element/group_cities.py:1:0: R0801: Similar lines in 2 files
==kyu_6.a_rule_of_divisibility_by_13.test_thirt:[16:21]
==kyu_6.conversion_between_kilobyte_and_kibibyte.test_memory_size_conversion:[18:23]
@allure.epic('6 kyu')
@allure.parent_suite('Novice')
@allure.suite("Fundamentals")
@allure.sub_suite("Unit Tests")
@allure.feature("Math") (duplicate-code)
@ikostan
Copy link
Member Author

ikostan commented Jan 2, 2025

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ikostan - I've reviewed your changes - here's some feedback:

Overall Comments:

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ikostan ikostan merged commit 092a71a into master Jan 2, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codewars documentation Improvements or additions to documentation kyu_6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant