Skip to content

Commit

Permalink
[FIX] Python3 compatibility, pyyaml warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
janstrohbeck committed Oct 29, 2019
1 parent 729352d commit 9f00fd7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions git-cmake-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def requiresFormat(fileName, f_type, project):
def load_project_config(filename):
with open(filename, 'r') as f:
try:
return yaml.load(f)
return yaml.load(f, Loader=yaml.SafeLoader)
except yaml.YAMLError as exc:
print("Could not read project YAML file!")
print(filename)
Expand Down Expand Up @@ -262,9 +262,9 @@ def load_project_config(filename):
project["formattable_files"] = {}
project["source_files"] = {}
for f_type, patterns in formatter_patterns.items():
project["formattable_files"][f_type] = filter(_matchesPattern(patterns), EditedFiles)
project["formattable_files"][f_type] = list(filter(_matchesPattern(patterns), EditedFiles))
for f_type, patterns in linter_patterns.items():
project["source_files"][f_type] = filter(_matchesPattern(patterns), EditedFiles)
project["source_files"][f_type] = list(filter(_matchesPattern(patterns), EditedFiles))
total_len = lambda _dict: sum([len(l) for l in _dict.values()])
projects = filter(lambda p: total_len(p["source_files"]) > 0 or total_len(p["formattable_files"]) > 0, projects)

Expand Down

0 comments on commit 9f00fd7

Please sign in to comment.