Skip to content

Commit 56a6971

Browse files
committed
Cleanup, removed nonfunctional exception.
1 parent 4c48c8d commit 56a6971

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

c3/c3objs.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ def __init__(self, name, desc="", comment="", params=None):
3636
if isinstance(par, Quantity):
3737
self.params[pname] = par
3838
else:
39-
try:
40-
self.params[pname] = Quantity(**par)
41-
except Exception as exception:
42-
print(f"Error initializing {pname} with\n {par}")
43-
raise exception
39+
self.params[pname] = Quantity(**par)
4440

4541
def __str__(self) -> str:
4642
return hjson.dumps(self.asdict(), default=hjson_encode)
@@ -213,7 +209,7 @@ def __getitem__(self, key):
213209

214210
def __float__(self):
215211
if self.length > 1:
216-
return NotImplemented
212+
raise NotImplementedError
217213
return float(self.numpy())
218214

219215
def __repr__(self):
@@ -223,10 +219,10 @@ def __str__(self):
223219
val = self.numpy()
224220
ret = ""
225221
for entry in np.nditer(val):
226-
if self.unit != "undefined":
222+
if self.unit == "pi":
223+
ret += f"{entry} {self.unit} "
224+
elif self.unit != "undefined":
227225
ret += num3str(entry) + self.unit + " "
228-
elif self.unit == "pi":
229-
ret += num3str(entry, use_prefix=False) + self.unit + " "
230226
else:
231227
ret += num3str(entry, use_prefix=False) + " "
232228
return ret

0 commit comments

Comments
 (0)