Skip to content

Commit 48c07d5

Browse files
Copilotadmdly
andauthored
Fix PoChecker instance isolation, method naming, and boolean simplification (#6)
* Initial plan * Fix class variable, rename method, and simplify boolean expression in PoChecker Agent-Logs-Url: https://github.com/FOSSBilling/poLanguageChecker/sessions/71c52364-8543-4ca5-a8d3-c22505437ce2 Co-authored-by: admdly <2807620+admdly@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
1 parent 81522d2 commit 48c07d5

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

check.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
# poChecker class - does all the main work
2929
class PoChecker:
30-
totalIssues = 0
3130

3231
def __init__(
3332
self,
@@ -57,6 +56,7 @@ def __init__(
5756
self.check_translation = check_translation
5857
self.custom_dict = custom_dict
5958
self.verbose = verbose
59+
self.totalIssues = 0
6060

6161
# Main check loop
6262
def process(self):
@@ -82,7 +82,7 @@ def doCheck(self, string):
8282
self.outputIssue(issue)
8383

8484
# Suggests a spelling correction using the custom dictionary
85-
def suggestCorrectionsFromCustomDic(self, typo, distance_limit=3):
85+
def suggestCorrectionsFromCustomDict(self, typo, distance_limit=3):
8686
min_dist = distance_limit + 1
8787
suggested_word = None
8888

@@ -124,13 +124,13 @@ def outputIssue(self, issue):
124124
issue.offsetInContext : issue.offsetInContext + issue.errorLength
125125
]
126126

127-
hasSuggestion = True if issue.replacements and issue.replacements[0] else False
127+
hasSuggestion = bool(issue.replacements and issue.replacements[0])
128128

129129
# Our method for giving suggestions is less robust, we should reduce the allowed edit distance if a suggestion was already provided
130130
if hasSuggestion:
131-
suggestionFromCustomDict = self.suggestCorrectionsFromCustomDic(typo, 2)
131+
suggestionFromCustomDict = self.suggestCorrectionsFromCustomDict(typo, 2)
132132
else:
133-
suggestionFromCustomDict = self.suggestCorrectionsFromCustomDic(typo, 3)
133+
suggestionFromCustomDict = self.suggestCorrectionsFromCustomDict(typo, 3)
134134

135135
if hasSuggestion:
136136
# Ensure we are providing the suggestion with the smallest edit distance

0 commit comments

Comments
 (0)