def infer_dict(node, context=None):
call = arguments.CallSite.from_call(node)<EOL>if call.has_invalid_arguments() or call.has_invalid_keywords():<EOL><INDENT>raise UseInferenceDefault<EOL><DEDENT>args = call.positional_arguments<EOL>kwargs = list(call.keyword_arguments.items())<EOL>if not args and not kwargs:<EOL><INDENT>return nodes.Dict()<EOL><DEDENT>elif kwargs and not args:<EOL><INDENT>items = [(nodes.Const(key), value) for key, value in kwargs]<EOL><DEDENT>elif len(args) == <NUM_LIT:1> and kwargs:<EOL><INDENT>elts = _get_elts(args[<NUM_LIT:0>], context)<EOL>keys = [(nodes.Const(key), value) for key, value in kwargs]<EOL>items = elts + keys<EOL><DEDENT>elif len(args) == <NUM_LIT:1>:<EOL><INDENT>items = _get_elts(args[<NUM_LIT:0>], context)<EOL><DEDENT>else:<EOL><INDENT>raise UseInferenceDefault()<EOL><DEDENT>value = nodes.Dict(<EOL>col_offset=node.col_offset, lineno=node.lineno, parent=node.parent<EOL>)<EOL>value.postinit(items)<EOL>return value<EOL>
Try to infer a dict call to a Dict node.

    The function treats the following cases:

        * dict()
        * dict(mapping)
        * dict(iterable)
        * dict(iterable, **kwargs)
        * dict(mapping, **kwargs)
        * dict(**kwargs)

    If a case can't be inferred, we'll fallback to default inference.