Skip to content

Commit

Permalink
Changes to use docformatter (log2timeline#4795)
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz authored Jan 28, 2024
1 parent 7c98809 commit 321cca3
Show file tree
Hide file tree
Showing 75 changed files with 193 additions and 174 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
add-apt-repository -y ppa:deadsnakes/ppa
add-apt-repository -y ppa:gift/dev
apt-get update -q
apt-get install -y build-essential git libffi-dev python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libcaes-python3 libcreg-python3 libesedb-python3 libevt-python3 libevtx-python3 libewf-python3 libfcrypto-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libfwsi-python3 liblnk-python3 libluksde-python3 libmodi-python3 libmsiecf-python3 libolecf-python3 libphdi-python3 libqcow-python3 libregf-python3 libscca-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libssl-dev libvhdi-python3 libvmdk-python3 libvsapm-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-acstore python3-artifacts python3-bencode python3-certifi python3-cffi-backend python3-chardet python3-dateutil python3-defusedxml python3-dfdatetime python3-dfvfs python3-dfwinreg python3-distutils python3-dtfabric python3-fakeredis python3-flor python3-future python3-idna python3-lz4 python3-mock python3-opensearch python3-pefile python3-pip python3-psutil python3-pyparsing python3-pytsk3 python3-redis python3-requests python3-setuptools python3-six python3-tz python3-urllib3 python3-xattr python3-xlsxwriter python3-yaml python3-yara python3-zmq python3-zstd
apt-get install -y build-essential git libffi-dev libssl-dev python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libcaes-python3 libcreg-python3 libesedb-python3 libevt-python3 libevtx-python3 libewf-python3 libfcrypto-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libfwsi-python3 liblnk-python3 libluksde-python3 libmodi-python3 libmsiecf-python3 libolecf-python3 libphdi-python3 libqcow-python3 libregf-python3 libscca-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsapm-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-acstore python3-artifacts python3-bencode python3-certifi python3-cffi-backend python3-chardet python3-dateutil python3-defusedxml python3-dfdatetime python3-dfvfs python3-dfwinreg python3-distutils python3-dtfabric python3-fakeredis python3-flor python3-future python3-idna python3-lz4 python3-mock python3-opensearch python3-pefile python3-pip python3-psutil python3-pyparsing python3-pytsk3 python3-redis python3-requests python3-setuptools python3-six python3-tz python3-urllib3 python3-xattr python3-xlsxwriter python3-yaml python3-yara python3-zmq python3-zstd
- name: Install tox
run: |
python3 -m pip install tox
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test_tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
add-apt-repository -y ppa:deadsnakes/ppa
add-apt-repository -y ppa:gift/dev
apt-get update -q
apt-get install -y build-essential git libffi-dev python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libcaes-python3 libcreg-python3 libesedb-python3 libevt-python3 libevtx-python3 libewf-python3 libfcrypto-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libfwsi-python3 liblnk-python3 libluksde-python3 libmodi-python3 libmsiecf-python3 libolecf-python3 libphdi-python3 libqcow-python3 libregf-python3 libscca-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libssl-dev libvhdi-python3 libvmdk-python3 libvsapm-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-acstore python3-artifacts python3-bencode python3-certifi python3-cffi-backend python3-chardet python3-dateutil python3-defusedxml python3-dfdatetime python3-dfvfs python3-dfwinreg python3-distutils python3-dtfabric python3-fakeredis python3-flor python3-future python3-idna python3-lz4 python3-mock python3-opensearch python3-pefile python3-pip python3-psutil python3-pyparsing python3-pytsk3 python3-redis python3-requests python3-setuptools python3-six python3-tz python3-urllib3 python3-xattr python3-xlsxwriter python3-yaml python3-yara python3-zmq python3-zstd
apt-get install -y build-essential git libffi-dev libssl-dev python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libcaes-python3 libcreg-python3 libesedb-python3 libevt-python3 libevtx-python3 libewf-python3 libfcrypto-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libfwsi-python3 liblnk-python3 libluksde-python3 libmodi-python3 libmsiecf-python3 libolecf-python3 libphdi-python3 libqcow-python3 libregf-python3 libscca-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsapm-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-acstore python3-artifacts python3-bencode python3-certifi python3-cffi-backend python3-chardet python3-dateutil python3-defusedxml python3-dfdatetime python3-dfvfs python3-dfwinreg python3-distutils python3-dtfabric python3-fakeredis python3-flor python3-future python3-idna python3-lz4 python3-mock python3-opensearch python3-pefile python3-pip python3-psutil python3-pyparsing python3-pytsk3 python3-redis python3-requests python3-setuptools python3-six python3-tz python3-urllib3 python3-xattr python3-xlsxwriter python3-yaml python3-yara python3-zmq python3-zstd
- name: Install tox
run: |
python3 -m pip install tox
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
add-apt-repository -y ppa:deadsnakes/ppa
add-apt-repository -y ppa:gift/dev
apt-get update -q
apt-get install -y build-essential git libffi-dev python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libcaes-python3 libcreg-python3 libesedb-python3 libevt-python3 libevtx-python3 libewf-python3 libfcrypto-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libfwsi-python3 liblnk-python3 libluksde-python3 libmodi-python3 libmsiecf-python3 libolecf-python3 libphdi-python3 libqcow-python3 libregf-python3 libscca-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libssl-dev libvhdi-python3 libvmdk-python3 libvsapm-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-acstore python3-artifacts python3-bencode python3-certifi python3-cffi-backend python3-chardet python3-dateutil python3-defusedxml python3-dfdatetime python3-dfvfs python3-dfwinreg python3-distutils python3-dtfabric python3-fakeredis python3-flor python3-future python3-idna python3-lz4 python3-mock python3-opensearch python3-pefile python3-pip python3-psutil python3-pyparsing python3-pytsk3 python3-redis python3-requests python3-setuptools python3-six python3-tz python3-urllib3 python3-xattr python3-xlsxwriter python3-yaml python3-yara python3-zmq python3-zstd
apt-get install -y build-essential git libffi-dev libssl-dev python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libcaes-python3 libcreg-python3 libesedb-python3 libevt-python3 libevtx-python3 libewf-python3 libfcrypto-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libfwsi-python3 liblnk-python3 libluksde-python3 libmodi-python3 libmsiecf-python3 libolecf-python3 libphdi-python3 libqcow-python3 libregf-python3 libscca-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsapm-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-acstore python3-artifacts python3-bencode python3-certifi python3-cffi-backend python3-chardet python3-dateutil python3-defusedxml python3-dfdatetime python3-dfvfs python3-dfwinreg python3-distutils python3-dtfabric python3-fakeredis python3-flor python3-future python3-idna python3-lz4 python3-mock python3-opensearch python3-pefile python3-pip python3-psutil python3-pyparsing python3-pytsk3 python3-redis python3-requests python3-setuptools python3-six python3-tz python3-urllib3 python3-xattr python3-xlsxwriter python3-yaml python3-yara python3-zmq python3-zstd
- name: Install tox
run: |
python3 -m pip install tox
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
add-apt-repository -y ppa:deadsnakes/ppa
add-apt-repository -y ppa:gift/dev
apt-get update -q
apt-get install -y build-essential git libffi-dev python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libcaes-python3 libcreg-python3 libesedb-python3 libevt-python3 libevtx-python3 libewf-python3 libfcrypto-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libfwsi-python3 liblnk-python3 libluksde-python3 libmodi-python3 libmsiecf-python3 libolecf-python3 libphdi-python3 libqcow-python3 libregf-python3 libscca-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libssl-dev libvhdi-python3 libvmdk-python3 libvsapm-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-acstore python3-artifacts python3-bencode python3-certifi python3-cffi-backend python3-chardet python3-dateutil python3-defusedxml python3-dfdatetime python3-dfvfs python3-dfwinreg python3-distutils python3-dtfabric python3-fakeredis python3-flor python3-future python3-idna python3-lz4 python3-mock python3-opensearch python3-pefile python3-pip python3-psutil python3-pyparsing python3-pytsk3 python3-redis python3-requests python3-setuptools python3-six python3-tz python3-urllib3 python3-xattr python3-xlsxwriter python3-yaml python3-yara python3-zmq python3-zstd
apt-get install -y build-essential git libffi-dev libssl-dev python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libcaes-python3 libcreg-python3 libesedb-python3 libevt-python3 libevtx-python3 libewf-python3 libfcrypto-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libfwsi-python3 liblnk-python3 libluksde-python3 libmodi-python3 libmsiecf-python3 libolecf-python3 libphdi-python3 libqcow-python3 libregf-python3 libscca-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsapm-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-acstore python3-artifacts python3-bencode python3-certifi python3-cffi-backend python3-chardet python3-dateutil python3-defusedxml python3-dfdatetime python3-dfvfs python3-dfwinreg python3-distutils python3-dtfabric python3-fakeredis python3-flor python3-future python3-idna python3-lz4 python3-mock python3-opensearch python3-pefile python3-pip python3-psutil python3-pyparsing python3-pytsk3 python3-redis python3-requests python3-setuptools python3-six python3-tz python3-urllib3 python3-xattr python3-xlsxwriter python3-yaml python3-yara python3-zmq python3-zstd
- name: Install tox
run: |
python3 -m pip install tox
Expand Down
4 changes: 2 additions & 2 deletions config/dpkg/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plaso (20240114-1) unstable; urgency=low
plaso (20240128-1) unstable; urgency=low

* Auto-generated

-- Log2Timeline maintainers <[email protected]> Sun, 14 Jan 2024 06:47:49 +0100
-- Log2Timeline maintainers <[email protected]> Sun, 28 Jan 2024 18:10:35 +0100
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
# docstrings.
napoleon_google_docstring = True
napoleon_numpy_docstring = False
napoleon_include_init_with_doc = True
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = True

Expand Down
2 changes: 1 addition & 1 deletion plaso/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
of log2timeline.
"""

__version__ = '20240114'
__version__ = '20240128'
4 changes: 2 additions & 2 deletions plaso/analysis/bloom.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Analysis plugin to look up file hashes in bloom database."""

import flor
import flor # pylint: disable=import-error

from plaso.analysis import hash_tagging
from plaso.analysis import logger
Expand Down Expand Up @@ -114,7 +114,7 @@ def _QueryHash(self, digest, bloom_filter):
return value_to_test in bloom_filter

def SetBloomDatabasePath(self, bloom_database_path):
"""Set the path to the bloom file containing hash
"""Set the path to the bloom file containing hash.
Args:
bloom_database_path (str): Path to the bloom file
Expand Down
4 changes: 2 additions & 2 deletions plaso/analysis/unique_domains_visited.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class UniqueDomainsVisitedPlugin(interface.AnalysisPlugin):
"""A plugin to generate a list all domains visited.
This plugin will extract domains from browser history events extracted by
Plaso. The list produced can be used to quickly determine if there has been
a visit to a site of interest, for example, a known phishing site.
Plaso. The list produced can be used to quickly determine if there has been a
visit to a site of interest, for example, a known phishing site.
"""

NAME = 'unique_domains_visited'
Expand Down
2 changes: 1 addition & 1 deletion plaso/analysis/virustotal.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def SetAPIKey(self, api_key):
self._api_key = api_key

def TestConnection(self):
"""Tests the connection to VirusTotal
"""Tests the connection to VirusTotal.
Returns:
bool: True if VirusTotal is reachable.
Expand Down
2 changes: 1 addition & 1 deletion plaso/analyzers/hashers/sha1.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
"""The SHA-1 Hasher implementation"""
"""The SHA-1 Hasher implementation."""

import hashlib

Expand Down
2 changes: 1 addition & 1 deletion plaso/analyzers/hashers/sha256.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
"""The SHA-256 Hasher implementation"""
"""The SHA-256 Hasher implementation."""

import hashlib

Expand Down
3 changes: 2 additions & 1 deletion plaso/analyzers/hashing_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class HashingAnalyzer(interface.BaseAnalyzer):
"""This class contains code for calculating file hashes of input files.
In Plaso, hashers are classes that map arbitrarily sized file content to a
fixed size value. See: https://en.wikipedia.org/wiki/Hash_function
fixed size value. See:
https://en.wikipedia.org/wiki/Hash_function
"""

NAME = 'hashing'
Expand Down
2 changes: 1 addition & 1 deletion plaso/analyzers/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BaseAnalyzer(object):

@abc.abstractmethod
def Analyze(self, data):
"""Analyzes a block of data, updating the state of the analyzer
"""Analyzes a block of data, updating the state of the analyzer.
Args:
data(bytes): block of data to process.
Expand Down
2 changes: 1 addition & 1 deletion plaso/cli/pinfo_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ def _PrintEventLabelsCounter(
table_view.Write(self._output_writer)

def _PrintParsersCounter(self, parsers_counter, session_identifier=None):
"""Prints the parsers counter
"""Prints the parsers counter.
Args:
parsers_counter (collections.Counter): number of events per parser or
Expand Down
2 changes: 1 addition & 1 deletion plaso/cli/psort_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def _ParseProcessingOptions(self, options):
self._worker_timeout = worker_timeout

def AddProcessingOptions(self, argument_group):
"""Adds processing options to the argument group
"""Adds processing options to the argument group.
Args:
argument_group (argparse._ArgumentGroup): argparse argument group.
Expand Down
2 changes: 1 addition & 1 deletion plaso/containers/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __init__(self, family=None, product=None, version=None):

@property
def version_tuple(self):
"""tuple[int]: version tuple or None if version is not set or invalid."""
"""Tuple[int]: version tuple or None if version is not set or invalid."""
try:
# pylint: disable=consider-using-generator
return tuple([int(digit, 10) for digit in self.version.split('.')])
Expand Down
4 changes: 2 additions & 2 deletions plaso/containers/event_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def __lt__(self, other):
class FileEntryEventSource(EventSource):
"""File entry event source.
The file entry event source is an event source that represents a file
within a file system.
The file entry event source is an event source that represents a file within a
file system.
"""
DATA_TYPE = 'file_entry'

Expand Down
12 changes: 5 additions & 7 deletions plaso/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,11 @@ def GetSourceFileSystem(self, file_system_path_spec, resolver_context=None):
resolver_context (dfvfs.Context): resolver context.
Returns:
tuple: containing:
dfvfs.FileSystem: file system
path.PathSpec: mount point path specification. The mount point path
specification refers to either a directory or a volume on a storage
media device or image. It is needed by the dfVFS file system
to indicate the base location of the file system.
tuple[dfvfs.FileSystem, path.PathSpec]: file system and mount point path
specification. The mount point path specification refers to either a
directory or a volume on a storage media device or image. It is
needed by the dfVFS file system to indicate the base location of the
file system.
Raises:
RuntimeError: if source file system path specification is not set.
Expand Down
4 changes: 2 additions & 2 deletions plaso/engine/knowledge_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
The knowledge base is filled by user provided input and the pre-processing
phase. It is intended to provide successive phases, like the parsing and
analysis phases, with essential information like the time zone and codepage
of the source data.
analysis phases, with essential information like the time zone and codepage of
the source data.
"""

import codecs
Expand Down
4 changes: 2 additions & 2 deletions plaso/engine/path_filters.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
"""Path filters.
Path filters are specified in filter files and are used during collection
to include or exclude file system paths.
Path filters are specified in filter files and are used during collection to
include or exclude file system paths.
"""

from dfvfs.helpers import file_system_searcher
Expand Down
13 changes: 6 additions & 7 deletions plaso/filters/path_filter.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
"""A scan tree-based path filter implementation.
The scan tree is a tree based on multiple paths that contains the path
segments per node. The most significant path segment is at the root and
therefore compared first. More information can be found here:
The scan tree is a tree based on multiple paths that contains the path segments
per node. The most significant path segment is at the root and therefore
compared first. More information can be found here:
https://github.com/libyal/libsigscan/wiki/Internals#scanning-tree-based-signature-scanning
The scan tree is used in the filter to filter provided paths.
Expand Down Expand Up @@ -97,9 +97,8 @@ def ToDebugString(self):
class _PathSegmentWeights(object):
"""Path segment weights.
The path segment weights are used to determine the most significant
path segment per index. The path segment weights are used to construct
a scan tree.
The path segment weights are used to determine the most significant path
segment per index. The path segment weights are used to construct a scan tree.
"""

def __init__(self):
Expand Down Expand Up @@ -582,7 +581,7 @@ def __init__(self, path_segment_index):

@property
def path_segments(self):
"""list[str]: path segments."""
"""List[str]: path segments."""
return self._path_segments.keys()

def AddPathSegment(self, path_segment, scan_object): # pylint: disable=missing-type-doc
Expand Down
10 changes: 5 additions & 5 deletions plaso/formatters/interface.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
"""This file contains the event formatters interface classes.
The l2t_csv and other formats are dependent on a message field,
referred to as description_long and description_short in l2t_csv.
The l2t_csv and other formats are dependent on a message field, referred to as
description_long and description_short in l2t_csv.
Plaso no longer stores these field explicitly.
A formatter, with a format string definition, is used to convert
the event object values into a formatted string that is similar
to the description_long and description_short field.
A formatter, with a format string definition, is used to convert the event
object values into a formatted string that is similar to the description_long
and description_short field.
"""

import abc
Expand Down
Loading

0 comments on commit 321cca3

Please sign in to comment.