do not use 'append = list.append'

This commit is contained in:
Mike Fährmann
2025-06-30 11:42:44 +02:00
parent 9dec26108e
commit 3810555bbd
8 changed files with 36 additions and 47 deletions

View File

@@ -280,7 +280,6 @@ class PathFormat():
def build_directory(self, kwdict):
"""Apply 'kwdict' to directory format strings"""
segments = []
append = segments.append
strip = self.strip
try:
@@ -290,14 +289,13 @@ class PathFormat():
# remove trailing dots and spaces (#647)
segment = segment.rstrip(strip)
if segment:
append(self.clean_segment(segment))
segments.append(self.clean_segment(segment))
return segments
except Exception as exc:
raise exception.DirectoryFormatError(exc)
def build_directory_conditional(self, kwdict):
segments = []
append = segments.append
strip = self.strip
try:
@@ -311,7 +309,7 @@ class PathFormat():
if strip and segment != "..":
segment = segment.rstrip(strip)
if segment:
append(self.clean_segment(segment))
segments.append(self.clean_segment(segment))
return segments
except Exception as exc:
raise exception.DirectoryFormatError(exc)