Fix ConversionPoint.__repr__ on objects that does not have __qualname__
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "breakshaft"
|
name = "breakshaft"
|
||||||
version = "0.1.3.post1"
|
version = "0.1.3.post2"
|
||||||
description = "Library for in-time codegen for type conversion"
|
description = "Library for in-time codegen for type conversion"
|
||||||
authors = [
|
authors = [
|
||||||
{ name = "nikto_b", email = "niktob560@yandex.ru" }
|
{ name = "nikto_b", email = "niktob560@yandex.ru" }
|
||||||
|
|||||||
@@ -31,7 +31,17 @@ class ConversionPoint:
|
|||||||
return hash((self.fn, self.injects, self.requires))
|
return hash((self.fn, self.injects, self.requires))
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f'({",".join(map(str, self.requires))}) -> {self.injects.__qualname__}: {self.fn.__qualname__}'
|
if '__qualname__' in dir(self.injects):
|
||||||
|
injects_name = self.injects.__qualname__
|
||||||
|
else:
|
||||||
|
injects_name = str(self.injects)
|
||||||
|
|
||||||
|
if '__qualname__' in dir(self.fn):
|
||||||
|
fn_name = self.fn.__qualname__
|
||||||
|
else:
|
||||||
|
fn_name = str(self.fn)
|
||||||
|
|
||||||
|
return f'({",".join(map(str, self.requires))}) -> {injects_name}: {fn_name}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def fn_args(self) -> list[tuple[str, type]]:
|
def fn_args(self) -> list[tuple[str, type]]:
|
||||||
|
|||||||
Reference in New Issue
Block a user