38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
import sys, os
|
|
|
|
sampleMode = False
|
|
|
|
def identifyDay(inputArgument):
|
|
twoDigitsDay = '00'
|
|
day = 0 if (inputArgument[inputArgument.rfind('/')+4:inputArgument.rfind('.')] == 'XX') else inputArgument[inputArgument.rfind('/')+4:inputArgument.rfind('.')]
|
|
twoDigitsDay = str(day).zfill(2)
|
|
return twoDigitsDay
|
|
|
|
def identifyYear(inputArgument):
|
|
inputArgument = inputArgument[:inputArgument.rfind('/')]
|
|
inputArgument = inputArgument[inputArgument.rfind('/')+1:]
|
|
year = int(inputArgument) if (inputArgument.isnumeric()) else 0
|
|
fourDigitsYear = str(year).zfill(4)
|
|
return fourDigitsYear
|
|
|
|
def setSampleMode(mode:bool):
|
|
global sampleMode
|
|
if (mode) : sampleMode = True
|
|
return
|
|
|
|
def getSampleMode():
|
|
return sampleMode
|
|
|
|
def showSampleMode():
|
|
if ( getSampleMode() ):
|
|
print ("----------------------")
|
|
print ("Running im Sample Mode")
|
|
print ("----------------------")
|
|
return
|
|
|
|
def getPath2Data(aocDay,aocYear):
|
|
return './'+str(aocYear)+'/data/day'+str(aocDay)+'/'
|
|
|
|
def getFilename2Data(aocDay):
|
|
dataFilename = 'sample.day'+str(aocDay) if ( sampleMode ) else 'input.day'+str(aocDay)
|
|
return dataFilename |