init
This commit is contained in:
42
2022/helpingFunctions.py
Normal file
42
2022/helpingFunctions.py
Normal file
@@ -0,0 +1,42 @@
|
||||
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)+'/day'+str(aocDay)+'/'
|
||||
|
||||
def getFilename2Data(aocDay):
|
||||
dataFilename = 'sample.day'+str(aocDay) if ( sampleMode ) else 'input.day'+str(aocDay)
|
||||
return dataFilename
|
||||
|
||||
def readDataFile (path, filename):
|
||||
data = ''
|
||||
return data
|
||||
Reference in New Issue
Block a user