Fix wrong quotes

This commit is contained in:
James Fitzgerald 2022-07-02 17:10:05 -04:00 committed by xs5871
parent 81f4f7ccf0
commit ab75b2bca3

View File

@ -3,9 +3,10 @@ try:
except ImportError:
# we're not in a dev environment, so we don't need to worry about typing
pass
from micropython import const
from kmk.keys import KC, Key
from kmk.modules import Module
from micropython import const
class State:
@ -21,7 +22,7 @@ class DictionaryEntry:
class Character:
"""Helper class for making a left-shifted key identical to a right-shifted key"""
'''Helper class for making a left-shifted key identical to a right-shifted key'''
is_shifted: bool = False
@ -37,7 +38,7 @@ class Character:
class Phrase:
"""Manages a collection of characters and keeps an index of them so that potential matches can be tracked"""
'''Manages a collection of characters and keeps an index of them so that potential matches can be tracked'''
def __init__(self, string: str) -> None:
self._characters: list[Character] = []
@ -48,36 +49,36 @@ class Phrase:
self._characters.append(Character(key_code, shifted))
def next_character(self) -> None:
"""Increment the current index for this phrase"""
'''Increment the current index for this phrase'''
if not self.index_at_end():
self._index += 1
def get_character_at_current_index(self) -> Character:
"""Returns the character at the current index for this phrase"""
'''Returns the character at the current index for this phrase'''
return self._characters[self._index]
def reset_index(self) -> None:
"""Reset the index to the start of the phrase"""
'''Reset the index to the start of the phrase'''
self._index = 0
def index_at_end(self) -> bool:
"""Returns True if the index is at the end of the phrase"""
'''Returns True if the index is at the end of the phrase'''
return self._index == len(self._characters)
def character_is_next(self, character) -> bool:
"""Returns True if the given character is the next character in the phrase"""
'''Returns True if the given character is the next character in the phrase'''
return self.get_character_at_current_index() == character
class Rule:
"""Represents the relationship between a phrase to be substituted and its substitution"""
'''Represents the relationship between a phrase to be substituted and its substitution'''
def __init__(self, to_substitute: Phrase, substitution: Phrase) -> None:
self.to_substitute: Phrase = to_substitute
self.substitution: Phrase = substitution
def restart(self) -> None:
"""Resets this rule's to_substitute and substitution phrases"""
'''Resets this rule's to_substitute and substitution phrases'''
self.to_substitute.reset_index()
self.substitution.reset_index()