This page was generated from tests/data/notebooks/notebook_with_out_flake8_tags.ipynb. Interactive online version: # noqa: E501
This notebook demonstrates flake8_nb
reporting
The next cell should report F401 'not_a_package' imported but unused
[1]:
import not_a_package
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-d9fbe3554078> in <module>
----> 1 import not_a_package
ModuleNotFoundError: No module named 'not_a_package'
The next cell should report E231 missing whitespace after ':'
[2]:
{"1":1}
[2]:
{'1': 1}
The next cell should not be reported, since it is valid syntax
[3]:
def func():
return "foo"
The next cell should not be reported, since it is valid syntax
[4]:
class Bar:
def foo(self):
return "foo"
The next cell should be ignored in the generated intermediate *.py
file since it is empty
[ ]:
The next cell should report E231 missing whitespace after ':'
[5]:
{"1":1}
[5]:
{'1': 1}
Report using execution count
[6]:
!flake8_nb notebook_with_out_flake8_tags.ipynb
notebook_with_out_flake8_tags.ipynb#In[1]:1:1: F401 'not_a_package' imported but unused
notebook_with_out_flake8_tags.ipynb#In[2]:1:5: E231 missing whitespace after ':'
notebook_with_out_flake8_tags.ipynb#In[5]:1:5: E231 missing whitespace after ':'
Report using code cell count
[7]:
!flake8_nb --notebook-cell-format '{nb_path}:code_cell#{code_cell_count}' notebook_with_out_flake8_tags.ipynb
'notebook_with_out_flake8_tags.ipynb:code_cell#1':1:1: F401 'not_a_package' imported but unused
'notebook_with_out_flake8_tags.ipynb:code_cell#2':1:5: E231 missing whitespace after ':'
'notebook_with_out_flake8_tags.ipynb:code_cell#6':1:5: E231 missing whitespace after ':'
Report using total cell count
[8]:
!flake8_nb --notebook-cell-format '{nb_path}:cell#{total_cell_count}' notebook_with_out_flake8_tags.ipynb
'notebook_with_out_flake8_tags.ipynb:cell#3':1:1: F401 'not_a_package' imported but unused
'notebook_with_out_flake8_tags.ipynb:cell#5':1:5: E231 missing whitespace after ':'
'notebook_with_out_flake8_tags.ipynb:cell#14':1:5: E231 missing whitespace after ':'