diff --git a/dlunch/core.py b/dlunch/core.py index f7916f7..bed67b7 100644 --- a/dlunch/core.py +++ b/dlunch/core.py @@ -1,3 +1,11 @@ +"""Module that defines main functions used to manage Data-Lunch operations. + +!!! Note + + Could be improved with classes. + +""" + import cryptography.fernet import panel as pn import pandas as pd @@ -1102,7 +1110,7 @@ def df_list_by_lunch_time( # The following function prepare the dataframe before saving it into # the dictionary that will be returned - def clean_up_table( + def _clean_up_table( config: DictConfig, df_in: pd.DataFrame, df_complete: pd.DataFrame ): df = df_in.copy() @@ -1147,13 +1155,15 @@ def clean_up_table( # Clean and add resulting dataframes to dict # RESTAURANT LUNCH if not df_users_restaurant.empty: - df_users_restaurant = clean_up_table( + df_users_restaurant = _clean_up_table( config, df_users_restaurant, df ) df_dict[time] = df_users_restaurant # TAKEAWAY if not df_users_takeaways.empty: - df_users_takeaways = clean_up_table(config, df_users_takeaways, df) + df_users_takeaways = _clean_up_table( + config, df_users_takeaways, df + ) df_dict[f"{time} {config.panel.gui.takeaway_id}"] = ( df_users_takeaways ) diff --git a/dlunch/models.py b/dlunch/models.py index 9269220..ee3b497 100755 --- a/dlunch/models.py +++ b/dlunch/models.py @@ -964,13 +964,13 @@ def create_exclusive_session(config: DictConfig) -> Session: # Alter begin statement @event.listens_for(engine, "connect") - def do_connect(dbapi_connection, connection_record): + def _do_connect(dbapi_connection, connection_record): # disable pysqlite's emitting of the BEGIN statement entirely. # also stops it from emitting COMMIT before any DDL. dbapi_connection.isolation_level = None @event.listens_for(engine, "begin") - def do_begin(conn): + def _do_begin(conn): # Emit exclusive BEGIN conn.exec_driver_sql("BEGIN EXCLUSIVE") @@ -1003,18 +1003,18 @@ def create_database(config: DictConfig, add_basic_auth_users=False) -> None: ) ), ) - def create_database_with_retries(config: DictConfig) -> None: + def _create_database_with_retries(config: DictConfig) -> None: engine = create_engine(config) Data.metadata.create_all(engine) # Create tables log.debug(f"attempt database creation: {config.db.attempt_creation}") if config.db.attempt_creation: - create_database_with_retries(config) + _create_database_with_retries(config) # Retries stats log.debug( - f"create database attempts: {create_database_with_retries.retry.statistics}" + f"create database attempts: {_create_database_with_retries.retry.statistics}" ) # If requested add users for basic auth (admin and guest) diff --git a/docs/index.md b/docs/index.md index 955bf93..b1297d9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -15,6 +15,8 @@ for a group of people (wether they are friends or teammates). It started as a small personal project and it quickly became an unrepleaceable companion for me and my colleagues. +[Getting Started :material-fuel:](getting_started.md){ .md-button .md-button--primary } + ## More info !!! warning "Work in Progress" diff --git a/mkdocs.yml b/mkdocs.yml index f514a67..32bea6a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -22,11 +22,22 @@ theme: logo: assets/logo-dark.png favicon: assets/favicon.ico palette: - scheme: dlunch + # Light mode + - scheme: dlunch + toggle: + icon: material/lightbulb-outline + name: Switch to dark mode + # Dark mode + - scheme: slate + toggle: + icon: material/lightbulb + name: Switch to light mode features: - navigation.tabs - navigation.tabs.sticky - navigation.sections + - navigation.top + - toc.follow # Custom colors extra_css: @@ -42,9 +53,9 @@ extra: # Plugins plugins: -- gh-admonitions - search - autorefs +- gh-admonitions - gen-files: scripts: - scripts/docs/generate_reference_pages.py @@ -76,6 +87,8 @@ plugins: # Extensions markdown_extensions: + - toc: + permalink: true - admonition - pymdownx.details - pymdownx.superfences