mirror of
https://github.com/django/django.git
synced 2025-01-03 06:55:47 +00:00
Refs #29942 -- Fixed docs build on Python < 3.9 avoiding dict union operator.
The docs build process was failing on djangoproject.com since it uses Python 3.8 and the dict union operator was added in Python 3.9.
This commit is contained in:
parent
480ccf9055
commit
15fff62d5d
@ -41,10 +41,10 @@ class CodeLocator(ast.NodeVisitor):
|
|||||||
file = module_name_to_file_path(node.module)
|
file = module_name_to_file_path(node.module)
|
||||||
file_contents = file.read_text(encoding="utf-8")
|
file_contents = file.read_text(encoding="utf-8")
|
||||||
locator = CodeLocator.from_code(file_contents)
|
locator = CodeLocator.from_code(file_contents)
|
||||||
self.import_locations |= locator.import_locations
|
self.import_locations.update(locator.import_locations)
|
||||||
self.import_locations |= {
|
self.import_locations.update(
|
||||||
n: node.module for n in locator.node_line_numbers if "." not in n
|
{n: node.module for n in locator.node_line_numbers if "." not in n}
|
||||||
}
|
)
|
||||||
else:
|
else:
|
||||||
self.import_locations[alias.name] = ("." * node.level) + (
|
self.import_locations[alias.name] = ("." * node.level) + (
|
||||||
node.module or ""
|
node.module or ""
|
||||||
|
Loading…
Reference in New Issue
Block a user