INNER CODE UNIT · Python

__hash__

KwaiAppTeam/KOOM · koom-common/kwai-android-base/src/main/cpp/fmtlib/support/docopt.py:37

    def __hash__(self):
        return hash(repr(self))

    def fix(self):
        self.fix_identities()
        self.fix_repeating_arguments()
        return self

    def fix_identities(self, uniq=None):
        """Make pattern-tree tips point to same object if they are equal."""
        if not hasattr(self, 'children'):
            return self
        uniq = list(set(self.flat())) if uniq is None else uniq
        for i, child in enumerate(self.children):
            if not hasattr(child, 'children'):
                assert child in uniq
                self.children[i] = uniq[uniq.index(child)]
            else:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…