File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -396,13 +396,20 @@ def parse_item(item):
396
396
# an O(N) complexity) instead of the command.
397
397
if isinstance (item [3 ], list ):
398
398
result ["command" ] = space .join (item [3 ])
399
- result ["client_address" ] = item [4 ]
400
- result ["client_name" ] = item [5 ]
399
+
400
+ # These fields are optional, depends on environment.
401
+ if len (item ) >= 6 :
402
+ result ["client_address" ] = item [4 ]
403
+ result ["client_name" ] = item [5 ]
401
404
else :
402
405
result ["complexity" ] = item [3 ]
403
406
result ["command" ] = space .join (item [4 ])
404
- result ["client_address" ] = item [5 ]
405
- result ["client_name" ] = item [6 ]
407
+
408
+ # These fields are optional, depends on environment.
409
+ if len (item ) >= 7 :
410
+ result ["client_address" ] = item [5 ]
411
+ result ["client_name" ] = item [6 ]
412
+
406
413
return result
407
414
408
415
return [parse_item (item ) for item in response ]
Original file line number Diff line number Diff line change @@ -1521,8 +1521,8 @@ def test_set_path(client):
1521
1521
1522
1522
root = tempfile .mkdtemp ()
1523
1523
sub = tempfile .mkdtemp (dir = root )
1524
- jsonfile = tempfile .mktemp (suffix = ".json" , dir = sub )
1525
- nojsonfile = tempfile .mktemp (dir = root )
1524
+ jsonfile = tempfile .mkstemp (suffix = ".json" , dir = sub )[ 1 ]
1525
+ nojsonfile = tempfile .mkstemp (dir = root )[ 1 ]
1526
1526
1527
1527
with open (jsonfile , "w+" ) as fp :
1528
1528
fp .write (json .dumps ({"hello" : "world" }))
You can’t perform that action at this time.
0 commit comments