# Path: sigtools/signatures.py

# 
# Path: sigtools/support.py
# def s(*args, **kwargs):
#     """Creates a signature from the given string representation of one.
# 
#     .. warning::
#         The contents of the arguments are eventually passed to `exec`.
#         Do not use with untrusted input.
# 
#     ::
# 
#         >>> from sigtools.support import s
#         >>> sig = s('a, b=2, *args, c:"annotation", **kwargs')
#         >>> sig
#         <inspect.Signature object at 0x7f15e6055550>
#         >>> print(sig)
#         (a, b=2, *args, c:'annotation', **kwargs)
#     """
#     return specifiers.signature(f(*args, **kwargs))
# 
# Path: sigtools/tests/util.py
# def conv_first_posarg(sig):
# def func_to_name(func):
# def transform_exp_sources(d, subject=None):
# def transform_real_sources(d):
#     def assertSigsEqual(self, found, expected, *args, **kwargs):
#     def assertSourcesEqual(self, found, expected, func=None, depth_order=False):
#     def downgrade_sig(self, sig):
# class SignatureTests(unittest.TestCase):
# 
# Path: sigtools/_util.py
# def get_funcsigs():
#     def __repr__(self):
# def noop(func):
# def qualname(obj):
#     def __init__(self, *args, **kwargs):
#             def cg(func, **kwargs):
#     def __get__(self, instance, owner):
# def safe_get(obj, instance, owner):
# def iter_call(obj):
# def get_introspectable(obj, forged=True, af_hint=True, partial=True):
# def get_ast(func):
# class _Unset(object):
# class OverrideableDataDesc(object):
# UNSET = _Unset()


from sigtools.signatures import merge, IncompatibleSignatures
from sigtools.support import s
from sigtools.tests.util import Fixtures
from sigtools._util import OrderedDict as Od, funcsigs
    annotation_right = 'a:1', {1: 'a', 2: 'a'}, 'a', 'a:1'

    star_erase = '', {}, '*args', ''
    star_same = '*args', {1: ['args'], 2: ['args']}, '*args', '*args'
    star_name = '*largs', {1: ['largs']}, '*largs', '*rargs'
    star_same_pok = (
        'a, *args', Od([(1, ['a', 'args']), (2, ['a', 'args'])]),
        'a, *args', 'a, *args')
    star_extend = '<a>, *args', {1: ['a', 'args']}, '<a>, *args', '*args'
    star_extend_r = '<a>, *args', {2: ['a', 'args']}, '*args', '<a>, *args'

    stars_erase = '', {}, '**kwargs', ''
    stars_same = '**kwargs', {1: ['kwargs'], 2: ['kwargs']}, '**kwargs', '**kwargs'
    stars_name = '**lkwargs', {1: ['lkwargs']}, '**lkwargs', '**rkwargs'
    stars_extend = '*, a, **kwargs', {2: ['a', 'kwargs']}, '**kwargs', '*, a, **kwargs'
    stars_extend_r = '*, a, **kwargs', {1: ['a', 'kwargs']}, '*, a, **kwargs', '**kwargs'

    def test_omit_sources(self):
        s1 = s('a, *args, **kwargs')
        s2 = s('a, *args, **kwargs')
        ret = merge(s1, s2)
        self.assertSigsEqual(ret, s('a, *args, **kwargs'))

    three = '*, a, b, c, **k', {1: 'a', 2: 'b', 3: 'ck'}, '*, a, **k', '*, b, **k', '*, c, **k'


class MergeRaiseTests(Fixtures):
    def _test(self, *signatures):
        assert len(signatures) >= 2
        sigs = [s(sig) for sig in signatures]

# Path: sigtools/signatures.py

# 
# Path: sigtools/support.py
# def s(*args, **kwargs):
#     """Creates a signature from the given string representation of one.
# 
#     .. warning::
#         The contents of the arguments are eventually passed to `exec`.
#         Do not use with untrusted input.
# 
#     ::
# 
#         >>> from sigtools.support import s
#         >>> sig = s('a, b=2, *args, c:"annotation", **kwargs')
#         >>> sig
#         <inspect.Signature object at 0x7f15e6055550>
#         >>> print(sig)
#         (a, b=2, *args, c:'annotation', **kwargs)
#     """
#     return specifiers.signature(f(*args, **kwargs))
# 
# Path: sigtools/tests/util.py
# def conv_first_posarg(sig):
# def func_to_name(func):
# def transform_exp_sources(d, subject=None):
# def transform_real_sources(d):
#     def assertSigsEqual(self, found, expected, *args, **kwargs):
#     def assertSourcesEqual(self, found, expected, func=None, depth_order=False):
#     def downgrade_sig(self, sig):
# class SignatureTests(unittest.TestCase):
# 
# Path: sigtools/_util.py
# def get_funcsigs():
#     def __repr__(self):
# def noop(func):
# def qualname(obj):
#     def __init__(self, *args, **kwargs):
#             def cg(func, **kwargs):
#     def __get__(self, instance, owner):
# def safe_get(obj, instance, owner):
# def iter_call(obj):
# def get_introspectable(obj, forged=True, af_hint=True, partial=True):
# def get_ast(func):
# class _Unset(object):
# class OverrideableDataDesc(object):
# UNSET = _Unset()


# Path: sigtools/tests/test_merge.py
from sigtools.signatures import merge, IncompatibleSignatures
from sigtools.support import s
from sigtools.tests.util import Fixtures
from sigtools._util import OrderedDict as Od, funcsigs

    annotation_right = 'a:1', {1: 'a', 2: 'a'}, 'a', 'a:1'

    star_erase = '', {}, '*args', ''
    star_same = '*args', {1: ['args'], 2: ['args']}, '*args', '*args'
    star_name = '*largs', {1: ['largs']}, '*largs', '*rargs'
    star_same_pok = (
        'a, *args', Od([(1, ['a', 'args']), (2, ['a', 'args'])]),
        'a, *args', 'a, *args')
    star_extend = '<a>, *args', {1: ['a', 'args']}, '<a>, *args', '*args'
    star_extend_r = '<a>, *args', {2: ['a', 'args']}, '*args', '<a>, *args'

    stars_erase = '', {}, '**kwargs', ''
    stars_same = '**kwargs', {1: ['kwargs'], 2: ['kwargs']}, '**kwargs', '**kwargs'
    stars_name = '**lkwargs', {1: ['lkwargs']}, '**lkwargs', '**rkwargs'
    stars_extend = '*, a, **kwargs', {2: ['a', 'kwargs']}, '**kwargs', '*, a, **kwargs'
    stars_extend_r = '*, a, **kwargs', {1: ['a', 'kwargs']}, '*, a, **kwargs', '**kwargs'

    def test_omit_sources(self):
        s1 = s('a, *args, **kwargs')
        s2 = s('a, *args, **kwargs')
        ret = merge(s1, s2)
        self.assertSigsEqual(ret, s('a, *args, **kwargs'))

    three = '*, a, b, c, **k', {1: 'a', 2: 'b', 3: 'ck'}, '*, a, **k', '*, b, **k', '*, c, **k'


class MergeRaiseTests(Fixtures):
    def _test(self, *signatures):
        assert len(signatures) >= 2
        sigs = [s(sig) for sig in signatures]

        self.assertRaises(IncompatibleSignatures, merge, *sigs)