Skip to content

Commit 6a42ba8

Browse files
committed
Remove unused _signature_get_bound_param
last referenced in 57d240e
1 parent e55a0e9 commit 6a42ba8

File tree

3 files changed

+2
-30
lines changed

3 files changed

+2
-30
lines changed

Lib/inspect.py

-23
Original file line numberDiff line numberDiff line change
@@ -1886,29 +1886,6 @@ def _signature_is_functionlike(obj):
18861886
isinstance(annotations, dict))
18871887

18881888

1889-
def _signature_get_bound_param(spec):
1890-
""" Private helper to get first parameter name from a
1891-
__text_signature__ of a builtin method, which should
1892-
be in the following format: '($param1, ...)'.
1893-
Assumptions are that the first argument won't have
1894-
a default value or an annotation.
1895-
"""
1896-
1897-
assert spec.startswith('($')
1898-
1899-
pos = spec.find(',')
1900-
if pos == -1:
1901-
pos = spec.find(')')
1902-
1903-
cpos = spec.find(':')
1904-
assert cpos == -1 or cpos > pos
1905-
1906-
cpos = spec.find('=')
1907-
assert cpos == -1 or cpos > pos
1908-
1909-
return spec[2:pos]
1910-
1911-
19121889
def _signature_strip_non_python_syntax(signature):
19131890
"""
19141891
Private helper function. Takes a signature in Argument Clinic's

Lib/test/test_inspect.py

-7
Original file line numberDiff line numberDiff line change
@@ -3735,13 +3735,6 @@ def foo(a): pass
37353735
self.assertIs(type(ba.arguments), dict)
37363736

37373737
class TestSignaturePrivateHelpers(unittest.TestCase):
3738-
def test_signature_get_bound_param(self):
3739-
getter = inspect._signature_get_bound_param
3740-
3741-
self.assertEqual(getter('($self)'), 'self')
3742-
self.assertEqual(getter('($self, obj)'), 'self')
3743-
self.assertEqual(getter('($cls, /, obj)'), 'cls')
3744-
37453738
def _strip_non_python_syntax(self, input,
37463739
clean_signature, self_parameter, last_positional_only):
37473740
computed_clean_signature, \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove unused ``_signature_get_bound_param`` function from :mod:`inspect` -
2+
by Anthony Sottile.

0 commit comments

Comments
 (0)