MCPcopy
hub / github.com/beetbox/beets / FilesystemError

Class FilesystemError

beets/util/__init__.py:129–154  ·  view source on GitHub ↗

An error that occurred while performing a filesystem manipulation via a function in this module. The `paths` field is a sequence of pathnames involved in the operation.

Source from the content-addressed store, hash-verified

127
128
129class FilesystemError(HumanReadableError):
130 """An error that occurred while performing a filesystem manipulation
131 via a function in this module. The `paths` field is a sequence of
132 pathnames involved in the operation.
133 """
134
135 def __init__(self, reason, verb, paths, tb=None):
136 self.paths = paths
137 super().__init__(reason, verb, tb)
138
139 def get_message(self):
140 # Use a nicer English phrasing for some specific verbs.
141 if self.verb in ("move", "copy", "rename"):
142 clause = (
143 f"while {self._gerund()} {displayable_path(self.paths[0])} to"
144 f" {displayable_path(self.paths[1])}"
145 )
146 elif self.verb in ("delete", "write", "create", "read"):
147 clause = f"while {self._gerund()} {displayable_path(self.paths[0])}"
148 else:
149 clause = (
150 f"during {self.verb} of paths"
151 f" {', '.join(displayable_path(p) for p in self.paths)}"
152 )
153
154 return f"{self._reasonstr()} {clause}"
155
156
157class MoveOperation(Enum):

Callers 9

loadMethod · 0.90
writeMethod · 0.90
mkdirallFunction · 0.85
removeFunction · 0.85
copyFunction · 0.85
moveFunction · 0.85
linkFunction · 0.85
hardlinkFunction · 0.85
reflinkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected