move get week method into utils file
This commit is contained in:
parent
d0b58a5a79
commit
01230ea178
3 changed files with 8 additions and 7 deletions
|
@ -1,11 +1,5 @@
|
|||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def get_week(d=datetime.today()):
|
||||
return (int(d.strftime("%W")) + 52 - 5) % 52
|
||||
|
||||
|
||||
# default is 'primary', if you are using a separate calendar for your course schedule,
|
||||
# your calendarId (which you can find by going to your Google Calendar settings, selecting
|
||||
# the relevant calendar and scrolling down to Calendar ID) probably looks like
|
||||
|
|
|
@ -5,7 +5,8 @@ import re
|
|||
import subprocess
|
||||
from datetime import datetime
|
||||
|
||||
from config import get_week, DATE_FORMAT, LOCALE, DEFAULT_MASTER_FILE_NAME, DEFAULT_NEW_LECTURE_HEADER
|
||||
from config import DATE_FORMAT, LOCALE, DEFAULT_MASTER_FILE_NAME, DEFAULT_NEW_LECTURE_HEADER
|
||||
from utils import get_week
|
||||
|
||||
# TODO
|
||||
locale.setlocale(locale.LC_TIME, LOCALE)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from datetime import datetime
|
||||
|
||||
from config import MAX_LEN
|
||||
|
||||
|
||||
|
@ -15,3 +17,7 @@ def generate_short_title(title):
|
|||
short_title = title[:MAX_LEN - len(' ... ')] + ' ... '
|
||||
short_title = short_title.replace('$', '')
|
||||
return short_title
|
||||
|
||||
|
||||
def get_week(d=datetime.today()):
|
||||
return (int(d.strftime("%W")) + 52 - 5) % 52
|
Loading…
Reference in a new issue