aboutsummaryrefslogtreecommitdiff
path: root/trappy/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'trappy/base.py')
-rw-r--r--trappy/base.py11
1 files changed, 4 insertions, 7 deletions
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 @@ class Base(object):
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 @@ class Base(object):
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