Skip to content

Commit 9e746e3

Browse files
authored
bpo-20684: Remove unused inspect._signature_get_bound_param (GH-21100)
1 parent e9f66ae commit 9e746e3

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
@@ -2020,29 +2020,6 @@ def _signature_is_functionlike(obj):
20202020
(isinstance(annotations, (dict)) or annotations is None) )
20212021

20222022

2023-
def _signature_get_bound_param(spec):
2024-
""" Private helper to get first parameter name from a
2025-
__text_signature__ of a builtin method, which should
2026-
be in the following format: '($param1, ...)'.
2027-
Assumptions are that the first argument won't have
2028-
a default value or an annotation.
2029-
"""
2030-
2031-
assert spec.startswith('($')
2032-
2033-
pos = spec.find(',')
2034-
if pos == -1:
2035-
pos = spec.find(')')
2036-
2037-
cpos = spec.find(':')
2038-
assert cpos == -1 or cpos > pos
2039-
2040-
cpos = spec.find('=')
2041-
assert cpos == -1 or cpos > pos
2042-
2043-
return spec[2:pos]
2044-
2045-
20462023
def _signature_strip_non_python_syntax(signature):
20472024
"""
20482025
Private helper function. Takes a signature in Argument Clinic's

Lib/test/test_inspect.py

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

40164016
class TestSignaturePrivateHelpers(unittest.TestCase):
4017-
def test_signature_get_bound_param(self):
4018-
getter = inspect._signature_get_bound_param
4019-
4020-
self.assertEqual(getter('($self)'), 'self')
4021-
self.assertEqual(getter('($self, obj)'), 'self')
4022-
self.assertEqual(getter('($cls, /, obj)'), 'cls')
4023-
40244017
def _strip_non_python_syntax(self, input,
40254018
clean_signature, self_parameter, last_positional_only):
40264019
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)