-
Notifications
You must be signed in to change notification settings - Fork 9
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 code improvements from Kokroo #280
Conversation
The Path() constructor already handles both str and Path types effectively.
Added a check to ensure the provided suffix starts with a dot (.), which is standard for file extensions. This prevents the creation of invalid file paths with malformed suffixes (e.g., .txt vs txt). Path(should_be_path).with_suffix(suffix) is directly applied, reducing the number of steps.
Combined checks for str, int, and tuple into a single isinstance call using a tuple of types. This reduces redundancy, improves clarity and performance . The TypeError is preserved to handle unsupported types. Added the correct return type (str).
This function is no longer needed.
The intersection() method can deal with arbitrary objects but it is not needed here since we coerce everything into a string. The & operator works at a lower level and is faster and sufficient for strings
Improvements: Avoid unnecessary double conversions to sets: Previously, set(a_sorted) and set(b_sorted) were resorted. The optimized code directly converts sequence_a and sequence_b into sets for fast lookups, creates a union using the low level "|" operator and then creates a sorted set. Sorting is performed only once on the union of the sets (a_set | b_set), rather than sorting a_sorted, b_sorted, and their combined union separately. Simplified membership checking: The if conditions now directly check the presence of an item in the sets instead of redundant checks. Removed unreachable error check: The raise ValueError condition is unnecessary since all items in all_items are guaranteed to come from either a_set or b_set. The input-output behavior remains consistent while achieving faster execution.
Readability and branching Improvements
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #280 +/- ##
===========================================
- Coverage 92.30% 92.01% -0.29%
===========================================
Files 6 6
Lines 442 426 -16
===========================================
- Hits 408 392 -16
Misses 34 34 ☔ View full report in Codecov by Sentry. |
@danielfromearth I just noticed that I didn't follow the branch naming scheme correctly. It should have started with "feature". Cheers! |
@kokroo, It's totally fine the way you did it! Because of branch protection rules, I (or another admin) will need to create the destination's feature branch in this repository. Happy Holidays! |
This PR is a secondary step for a merge from a repository fork, in Pull Request #264. After merging the external fork to a NASA feature branch, this current PR from a NASA feature branch to
develop
runs the complete CI workflow.📚 Documentation preview 📚: https://ncompare--280.org.readthedocs.build/en/280/