Skip to content

Commit 746c585

Browse files
jvanmalderjvanmalder
andauthored
strip before checking for empty value (#54)
Co-authored-by: jvanmalder <[email protected]>
1 parent eb41fec commit 746c585

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

redisgraph_bulk_loader/entity_file.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,15 @@ def typed_prop_to_binary(prop_val, prop_type):
115115
def inferred_prop_to_binary(prop_val):
116116
# All format strings start with an unsigned char to represent our prop_type enum
117117
format_str = "=B"
118+
119+
# Remove leading and trailing whitespace
120+
prop_val = prop_val.strip()
121+
118122
if prop_val == "":
119123
# An empty string indicates a NULL property.
120124
# TODO This is not allowed in Cypher, consider how to handle it here rather than in-module.
121125
return struct.pack(format_str, 0)
122126

123-
# Remove leading and trailing whitespace
124-
prop_val = prop_val.strip()
125-
126127
# Try to parse value as an integer.
127128
try:
128129
numeric_prop = int(prop_val)

0 commit comments

Comments
 (0)