mirror of
https://github.com/davidhalter/jedi.git
synced 2026-10-18 21:51:28 +08:00
Reduce noise in signatures of compiled params (#1564)
* Remove "typing." prefix from compiled signature param
* Don't print default "None" for Optional params
* Don't remove 'typing.' prefix if symbol doesn't come from typing module
* Revert "Don't print default "None" for Optional params"
This reverts commit 8db334d9bb.
* Make sure "typing." doesn't appear in the middle
* Make sure only "typing." prefix is removed and not it's entries in the middle
* Use inspect.formatannotation() to create an annotation string
* Update AUTHORS.txt
* Add test for compiled param annotation string
* Replace Optional in test with other typing facilities
in order for test to be forward-compatible with 3.9
* Add an empty string fallback for Python 2
* Move _annotation_to_str back to original position
This commit is contained in:
1 parent
be7a1346ec
commit
e1c0d2c501
3 files changed
+15
-3
No files matched your search
@@ -485,9 +485,9 @@ class DirectObjectAccess(object):
|
||||
return inspect.isclass(self._obj) and self._obj != type
|
||||
|
||||
def _annotation_to_str(self, annotation):
|
||||
if isinstance(annotation, type):
|
||||
return str(annotation.__name__)
|
||||
return str(annotation)
|
||||
if py_version < 30:
|
||||
return ''
|
||||
return inspect.formatannotation(annotation)
|
||||
|
||||
def get_signature_params(self):
|
||||
return [
|
||||
|
||||
Reference in new issue
Block a user