mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-17 07:48:18 +01:00
Fixed for mypy code errors
This commit is contained in:
parent
dc393dd09c
commit
39f8f0f115
1 changed files with 9 additions and 7 deletions
|
@ -1,6 +1,8 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# mypy: disable-error-code="no-redef"
|
||||
|
||||
import shutil
|
||||
import subprocess
|
||||
from datetime import datetime
|
||||
|
@ -24,15 +26,15 @@ class MultiProcess(Configs):
|
|||
self.errors = Errors()
|
||||
|
||||
self.columns, self.rows = shutil.get_terminal_size()
|
||||
self.timestamp: str = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
self.head_message: str = f'Timestamp: {self.timestamp}'
|
||||
self.bottom_message: str = 'EOF - End of log file'
|
||||
self.timestamp: str = datetime.now().strftime("%Y-%m-%d %H:%M:%S") # type: ignore[annotation-unchecked]
|
||||
self.head_message: str = f'Timestamp: {self.timestamp}' # type: ignore[annotation-unchecked]
|
||||
self.bottom_message: str = 'EOF - End of log file' # type: ignore[annotation-unchecked]
|
||||
|
||||
if flags is not None:
|
||||
self.option_for_progress_bar: bool = self.utils.is_option(
|
||||
self.option_for_progress_bar: bool = self.utils.is_option( # type: ignore[annotation-unchecked]
|
||||
('-B', '--progress-bar'), flags)
|
||||
|
||||
self.option_for_reinstall: bool = self.utils.is_option(
|
||||
self.option_for_reinstall: bool = self.utils.is_option( # type: ignore[annotation-unchecked]
|
||||
('-r', '--reinstall'), flags)
|
||||
|
||||
def process_and_log(self, command: str, filename: str, progress_message: str) -> None:
|
||||
|
@ -97,7 +99,7 @@ class MultiProcess(Configs):
|
|||
self._write_log_head()
|
||||
|
||||
# Write the process to the log file and to the terminal.
|
||||
with process.stdout as output:
|
||||
with process.stdout as output: # type: ignore[union-attr]
|
||||
for i, line in enumerate(output):
|
||||
if not self.progress_bar_conf and not self.option_for_progress_bar:
|
||||
print(line.strip()) # Print to console
|
||||
|
@ -117,7 +119,7 @@ class MultiProcess(Configs):
|
|||
def _error_process(self):
|
||||
""" Prints error message for a process. """
|
||||
if not self.progress_bar_conf and not self.option_for_progress_bar:
|
||||
message: str = f'Error occurred with process. Please check the log file.'
|
||||
message: str = 'Error occurred with process. Please check the log file.' # type: ignore[annotation-unchecked]
|
||||
print()
|
||||
print(len(message) * '=')
|
||||
print(f'{self.bred}{message}{self.endc}')
|
||||
|
|
Loading…
Reference in a new issue