io: fix Lazy __str__/__repr__ mixup

This commit is contained in:
Shiz 2021-08-12 04:35:21 +02:00
parent f1c82f7502
commit 2fdec1b697
1 changed files with 8 additions and 8 deletions

View File

@ -299,10 +299,14 @@ class LazyEntry(G[T]):
return self.value
def __str__(self) -> str:
return f'~{self.type}'
if self.value is LazyUnresolved:
return f'~{self.type}'
return f'~{self.value}'
def __repr__(self) -> str:
return f'{__name__}.{self.__class__.__name__}({self.type!r})'
if self.value is LazyUnresolved:
return f'{__name__}.{self.__class__.__name__}({self.type!r})'
return f'{__name__}.{self.__class__.__name__}(value={self.valu!r})'
class Lazy(G[T], Type[LazyEntry[T]]):
__slots__ = ('type',)
@ -342,14 +346,10 @@ class Lazy(G[T], Type[LazyEntry[T]]):
return LazyEntry(self.type, context, None, {}, value=context.default(to_type(self.type)))
def __str__(self) -> str:
if self.value is LazyUnresolved:
return f'~{self.type}'
return f'~{self.value}'
return f'~{self.type}'
def __repr__(self) -> str:
if self.value is LazyUnresolved:
return f'{__name__}.{self.__class__.__name__}({self.type!r})'
return f'{__name__}.{self.__class__.__name__}(value={self.value!r})'
return f'{__name__}.{self.__class__.__name__}({self.type!r})'
class AlignTo(G[T], Wrapper[T]):