Skip to content

Commit 5d4339c

Browse files
committed
chore: Update .gitignore and gamedata.py
The .gitignore file was updated to exclude the .vscode directory. In gamedata.py, the formatting was improved and unnecessary line breaks were removed.
1 parent 9362e89 commit 5d4339c

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ temp
55
.DS_Store
66

77
config.py
8+
.vscode

blueprints/gamedata.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Misc endpoints to return gamedata (e.g. entitlements, limited uses)
33
"""
4+
45
from flask import Blueprint, request
56

67
from gamedata.compendium import compendium
@@ -39,10 +40,8 @@ def get_limited_use():
3940
@gamedata.route("spells", methods=["GET"])
4041
def get_spells():
4142
"""Returns a list of valid entities for use in building a Cast Spell node in the automation builder."""
42-
return success(
43-
{f"{t['name']} ({t['source']})": t["id"] for t in compendium.raw_spells}
44-
)
45-
43+
return success({f"{t['name']} ({t['source']})": t["id"] for t in compendium.raw_spells})
44+
4645

4746
@gamedata.route("describable", methods=["GET"])
4847
def get_describables():

lib/validation.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Pydantic automation validation.
33
"""
4+
45
from __future__ import annotations
56

67
from collections import defaultdict
@@ -43,21 +44,26 @@ def parse_validation_error(data: Union[Dict, List], the_error: ValidationError)
4344
error_location = (" -> ".join(map(str, error["loc"][i + 1 :]))).replace("__root__", "root")
4445

4546
# add the error to the list of errors on this key
46-
error_dict[cur_key].append(f"""
47+
error_dict[cur_key].append(
48+
f"""
4749
<li>
4850
<em>{error_location}</em> — {error['msg'].capitalize()}
4951
</li>
50-
""")
52+
"""
53+
)
5154

5255
title = f"{len(errors)} validation errors in {len(error_dict)} object"
5356

54-
error_list = [f"""
57+
error_list = [
58+
f"""
5559
<p class='validation-error-item'>
5660
<strong>{name[:50]}</strong>
5761
</p>
5862
<ul class='validation-error-list'>
5963
{''.join(loc)}
6064
</ul>
61-
""" for name, loc in error_dict.items()]
65+
"""
66+
for name, loc in error_dict.items()
67+
]
6268

6369
return f"<h3 class='validation-error-header'>{title}</h3>\n" + "\n".join(error_list)

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ wheel==0.36.2 # dep install
2222

2323
# pre-commit & formatting deps
2424
pre-commit==2.17.0
25-
black==22.1.0
25+
black==24.8.0

0 commit comments

Comments
 (0)