Skip to content

Commit

Permalink
Actualize CyberAge biographical example generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
gabywald committed Nov 20, 2020
1 parent f84379d commit 4f2671c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 18 deletions.
6 changes: 3 additions & 3 deletions Python/biography/BiographicTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def subLoad( self, tables, fileInConfig ) :
if (tables != None) :
return tables
tables = {}
data = ModuleHelper.loadConfig( fileInConfig )
data = ModuleHelper.loadFileConfig( fileInConfig )
nextTable = None
nextSubTable = None
for line in data :
Expand Down Expand Up @@ -77,7 +77,7 @@ def loadJobsToSkills( self ) :
if (self._jobsToSkills != None) :
return self._jobsToSkills
self._jobsToSkills = {}
data = ModuleHelper.loadConfig( "metiersEtTalentsCyberAge" )
data = ModuleHelper.loadFileConfig( "metiersEtTalentsCyberAge" )
nextTable = None
for line in data :
resultTableHead = re.match( "^(.*?)\t(.*?)$", line)
Expand All @@ -95,7 +95,7 @@ def loadSkills( self ) :
if (self._skills != None) :
return self._skills
self._skills = {}
data = ModuleHelper.loadConfig( "talentsCyberAge" )
data = ModuleHelper.loadFileConfig( "talentsCyberAge" )
nextTable = None
for line in data :
resultTableHead = re.match( "^(.*?)\t(.*?)(\t\[(.*?)\])?$", line)
Expand Down
39 changes: 25 additions & 14 deletions Python/biography/ModuleHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,29 @@
import configparser

def readFileToList( filePath ) :
"""Read file from path indicated in parameter and return it as a list of lines. """
listToReturn = []
with open(filePath, 'r') as file :
data = file.read()
listToReturn = data.split( "\n" )
return listToReturn
"""Read file from path indicated in parameter and return it as a list of lines. """
listToReturn = []
with open(filePath, 'r') as file :
data = file.read()
listToReturn = data.split( "\n" )
return listToReturn

def loadConfig( nameOfRSC ) :
## Use a configuration file ! 'sources.ini' !
parser = configparser.ConfigParser()
parser.read( "sources.ini" )
if parser.has_option('paths', nameOfRSC):
return readFileToList( parser[ "paths" ].get( nameOfRSC ) )
else:
return []
def loadFileConfig( nameOfRSC ) :
""" To read file resources ! """
## Use a configuration file ! 'sources.ini' !
parser = configparser.ConfigParser()
parser.read( "sources.ini" )
if parser.has_option('paths', nameOfRSC):
return readFileToList( parser[ "paths" ].get( nameOfRSC ) )
else:
return []

def loadDataConfig( nameOfRSC ) :
""" To read data resources ! """
## Use a configuration file ! 'sources.ini' !
parser = configparser.ConfigParser()
parser.read( "sources.ini" )
if parser.has_option('data', nameOfRSC):
return parser[ "data" ].get( nameOfRSC )[2:-2].split( ", " )
else:
return []
8 changes: 7 additions & 1 deletion Python/biography/generateBiography.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@
else :
print( "\t%s" %( item ) )

## TODO better treatment of jobs ('metiers') ; equipments, software ('logici els') ; GodFather's ('Parrain') ; debts (debtTo & debtFrom) ; some elements ('credit', ...)
## TODO avoid double results
## TODO better treatment of jobs ('metiers')
## TODO better treatment of equipments, software ('logiciels')
## TODO better treatment of GodFather's ('Parrain')
## TODO better treatment of debts (debtTo & debtFrom)
## TODO better treatment of some elements ('credit', ...)

0 comments on commit 4f2671c

Please sign in to comment.