Skip to content

Commit

Permalink
rename var
Browse files Browse the repository at this point in the history
  • Loading branch information
zmezei committed Jul 3, 2023
1 parent 746146c commit 0bf470f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/uagents/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ def _refresh_schema_cache(model: Type["Model"]):
@staticmethod
def build_schema_digest(model: Union["Model", Type["Model"]]) -> str:
orig_descriptions: Dict[str, Union[str, Dict]] = {}
obj_for_descr_remove = model if isinstance(model, type) else model.__class__
Model._remove_descriptions(obj_for_descr_remove, orig_descriptions)
type_obj = model if isinstance(model, type) else model.__class__
Model._remove_descriptions(type_obj, orig_descriptions)
digest = (
hashlib.sha256(
model.schema_json(indent=None, sort_keys=True).encode("utf8")
)
.digest()
.hex()
)
Model._restore_descriptions(obj_for_descr_remove, orig_descriptions)
Model._refresh_schema_cache(obj_for_descr_remove)
Model._restore_descriptions(type_obj, orig_descriptions)
Model._refresh_schema_cache(type_obj)
return f"model:{digest}"


Expand Down

0 comments on commit 0bf470f

Please sign in to comment.