Skip to content

Commit

Permalink
Merge pull request #61 from knauth/jsons-migrate
Browse files Browse the repository at this point in the history
Remove "jsons" dependency
  • Loading branch information
knauth authored Dec 19, 2024
2 parents 3a37751 + 387faff commit 243eb8d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ classifiers = [
dependencies = [
'distro==1.8.0',
'elasticsearch==8.11.0',
'jsons==1.6.3',
'pydantic>=1.2',
'pyluwen @ git+https://github.com/tenstorrent/[email protected]#subdirectory=crates/pyluwen',
'tt_tools_common @ git+https://github.com/tenstorrent/[email protected]',
Expand Down
14 changes: 12 additions & 2 deletions tt_smi/tt_smi_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import os
import re
import sys
import jsons
import datetime
from tt_smi import log
from pathlib import Path
Expand Down Expand Up @@ -208,7 +207,7 @@ def get_smbus_board_info(self, board_num: int) -> Dict:
telem_struct = pyluwen_chip.as_wh().get_telemetry()
else:
telem_struct = pyluwen_chip.as_gs().get_telemetry()
json_map = jsons.dump(telem_struct)
json_map = dict_from_public_attrs(telem_struct)
smbus_telem_dict = dict.fromkeys(constants.SMBUS_TELEMETRY_LIST)

for key, value in json_map.items():
Expand Down Expand Up @@ -561,6 +560,17 @@ def gs_tensix_reset(self, board_num) -> None:
)


def dict_from_public_attrs(obj) -> dict:
"""Parse an object's public attributes into a dictionary"""
all_attrs = obj.__dir__()
# Filter private attrs
public = [attr for attr in all_attrs if not attr.startswith("_")]
ret = {}
for attr in public:
ret[attr] = getattr(obj, attr)
return ret


# Reset specific functions


Expand Down

0 comments on commit 243eb8d

Please sign in to comment.