Skip to content

Commit

Permalink
[DataLake]convert PathProperties.last_modified to datetime format (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
xiafu-msft authored Jan 13, 2021
1 parent cb63736 commit 088abeb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# --------------------------------------------------------------------------
# pylint: disable=too-few-public-methods, too-many-instance-attributes
# pylint: disable=super-init-not-called, too-many-lines
from datetime import datetime
from enum import Enum

from azure.storage.blob import LeaseProperties as BlobLeaseProperties
Expand Down Expand Up @@ -211,7 +212,7 @@ def _from_generated(cls, generated):
path_prop.owner = generated.owner
path_prop.group = generated.group
path_prop.permissions = generated.permissions
path_prop.last_modified = generated.last_modified
path_prop.last_modified = datetime.strptime(generated.last_modified, "%a, %d %b %Y %H:%M:%S %Z")
path_prop.is_directory = bool(generated.is_directory)
path_prop.etag = generated.additional_properties.get('etag')
path_prop.content_length = generated.content_length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def test_list_paths(self):
paths = list(file_system.get_paths(upn=True))

self.assertEqual(len(paths), 6)
self.assertTrue(isinstance(paths[0].last_modified, datetime))

@record
def test_list_paths_which_are_all_files(self):
Expand Down

0 comments on commit 088abeb

Please sign in to comment.