Correct issues found by Codacy

pull/1416/head
Cakeh 2018-02-08 22:20:56 +01:00
parent 3a11f39d7d
commit fcbf2eae9e
2 changed files with 4 additions and 7 deletions

View File

@ -100,15 +100,15 @@ def number_parse_fr(words, i):
return s, i + 1
return None
def number_word_fr(i, min, max):
# Check if words[i] is a number in numbers_fr between min and max.
def number_word_fr(i, mi, ma):
# Check if words[i] is a number in numbers_fr between mi and ma.
# If it is return tuple with number, index of next word.
# If it is not return None.
if i < len(words):
val = numbers_fr.get(words[i])
# Numbers [1-16,20,30,40,50,60,70,80,90,100,1000]
if val is not None:
if val >= min and val <= max:
if val >= mi and val <= ma:
return val, i + 1
else:
return None
@ -258,7 +258,6 @@ def extractnumber_fr(text):
val = None
word = aWords[count]
wordNext = None
wordNextNext = None
if count < (len(aWords) - 1):
wordNext = aWords[count + 1]
@ -538,7 +537,7 @@ def extract_datetime_fr(string, currentDate=None):
tmpOffset -= 7
used += 1
elif tmpOffset < 0:
tmpOffset += 7
tmpOffset += 7
dayOffset += tmpOffset
if used > 0:
if start - 1 > 0 and words[start - 1] in ["ce", "cette"]:

View File

@ -21,8 +21,6 @@ from mycroft.util.parse import get_gender
from mycroft.util.parse import extract_datetime
from mycroft.util.parse import extractnumber
from mycroft.util.parse import normalize
from mycroft.util.parse import fuzzy_match
from mycroft.util.parse import match_one
class TestNormalize_fr(unittest.TestCase):