From e660acdc4880cf6dbf6c2fdc83248749e58d1715 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Sun, 9 Jan 2022 16:04:05 -0500 Subject: [PATCH] Add static typing for FileDiffViewerBase.Line --- src/diffuse/widgets.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/diffuse/widgets.py b/src/diffuse/widgets.py index a57a9bb..f901917 100644 --- a/src/diffuse/widgets.py +++ b/src/diffuse/widgets.py @@ -22,7 +22,7 @@ import os import unicodedata from gettext import gettext as _ -from typing import Any, Dict, List +from typing import Any, Dict, List, Optional from diffuse import utils from diffuse.resources import theResources @@ -173,7 +173,7 @@ class FileDiffViewerBase(Gtk.Grid): # class describing a single line of a pane class Line: - def __init__(self, line_number=None, text=None): + def __init__(self, line_number: Optional[int] = None, text: Optional[str] = None) -> None: # line number self.line_number = line_number # original text for the line @@ -181,13 +181,13 @@ class FileDiffViewerBase(Gtk.Grid): # flag indicating modifications are present self.is_modified = False # actual modified text - self.modified_text = None + self.modified_text: Optional[str] = None # cache used to speed up comparison of strings # this should be cleared whenever the comparison preferences change - self.compare_string = None + self.compare_string: Optional[str] = None # returns the current text for this line - def getText(self): + def getText(self) -> Optional[str]: if self.is_modified: return self.modified_text return self.text