Skip to content

Commit

Permalink
Refactor: Add annotations to base lftools
Browse files Browse the repository at this point in the history
Issue: RELENG-4933
Signed-off-by: Andrew Grimberg <[email protected]>
Change-Id: I9d793ebe4db3ca47dafee56c9016789f8bcd3f1f
  • Loading branch information
tykeal committed Oct 6, 2023
1 parent bc55d33 commit 49d12c1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lftools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: EPL-1.0
##############################################################################
# Copyright (c) 2017 The Linux Foundation and others.
# Copyright (c) 2017, 2023 The Linux Foundation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -9,8 +9,10 @@
#
# Contributors:
# Thanh Ha - Initial implementation
# Linux Foundation Release Engineering
##############################################################################
"""lftools package."""
from __future__ import annotations

__author__ = "Thanh Ha"
__summary__ = "Linux Foundation Release Engineering Tools"
Expand All @@ -22,11 +24,11 @@
class LogFormatter(logging.Formatter):
"""Custom log formatter."""

default_fmt = logging.Formatter("%(levelname)s: %(message)s")
debug_fmt = logging.Formatter("%(levelname)s: %(name)s:%(lineno)d: %(message)s")
info_fmt = logging.Formatter("%(message)s")
default_fmt: logging.Formatter = logging.Formatter("%(levelname)s: %(message)s")
debug_fmt: logging.Formatter = logging.Formatter("%(levelname)s: %(name)s:%(lineno)d: %(message)s")
info_fmt: logging.Formatter = logging.Formatter("%(message)s")

def format(self, record):
def format(self, record: logging.LogRecord) -> str:
"""Format log messages depending on log level."""
if record.levelno == logging.INFO:
return self.info_fmt.format(record)
Expand Down
24 changes: 24 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[mypy]
warn_return_any = True
warn_unused_configs = True

[mypy-defusedxml.minidom.*]
ignore_missing_imports = True

[mypy-docker.*]
ignore_missing_imports = True

[mypy-jenkins.*]
ignore_missing_imports = True

[mypy-ldap.*]
ignore_missing_imports = True

[mypy-oauth2client.*]
ignore_missing_imports = True

[mypy-pygerrit2.*]
ignore_missing_imports = True

[mypy-ruamel.*]
ignore_missing_imports = True

0 comments on commit 49d12c1

Please sign in to comment.