Current File : //usr/local/apps/python3/lib/python3.11/idlelib/__pycache__/codecontext.cpython-311.opt-1.pyc |
�
�Ke�, � � � d Z ddlZddlmZ ddlmZmZmZ ddl m
Z
mZ ddlm
Z
h d�Z ej d� � fd �Zd
� Z G d� d� � Ze� � � ed
k rddlmZ eddd�� � dS dS )a� codecontext - display the block context above the edit window
Once code has scrolled off the top of a window, it can be difficult to
determine which block you are in. This extension implements a pane at the top
of each IDLE edit window which provides block structure hints. These hints are
the lines which contain the block opening keywords, e.g. 'if', for the
enclosing block. The number of hint lines is determined by the maxlines
variable in the codecontext section of config-extensions.def. Lines which do
not open blocks are not shown in the context hints pane.
For EditorWindows, <<toggle-code-context>> is bound to CodeContext(self).
toggle_code_context_event.
� N)�maxsize)�Frame�Text�TclError)�NSEW�SUNKEN)�idleConf> �if�def�for�try�elif�else�with�async�class�while�except�finallyz^(\s*)(\w*)c �P � |� | � � � � � S )z>Extract the beginning whitespace and first word from codeline.)�match�groups)�codeline�cs �=/usr/local/apps/python3/lib/python3.11/idlelib/codecontext.py�get_spaces_firstwordr s � ��7�7�8���#�#�%�%�%� c � � t | � � \ }}t |� � }t | � � |k s| | dk rt }|t v o|}|| |fS )z�Return tuple of (line indent value, codeline, block start keyword).
The indentation of empty lines (or comment lines) is INFINITY.
If the line does not start a block, the keyword value is False.
�#)r �len�INFINITY�BLOCKOPENERS)r �spaces� firstword�indent�openers r �
get_line_infor'