Interface¶
A simple tool to extract python code from a Jupyter notebook, and then run pylint on it for static analysis.
Jupylint object¶
- class jupylint.Jupylint¶
Bases:
object
The tool to extract from Jupyter notebooks and run pylint
- static get_arguments()¶
Parse keyword arguments for the tool
- static get_json_content(in_file_name)¶
Extract the json contents from the Jupyter file
- static get_code_content(json_content)¶
Extract the code blocks from the json
- static execute(args)¶
Call the chain of functions composing the tool given a set of arguments, and return the output
- static run()¶
Provide a simple function call to take user input through arguments and print the results to standard output
- __weakref__¶
list of weak references to the object (if defined)
- jupylint.main()¶
External run hook for more convenient interfacing within python
Unit tests¶
The template of the tests provided for the Jupylint package. Mostly used to provide an outline to Sphinx autodoc of the testing functionality
- class _test_template.TestJupylint(methodName='runTest')¶
Bases:
TestCase
Unit tests for the Jupylint package
- test_file_markdown_cells()¶
Check that no code is captured out of a pure markdown file
- test_file_running_code()¶
Check that code is correctly captured from a file containing code
- test_file_old_format()¶
Check that old Jupyter formats are rejected
- test_file_malformed()¶
Check that a malformed input file is correctly identified
- test_stylish_code()¶
Check that a perfectly stylish file is not penalised
- test_ugly_code()¶
Check that an ugly file is penalised
- test_no_params()¶
Check that running with no parameters fails
- test_params_input_file_valid()¶
Check that running with a valid input file works
- test_params_input_file_not_found()¶
Check that running with an invalid input file fails
- test_params_output_file()¶
Check that running with a valid output file works
- test_keep_code_file_default()¶
Check that running without the keep flag deletes the file
- test_keep_code_file_set()¶
Check that running with the keep flag doesn’t delete the file
- test_no_pylintrc_inclusion()¶
Check that not specifying a pylintrc file won’t use one
- test_pylintrc_inclusion()¶
Check that using a pylintrc file will change the output style
- test_pylintrc_not_found()¶
Check that using a non-existent pylintrc file will fail
- _test_template.get_jupylint_output(command)¶
Run a command to get its output, abstracting away error handling