mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-26 11:34:49 +02:00
Rework some code to help with typing.
This commit is contained in:
@@ -43,13 +43,13 @@ class PrimitiveObject(interfaces.objects.ObjectInterface):
|
||||
struct_format = struct_format)
|
||||
self._struct_format = struct_format
|
||||
|
||||
def __new__(cls,
|
||||
def __new__(cls: typing.Type,
|
||||
context: interfaces.context.ContextInterface,
|
||||
type_name: str,
|
||||
object_info: interfaces.objects.ObjectInformation,
|
||||
struct_format: str,
|
||||
new_value: typing.Union[int, float, bool, bytes, str] = None,
|
||||
**kwargs) -> 'PrimitiveObject':
|
||||
**kwargs) -> typing.Type['PrimitiveObject']:
|
||||
"""Creates the appropriate class and returns it so that the native type is inherited
|
||||
|
||||
The only reason the **kwargs is added, is so that the inherriting types can override __init__
|
||||
@@ -136,12 +136,12 @@ class Bytes(PrimitiveObject, bytes):
|
||||
struct_format = str(length) + "s")
|
||||
self._vol['length'] = length
|
||||
|
||||
def __new__(cls,
|
||||
def __new__(cls: typing.Type,
|
||||
context: interfaces.context.ContextInterface,
|
||||
type_name: str,
|
||||
object_info: interfaces.objects.ObjectInformation,
|
||||
length: int = 1,
|
||||
**kwargs) -> 'Bytes':
|
||||
**kwargs) -> typing.Type['Bytes']:
|
||||
"""Creates the appropriate class and returns it so that the native type is inherritted
|
||||
|
||||
The only reason the **kwargs is added, is so that the inherriting types can override __init__
|
||||
|
||||
Reference in New Issue
Block a user