Skip to content

Commit e660acd

Browse files
committed
Add static typing for FileDiffViewerBase.Line
1 parent dcfb7ad commit e660acd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/diffuse/widgets.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import unicodedata
2323

2424
from gettext import gettext as _
25-
from typing import Any, Dict, List
25+
from typing import Any, Dict, List, Optional
2626

2727
from diffuse import utils
2828
from diffuse.resources import theResources
@@ -173,21 +173,21 @@ def __init__(self) -> None:
173173

174174
# class describing a single line of a pane
175175
class Line:
176-
def __init__(self, line_number=None, text=None):
176+
def __init__(self, line_number: Optional[int] = None, text: Optional[str] = None) -> None:
177177
# line number
178178
self.line_number = line_number
179179
# original text for the line
180180
self.text = text
181181
# flag indicating modifications are present
182182
self.is_modified = False
183183
# actual modified text
184-
self.modified_text = None
184+
self.modified_text: Optional[str] = None
185185
# cache used to speed up comparison of strings
186186
# this should be cleared whenever the comparison preferences change
187-
self.compare_string = None
187+
self.compare_string: Optional[str] = None
188188

189189
# returns the current text for this line
190-
def getText(self):
190+
def getText(self) -> Optional[str]:
191191
if self.is_modified:
192192
return self.modified_text
193193
return self.text

0 commit comments

Comments
 (0)