Skip to content

Commit

Permalink
Remove unused _signature_get_bound_param
Browse files Browse the repository at this point in the history
last referenced in 57d240e
  • Loading branch information
asottile committed Sep 3, 2020
1 parent e55a0e9 commit 6a42ba8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 30 deletions.
23 changes: 0 additions & 23 deletions Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1886,29 +1886,6 @@ def _signature_is_functionlike(obj):
isinstance(annotations, dict))


def _signature_get_bound_param(spec):
""" Private helper to get first parameter name from a
__text_signature__ of a builtin method, which should
be in the following format: '($param1, ...)'.
Assumptions are that the first argument won't have
a default value or an annotation.
"""

assert spec.startswith('($')

pos = spec.find(',')
if pos == -1:
pos = spec.find(')')

cpos = spec.find(':')
assert cpos == -1 or cpos > pos

cpos = spec.find('=')
assert cpos == -1 or cpos > pos

return spec[2:pos]


def _signature_strip_non_python_syntax(signature):
"""
Private helper function. Takes a signature in Argument Clinic's
Expand Down
7 changes: 0 additions & 7 deletions Lib/test/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3735,13 +3735,6 @@ def foo(a): pass
self.assertIs(type(ba.arguments), dict)

class TestSignaturePrivateHelpers(unittest.TestCase):
def test_signature_get_bound_param(self):
getter = inspect._signature_get_bound_param

self.assertEqual(getter('($self)'), 'self')
self.assertEqual(getter('($self, obj)'), 'self')
self.assertEqual(getter('($cls, /, obj)'), 'cls')

def _strip_non_python_syntax(self, input,
clean_signature, self_parameter, last_positional_only):
computed_clean_signature, \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove unused ``_signature_get_bound_param`` function from :mod:`inspect` -
by Anthony Sottile.

0 comments on commit 6a42ba8

Please sign in to comment.