@classmethod<EOL><INDENT>def _flatten_projection(cls, projection):<DEDENT>
<EOL>if not projection:<EOL><INDENT>return {'<STR_LIT>': False}, {}, {}<EOL><DEDENT>flat_projection = {}<EOL>references = {}<EOL>subs = {}<EOL>inclusive = True<EOL>for key, value in deepcopy(projection).items():<EOL><INDENT>if isinstance(value, dict):<EOL><INDENT>if '<STR_LIT>' in value:<EOL><INDENT>references[key] = value<EOL><DEDENT>elif '<STR_LIT>' in value or '<STR_LIT>' in value:<EOL><INDENT>subs[key] = value<EOL><DEDENT>flat_projection[key] = True<EOL><DEDENT>elif key == '<STR_LIT>':<EOL><INDENT>continue<EOL><DEDENT>elif key == '<STR_LIT>' or key == '<STR_LIT>':<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>flat_projection[key] = value<EOL>inclusive = False<EOL><DEDENT><DEDENT>if inclusive:<EOL><INDENT>flat_projection = {'<STR_LIT>': False}<EOL><DEDENT>return flat_projection, references, subs<EOL>
Flatten a structured projection (structure projections support for
projections of (to be) dereferenced fields.