Skip to content

Commit

Permalink
Deprecated GetStat file entry method log2timeline#52
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Nov 14, 2021
1 parent 76c6602 commit 1cc842b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions dfvfs/vfs/file_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
"""
Expand Down
13 changes: 6 additions & 7 deletions tests/vfs/ntfs_file_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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]

Expand Down

0 comments on commit 1cc842b

Please sign in to comment.