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

Refactor geometry (Sourcery refactored) #240

Closed
wants to merge 1 commit into from

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Oct 14, 2023

Pull Request #239 refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the refactor-geometry branch, then run:

git fetch origin sourcery/refactor-geometry
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from cleder October 14, 2023 17:42
if val == "true":
return 1
return int(float(val))
return 1 if val == "true" else int(float(val))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function PolyStyle.from_element refactored with the following changes:

Comment on lines -631 to +629
if key is None:
if key is None or key.text not in ["highlight", "normal"]:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function StyleMap.from_element refactored with the following changes:

element = cast(types.Element, config.etree.Element(config.KMLNS + "Base")) # type: ignore[attr-defined]
element = cast(types.Element, config.etree.Element(f"{config.KMLNS}Base"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function TestStdLibrary.test_base_from_element_raises refactored with the following changes:

This removes the following comments ( why? ):

# type: ignore[attr-defined]

@watermelon-copilot-for-code-review

@what-the-diff
Copy link

what-the-diff bot commented Oct 14, 2023

PR Summary

  • Modification to the strtobool function in fastkml/styles.py
    The strtobool function, which is used to convert string values into boolean values, has now been modified. Instead of giving True or False, now it will provide 1 or 0, respectively. This would make it easier for other functions to interpret.

  • Changes to the from_element method in fastkml/styles.py
    This method has been tweaked to add more validation checks. From now on, if the key provided to this method is None or if the text value of key is neither "highlight" nor "normal", it would raise an error message. This would prevent potential future issues by ensuring that inappropriate values are not passed to the function.

  • Improvement to the test_base_from_element_raises method in tests/base_test.py
    Refinement was made to how the element variable is formatted in this method. It now uses the more efficient f-string formatting. This might enhance the readability and performance of the method.

@ghost
Copy link

ghost commented Oct 14, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@cleder cleder closed this Oct 14, 2023
@cleder cleder deleted the sourcery/refactor-geometry branch October 14, 2023 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant