Auto generated documentation

Plugin

Plugin for gedit that allow flake8 integration

author:Sébastien CHAZALLET <s.chazallet@gmail.com>
organization:InsPyration EURL
copyright:Copyright © InsPyration EURL <www.inspyration.org>
license:GPL 3 <http://www.gnu.org/licenses/gpl.html>
version:0.1

Integrated

Module used to manage the results of flake8 :

> 1. get them instead of print them ; > 2. format them ;

This module works with Python2 and Python3

author:Sébastien CHAZALLET <s.chazallet@gmail.com>
organization:InsPyration EURL
copyright:Copyright © InsPyration EURL <www.inspyration.org>
license:GPL 3 <http://www.gnu.org/licenses/gpl.html>
version:0.1
flake8_integration.integrated._format_flake8_results(warnings)[source]

Function used to extract useful informations from flake8 results

Parameters:warnings (str) – Warnings generated by flake8
Return type:list
Returns:list of (code:str, line:int, col:int, description:str)
>>> result = _format_flake8_results(
...     '''stdin:1:10: E901 SyntaxError: unexpected EOF while parsing
...     stdin:2:1: E901 TokenError: EOF in multi-line statement''')
>>> for r in result:
...     print r
...
(' e901', 1, 10, 'SyntaxError: unexpected EOF while parsing')
(' e901', 2, 1, 'TokenError: EOF in multi-line statement')
flake8_integration.integrated._intercept_printed(action, *args, **kwargs)[source]

Function used to redirect printed to returned value

Parameters:action (function) – Called function that we intercept prints
Return type:str
Returns:all that was printed by the call of action
>>> def do():
...     print('Hello World')
...
>>> result = _intercept_printed(do)
>>> print(result)
Hello World
flake8_integration.integrated.check_code_and_get_formated_result(code, ignore=(), complexity=-1)[source]

Function used to return the printed result of flake8 check_code function

>>> result = check_code_with_flake8("a = 42")
>>> print(result)

>>> result = check_code_with_flake8("a = f(42")
>>> print(result)
stdin:1:10: E901 SyntaxError: unexpected EOF while parsing
stdin:2:1: E901 TokenError: EOF in multi-line statement

Window activatable

Main module of the Plugin for gedit that allow flake8 integration

author:Sébastien CHAZALLET <s.chazallet@gmail.com>
organization:InsPyration EURL
copyright:Copyright © InsPyration EURL <www.inspyration.org>
license:GPL 3 <http://www.gnu.org/licenses/gpl.html>
version:0.1
class flake8_integration.windowactivatable.GeditFlake8WindowActivatable[source]

Main module of the gedit flake8 plugin

__init__()[source]

Initialize plugin

Parameters:action (function) – Called function that we intercept prints
Return type:None
do_activate()[source]

Activate the plugin

Parameters:self (GeditFlake8WindowActivatable) – Current plugin
Return type:None
do_create_configure_widget()[source]

Action when a user want to configure the plugin

Parameters:self (GeditFlake8WindowActivatable) – Current plugin
Return type:GeditFlake8ConfigWidget
Returns:a configuration widget
do_deactivate()[source]

Deactivate the plugin

Parameters:self (GeditFlake8WindowActivatable) – Current plugin
Return type:None
do_update_state()[source]

Allow to activate the plugin only if the document is python code If the document is a new document, it hasto be saved or the language of the document has to be set.

Parameters:self (GeditFlake8WindowActivatable) – Current plugin
Return type:None
on_check_source_code(action)[source]

The user ask to check code source : 1check there is a doc and the doc is python code 2use flake8 3put flake8 results into the tree and activate it

Parameters:
  • self (GeditFlake8WindowActivatable) – Current plugin
  • action (Gtk.Action) – Called function that we intercept prints
Return type:

None

Tree

Module managing the tree and all stuff around it

author:Sébastien CHAZALLET <s.chazallet@gmail.com>
organization:InsPyration EURL
copyright:Copyright © InsPyration EURL <www.inspyration.org>
license:GPL 3 <http://www.gnu.org/licenses/gpl.html>
version:0.1
class flake8_integration.tree.GeditFlake8Tree(window)[source]

