Skip to content

Commit a04e936

Browse files
committed
Typing annotations
1 parent 5e26264 commit a04e936

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

qiling/os/memory.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,13 @@ def map_anywhere(self, size: int, minaddr: int = None, maxaddr: int = None, alig
444444

445445
return addr
446446

447-
def protect(self, addr, size, perms):
447+
def protect(self, addr: int, size: int, perms):
448448
# mask off perms bits that are not supported by unicorn
449449
perms &= UC_PROT_ALL
450450

451451
aligned_address = (addr >> 12) << 12
452452
aligned_size = self.align((addr & 0xFFF) + size)
453+
453454
self.ql.uc.mem_protect(aligned_address, aligned_size, perms)
454455

455456

qiling/os/posix/const_mapping.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@
33
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
44
#
55

6+
from typing import MutableSequence
67
from .const import *
78
from qiling.const import *
89

910

10-
def _invert_dict(d):
11+
def _invert_dict(d: Mapping) -> Mapping:
1112
return { v:k for k, v in d.items()}
1213

1314

14-
def _constant_mapping(bits, d_map, ret=None, single_mapping=False):
15-
if ret is None:
16-
ret = []
17-
15+
def _constant_mapping(bits: int, d_map: Mapping[str, int], ret: MutableSequence[str] = [], single_mapping: bool = False) -> str:
1816
b_map = _invert_dict(d_map)
1917

2018
if single_mapping:

0 commit comments

Comments
 (0)