gh-119180: Rename SOURCE format to STRING (#124620)

This commit is contained in:
Jelle Zijlstra 2024-09-26 13:49:48 -07:00 committed by GitHub
parent a4d1fdfb15
commit 2c10832887
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 156 additions and 171 deletions

View file

@ -485,10 +485,10 @@ class _CallableGenericAlias(GenericAlias):
def __repr__(self):
if len(self.__args__) == 2 and _is_param_expr(self.__args__[0]):
return super().__repr__()
from annotationlib import value_to_source
from annotationlib import value_to_string
return (f'collections.abc.Callable'
f'[[{", ".join([value_to_source(a) for a in self.__args__[:-1]])}], '
f'{value_to_source(self.__args__[-1])}]')
f'[[{", ".join([value_to_string(a) for a in self.__args__[:-1]])}], '
f'{value_to_string(self.__args__[-1])}]')
def __reduce__(self):
args = self.__args__