From 1cc842b5e90eae331986ddd6daf90c3dd7bcd279 Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Sun, 14 Nov 2021 09:36:13 +0100 Subject: [PATCH] Deprecated GetStat file entry method #52 --- dfvfs/vfs/file_entry.py | 4 ++++ tests/vfs/ntfs_file_entry.py | 13 ++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/dfvfs/vfs/file_entry.py b/dfvfs/vfs/file_entry.py index 4154c4a8..57f6dacb 100644 --- a/dfvfs/vfs/file_entry.py +++ b/dfvfs/vfs/file_entry.py @@ -7,6 +7,7 @@ import abc +from dfvfs.lib import decorators from dfvfs.lib import definitions from dfvfs.resolver import resolver from dfvfs.vfs import vfs_stat @@ -417,9 +418,12 @@ def GetSubFileEntryByName(self, name, case_sensitive=True): return matching_sub_file_entry + @decorators.deprecated def GetStat(self): """Retrieves information about the file entry. + This method is deprecated use StatAttribute instead. + Returns: VFSStat: a stat object or None if not available. """ diff --git a/tests/vfs/ntfs_file_entry.py b/tests/vfs/ntfs_file_entry.py index 05f8b490..32963928 100644 --- a/tests/vfs/ntfs_file_entry.py +++ b/tests/vfs/ntfs_file_entry.py @@ -569,10 +569,9 @@ def testAttributes(self): self.assertIsNotNone(attribute.modification_time) self.assertIsNotNone(attribute.entry_modification_time) - stat_time, stat_time_nano = ( - attribute.modification_time.CopyToStatTimeTuple()) - self.assertEqual(stat_time, 1567246979) - self.assertEqual(stat_time_nano, 9581788) + date_time_string = ( + attribute.modification_time.CopyToDateTimeStringISO8601()) + self.assertEqual(date_time_string, '2019-08-31T10:22:59.9581788Z') attribute = attributes[1] @@ -584,9 +583,9 @@ def testAttributes(self): self.assertIsNotNone(attribute.modification_time) self.assertIsNotNone(attribute.entry_modification_time) - stat_time, stat_time_nano = attribute.access_time.CopyToStatTimeTuple() - self.assertEqual(stat_time, 1567246979) - self.assertEqual(stat_time_nano, 9567496) + date_time_string = ( + attribute.access_time.CopyToDateTimeStringISO8601()) + self.assertEqual(date_time_string, '2019-08-31T10:22:59.9567496Z') attribute = attributes[2]