Skip to content

Commit

Permalink
arrays and list will no only log the first 3 values
Browse files Browse the repository at this point in the history
  • Loading branch information
uliw committed Dec 9, 2020
1 parent a42c5c3 commit c324ddf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions esbmtk/esbmtk.org
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class esbmtkBase():
else:
self.mo.lmo.append(self.name)
setattr(builtins, self.name, self)

logging.info(self)

def __validateinput__(self, kwargs: Dict[str, any]) -> None:
Expand Down Expand Up @@ -284,26 +284,31 @@ class esbmtkBase():
tdiff = time.monotonic() - self.reg_time

# do not echo input unless explicitly requestted


m = f"{self.__class__.__name__}(\n"
for k, v in self.provided_kwargs.items():
if not isinstance({k}, esbmtkBase):
# check if this is not another esbmtk object
if "esbmtk" in str(type(v)):
m = m + f" {k} = {v.n},\n"
# if this is a string
elif isinstance(v, str):
m = m + f" {k} = '{v}',\n"
# if this is a quantity
elif isinstance(v, Q_):
m = m + f" {k} = '{v}',\n"
# if this is a list
elif isinstance(v, (list, np.ndarray)):
m = m + f" {k} = '{v[0:3]}',\n"
# all other cases
else:
m = m + f" {k} = {v},\n"

m = m + ")"

#if tdiff < 1:
# m = ""

return m

def __str__(self, **kwargs):
Expand Down

0 comments on commit c324ddf

Please sign in to comment.