diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/spaceapi_server/config/__init__.py b/spaceapi_server/config/__init__.py index 000d239..9b35c46 100644 --- a/spaceapi_server/config/__init__.py +++ b/spaceapi_server/config/__init__.py @@ -7,10 +7,10 @@ __CONFIG = {} def load(filename: str) -> None: - ''' + """ Load a JSON-formatted configuration file. - @param filename The config file to load. - ''' + :type filename: The config file to load. + """ global __CONFIG # Open and parse the JSON config file with open(filename, 'r') as conf: @@ -18,8 +18,8 @@ def load(filename: str) -> None: def get() -> dict: - ''' + """ Return the current configuration. - ''' + """ global __CONFIG return __CONFIG diff --git a/spaceapi_server/plugins/__init__.py b/spaceapi_server/plugins/__init__.py index 49d9775..7677a9d 100644 --- a/spaceapi_server/plugins/__init__.py +++ b/spaceapi_server/plugins/__init__.py @@ -3,10 +3,10 @@ from spaceapi_server.template import env_init def template_function(fn): - ''' + """ Register the decorated function as a callable template function. - @param fn The function to register. - ''' + :type fn: The function to register. + """ # Make sure the Jinja2 environment is initialized env = env_init() # Add the function to the environment's globals @@ -15,10 +15,10 @@ def template_function(fn): def template_filter(fn): - ''' + """ Register the decorated function as a template filter. - @param fn The function to register. - ''' + :type fn: The function to register. + """ # Make sure the Jinja2 environment is initialized env = env_init() # Add the function to the environment's filters @@ -27,10 +27,10 @@ def template_filter(fn): def template_test(fn): - ''' + """ Register the decorated function as a template test. - @param fn The function to register. - ''' + :type fn: The function to register. + """ # Make sure the Jinja2 environment is initialized env = env_init() # Add the function to the environment's tests diff --git a/spaceapi_server/server/__init__.py b/spaceapi_server/server/__init__.py index 831e934..d4639c5 100644 --- a/spaceapi_server/server/__init__.py +++ b/spaceapi_server/server/__init__.py @@ -14,10 +14,11 @@ __TEMPLATE = None def render_traverse(obj): - ''' + """ Walk through a complex, JSON-serializable data structure, and pass string objects through the Jinja2 templating engine. - ''' + :type obj: The object to traverse. + """ if isinstance(obj, list): # list -> recurse into each item for i in range(len(obj)): diff --git a/spaceapi_server/template/__init__.py b/spaceapi_server/template/__init__.py index 811d926..945db25 100644 --- a/spaceapi_server/template/__init__.py +++ b/spaceapi_server/template/__init__.py @@ -8,10 +8,10 @@ _ENV = None def env_init(force: bool = False): - ''' + """ Initialize the Jinja2 environment. - @param force If true, force reload the environment. - ''' + :type force: If true, force reload the environment. + """ global _ENV if _ENV is None or force: # Use json.dumps as finalizer in order to preserve complex data structures @@ -20,10 +20,10 @@ def env_init(force: bool = False): def render(template: str): - ''' + """ Render the given string as a Jinja2 template. - @param template The template string to render - ''' + :type template: The template string to render. + """ # Make sure the Jinaj2 environment is initialized env = env_init() # Create a Jinja2 template from the input string