This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
multipub/.pyenv/lib/python3.7/site-packages/pylint/test/functional/unnecessary_pass.py

50 lines
1.1 KiB
Python
Raw Normal View History

2019-02-09 02:45:25 -06:00
# pylint: disable=missing-docstring, too-few-public-methods
try:
A = 2
except ValueError:
A = 24
pass # [unnecessary-pass]
def docstring_only():
'''In Python, stubbed functions often have a body that contains just a
single `pass` statement, indicating that the function doesn't do
anything. However, a stubbed function can also have just a
docstring, and function with a docstring and no body also does
nothing.
'''
# This function has no docstring, so it needs a `pass` statement.
def pass_only():
pass
def docstring_and_pass():
'''This function doesn't do anything, but it has a docstring, so its
`pass` statement is useless clutter.
NEW CHECK: useless-pass
This would check for stubs with both docstrings and `pass`
statements, suggesting the removal of the useless `pass`
statements
'''
pass # [unnecessary-pass]
class DocstringOnly:
'''The same goes for class stubs: docstring, or `pass`, but not both.
'''
# No problem
class PassOnly:
pass
class DocstringAndPass:
'''Whoops! Mark this one as bad too.
'''
pass # [unnecessary-pass]