diff --git a/docs/_ext/github_links.py b/docs/_ext/github_links.py index 32af97186d..08f4161a01 100644 --- a/docs/_ext/github_links.py +++ b/docs/_ext/github_links.py @@ -41,10 +41,10 @@ class CodeLocator(ast.NodeVisitor): file = module_name_to_file_path(node.module) file_contents = file.read_text(encoding="utf-8") locator = CodeLocator.from_code(file_contents) - self.import_locations |= locator.import_locations - self.import_locations |= { - n: node.module for n in locator.node_line_numbers if "." not in n - } + self.import_locations.update(locator.import_locations) + self.import_locations.update( + {n: node.module for n in locator.node_line_numbers if "." not in n} + ) else: self.import_locations[alias.name] = ("." * node.level) + ( node.module or ""