def extract_fields(document_data, prefix_path, expand_dots=False):
    """Do depth-first walk of tree, yielding field_path, value"""
    if not document_data:
        yield prefix_path, _EmptyDict
    else:
        for key, value in sorted(six.iteritems(document_data)):

            if expand_dots:
                sub_key = FieldPath.from_string(key)
            else:
                sub_key = FieldPath(key)

            field_path = FieldPath(*(prefix_path.parts + sub_key.parts))

            if isinstance(value, dict):
                for s_path, s_value in extract_fields(value, field_path):
                    yield s_path, s_value
            else:
                yield field_path, value
def extract_fields ( document_data , prefix_path , expand_dots = False ) : if not document_data : yield prefix_path , _EmptyDict else : for key , value in sorted ( six . iteritems ( document_data ) ) : if expand_dots : sub_key = FieldPath . from_string ( key ) else : sub_key = FieldPath ( key ) field_path = FieldPath ( * ( prefix_path . parts + sub_key . parts ) ) if isinstance ( value , dict ) : for s_path , s_value in extract_fields ( value , field_path ) : yield s_path , s_value else : yield field_path , value
Do depth-first walk of tree, yielding field_path, value