# Path: mididings/misc.py
# def flatten(arg):
# def issequence(seq, accept_string=False):
# def issequenceof(seq, t):
# def islambda(f):
# def getargspec(f):
#     def __init__(self, replacement=None):
#     def wrapper(self, f, *args, **kwargs):
#     def __call__(self, f):
#     def __new__(cls, value, name):
#     def __init__(self, value, name):
#     def __getnewargs__(self):
#     def __repr__(self):
#     def __str__(self):
#     def __or__(self, other):
#     def __invert__(self):
# def prune_globals(g):
# def sequence_to_hex(data):
#     def __init__(self, data):
#     def __repr__(self):
# def get_terminal_size():
# class deprecated(object):
# class NamedFlag(int):
# class NamedBitMask(NamedFlag):
# class bytestring(object):


from mididings import misc
import inspect
import functools
    Search funcs for a function with parameters such that args and kwargs
    can be applied, and call the first suitable function that is found.
    """
    for f in funcs:
        n = len(args)

        # get argument names and the number of default arguments of f
        argspec = misc.getargspec(f)
        names = argspec[0]
        varargs = argspec[1]
        ndef = len(argspec[3]) if argspec[3] else 0

        # names of the default arguments not overridden by positional arguments
        npos = max(len(names) - ndef, n)
        defargs = names[npos:]

        # check if the number of positional arguments fits, and if the
        # remaining parameters can be filled with keyword and default
        # arguments.
        # alternatively, a suitable function with varargs is also accepted.
        if ((n <= len(names) and set(kwargs) | set(defargs) == set(names[n:]))
                or (n >= len(names) and varargs is not None)):
            # call f with all original arguments
            return f(*args, **kwargs)

    # no overload found, generate a comprehensible error message
    if name is None:
        name = inspect.stack()[1][3]

    # format arg spec for each candidate

# Path: mididings/misc.py
# def flatten(arg):
# def issequence(seq, accept_string=False):
# def issequenceof(seq, t):
# def islambda(f):
# def getargspec(f):
#     def __init__(self, replacement=None):
#     def wrapper(self, f, *args, **kwargs):
#     def __call__(self, f):
#     def __new__(cls, value, name):
#     def __init__(self, value, name):
#     def __getnewargs__(self):
#     def __repr__(self):
#     def __str__(self):
#     def __or__(self, other):
#     def __invert__(self):
# def prune_globals(g):
# def sequence_to_hex(data):
#     def __init__(self, data):
#     def __repr__(self):
# def get_terminal_size():
# class deprecated(object):
# class NamedFlag(int):
# class NamedBitMask(NamedFlag):
# class bytestring(object):


# Path: mididings/overload.py
from mididings import misc
import inspect
import functools

    Search funcs for a function with parameters such that args and kwargs
    can be applied, and call the first suitable function that is found.
    """
    for f in funcs:
        n = len(args)

        # get argument names and the number of default arguments of f
        argspec = misc.getargspec(f)
        names = argspec[0]
        varargs = argspec[1]
        ndef = len(argspec[3]) if argspec[3] else 0

        # names of the default arguments not overridden by positional arguments
        npos = max(len(names) - ndef, n)
        defargs = names[npos:]

        # check if the number of positional arguments fits, and if the
        # remaining parameters can be filled with keyword and default
        # arguments.
        # alternatively, a suitable function with varargs is also accepted.
        if ((n <= len(names) and set(kwargs) | set(defargs) == set(names[n:]))
                or (n >= len(names) and varargs is not None)):
            # call f with all original arguments
            return f(*args, **kwargs)

    # no overload found, generate a comprehensible error message
    if name is None:
        name = inspect.stack()[1][3]

    # format arg spec for each candidate

    formatargspec = lambda f: inspect.formatargspec(*misc.getargspec(f))