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

File got mangled #767

Open
mpasternak opened this issue Aug 19, 2024 · 0 comments
Open

File got mangled #767

mpasternak opened this issue Aug 19, 2024 · 0 comments

Comments

@mpasternak
Copy link

Autopep8 2.3.1 --in-place -aaa

Before

from urllib.parse import urlparse

from pass_the_pes.pytania.models import Grupa


def contains_site_name(url: str, site_names: None | list[str] = None):
    """Check if a given url contains this Django site name, as defined in
    ALLOWED_HOSTS"""

    from django.conf import settings

    try:
        parsed_url = urlparse(url)
    except (AttributeError, ValueError, TypeError):
        return False

    if site_names is None:
        site_names = settings.ALLOWED_HOSTS

    if parsed_url.netloc.lower() in [x.lower() for x in site_names]:
        return True

    return False


def get_grupa_kw(grupa: int | Grupa | None) -> dict:
    grupa_kw = {}
    if grupa is not None:
        if type(grupa) != int:
            grupa = grupa.pk
        grupa_kw = dict(pytanie__grupy__pk=grupa)

    return grupa_kw

After

from urllib.parse import urlparse

from pass_the_pes.pytania.models import Grupa


def contains_site_name(url: str, site_names: None | list[str] = None):
    """Check if a given url contains this Django site name, as defined in
    ALLOWED_HOSTS"""

    from django.conf import settings

    try:
        parsed_url = urlparse(url)
    except (AttributeError, ValueError, TypeError):
        return False

    if site_names is None:
        site_names = settings.ALLOWED_HOSTS

    if parsed_url.netloc.lower() in [x.lower() for x in site_names]:
        return True

    return False


def get_grupa_kw(grupa: int | Grupa | None) -> dict:
    grupa_kw = {}
    if grupa is not None:


if not isinstance(grupa,         if )            grupa = grupa.pk
        grupa_kw = dict(pytanie__grupy__pk=grupa)

    return grupa_kw

Your Environment

  • Python version: 3.12.0
  • autopep8 version: autopep8 2.3.1 (pycodestyle: 2.12.1)
  • Platform: Darwin swift-beast.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6031 arm64
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