Module refinery.lib.inno
Library functions for processing of Inno Setup files.
Expand source code Browse git
"""
Library functions for processing of Inno Setup files.
"""
from collections.abc import MutableMapping
class CaseInsensitiveDict(MutableMapping):
def __init__(self, data=None, **kwargs):
if isinstance(data, CaseInsensitiveDict):
self._fold = dict(data._fold)
self._dict = dict(data._dict)
else:
self._fold = dict()
self._dict = dict()
self.update(data or {}, **kwargs)
def __setitem__(self, key: str, value):
kci = key.casefold()
self._fold[kci] = key
self._dict[key] = value
def __getitem__(self, key: str):
return self._dict[self._fold[key.casefold()]]
def __delitem__(self, key: str):
kci = key.casefold()
key = self._fold[kci]
del self._fold[kci]
del self._dict[key]
def __iter__(self):
return iter(self._dict)
def __len__(self):
return len(self._dict)
def casefold(self):
for kci, key in self._fold.items():
yield (kci, self._dict[key])
def __eq__(self, other):
try:
other = CaseInsensitiveDict(other)
except Exception:
return False
return dict(self.casefold()) == dict(other.casefold())
def copy(self):
return CaseInsensitiveDict(self)
def __repr__(self):
return repr(self._dict)
Sub-modules
refinery.lib.inno.archive
-
Data structures and methods for parsing Inno Setup installer archives. The design is based on [innoextract][IE] source code and its Python port in …
refinery.lib.inno.emulator
-
An emulator for Inno Setup executables. The implementation is unlikely to be 100% correct as it was engineered by making various malicious scripts …
refinery.lib.inno.ifps
-
The code is based on the logic implemented in IFPSTools: https://github.com/Wack0/IFPSTools
refinery.lib.inno.symbols
-
Contains a library of known external function symbols for the IFPS runtime in InnoSetup installers.
Classes
class CaseInsensitiveDict (data=None, **kwargs)
-
A MutableMapping is a generic container for associating key/value pairs.
This class provides concrete generic implementations of all methods except for getitem, setitem, delitem, iter, and len.
Expand source code Browse git
class CaseInsensitiveDict(MutableMapping): def __init__(self, data=None, **kwargs): if isinstance(data, CaseInsensitiveDict): self._fold = dict(data._fold) self._dict = dict(data._dict) else: self._fold = dict() self._dict = dict() self.update(data or {}, **kwargs) def __setitem__(self, key: str, value): kci = key.casefold() self._fold[kci] = key self._dict[key] = value def __getitem__(self, key: str): return self._dict[self._fold[key.casefold()]] def __delitem__(self, key: str): kci = key.casefold() key = self._fold[kci] del self._fold[kci] del self._dict[key] def __iter__(self): return iter(self._dict) def __len__(self): return len(self._dict) def casefold(self): for kci, key in self._fold.items(): yield (kci, self._dict[key]) def __eq__(self, other): try: other = CaseInsensitiveDict(other) except Exception: return False return dict(self.casefold()) == dict(other.casefold()) def copy(self): return CaseInsensitiveDict(self) def __repr__(self): return repr(self._dict)
Ancestors
- collections.abc.MutableMapping
- collections.abc.Mapping
- collections.abc.Collection
- collections.abc.Sized
- collections.abc.Iterable
- collections.abc.Container
Methods
def casefold(self)
-
Expand source code Browse git
def casefold(self): for kci, key in self._fold.items(): yield (kci, self._dict[key])
def copy(self)
-
Expand source code Browse git
def copy(self): return CaseInsensitiveDict(self)