text stringlengths 0 828 |
|---|
subdir[f] = meta |
parent = nested_dir |
for fold in folders[:-1]: |
parent = parent.get(fold) |
# Attach the config of all children nodes onto the parent |
parent[folders[-1]] = subdir |
return nested_dir" |
1577,"def _parse_orders(self, orders): |
"""""" |
Transform orders from list objects to PHP arrays: |
[ |
{ |
'PNAME': 'CD Player', |
'PCODE': 'PROD_04891', |
'PINFO': 'Extended Warranty - 5 Years', |
'PRICE': '82.3', |
'PRICE_TYPE': 'GROSS', |
'QTY': '7', |
'VAT':'20' |
}, |
{ |
'PNAME': 'Mobile Phone', |
'PCODE': 'PROD_07409', |
'PINFO': 'Dual SIM', |
'PRICE': '1945.75', |
'PRICE_TYPE': 'GROSS', |
'QTY': '3', |
'VAT':'20' |
}, |
{ |
'PNAME': 'Laptop', |
'PCODE': 'PROD_04965', |
'PINFO': '17"" Display', |
'PRICE': '5230', |
'PRICE_TYPE': 'GROSS', |
'QTY': '1', |
'VAT':'20' |
} |
] |
|| |
\/ |
{ |
'ORDER_PCODE[0]': 'PROD_04891', |
'ORDER_PCODE[1]': 'PROD_07409', |
'ORDER_PCODE[2]': 'PROD_04965', |
'ORDER_PINFO[0]': 'Extended Warranty - 5 Years', |
'ORDER_PINFO[1]': 'Dual SIM', |
'ORDER_PINFO[2]': '17"" Display', |
'ORDER_PNAME[0]': 'CD Player', |
'ORDER_PNAME[1]': 'Mobile Phone', |
'ORDER_PNAME[2]': 'Laptop', |
'ORDER_PRICE[0]': '82.3', |
'ORDER_PRICE[1]': '1945.75', |
'ORDER_PRICE[2]': '5230', |
'ORDER_PRICE_TYPE[0]': 'GROSS', |
'ORDER_PRICE_TYPE[1]': 'GROSS', |
'ORDER_PRICE_TYPE[2]': 'GROSS', |
'ORDER_QTY[0]': '7', |
'ORDER_QTY[1]': '3', |
'ORDER_QTY[2]': '1', |
'ORDER_VAT[0]': '20', |
'ORDER_VAT[1]': '20', |
'ORDER_VAT[2]': '20' |
} |
"""""" |
result = {} |
for index, order in enumerate(orders): |
for detail, value in order.iteritems(): |
result[""ORDER_%s[%s]"" % (detail, index)] = value |
return result" |
1578,"def average_detections(detections, predictions, relative_prediction_threshold = 0.25): |
""""""average_detections(detections, predictions, [relative_prediction_threshold]) -> bounding_box, prediction |
Computes the weighted average of the given detections, where the weights are computed based on the prediction values. |
**Parameters:** |
``detections`` : [:py:class:`BoundingBox`] |
The overlapping bounding boxes. |
``predictions`` : [float] |
The predictions for the ``detections``. |
``relative_prediction_threshold`` : float between 0 and 1 |
Limits the bounding boxes to those that have a prediction value higher then ``relative_prediction_threshold * max(predictions)`` |
**Returns:** |
``bounding_box`` : :py:class:`BoundingBox` |
The bounding box which has been merged from the detections |
``prediction`` : float |
The prediction value of the bounding box, which is a weighted sum of the predictions with minimum overlap |
"""""" |
# remove the predictions that are too low |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.