Skip to content

Commit a9e54a3

Browse files
committed
docs: add docstrings
Signed-off-by: Abhijeet Saharan <abhijeetsaharan2236@gmail.com>
1 parent ade7c18 commit a9e54a3

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

application/defs/cheatsheet_defs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ def __post_init__(self):
7878
raise ValueError(
7979
"CheatsheetRecord: metadata keys and values must be strings, "
8080
f"got {key!r}: {value!r}"
81-
)
81+
)

application/utils/external_project_parsers/parsers/cheatsheet_extractor.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import os
22
import re
3+
34
from application.defs.cheatsheet_defs import CheatsheetRecord
45

56
PARSER_VERSION = "v1"
67
FALLBACK_USED = "false"
8+
79
CANONICAL_BASE_URL = "https://cheatsheetseries.owasp.org/cheatsheets/"
810

911
_TITLE_RE = re.compile(r"^#\s+(?P<title>.+)$", re.MULTILINE)
@@ -51,6 +53,7 @@ def _extract_summary(markdown: str) -> str:
5153

5254
if body:
5355
return body
56+
5457
break
5558

5659
for match in all_heading_matches:
@@ -59,7 +62,9 @@ def _extract_summary(markdown: str) -> str:
5962
if body:
6063
return body
6164

62-
raise ValueError("_extract_summary: no summary could be extracted from markdown.")
65+
raise ValueError(
66+
"_extract_summary: no summary could be extracted from markdown."
67+
)
6368

6469

6570
def extract_cheatsheet_record(
@@ -90,4 +95,4 @@ def extract_cheatsheet_record(
9095
"parser_version": PARSER_VERSION,
9196
"fallback_used": FALLBACK_USED,
9297
},
93-
)
98+
)

0 commit comments

Comments
 (0)