forked from K0lb3/UnityPy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnknownObject.py
More file actions
33 lines (22 loc) · 883 Bytes
/
UnknownObject.py
File metadata and controls
33 lines (22 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from typing import Optional
from ..helpers.TypeTreeNode import TypeTreeNode
from .Object import Object
class UnknownObject(Object):
"""An object of unknown type that showed up during typetree parsing."""
__node__: Optional[TypeTreeNode]
def __init__(self, __node__: Optional[TypeTreeNode] = None, **kwargs):
self.__node__ = __node__
self.__dict__.update(**kwargs)
def get_type(self):
return self.__node__.m_Type if self.__node__ else None
def __repr__(self) -> str:
def format_value(v):
vstr = repr(v)
if len(vstr) > 100:
return vstr[:97] + "..."
return vstr
inner_str = ", ".join(f"{k}={format_value(v)}" for k, v in self.__dict__.items() if k != "__node__")
return f"<UnknownObject<{self.get_type()}> {inner_str}>"
__all__ = [
"UnknownObject",
]