Tree inside gedit side panel containing all flake8 warnings

__init__(window)[source]

Configure tree columns, tree selection and add it to side panel

Parameters:
  • self (GeditFlake8Tree) – Current tree
  • window (Gedit.Window) – GEdit window object
Return type:

None

activate()[source]

show the tree in the side panel

Parameters:self (GeditFlake8Tree) – Current tree
Return type:None
on_tree_selection(selection)[source]

When a tree line is selected, go to the file linked line

Parameters:
  • self (GeditFlake8Tree) – Current tree
  • selection (Gtk.TreeSelection) – Current selection
Return type:

None

remove()[source]

remove the tree from the side panel

Parameters:self (GeditFlake8Tree) – Current tree
Return type:None
update_model(datas)[source]

Update the tree with new datas

Parameters:
  • self (GeditFlake8Tree) – Current tree
  • datas (list) – list of ready to use (str, int, int, str) tuples
Return type:

None

Settings

Module used to define how to manage settings and their persistence

author:Sébastien CHAZALLET <s.chazallet@gmail.com>
organization:InsPyration EURL
copyright:Copyright © InsPyration EURL <www.inspyration.org>
license:GPL 3 <http://www.gnu.org/licenses/gpl.html>
version:0.1
class flake8_integration.settings.SettingsManager[source]

Allow to manage local settings and it persistent storage

__init__()[source]

Initialize Settings Manager

Parameters:self (SettingsManager) – Current manager
Return type:None
__weakref__

list of weak references to the object (if defined)

get_complexity()[source]

Get the user defined complexity parameter

Parameters:self (SettingsManager) – Current manager
Return type:int
Returns:complexity
get_complexity_key()[source]

Allow to share information about key used to store complexity

Parameters:self (SettingsManager) – Current manager
Return type:str
Returns:name of the complexity key
get_ignore_items()[source]

Allow to share information about keys used to store ignore list

Parameters:self (SettingsManager) – Current manager
Return type:list of tuple of str
Returns:list of (ignore key, ignore label)
get_ignore_keys()[source]

Allow to share information about keys used to store ignore list

Parameters:self (SettingsManager) – Current manager
Return type:list of str
Returns:list of ignore keys
get_ignore_list()[source]

Get the user defined warning keys to ignore

Parameters:self (SettingsManager) – Current manager
Return type:list of str
Returns:list of warning keys
is_in_ignore_list(key)[source]

Answer to “Is tag in ignore list ?” question

Parameters:
  • self (SettingsManager) – Current manager
  • key (str) – flake8 key as defined in FLAKE8_IGNORED_KEYS
Return type:

bool

Returns:

True if the key is in ignore list, False otherwise

pull_settings()[source]

Pull operation update local settings from persistent storage

Parameters:self (SettingsManager) – Current manager
Return type:None
push_settings()[source]

Push operation allow persistent storage update from local settings

Parameters:self (SettingsManager) – Current manager
Return type:None
update_setting(values={})[source]

Updating settings allow to update local and persistent settings

Parameters:
  • self (SettingsManager) – Current manager
  • values (dict) – values to store persistently
Return type:

None

Configuration

Module used to configure plugin from an easy-to-use widget

author:Sébastien CHAZALLET <s.chazallet@gmail.com>
organization:InsPyration EURL
copyright:Copyright © InsPyration EURL <www.inspyration.org>
license:GPL 3 <http://www.gnu.org/licenses/gpl.html>
version:0.1
class flake8_integration.configuration.GeditFlake8ConfigWidget(settings)[source]
__init__(settings)[source]

Initialize the configuration widget from SettingsManager properties

Parameters:
  • self (GeditFlake8ConfigWidget) – Current widget
  • settings (SettingsManager) – Object used to define all configurable properties
Return type:

None

on_configure_destroy(widget)[source]

Called when the widget is destroyed

Parameters:
  • self (GeditFlake8ConfigWidget) – Current widget
  • widget (GeditFlake8ConfigWidget) – Current widget
Return type:

None

Status

This plugin is under active development.

Table Of Contents

Previous topic

Welcome to gedit Flake8 integration’s documentation!

This Page