Skip to content

Commit 416729d

Browse files
committed
Run black on template.py
1 parent cbbeae5 commit 416729d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

docxtpl/template.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -887,34 +887,36 @@ def save(self, filename: Union[IO[bytes], str, PathLike], *args, **kwargs) -> No
887887
self.is_saved = True
888888

889889
def get_undeclared_template_variables(
890-
self, jinja_env: Optional[Environment] = None, context: Optional[Dict[str, Any]] = None
890+
self,
891+
jinja_env: Optional[Environment] = None,
892+
context: Optional[Dict[str, Any]] = None,
891893
) -> Set[str]:
892894
# Create a temporary document to analyze the template without affecting the current state
893895
temp_doc = Document(self.template_file)
894-
896+
895897
# Get XML from the temporary document
896898
xml = self.xml_to_string(temp_doc._element.body)
897899
xml = self.patch_xml(xml)
898-
900+
899901
# Add headers and footers
900902
for uri in [self.HEADER_URI, self.FOOTER_URI]:
901903
for relKey, val in temp_doc._part.rels.items():
902904
if (val.reltype == uri) and (val.target_part.blob):
903905
_xml = self.xml_to_string(parse_xml(val.target_part.blob))
904906
xml += self.patch_xml(_xml)
905-
907+
906908
if jinja_env:
907909
env = jinja_env
908910
else:
909911
env = Environment()
910-
912+
911913
parse_content = env.parse(xml)
912914
all_variables = meta.find_undeclared_variables(parse_content)
913-
915+
914916
# If context is provided, return only variables that are not in the context
915917
if context is not None:
916918
provided_variables = set(context.keys())
917919
return all_variables - provided_variables
918-
920+
919921
# If no context provided, return all variables (original behavior)
920-
return all_variables
922+
return all_variables

0 commit comments

Comments
 (0)