SAE Teensy ECU
IIT SAE Microcontroller programming
Loading...
Searching...
No Matches
script.file_entry.FileEntry Class Reference

Represents a source file to map log calls with. More...

Public Member Functions

 __init__ (self, RawPath, FilePath, FileName, Offset)
 
None new_error (self, Exception exception, str name, str tag)
 Store an error to display later.
 
int get_new_pair_mapping (self, str tag_str, str id_str, range map_range)
 Get a new unique mapping to both a TAG and ID.
 
int get_new_tag (self, str tag_str)
 Get a new unique TAG mapping.
 
int get_new_id (self, str raw_log_level, str id_str)
 Get a new unique ID mapping.
 
str line_special (self, str line, list[str] matches)
 Format special string msg calls.
 
str line_tag (self, str line, list[str] matches)
 Format defined log tags.
 
str line_vsx (self, str line, list[str] matches)
 Format 'variable string' type log calls.
 
str line_ssx (self, str line, list[str] matches)
 Format 'string string' type log calls.
 
None map_lines (self, Callable[[str], str] function)
 Map a function to each line of this file.
 
str match_log_mapping (self, str line)
 Maps a source file line to Log related syntax.
 
None scan (self)
 Begin replacing lines for mapping log calls.
 

Public Attributes

 name
 
 path
 
 rawpath
 
 working_path
 
 offset
 
 errors
 
 modified
 
 line_vsx
 
 line_ssx
 
 line_special
 
 line_tag
 
 match_log_mapping
 

Static Public Attributes

str name = ""
 
str path = ""
 
str rawpath = ""
 
str working_path = ""
 
str offset = ""
 
bool modified = False
 
list errors [str]
 

Detailed Description

Represents a source file to map log calls with.

Definition at line 24 of file file_entry.py.

Constructor & Destructor Documentation

◆ __init__()

script.file_entry.FileEntry.__init__ (   self,
  RawPath,
  FilePath,
  FileName,
  Offset 
)

Definition at line 35 of file file_entry.py.

Member Function Documentation

◆ get_new_id()

int script.file_entry.FileEntry.get_new_id (   self,
str  raw_log_level,
str  id_str 
)

Get a new unique ID mapping.

Args: raw_log_level (str): Logging level of this tag id_str (str): raw string to store

Returns: int: uid to replace this string with

Definition at line 93 of file file_entry.py.

◆ get_new_pair_mapping()

int script.file_entry.FileEntry.get_new_pair_mapping (   self,
str  tag_str,
str  id_str,
range  map_range 
)

Get a new unique mapping to both a TAG and ID.

Args: tag_str (str): raw tag string to store id_str (str): raw id string to store

Returns: int: uid to replace these strings with

Definition at line 58 of file file_entry.py.

◆ get_new_tag()

int script.file_entry.FileEntry.get_new_tag (   self,
str  tag_str 
)

Get a new unique TAG mapping.

Args: tag_str (str): raw string to store

Returns: int: uid to replace this string with

Definition at line 75 of file file_entry.py.

◆ line_special()

str script.file_entry.FileEntry.line_special (   self,
str  line,
list[str]  matches 
)

Format special string msg calls.

Args: line (str): The line that matched this type reMatch (list[str]): The resulting regex list

Returns: str: Reformatted line

Definition at line 107 of file file_entry.py.

◆ line_ssx()

str script.file_entry.FileEntry.line_ssx (   self,
str  line,
list[str]  matches 
)

Format 'string string' type log calls.

Args: line (str): The line that matched this type reMatch (list[str]): The resulting regex list

Returns: str: Reformatted line

Definition at line 146 of file file_entry.py.

◆ line_tag()

str script.file_entry.FileEntry.line_tag (   self,
str  line,
list[str]  matches 
)

Format defined log tags.

Args: line (str): The line that matched this type reMatch (list[str]): The resulting regex list

Returns: str: Reformatted line

Definition at line 120 of file file_entry.py.

◆ line_vsx()

str script.file_entry.FileEntry.line_vsx (   self,
str  line,
list[str]  matches 
)

Format 'variable string' type log calls.

Args: line (str): The line that matched this type reMatch (list[str]): The resulting regex list

Returns: str: Reformatted line

Definition at line 133 of file file_entry.py.

◆ map_lines()

None script.file_entry.FileEntry.map_lines (   self,
Callable[[str], str]  function 
)

Map a function to each line of this file.

Args: function (Callable[[str], None]): Function that takes in a str and returns a str

Definition at line 169 of file file_entry.py.

◆ match_log_mapping()

str script.file_entry.FileEntry.match_log_mapping (   self,
str  line 
)

Maps a source file line to Log related syntax.

Args: line (str): The line to scan

Raises: ScriptException: On invalid Log related syntax

Returns: str: Reformatted line

Definition at line 192 of file file_entry.py.

◆ new_error()

None script.file_entry.FileEntry.new_error (   self,
Exception  exception,
str  name,
str  tag 
)

Store an error to display later.

Args: exception (Exception): Exception to store name (str): Name of this error tag (str): Additional tag for this error

Definition at line 48 of file file_entry.py.

◆ scan()

None script.file_entry.FileEntry.scan (   self)

Begin replacing lines for mapping log calls.

Definition at line 237 of file file_entry.py.

Member Data Documentation

◆ errors [1/2]

list script.file_entry.FileEntry.errors [str]
static

Definition at line 33 of file file_entry.py.

◆ errors [2/2]

script.file_entry.FileEntry.errors

Definition at line 44 of file file_entry.py.

◆ line_special

script.file_entry.FileEntry.line_special

Definition at line 214 of file file_entry.py.

◆ line_ssx

script.file_entry.FileEntry.line_ssx

Definition at line 212 of file file_entry.py.

◆ line_tag

script.file_entry.FileEntry.line_tag

Definition at line 215 of file file_entry.py.

◆ line_vsx

script.file_entry.FileEntry.line_vsx

Definition at line 210 of file file_entry.py.

◆ match_log_mapping

script.file_entry.FileEntry.match_log_mapping

Definition at line 239 of file file_entry.py.

◆ modified [1/2]

bool script.file_entry.FileEntry.modified = False
static

Definition at line 32 of file file_entry.py.

◆ modified [2/2]

script.file_entry.FileEntry.modified

Definition at line 189 of file file_entry.py.

◆ name [1/2]

str script.file_entry.FileEntry.name = ""
static

Definition at line 27 of file file_entry.py.

◆ name [2/2]

script.file_entry.FileEntry.name

Definition at line 39 of file file_entry.py.

◆ offset [1/2]

str script.file_entry.FileEntry.offset = ""
static

Definition at line 31 of file file_entry.py.

◆ offset [2/2]

script.file_entry.FileEntry.offset

Definition at line 43 of file file_entry.py.

◆ path [1/2]

str script.file_entry.FileEntry.path = ""
static

Definition at line 28 of file file_entry.py.

◆ path [2/2]

script.file_entry.FileEntry.path

Definition at line 40 of file file_entry.py.

◆ rawpath [1/2]

str script.file_entry.FileEntry.rawpath = ""
static

Definition at line 29 of file file_entry.py.

◆ rawpath [2/2]

script.file_entry.FileEntry.rawpath

Definition at line 41 of file file_entry.py.

◆ working_path [1/2]

str script.file_entry.FileEntry.working_path = ""
static

Definition at line 30 of file file_entry.py.

◆ working_path [2/2]

script.file_entry.FileEntry.working_path

Definition at line 42 of file file_entry.py.


The documentation for this class was generated from the following file: