FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-20684: Remove unused inspect._signature_get_bound_param by asottile · Pull Request #21100 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
23 changes: 0 additions & 23 deletions Lib/inspect.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Back | FazBrowse Home | New Git URL