def get_vars(expr):
<EOL>signature = _get_object_signature(expr)<EOL>if signature is None:<EOL><INDENT>return ({}, [], {})<EOL><DEDENT>args = collections.OrderedDict()<EOL>var_args = []<EOL>kwargs = {}<EOL>if expr is None:<EOL><INDENT>return args, var_args, kwargs<EOL><DEDENT>for i, (name, parameter) in enumerate(signature.parameters.items()):<EOL><INDENT>if i == <NUM_LIT:0> and name in ("<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>continue<EOL><DEDENT>if parameter.kind is inspect._POSITIONAL_ONLY:<EOL><INDENT>try:<EOL><INDENT>args[name] = getattr(expr, name)<EOL><DEDENT>except AttributeError:<EOL><INDENT>args[name] = expr[name]<EOL><DEDENT><DEDENT>elif (<EOL>parameter.kind is inspect._POSITIONAL_OR_KEYWORD<EOL>or parameter.kind is inspect._KEYWORD_ONLY<EOL>):<EOL><INDENT>found = False<EOL>for x in (name, "<STR_LIT:_>" + name):<EOL><INDENT>try:<EOL><INDENT>value = getattr(expr, x)<EOL>found = True<EOL>break<EOL><DEDENT>except AttributeError:<EOL><INDENT>try:<EOL><INDENT>value = expr[x]<EOL>found = True<EOL>break<EOL><DEDENT>except (KeyError, TypeError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>if not found:<EOL><INDENT>raise ValueError("<STR_LIT>".format(name))<EOL><DEDENT>if parameter.default is inspect._empty:<EOL><INDENT>args[name] = value<EOL><DEDENT>elif parameter.default != value:<EOL><INDENT>kwargs[name] = value<EOL><DEDENT><DEDENT>elif parameter.kind is inspect._VAR_POSITIONAL:<EOL><INDENT>value = None<EOL>try:<EOL><INDENT>value = expr[:]<EOL><DEDENT>except TypeError:<EOL><INDENT>value = getattr(expr, name)<EOL><DEDENT>if value:<EOL><INDENT>var_args.extend(value)<EOL><DEDENT><DEDENT>elif parameter.kind is inspect._VAR_KEYWORD:<EOL><INDENT>items = {}<EOL>if hasattr(expr, "<STR_LIT>"):<EOL><INDENT>items = expr.items()<EOL><DEDENT>elif hasattr(expr, name):<EOL><INDENT>mapping = getattr(expr, name)<EOL>if not isinstance(mapping, dict):<EOL><INDENT>mapping = dict(mapping)<EOL><DEDENT>items = mapping.items()<EOL><DEDENT>elif hasattr(expr, "<STR_LIT:_>" + name):<EOL><INDENT>mapping = getattr(expr, "<STR_LIT:_>" + name)<EOL>if not isinstance(mapping, dict):<EOL><INDENT>mapping = dict(mapping)<EOL><DEDENT>items = mapping.items()<EOL><DEDENT>for key, value in items:<EOL><INDENT>if key not in args:<EOL><INDENT>kwargs[key] = value<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return args, var_args, kwargs<EOL>
Get ``args``, ``var args`` and ``kwargs`` for an object ``expr``.

::

    >>> class MyObject:
    ...     def __init__(self, arg1, arg2, *var_args, foo=None, bar=None, **kwargs):
    ...         self.arg1 = arg1
    ...         self.arg2 = arg2
    ...         self.var_args = var_args
    ...         self.foo = foo
    ...         self.bar = bar
    ...         self.kwargs = kwargs
    ...
    >>> my_object = MyObject('a', 'b', 'c', 'd', foo='x', quux=['y', 'z'])

::

    >>> import uqbar
    >>> args, var_args, kwargs = uqbar.objects.get_vars(my_object)

::

    >>> args
    OrderedDict([('arg1', 'a'), ('arg2', 'b')])

::

    >>> var_args
    ['c', 'd']

::

    >>> kwargs
    {'foo': 'x', 'quux': ['y', 'z']}