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

Inconsistance of code when doing sorting of routes and tags #416

Open
azdolinski opened this issue May 10, 2024 · 0 comments
Open

Inconsistance of code when doing sorting of routes and tags #416

azdolinski opened this issue May 10, 2024 · 0 comments

Comments

@azdolinski
Copy link

In case when you have all router with lowercase letters.... and we add some router called "urlscraper", + uppercase tag like "URLScraper", this will cause inconsistrance between routers and tags arrays which cause mismatch between route and file name (generated based on tags names).
Python sorted tags in lexicographical (alphabetical) order, 'U', will comes before the lowercase letters and become on first element in the array.
In case of routes you using lower() function for tags and that cause inconsistence.

    routers = sorted(
        [re.sub(TITLE_PATTERN, '_', tag.strip()).lower() for tag in sorted_tags]
    )

fix:

    sorted_tags = sorted(set(all_tags), key=lambda x: x.lower())

then both arrays (routers and sorted_tags) will be sorted in sam way.

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

No branches or pull requests

1 participant