File tree 4 files changed +14
-4
lines changed
4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -60,3 +60,7 @@ target/
60
60
61
61
# PyCharm
62
62
.idea /
63
+
64
+ # PyTest
65
+ .pytest_cache /
66
+
Original file line number Diff line number Diff line change @@ -168,8 +168,7 @@ def extract(self, optimized_str):
168
168
if sum_field :
169
169
res_find += res_val
170
170
else :
171
- res_find = res_val
172
- break
171
+ res_find .extend (res_val )
173
172
else :
174
173
res_find = re .findall (v , optimized_str )
175
174
if res_find :
@@ -188,7 +187,11 @@ def extract(self, optimized_str):
188
187
else :
189
188
output [k ] = self .parse_number (res_find [0 ])
190
189
else :
191
- output [k ] = res_find [0 ]
190
+ res_find = list (set (res_find ))
191
+ if len (res_find ) == 1 :
192
+ output [k ] = res_find [0 ]
193
+ else :
194
+ output [k ] = res_find
192
195
else :
193
196
logger .warning ("regexp for field %s didn't match" , k )
194
197
Original file line number Diff line number Diff line change 3
3
amount : GrandTotalRs(\d+)
4
4
date : Date:(\d{1,2}\/\d{1,2}\/\d{1,4})
5
5
invoice_number : ([A-Z0-9]+)CashatHotel
6
+ payment_method :
7
+ - \d+(\S*)atHotel
6
8
keywords :
7
9
- OYO
8
10
- Oravel
Original file line number Diff line number Diff line change 5
5
"date" : " 31/12/2017" ,
6
6
"desc" : " Invoice IBZY2087 from OYO" ,
7
7
"invoice_number" : " IBZY2087" ,
8
- "issuer" : " OYO"
8
+ "issuer" : " OYO" ,
9
+ "payment_method" : " Cash"
9
10
}
10
11
]
You can’t perform that action at this time.
0 commit comments