You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In various parts of our codebase, we are handling paths as string objects. It is recommended to use the pathlib module when dealing with paths as it provides a more readable and reliable way to handle filesystem paths. It also makes the code more object-oriented and less error-prone.
Here is an example of the current code that should be refactored:
deffix_windows_path_limit(path):
""" Prefix paths when running on Windows to overcome 260 character path length limit. See https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath :param path: a path to prefix :type path: str :return: a prefixed path :rtype: str """ifplatform.system() =='Windows':
ifpath.startswith('\\\\'):
# UNC network pathreturn'\\\\?\\UNC\\'+path[2:]
elifos.path.isabs(path):
# local absolute pathreturn'\\\\?\\'+pathelse:
# relative path, don't alterreturnpathelse:
returnpath
The following classes and methods are known to require this refactor:
def fix_windows_path_limit(path)
class AbstractFolder and its subclasses
class ProgressReport (potentially)
class AbstractPath and its subclasses
class ScanPoliciesManager
class AbstractAction and its subclasses
This issue's resolution would involve replacing the current string path handling with pathlib objects, ensuring all related functionality remains intact.
The text was updated successfully, but these errors were encountered:
In various parts of our codebase, we are handling paths as string objects. It is recommended to use the pathlib module when dealing with paths as it provides a more readable and reliable way to handle filesystem paths. It also makes the code more object-oriented and less error-prone.
Here is an example of the current code that should be refactored:
The following classes and methods are known to require this refactor:
def fix_windows_path_limit(path)
class AbstractFolder
and its subclassesclass ProgressReport
(potentially)class AbstractPath
and its subclassesclass ScanPoliciesManager
class AbstractAction
and its subclassesThis issue's resolution would involve replacing the current string path handling with pathlib objects, ensuring all related functionality remains intact.
The text was updated successfully, but these errors were encountered: