Skip to content

Commit

Permalink
Changes to use docformatter
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Jan 28, 2024
1 parent cd49038 commit 7dcc7a6
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 35 deletions.
12 changes: 10 additions & 2 deletions dfvfs/helpers/source_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ def __init__(self, path_spec):

@property
def type_indicator(self):
"""str: path specification type indicator."""
"""Retrieves the type indicator.
Returns:
str: path specification type indicator.
"""
return self.path_spec.type_indicator

def GetSubNodeByLocation(self, location):
Expand Down Expand Up @@ -165,7 +169,11 @@ def __init__(self):

@property
def locked_scan_nodes(self):
"""List[SourceScanNode]: locked scan nodes."""
"""Retrieves the locked scan nodes.
Returns:
list[SourceScanNode]: locked scan nodes.
"""
return list(self._locked_scan_nodes.values())

def AddScanNode(self, path_spec, parent_scan_node):
Expand Down
6 changes: 5 additions & 1 deletion dfvfs/lib/gzipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,11 @@ def __init__(self):

@property
def members(self):
"""List(GzipMember): members in the gzip file."""
"""Retrieves the members in the file.
Returns:
list[GzipMember]: members in the file.
"""
return list(self._members_by_end_offset.values())

def _GetMemberForOffset(self, offset):
Expand Down
18 changes: 15 additions & 3 deletions dfvfs/vfs/apfs_container_file_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ def _GetSubFileEntries(self):

@property
def name(self):
"""str: name of the file entry, which does not include the full path."""
"""Retrieves the name.
Return:
str: name of the file entry, which does not include the full path.
"""
if self._name is None:
self._name = ''

Expand All @@ -98,7 +102,11 @@ def name(self):

@property
def size(self):
"""int: size of the file entry in bytes or None if not available."""
"""Retrieves the size.
Returns:
int: size of the file entry in bytes or None if not available.
"""
if self._fsapfs_volume is None:
return None

Expand All @@ -107,7 +115,11 @@ def size(self):

@property
def sub_file_entries(self):
"""Generator[APFSContainerFileEntry]: sub file entries."""
"""Retrieves sub file entries.
Returns:
generator[APFSContainerFileEntry]: sub file entries.
"""
return self._GetSubFileEntries()

def GetAPFSVolume(self):
Expand Down
6 changes: 5 additions & 1 deletion dfvfs/vfs/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@ def _EntriesGenerator(self):

@property
def entries(self):
"""Generator[PathSpec]: path specifications of the directory entries."""
"""Retrieves directory entries.
Returns:
generator[PathSpec]: path specifications of the directory entries.
"""
return self._EntriesGenerator()
105 changes: 86 additions & 19 deletions dfvfs/vfs/file_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,77 +122,133 @@ def _GetSubFileEntries(self):

@property
def access_time(self):
"""dfdatetime.DateTimeValues: access time or None if not available."""
"""Retrieves the access time.
Returns:
dfdatetime.DateTimeValues: access time or None if not available.
"""
return None

@property
def added_time(self):
"""dfdatetime.DateTimeValues: added time or None if not available."""
"""Retrieves the added time.
Returns:
dfdatetime.DateTimeValues: added time or None if not available.
"""
return None

@property
def attributes(self):
"""Generator[Attribute]: attributes."""
"""Retrieves attributes.
Returns:
generator[Attribute]: attributes.
"""
return self._GetAttributes()

@property
def backup_time(self):
"""dfdatetime.DateTimeValues: backup time or None if not available."""
"""Retrieves the backup time.
Returns:
dfdatetime.DateTimeValues: backup time or None if not available.
"""
return None

@property
def change_time(self):
"""dfdatetime.DateTimeValues: change time or None if not available."""
"""Retrieves the change time.
Returns:
dfdatetime.DateTimeValues: change time or None if not available.
"""
return None

@property
def creation_time(self):
"""dfdatetime.DateTimeValues: creation time or None if not available."""
"""Retrieves the creation time.
Returns:
dfdatetime.DateTimeValues: creation time or None if not available.
"""
return None

@property
def deletion_time(self):
"""dfdatetime.DateTimeValues: deletion time or None if not available."""
"""Retrieves the deletion time.
Returns:
dfdatetime.DateTimeValues: deletion time or None if not available.
"""
return None

@property
def data_streams(self):
"""Generator[DataStream]: data streams."""
"""Retrieves data streams.
Returns:
generator[DataStream]: data streams.
"""
return self._GetDataStreams()

@property
def link(self):
"""str: full path of the linked file entry or None if not available."""
"""Retrieves the path of a linked file entry.
Returns:
str: full path of the linked file entry or None if not available.
"""
if not self.IsLink():
return None

return self._GetLink()

