Skip to content

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.

@floriansnow
Copy link
Contributor

Is there still interest in these changes?

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.

Script documentation: run addheader on new files via pre-commit Add configuration for addheader and provide --defaults for addheader

3 participants