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

Default values for reuse annotate, enabling a pre-commit hook #761

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

carmenbianca
Copy link
Member

Fixes #68
Fixes #534

WIP

@carmenbianca carmenbianca force-pushed the annotate-hook branch 2 times, most recently from 54c2a92 to 12ec884 Compare June 17, 2023 10:36
# precedence.
for o_path, options in self.override_annotate_options.items():
o_path = Path(o_path).expanduser()
if path.is_relative_to(o_path):
Copy link
Member Author

Choose a reason for hiding this comment

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

Apparently this method doesn't exist in Python ≤3.8.

Copy link

Choose a reason for hiding this comment

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

I think it can be replaced with relative_to, which exists in 3.8 though. From the 3.9 source:

    def is_relative_to(self, *other):
        """Return True if the path is relative to another path or False.
        """
        try:
            self.relative_to(*other)
            return True
        except ValueError:
            return False

In newer versions both functions are based on with_segments which doesn't exist in 3.8 or 3.9 yet.

Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants