Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.pygments.modeline Namespace Reference

Functions

 get_filetype_from_line (l)
 
 get_filetype_from_buffer (buf, max_lines=5)
 

Variables

 modeline_re = re.compile(, re.VERBOSE)
 

Detailed Description

    pygments.modeline
    ~~~~~~~~~~~~~~~~~

    A simple modeline parser (based on pymodeline).

    :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.

Function Documentation

◆ get_filetype_from_buffer()

get_filetype_from_buffer (   buf,
  max_lines = 5 
)
Scan the buffer for modelines and return filetype if one is found.

Definition at line 28 of file modeline.py.

28def get_filetype_from_buffer(buf, max_lines=5):
29 """
30 Scan the buffer for modelines and return filetype if one is found.
31 """
32 lines = buf.splitlines()
33 for l in lines[-1:-max_lines-1:-1]:
34 ret = get_filetype_from_line(l)
35 if ret:
36 return ret
37 for i in range(max_lines, -1, -1):
38 if i < len(lines):
39 ret = get_filetype_from_line(lines[i])
40 if ret:
41 return ret
42
43 return None
for i

References pip._vendor.pygments.modeline.get_filetype_from_line(), and i.

Here is the call graph for this function:

◆ get_filetype_from_line()

get_filetype_from_line (   l)

Definition at line 22 of file modeline.py.

22def get_filetype_from_line(l):
24 if m:
25 return m.group(1)
26
27

References i.

Referenced by pip._vendor.pygments.modeline.get_filetype_from_buffer().

Here is the caller graph for this function:

Variable Documentation

◆ modeline_re

modeline_re = re.compile(, re.VERBOSE)

Definition at line 16 of file modeline.py.