Add __repr__ method to File class (#2550)

This commit is contained in:
Álvaro Mondéjar
2021-08-30 14:32:54 +02:00
committed by GitHub
parent c93c05341d
commit 1dc66b76b4

View File

@@ -141,6 +141,11 @@ class File:
def __ne__(self, other):
return not self.__eq__(other)
def __repr__(self):
return "File(src_path='{}', dest_path='{}', name='{}', url='{}')".format(
self.src_path, self.dest_path, self.name, self.url
)
def _get_stem(self):
""" Return the name of the file without it's extension. """
filename = os.path.basename(self.src_path)