Added some of the doc for usage
This commit is contained in:
parent
ddd2bc55e6
commit
43b8fe5a32
|
|
@ -1,5 +1,9 @@
|
||||||
# Interprets config files
|
# Interprets config files
|
||||||
# You probably want to go to environment to get the loaded config
|
# The Config will be loaded by the environment at runtime and should be acessed that way
|
||||||
|
# Usage:
|
||||||
|
# from bootstraparse.modules.config import ConfigLoader
|
||||||
|
# config = ConfigLoader([list of config files], extentions=[list of extentions])
|
||||||
|
# config['file']['key']
|
||||||
# The ConfigLoader class has load_from_file and load_from_folder methods and __getitem__ for accessing loaded elements
|
# The ConfigLoader class has load_from_file and load_from_folder methods and __getitem__ for accessing loaded elements
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,13 @@
|
||||||
# self.content: accessible via __getitem__, __setitem__, add, __len__, __iter__ and __getslice__.
|
# self.content: accessible via __getitem__, __setitem__, add, __len__, __iter__ and __getslice__.
|
||||||
# self.optionals: accessible via __rshift__ (remapped to return self.map[other]())
|
# self.optionals: accessible via __rshift__ (remapped to return self.map[other]())
|
||||||
# and self.map: accessible via __invert__ (remapped to return self.optionals)
|
# and self.map: accessible via __invert__ (remapped to return self.optionals)
|
||||||
|
# Usage:
|
||||||
|
# from bootstraparse.modules.context_mngr import ContextManager
|
||||||
|
# ctx = ContextManager()
|
||||||
|
# ctx.???
|
||||||
|
# container = BaseContainer()
|
||||||
|
# container[number] -> The number element in the content
|
||||||
|
# "class_insert" >> container[number] -> Get an element from one of the mapped methods
|
||||||
import rich
|
import rich
|
||||||
from bootstraparse.modules import syntax
|
from bootstraparse.modules import syntax
|
||||||
from bootstraparse.modules.error_mngr import CannotBeContainedError
|
from bootstraparse.modules.error_mngr import CannotBeContainedError
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,19 @@
|
||||||
# Environment has self._mParams for mandatory parameters, self._sParams for secondary parameters and
|
# Environment has self._mParams for mandatory parameters, self._sParams for secondary parameters and
|
||||||
# self.wasInitialised and integrity_check for debug.
|
# self.wasInitialised and integrity_check for debug.
|
||||||
# __getattr__ and __setattr__ check for existing super, s or m parameters, returns error if not found.
|
# __getattr__ and __setattr__ check for existing super, s or m parameters, returns error if not found.
|
||||||
|
# Usage:
|
||||||
|
# from bootstraparse.modules.environment import Environment
|
||||||
|
# env = Environment()
|
||||||
|
# env.integrity_check() -> Checks if all mandatory parameters are set.
|
||||||
|
# env["Config"] -> returns config object
|
||||||
|
# env["context_mngr"] -> returns context manager object
|
||||||
|
# env["export_mngr"] -> returns export manager object
|
||||||
|
# env["global_path"] -> returns global path ???
|
||||||
|
# env["user_path"] -> returns user path ???
|
||||||
|
# env["site_path"] -> returns site path
|
||||||
|
# env["export"] -> returns export object ???
|
||||||
|
# env["site_crawler"] -> returns site crawler object
|
||||||
|
|
||||||
from bootstraparse.modules import error_mngr
|
from bootstraparse.modules import error_mngr
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
# Dedicated module for defining and interpreting errors as well as generating error messages
|
# Dedicated module for defining and interpreting errors as well as generating error messages
|
||||||
# You're probably here for log_message or log_exception.
|
# You're probably here for log_message or log_exception.
|
||||||
# They take: message, level="ERROR, "INFO", "WARNING", "DEBUG", "CRITICAL"
|
# They take: message, level=("ERROR, "INFO", "WARNING", "DEBUG", "CRITICAL")
|
||||||
# There's also a dict_check(dic, *args) that returns true if all args are keys in the dict.
|
# There's also a dict_check(dic, *args) that returns true if all args are keys in the dict.
|
||||||
|
# Usage:
|
||||||
|
# from bootstraparse.modules.error_mngr import log_message, log_exception
|
||||||
|
# log_message("This is a message", level="INFO") level=("ERROR, "INFO", "WARNING", "DEBUG", "CRITICAL")
|
||||||
|
# log_exception(Exception("This is an exception"), level="ERROR")
|
||||||
|
# dict_check({"a": 1, "b": 2}, "a", "b") # returns [True, True]
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import traceback
|
import traceback
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
# Module for final generation of the translated website
|
# Module for final generation of the translated website
|
||||||
# Everything seems important :(
|
# Usage:
|
||||||
|
# from bootstraparse.modules.export import ExportManager, ExportRequest, ExportResponse
|
||||||
|
# rqs = ExportRequest("strucural_elements", "div", "optionals", {"id": "my_id", "class": "my_class"})
|
||||||
|
# rsp = ExportResponse("start_string", "end_string")
|
||||||
|
# em = ExportManager(config_file, template_file)
|
||||||
|
# em(ExportRequest()) -> ExportResponse()
|
||||||
|
|
||||||
from bootstraparse.modules import config, pathresolver, error_mngr
|
from bootstraparse.modules import config, pathresolver, error_mngr
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue