-
-
Save anonymous/a8d7845e38ab758aa193ac59b953d762 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plover/steno_dictionary.py | 4 ++-- | |
plover/translation.py | 10 +++++----- | |
2 files changed, 7 insertions(+), 7 deletions(-) | |
diff --git i/plover/steno_dictionary.py w/plover/steno_dictionary.py | |
index d9ddcce3..486dd932 100644 | |
--- i/plover/steno_dictionary.py | |
+++ w/plover/steno_dictionary.py | |
@@ -66,7 +66,7 @@ class StenoDictionary(collections.MutableMapping): | |
self._longest_key = 0 | |
def __contains__(self, key): | |
- return self.get(key) is not None | |
+ return key in self._dict | |
def reverse_lookup(self, value): | |
return self.reverse.get(value, ()) | |
@@ -126,7 +126,7 @@ class StenoDictionaryCollection(object): | |
if key_len > d.longest_key: | |
continue | |
value = d.get(key) | |
- if value: | |
+ if value is not None: | |
for f in filters: | |
if f(key, value): | |
return None | |
diff --git i/plover/translation.py w/plover/translation.py | |
index 493d63a5..d387dc4c 100644 | |
--- i/plover/translation.py | |
+++ w/plover/translation.py | |
@@ -333,7 +333,7 @@ class Translator(object): | |
t.is_retrospective_command = True | |
return t | |
- if mapping is not None: # Could be the empty string. | |
+ if mapping: | |
return Translation([stroke], mapping) | |
t = self._find_translation_helper(stroke, system.SUFFIX_KEYS) | |
if t: | |
@@ -360,7 +360,7 @@ class Translator(object): | |
strokes = list(itertools.chain(*[t.strokes for t in replaced])) | |
strokes.append(stroke) | |
mapping = self._lookup(strokes, suffixes) | |
- if mapping != None: | |
+ if mapping: | |
t = Translation(strokes, mapping) | |
t.replaced = replaced | |
return t | |
@@ -368,14 +368,14 @@ class Translator(object): | |
def _lookup(self, strokes, suffixes=()): | |
dict_key = tuple(s.rtfcre for s in strokes) | |
result = self._dictionary.lookup(dict_key) | |
- if result != None: | |
+ if result: | |
return result | |
for key in suffixes: | |
if key in strokes[-1].steno_keys: | |
dict_key = (Stroke([key]).rtfcre,) | |
suffix_mapping = self._dictionary.lookup(dict_key) | |
- if suffix_mapping is None: | |
+ if not suffix_mapping: | |
continue | |
keys = strokes[-1].steno_keys[:] | |
keys.remove(key) | |
@@ -383,7 +383,7 @@ class Translator(object): | |
copy[-1] = Stroke(keys) | |
dict_key = tuple(s.rtfcre for s in copy) | |
main_mapping = self._dictionary.lookup(dict_key) | |
- if main_mapping is None: | |
+ if not main_mapping: | |
continue | |
return main_mapping + ' ' + suffix_mapping | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment