File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1076,15 +1076,12 @@ def format(
10761076 ** kwargs : t .Any ,
10771077 ) -> bool :
10781078 """Format all SQL models and audits."""
1079- unformatted_file_paths = []
1080- format_targets = {** self ._models , ** self ._audits }
1081-
1082- for target in format_targets .values ():
1083- if target ._path is None or target ._path .suffix != ".sql" :
1084- continue
1085- if paths and not any (target ._path .samefile (p ) for p in paths ):
1086- continue
1087-
1079+ filtered_targets = [
1080+ target for target in self ._models .values () | self ._audits .values ()
1081+ if target ._path is not None and target ._path .suffix == ".sql"
1082+ and (not paths or any (target ._path .samefile (p ) for p in paths ))
1083+ ]
1084+ for target in filtered_targets :
10881085 with open (target ._path , "r+" , encoding = "utf-8" ) as file :
10891086 before = file .read ()
10901087 expressions = parse (before , default_dialect = self .config_for_node (target ).dialect )
You can’t perform that action at this time.
0 commit comments