Skip to content

Commit db15af2

Browse files
committed
Apply suggestions
1 parent 68ee36f commit db15af2

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

tools/metrics/metrics.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def parse_metrics(metrics_text):
4343
- Works regardless of # HELP / # TYPE order
4444
- Captures # UNIT metadata if present
4545
"""
46-
import re, logging
4746

4847
lines = metrics_text.splitlines()
4948

tools/property-extractor/property_extractor.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def get_files_with_properties(file_pairs, treesitter_parser, cpp_language):
8787
def transform_files_with_properties(files_with_properties):
8888
type_transformer = TypeTransformer()
8989
transformers = [
90-
TypeTransformer(),
9190
EnterpriseTransformer(), ## this must be the first, as it modifies current data
91+
TypeTransformer(),
9292
MetaParamTransformer(),
9393
BasicInfoTransformer(),
9494
IsNullableTransformer(),
@@ -129,12 +129,16 @@ def transform_files_with_properties(files_with_properties):
129129
def merge_properties_and_definitions(properties, definitions):
130130
for name in properties:
131131
property = properties[name]
132-
133-
if property["type"] in definitions:
134-
properties[name]["type"] = "#/definitions/" + property["type"]
135-
elif property["type"] == "array" and property["items"]["type"] in definitions:
132+
# guard against missing "type"
133+
prop_type = property.get("type")
134+
if prop_type and prop_type in definitions:
135+
properties[name]["type"] = f"#/definitions/{prop_type}"
136+
elif (
137+
prop_type == "array"
138+
and property.get("items", {}).get("type") in definitions
139+
):
136140
properties[name]["items"]["type"] = (
137-
"#/definitions/" + property["items"]["type"]
141+
f"#/definitions/{property['items']['type']}"
138142
)
139143

140144
return dict(properties=properties, definitions=definitions)

0 commit comments

Comments
 (0)