sec_parser.utils.py_utils

Attributes

MAX_THRESHOLD

Exceptions

SecParserValueError

Base exception class for sec_parser.

Functions

get_direct_subclass_of_base_class(→ type)

Given a class, find the class that is one step below

clean_whitespace(→ str)

Replace newlines and any following spaces with a single space.

normalize_string(→ str)

exceeds_capitalization_threshold(→ bool)

Calculate the percentage of capitalized letters in a given string s.

Module Contents

exception sec_parser.utils.py_utils.SecParserValueError

Bases: SecParserError, ValueError

Base exception class for sec_parser. All custom exceptions in sec_parser are inherited from this class.

sec_parser.utils.py_utils.MAX_THRESHOLD = 100.0
sec_parser.utils.py_utils.get_direct_subclass_of_base_class(cls: type, base_class: type) type

Given a class, find the class that is one step below the specified base_class in its inheritance hierarchy.

sec_parser.utils.py_utils.clean_whitespace(input_str: str) str

Replace newlines and any following spaces with a single space.

sec_parser.utils.py_utils.normalize_string(input_str: str) str
sec_parser.utils.py_utils.exceeds_capitalization_threshold(s: str, threshold: float) bool

Calculate the percentage of capitalized letters in a given string s. Only counts characters that can be capitalized (alphabetic characters).