mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: access class __annotations__ instead of instance
Python 3.14 removed implicit fallback to class-level __annotations__, causing AttributeError when accessing self.__annotations__. Updated matches() to use self.__class__.__annotations__ for compatibility across Python 3.10+. Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
parent
d35abe89c4
commit
66753e44f2
1 changed files with 2 additions and 2 deletions
|
|
@ -46,7 +46,7 @@ class Identifier:
|
||||||
# Compare each property of other with the corresponding property in self
|
# Compare each property of other with the corresponding property in self
|
||||||
# If the property in self is None, the property in other can be anything
|
# If the property in self is None, the property in other can be anything
|
||||||
# If the property in self is not None, the property in other must be the same
|
# If the property in self is not None, the property in other must be the same
|
||||||
for field in self.__annotations__:
|
for field in self.__class__.__annotations__:
|
||||||
pattern_value = getattr(self, field)
|
pattern_value = getattr(self, field)
|
||||||
update_value = getattr(update, field)
|
update_value = getattr(update, field)
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ class Identifier:
|
||||||
def count_populated(self):
|
def count_populated(self):
|
||||||
non_null_count = 0
|
non_null_count = 0
|
||||||
|
|
||||||
for attr in self.__annotations__:
|
for attr in self.__class__.__annotations__:
|
||||||
if getattr(self, attr) is not None:
|
if getattr(self, attr) is not None:
|
||||||
non_null_count += 1
|
non_null_count += 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue