def anonymize_edge_names()

in uberpoet/dotreader.py [0:0]


    def anonymize_edge_names(edges, main_app_module_name):
        # type: (List[List[str]], str) -> List[List[str]]
        """
        Makes edge names anonymous so you can send them to third parties without
        revealing the names of your modules.
        """

        # make lib_index an object to avoid a scope quirk of python with inner functions
        # https://www.codesdope.com/blog/article/nested-function-scope-of-variable-closures-in-pyth/
        lib_index = itertools.count()
        name_dict = {main_app_module_name: "DotReaderMainModule"}

        def name(orig):
            if orig not in name_dict:
                name_dict[orig] = 'DotReaderLib' + str(next(lib_index))
            return name_dict[orig]

        return [[name(left), name(right)] for left, right in edges]