Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-20684: Remove unused inspect._signature_get_bound_param #21100

Merged
merged 1 commit into from
May 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.