Skip to content

Commit

Permalink
Changes to use docformatter (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz authored Jan 28, 2024
1 parent 38b793b commit c1b8ae8
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 30 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 python3-distutils python3-pip python3-setuptools
apt-get install -y build-essential git python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv python3-distutils python3-pip python3-setuptools
- 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 python3-distutils python3-pip python3-setuptools
apt-get install -y build-essential git python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv python3-distutils python3-pip python3-setuptools
- 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 python3-distutils python3-pip python3-setuptools
apt-get install -y build-essential git python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv python3-distutils python3-pip python3-setuptools
- 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 python3-distutils python3-pip python3-setuptools
apt-get install -y build-essential git python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv python3-distutils python3-pip python3-setuptools
- 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 @@
dfdatetime (20240113-1) unstable; urgency=low
dfdatetime (20240128-1) unstable; urgency=low

* Auto-generated

-- Log2Timeline maintainers <[email protected]> Sat, 13 Jan 2024 09:23:13 +0100
-- Log2Timeline maintainers <[email protected]> Sun, 28 Jan 2024 09:38:26 +0100
6 changes: 3 additions & 3 deletions dfdatetime/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
"""Digital Forensics Date and Time (dfDateTime).
dfDateTime, or Digital Forensics date and time, provides date and time
objects to preserve accuracy and precision.
dfDateTime, or Digital Forensics date and time, provides date and time objects
to preserve accuracy and precision.
"""

# Imports for date time values factory.
Expand All @@ -25,4 +25,4 @@
from dfdatetime import webkit_time


__version__ = '20240113'
__version__ = '20240128'
4 changes: 2 additions & 2 deletions dfdatetime/dotnet_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class DotNetDateTime(interface.DateTimeValues):
""".NET DateTime ticks.
The .NET DateTime timestamp is a 64-bit signed integer that contains the date
and time as the number of 100 nanoseconds since 12:00 AM January 1, year
1 A.D. in the proleptic Gregorian Calendar.
and time as the number of 100 nanoseconds since 12:00 AM January 1, year 1
A.D. in the proleptic Gregorian Calendar.
"""

_EPOCH = DotNetDateTimeEpoch()
Expand Down
12 changes: 3 additions & 9 deletions dfdatetime/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,17 @@ def __init__(self, is_delta=False, precision=None, time_zone_offset=None):

@property
def is_delta(self):
"""is_delta (bool): True if the date and time value is relative to another
date and time value.
"""
"""Is delta (bool): True if the date and time is relative to another."""
return self._is_delta

@property
def precision(self):
"""precision (str): precision of the date and time value, which should
be one of the PRECISION_VALUES in definitions.
"""
"""Precision (str): precision of the date and time value."""
return self._precision

@property
def time_zone_offset(self):
"""time_zone_offset (int): time zone offset in number of minutes from UTC
or None if not set.
"""
"""Time zone offset (int): time zone offset in minutes from UTC."""
return self._time_zone_offset

@time_zone_offset.setter
Expand Down
12 changes: 6 additions & 6 deletions dfdatetime/systemtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,32 +111,32 @@ def day_of_week(self):

@property
def hours(self):
"""hours (int): hours, 0 through 23."""
"""Hours (int): hours, 0 through 23."""
return self._hours

@property
def milliseconds(self):
"""milliseconds (int): milliseconds, 0 through 999."""
"""Milliseconds (int): milliseconds, 0 through 999."""
return self._milliseconds

@property
def minutes(self):
"""minutes (int): minutes, 0 through 59."""
"""Minutes (int): minutes, 0 through 59."""
return self._minutes

@property
def month(self):
"""month (int): month of year, 1 through 12."""
"""Month (int): month of year, 1 through 12."""
return self._month

@property
def seconds(self):
"""seconds (int): seconds, 0 through 59."""
"""Seconds (int): seconds, 0 through 59."""
return self._seconds

@property
def year(self):
"""year (int): year, 1601 through 30827."""
"""Year (int): year, 1601 through 30827."""
return self._year

def _GetNormalizedTimestamp(self):
Expand Down
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
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.docformatter]
black = false
non-cap = ["dfDateTime"]
non-strict = false
wrap-summaries = 80
wrap-descriptions = 80
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = dfdatetime
version = 20240113
version = 20240128
description = Digital Forensics date and time (dfDateTime).
long_description = dfDateTime, or Digital Forensics date and time, provides date and time objects to preserve accuracy and precision.
long_description_content_type = text/plain
Expand Down
15 changes: 13 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py3{7,8,9,10,11,12},coverage,docs,lint,wheel
envlist = py3{7,8,9,10,11,12},coverage,docformatter,docs,lint,wheel

[testenv]
allowlist_externals = ./run_tests.py
Expand All @@ -25,6 +25,13 @@ commands =
coverage: coverage xml
wheel: python -m build --no-isolation --wheel

[testenv:docformatter]
usedevelop = True
deps =
docformatter
commands =
docformatter --in-place --recursive dfdatetime tests

[testenv:docs]
usedevelop = True
deps =
Expand All @@ -45,7 +52,11 @@ setenv =
deps =
-rrequirements.txt
-rtest_requirements.txt
pylint >= 2.17.0, < 2.18.0
docformatter
pylint >= 3.0.0, < 3.1.0
setuptools
commands =
docformatter --version
pylint --version
docformatter --check --diff --recursive dfdatetime setup.py tests
pylint --rcfile=.pylintrc dfdatetime setup.py tests
2 changes: 1 addition & 1 deletion utils/update_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dfdatetime (${VERSION}-1) unstable; urgency=low
EOT

# Regenerate the API documentation.
tox -edocs
tox -edocformatter,docs

exit ${EXIT_SUCCESS};

0 comments on commit c1b8ae8

Please sign in to comment.