flake8 pre-commit failing in settings

105 views
Skip to first unread message

Javier Marcon

unread,
Nov 6, 2023, 4:47:46 PM11/6/23
to django...@googlegroups.com
Hello, the documetation tells us to import all oscar defaults in the setting file

from oscar.defaults import *

The problem with that is that it makes flake8 pre-commit to fail.

flake8...................................................................Failed
- hook id: flake8
- exit code: 1

config/settings/base.py:8:1: F403 'from oscar.defaults import *' used; unable to detect undefined names
config/settings/base.py:8:1: F401 'oscar.defaults.*' imported but unused

Did you find a way to import it in a linter friendly way?

Thanks,

Javier.


Ben Stähli

unread,
Nov 6, 2023, 6:44:43 PM11/6/23
to django...@googlegroups.com
either you know exactly what you want to import, or you'll use # noqa -
that's what I did most of the times. nothing that I'm proud of, but it
works.

or, maybe a bit better: from oscar import defaults as oscar_defaults,
and then use oscar_defaults.xy in your code?
> --
> https://github.com/django-oscar/django-oscar
> http://django-oscar.readthedocs.org/en/latest/
> ---
> You received this message because you are subscribed to the Google
> Groups "django-oscar" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to django-oscar...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/django-oscar/08985e7e-6cea-43ab-a035-846a1170e6ef%40gmail.com
> .

--
Ben Stähli
bnzk GmbH | +41 22 575 25 77 | bnzk.ch
--
Reply all
Reply to author
Forward
0 new messages