From f668288dfc930d72f3735a86910c5d17a412e836 Mon Sep 17 00:00:00 2001 From: hakril Date: Sat, 1 Feb 2025 22:44:53 +0100 Subject: [PATCH] Fix bad escape in some docstrings --- tests/test_handle.py | 2 +- tests/test_object_manager.py | 6 +++--- windows/debug/symbols.py | 10 +++++----- windows/utils/winutils.py | 2 +- windows/winobject/object_manager.py | 4 ++-- windows/winobject/system.py | 4 ++-- windows/winobject/wmi.py | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/test_handle.py b/tests/test_handle.py index 0004aeb..8008d7c 100644 --- a/tests/test_handle.py +++ b/tests/test_handle.py @@ -31,6 +31,6 @@ def test_remote_handle_type_and_name(proc32_64): remote_handle = [x for x in proc32_64.handles if x.value == file_handle_vlue][0] assert remote_handle.pid == proc32_64.pid assert remote_handle.type == "File" - assert remote_handle.name.startswith("\Device\HarddiskVolume") + assert remote_handle.name.startswith(r"\Device\HarddiskVolume") assert remote_handle.name.endswith(TEST_FILE_FOR_HANDLE[2:]) # Remove volume letter assert remote_handle.infos \ No newline at end of file diff --git a/tests/test_object_manager.py b/tests/test_object_manager.py index 4fbc392..05a74d6 100644 --- a/tests/test_object_manager.py +++ b/tests/test_object_manager.py @@ -32,7 +32,7 @@ def test_multiple_access_type(objname): def test_complex_object_path(): - obj = objmanager["\\KnownDLLs\\kernel32.dll"] + obj = objmanager[r"\KnownDLLs\kernel32.dll"] assert obj.name == "kernel32.dll" assert obj.fullname == "\\KnownDLLs\\kernel32.dll" assert obj.path == "\\KnownDLLs" @@ -41,9 +41,9 @@ def test_complex_object_path(): def test_link_object(): - obj = objmanager["\\KnownDLLs\\KnownDLLPath"] + obj = objmanager[r"\KnownDLLs\KnownDLLPath"] assert obj.type == "SymbolicLink" - assert obj.target.lower() == "c:\windows\system32" + assert obj.target.lower() == r"c:\windows\system32" # Test unicode string in Kernel object using an ALPC port diff --git a/windows/debug/symbols.py b/windows/debug/symbols.py index d14fb7f..d0599b6 100644 --- a/windows/debug/symbols.py +++ b/windows/debug/symbols.py @@ -13,7 +13,7 @@ DEFAULT_DBG_OPTION = gdef.SYMOPT_DEFERRED_LOADS + gdef.SYMOPT_UNDNAME def set_dbghelp_path(path): - """Set the path of the ``dbghelp.dll`` file to use. It allow to configure a different version of the DLL handling PDB downloading. + r"""Set the path of the ``dbghelp.dll`` file to use. It allow to configure a different version of the DLL handling PDB downloading. If ``path`` is a directory, the final ``dbghelp.dll`` will be computed as ``path\\dbghelp.dll``. @@ -124,7 +124,7 @@ class SymbolInfoA(gdef.SYMBOL_INFO, SymbolInfoBase): CHAR_TYPE = gdef.CHAR class SymbolInfoW(gdef.SYMBOL_INFOW, SymbolInfoBase): - """Represent a Symbol. + r"""Represent a Symbol. This class in based on the class `SYMBOL_INFO `_ with the handling on displacement embeded into it.s @@ -326,7 +326,7 @@ class SymbolModule(gdef.IMAGEHLP_MODULEW64): @property def pdb(self): - """The local path of the loaded PDB if present + r"""The local path of the loaded PDB if present Exemple: >>> sh = windows.debug.symbols.VirtualSymbolHandler() @@ -455,7 +455,7 @@ class SymbolHandler(object): return sym def resolve(self, name_or_addr): - """Resolve ``name_or_addr``. + r"""Resolve ``name_or_addr``. If its an int -> Return the :class:`SymbolInfo` at the address. If its a string -> Return the :class:`SymbolInfo` corresponding to the symbol name @@ -504,7 +504,7 @@ class SymbolHandler(object): return True def search(self, mask, mod=0, tag=0, options=gdef.SYMSEARCH_ALLITEMS, callback=None): - """Search the symbols matching ``mask`` (``Windbg`` like). + r"""Search the symbols matching ``mask`` (``Windbg`` like). :return: [:class:`SymbolInfo`] -- A list of :class:`SymbolInfo` diff --git a/windows/utils/winutils.py b/windows/utils/winutils.py index 2706b8d..1f803f1 100644 --- a/windows/utils/winutils.py +++ b/windows/utils/winutils.py @@ -626,7 +626,7 @@ class VirtualProtected(object): class DisableWow64FsRedirection(object): - """ + r""" A context manager that disable the SysWow64 Filesystem Redirection :: if is_process_32_bits: diff --git a/windows/winobject/object_manager.py b/windows/winobject/object_manager.py index f0de7f3..a0590d7 100644 --- a/windows/winobject/object_manager.py +++ b/windows/winobject/object_manager.py @@ -166,13 +166,13 @@ class KernelObject(object): raise KeyError("Could not find WinObject <{0}> under <{1}>".format(name, self.fullname)) def __getitem__(self, name): - """Query object ``name`` from the directory, split and subquery on ``\\``:: + r"""Query object ``name`` from the directory, split and subquery on ``\``:: >>> obj >>> obj["WindowStations"]["WinSta0"] - >>> obj["WindowStations\\WinSta0"] + >>> obj[r"WindowStations\\WinSta0"] :rtype: :class:`KernelObject` diff --git a/windows/winobject/system.py b/windows/winobject/system.py index 1f1f83e..257f0bc 100644 --- a/windows/winobject/system.py +++ b/windows/winobject/system.py @@ -87,7 +87,7 @@ class System(object): @property def logicaldrives(self): - """List of logical drives [C:\, ...] + """List of logical drives [C:\\, ...] :type: [:class:`~windows.winobject.volume.LogicalDrive`] -- A list of LogicalDrive """ @@ -621,7 +621,7 @@ class System(object): @staticmethod def enumerate_threads(): - return [WinThread._from_THREADENTRY32(th) for th in System.enumerate_threads_generator()] + return [process.WinThread._from_THREADENTRY32(th) for th in System.enumerate_threads_generator()] def enumerate_threads_setup_owners(self): diff --git a/windows/winobject/wmi.py b/windows/winobject/wmi.py index 83b8bb2..fc9008e 100644 --- a/windows/winobject/wmi.py +++ b/windows/winobject/wmi.py @@ -474,11 +474,11 @@ class WmiNamespace(gdef.IWbemServices, WmiComInterface): return """<{0} "{1}"{2}>""".format(type(self).__name__, self.name, null) class WmiManager(dict): - """The main WMI class exposed, used to list and access differents WMI namespace, can be used as a dict to access + r"""The main WMI class exposed, used to list and access differents WMI namespace, can be used as a dict to access :class:`WmiNamespace` by name Example: - >>> windows.system.wmi["root\\SecurityCenter2"] + >>> windows.system.wmi[r"root\SecurityCenter2"] """ DEFAULT_NAMESPACE = "root\\cimv2" #: The default namespace for :func:`select` & :func:`query`