more work
This commit is contained in:
parent
077c557abb
commit
2c0ca29ed4
|
|
@ -1,24 +1,35 @@
|
|||
# Interprets config files
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
class ConfigLoader():
|
||||
"""
|
||||
Reads config files.
|
||||
"""
|
||||
|
||||
def __init__(self, configfile):
|
||||
def __init__(self, configfile):
|
||||
with open(configfile, "r") as f:
|
||||
self.loadedconf = yaml.safe_load(f)
|
||||
|
||||
def __getitem__(self, item):
|
||||
return self.loadedconf[item]
|
||||
try:
|
||||
return self.loadedconf[item]
|
||||
except KeyError:
|
||||
print("Argument", item, "not found.")
|
||||
|
||||
def __repr__(self):
|
||||
return(self.loadedconf.__repr__())
|
||||
|
||||
|
||||
class UserConfig(ConfigLoader):
|
||||
def __init__(self, configfile):
|
||||
super().__init__(configfile)
|
||||
|
||||
|
||||
class GlobalConfig(ConfigLoader):
|
||||
def __init__(self, configfile):
|
||||
super().__init__(configfile)
|
||||
|
||||
|
||||
|
||||
conf = ConfigLoader("./example_userfiles/config/aliases.yml")
|
||||
|
|
|
|||
|
|
@ -1,15 +1,20 @@
|
|||
# Module sequencing the successive actions necessary for website building
|
||||
|
||||
import modules.config as config
|
||||
|
||||
|
||||
def create_website():
|
||||
"""
|
||||
First function called by bparse.py, calls all other modules in the right order.
|
||||
First function called by bparse.py,
|
||||
calls all other modules in the right order.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def create_environment():
|
||||
"""
|
||||
Returns parserEnvironment as an object containing everything needed for app execution.
|
||||
Returns parserEnvironment as an object containing
|
||||
everything needed for app execution.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
|
@ -18,7 +23,7 @@ def create_config():
|
|||
"""
|
||||
Returns globalConfig as an object from parser_config.yml settings.
|
||||
"""
|
||||
pass
|
||||
return config.GlobalConfig("configs/parser_config.yml")
|
||||
|
||||
|
||||
def create_crawler():
|
||||
|
|
@ -30,35 +35,40 @@ def create_crawler():
|
|||
|
||||
def create_user_config():
|
||||
"""
|
||||
Returns userConfig as an object from aliases.yml, glossary.yml and website.yml.
|
||||
Returns userConfig as an object from aliases.yml,
|
||||
glossary.yml and website.yml.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def create_template():
|
||||
"""
|
||||
Returns a templateManager from templates for generating the correct html files.
|
||||
Returns a templateManager from templates for
|
||||
generating the correct html files.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def env_checker():
|
||||
"""
|
||||
Verify all is in order for initialisation of the parserEnvironment object and initialises.
|
||||
Verify all is in order for initialisation of
|
||||
the parserEnvironment object and initialises.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def begin_crawling(pEnv):
|
||||
"""
|
||||
Starts reading every file in the userfiles and adds them to the crawler object progressively.
|
||||
Starts reading every file in the userfiles and
|
||||
adds them to the crawler object progressively.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def begin_preparsing(pEnv):
|
||||
"""
|
||||
Create an importTree and checks for conflicts or loops; then replaces imports with their contents,
|
||||
Create an importTree and checks for conflicts or loops;
|
||||
then replaces imports with their contents,
|
||||
then replaces all aliases with their values.
|
||||
"""
|
||||
pass
|
||||
|
|
@ -66,15 +76,19 @@ def begin_preparsing(pEnv):
|
|||
|
||||
def begin_parsing(pEnv):
|
||||
"""
|
||||
For each of the generated files, parses element after element and creates the graph representation of the website,
|
||||
interacts with context_mngr.py to ascertain integrity and deal with errors.
|
||||
For each of the generated files,
|
||||
parses element after element and creates
|
||||
the graph representation of the website,
|
||||
interacts with context_mngr.py to ascertain integrity
|
||||
and deal with errors.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def begin_export():
|
||||
"""
|
||||
Replaces all parsed values with their attributed correspondances as per the template_manager
|
||||
Replaces all parsed values with their attributed
|
||||
correspondances as per the template_manager
|
||||
and exports the result as a website.
|
||||
"""
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in New Issue