You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromurllib.parseimporturlparsefrompass_the_pes.pytania.modelsimportGrupadefcontains_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"""fromdjango.confimportsettingstry:
parsed_url=urlparse(url)
except (AttributeError, ValueError, TypeError):
returnFalseifsite_namesisNone:
site_names=settings.ALLOWED_HOSTSifparsed_url.netloc.lower() in [x.lower() forxinsite_names]:
returnTruereturnFalsedefget_grupa_kw(grupa: int|Grupa|None) ->dict:
grupa_kw= {}
ifgrupaisnotNone:
iftype(grupa) !=int:
grupa=grupa.pkgrupa_kw=dict(pytanie__grupy__pk=grupa)
returngrupa_kw
After
fromurllib.parseimporturlparsefrompass_the_pes.pytania.modelsimportGrupadefcontains_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"""fromdjango.confimportsettingstry:
parsed_url=urlparse(url)
except (AttributeError, ValueError, TypeError):
returnFalseifsite_namesisNone:
site_names=settings.ALLOWED_HOSTSifparsed_url.netloc.lower() in [x.lower() forxinsite_names]:
returnTruereturnFalsedefget_grupa_kw(grupa: int|Grupa|None) ->dict:
grupa_kw= {}
ifgrupaisnotNone:
ifnotisinstance(grupa, if ) grupa=grupa.pkgrupa_kw=dict(pytanie__grupy__pk=grupa)
returngrupa_kw
Autopep8 2.3.1 --in-place -aaa
Before
After
Your Environment
The text was updated successfully, but these errors were encountered: