Skip to content

Commit d23f263

Browse files
committed
Add docstring
1 parent 2575284 commit d23f263

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

schema_salad/dlang_codegen.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ def parse(self, items: List[Dict[str, Any]]) -> None:
405405

406406

407407
def is_constant_field(field: Dict[str, Any]) -> bool:
408+
"""Return True if a given field only takes the specified string."""
408409
jsonld_pred = field.get("jsonldPredicate", None)
409410
type_ = field["type"]
410411
if (
@@ -424,12 +425,14 @@ def is_constant_field(field: Dict[str, Any]) -> bool:
424425

425426

426427
def constant_fields_of(type_: Any) -> Set[str]:
428+
"""Return a list of constant fields name from a given record schema."""
427429
if isinstance(type_, dict):
428430
return set(shortname(f["name"]) for f in type_.get("fields", []) if is_constant_field(f))
429431
return set()
430432

431433

432434
def are_dispatchable(types: List[Any], parent_has_idmap: bool) -> bool:
435+
"""Return True if a given list of types are dispatchable."""
433436
if any(t for t in types if not isinstance(t, dict)):
434437
return False
435438
constants = (constant_fields_of(t) for t in types)

0 commit comments

Comments
 (0)