Grammalecte  Check-in [b0e46a6636]

Overview
Comment:[fr][core] date verification: switch back to previous behavior
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fr | core | rg
Files: files | file ages | folders
SHA3-256: b0e46a6636b85a40743609691ce5dcefd71e5ccfd6093724055ed03b92a5ca5b
User & Date: olr on 2018-07-17 11:40:50
Other Links: branch diff | manifest | tags
Context
2018-07-17
11:41
[fr] conversion: regex rules -> graph rules check-in: 1768a9e3e4 user: olr tags: fr, rg
11:40
[fr][core] date verification: switch back to previous behavior check-in: b0e46a6636 user: olr tags: core, fr, rg
11:38
[core] better capitalization function check-in: 0b3f9d14dc user: olr tags: core, rg
Changes

Modified gc_lang/fr/modules/gce_date_verif.py from [ea534786c6] to [c3f0a9eb2f].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
..
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
        return datetime.date(int(sYear), _dMonth.get(sMonth.lower(), ""), int(sDay))
    except ValueError:
        return False
    except:
        return True


def checkDay (sWeekday, sDate):
    "to use if <sMonth> is a number"
    print(sWeekday, sDay)
    sDay, sMonth, sYear = sDate.split("-")
    oDate = checkDate(sDay, sMonth, sYear)
    if oDate and _lDay[oDate.weekday()] != sWeekday.lower():
        return False
    return True


def checkDayWithString (sWeekday, sDay, sMonth, sYear):
................................................................................
    "to use if <sMonth> is a noun"
    oDate = checkDate(sDay, _dMonth.get(sMonth, ""), sYear)
    if oDate and _lDay[oDate.weekday()] != sWeekday.lower():
        return False
    return True


def getDay (sDate):
    "to use if <sMonth> is a number"
    sDay, sMonth, sYear = sDate.split("-")
    return _lDay[datetime.date(int(sYear), int(sMonth), int(sDay)).weekday()]


def getDayWithString (sDay, sMonth, sYear):
    "to use if <sMonth> is a noun"
    return _lDay[datetime.date(int(sYear), _dMonth.get(sMonth.lower(), ""), int(sDay)).weekday()]







|

<
<







 







|

<






24
25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
..
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
        return datetime.date(int(sYear), _dMonth.get(sMonth.lower(), ""), int(sDay))
    except ValueError:
        return False
    except:
        return True


def checkDay (sWeekday, sDay, sMonth, sYear):
    "to use if <sMonth> is a number"


    oDate = checkDate(sDay, sMonth, sYear)
    if oDate and _lDay[oDate.weekday()] != sWeekday.lower():
        return False
    return True


def checkDayWithString (sWeekday, sDay, sMonth, sYear):
................................................................................
    "to use if <sMonth> is a noun"
    oDate = checkDate(sDay, _dMonth.get(sMonth, ""), sYear)
    if oDate and _lDay[oDate.weekday()] != sWeekday.lower():
        return False
    return True


def getDay (sDay, sMonth, sYear):
    "to use if <sMonth> is a number"

    return _lDay[datetime.date(int(sYear), int(sMonth), int(sDay)).weekday()]


def getDayWithString (sDay, sMonth, sYear):
    "to use if <sMonth> is a noun"
    return _lDay[datetime.date(int(sYear), _dMonth.get(sMonth.lower(), ""), int(sDay)).weekday()]