Conditions | 4 |
Total Lines | 29 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | #! /usr/bin/env python3 |
||
47 | 1 | def marvinMorning(row): |
|
48 | """ |
||
49 | Marvin says Good morning after someone else says it |
||
50 | """ |
||
51 | 1 | msg = None |
|
52 | 1 | phrases = [ |
|
53 | "morgon", |
||
54 | "godmorgon", |
||
55 | "god morgon", |
||
56 | "morrn", |
||
57 | "morn" |
||
58 | ] |
||
59 | |||
60 | 1 | morning_phrases = [ |
|
61 | "Godmorgon! :-)", |
||
62 | "Morgon allesammans", |
||
63 | "Morgon gott folk", |
||
64 | "Guten morgen", |
||
65 | "Morgon" |
||
66 | ] |
||
67 | |||
68 | global lastDateGreeted |
||
69 | |||
70 | 1 | for phrase in phrases: |
|
71 | 1 | if phrase in row: |
|
72 | 1 | if lastDateGreeted != datetime.date.today(): |
|
73 | 1 | lastDateGreeted = datetime.date.today() |
|
74 | 1 | msg = random.choice(morning_phrases) |
|
75 | return msg |
||
76 |