Answers for "about # noqa nopep8 etc."

0

about # noqa nopep8 etc.

#ref: https://www.overcoded.net/noqa-python-501210/
# noqa stands for no quality assurance. It tells code-analysis software to ignore warnings. 
# noqa has evolved from the # nopep8 syntax used in previous releases of flake8
# noqa is supported by IDEs, like PyCharm, for use with their built-in code inspection tools.
# noqa can be used as a pre-commit directive, such that prior to new commits an inspection process must complete
# noqa can be used to ignore all warnings or given specific warnings to ignore. For example, # noqa: F401 will ignore an unused imported module warning.
# noqa: <error>, e.g., # noqa: E234 at the end: ignore specific errors on a line
	# multiple error codes can be given, separated by comma
	# the colon before the list of codes is required
# e.g.
import os  # noqa
print("Hello, world!")

# This will ignore all warnings. However, if one were only to want to ignore a specific warning (PEP8 F401 imported but not used), it could be done as such:

import os  # noqa: F401
print("Hello, world!")
Posted by: Guest on May-15-2021

Python Answers by Framework

Browse Popular Code Answers by Language