INNER CODE UNIT · Python

calculate_line_id

mpenning/ciscoconfparse · ciscoconfparse/ccp_abc.py:237

    def calculate_line_id(self):
        """
        Calculate and return an integer line_id for BaseCfgLine()

        The `hash()` of `self.text` is used to build a numerical identity
        for a given BaseCfgLine().

        Do NOT cache this value.  It must be recalculated when self._text
        changes.
        """
        indent = self.indent

        # Do NOT make changes to _line_id.  This hash() value built from
        #     _line_id is the glue that holds `ciscoconfparse.HDiff()`
        #     together.
        _line_id = hash(" " * indent + " ".join(self.text.strip().split()))

        if bool([]): # Do not execute this code...

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…