@property
def modification_time(self):
"""dfdatetime.DateTimeValues: modification time or None if not available."""
"""Retrieves the modification time.
Returns:
dfdatetime.DateTimeValues: modification time or None if not available.
"""
return None

@property
@abc.abstractmethod
def name(self):
"""str: name of the file entry, without the full path."""
"""Retrieves the name.
Returns:
str: name of the file entry, without the full path.
"""

@property
def number_of_attributes(self):
"""int: number of attributes."""
"""Retrieves the number of attributes.
Returns:
int: number of attributes.
"""
attributes = self._GetAttributes()
return len(attributes)

@property
def number_of_data_streams(self):
"""int: number of data streams."""
"""Retrieves the number of data streams.
Returns:
int: number of data streams.
"""
data_streams = self._GetDataStreams()
return len(data_streams)

@property
def number_of_sub_file_entries(self):
"""int: number of sub file entries."""
"""Retrieves the number of sub file entries.
Returns:
int: number of sub file entries.
"""
number_of_sub_file_entries = 0
if self.entry_type == definitions.FILE_ENTRY_TYPE_DIRECTORY:
directory = self._GetDirectory()
Expand All @@ -203,19 +259,30 @@ def number_of_sub_file_entries(self):

@property
def size(self):
"""int: size of the file entry in bytes or None if not available."""
"""Retrieves the size.
Returns:
int: size of the file entry in bytes or None if not available.
"""
return None

@property
def sub_file_entries(self):
"""Generator[FileEntry]: sub file entries."""
"""Retrieves sub file entries.
Returns:
generator[FileEntry]: sub file entries.
"""
return self._GetSubFileEntries()

@property
def type_indicator(self):
"""str: type indicator."""
# pylint: disable=no-member
return self.TYPE_INDICATOR
"""Retrieves the type indicator.
Returns:
str: type indicator.
"""
return getattr(self, 'TYPE_INDICATOR', None)

def GetDataStream(self, name, case_sensitive=True):
"""Retrieves a data stream by name.
Expand Down
54 changes: 45 additions & 9 deletions dfvfs/volume/volume_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ def _Parse(self):

@property
def attributes(self):
"""Generator[VolumeAttribute]: volume attributes generator."""
"""Retrieves attributes.
Returns:
generator[VolumeAttribute]: volume attributes generator.
"""
if not self._is_parsed:
self._Parse()
self._is_parsed = True
Expand All @@ -89,7 +93,11 @@ def attributes(self):

@property
def extents(self):
"""List[VolumeExtent]: volume extents."""
"""Retrieves extents.
Returns:
list[VolumeExtent]: volume extents.
"""
if not self._is_parsed:
self._Parse()
self._is_parsed = True
Expand All @@ -98,7 +106,11 @@ def extents(self):

@property
def number_of_attributes(self):
"""int: number of attributes."""
"""Retrieves the number of attributes.
Returns:
int: number of attributes.
"""
if not self._is_parsed:
self._Parse()
self._is_parsed = True
Expand All @@ -107,7 +119,11 @@ def number_of_attributes(self):

@property
def number_of_extents(self):
"""int: number of extents."""
"""Retrieves the number of extents.
Returns:
int: number of extents.
"""
if not self._is_parsed:
self._Parse()
self._is_parsed = True
Expand Down Expand Up @@ -181,7 +197,11 @@ def _Parse(self):

@property
def number_of_sections(self):
"""int: number of sections."""
"""Retrieves the number of sections.
Returns:
int: number of sections.
"""
if not self._is_parsed:
self._Parse()
self._is_parsed = True
Expand All @@ -190,7 +210,11 @@ def number_of_sections(self):

@property
def number_of_volumes(self):
"""int: number of volumes."""
"""Retrieves the number of volumes.
Returns:
int: number of volumes.
"""
if not self._is_parsed:
self._Parse()
self._is_parsed = True
Expand All @@ -199,7 +223,11 @@ def number_of_volumes(self):

@property
def sections(self):
"""List[VolumeExtent]: sections."""
"""Retrieves sections.
Returns:
list[VolumeExtent]: sections.
"""
if not self._is_parsed:
self._Parse()
self._is_parsed = True
Expand All @@ -208,7 +236,11 @@ def sections(self):

@property
def volume_identifiers(self):
"""List[str]: volume identifiers."""
"""Retrieves volume identifiers.
Returns:
list[str]: volume identifiers.
"""
if not self._is_parsed:
self._Parse()
self._is_parsed = True
Expand All @@ -217,7 +249,11 @@ def volume_identifiers(self):

@property
def volumes(self):
"""Generator(Volume): volumes generator."""
"""Retrieves volumes.
Returns:
generator(Volume): volumes generator.
"""
if not self._is_parsed:
self._Parse()
self._is_parsed = True
Expand Down

0 comments on commit 7dcc7a6

Please sign in to comment.