Revert "trappy: Optimize integer conversion in generate_data_dict"
This reverts commit c0a49a16d85ef5b732fafe02faad73c67df7b665.
diff --git a/trappy/base.py b/trappy/base.py
index 3c4c7bd..4f06af2 100644
--- a/trappy/base.py
+++ b/trappy/base.py
@@ -179,12 +179,6 @@
self.line_array.append(line)
self.data_array.append(data)
- def conv_to_int(self, value):
- # Handle false-positives for negative numbers
- if value.lstrip("-").isdigit():
- value = int(value)
- return value
-
def generate_data_dict(self, data_str):
data_dict = {}
prev_key = None
@@ -196,7 +190,10 @@
data_dict[prev_key] += ' ' + field
continue
(key, value) = field.split('=', 1)
- value = self.conv_to_int(value)
+ try:
+ value = int(value)
+ except ValueError:
+ pass
data_dict[key] = value
prev_key = key
return data_dict