-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REFACTOR: Move core to module level.
- Loading branch information
Showing
18 changed files
with
95 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import configparser | ||
import os | ||
from faslr.constants import CONFIG_PATH | ||
|
||
|
||
def get_startup_db_path( | ||
config_path: str = CONFIG_PATH | ||
) -> str: | ||
""" | ||
Extracts the db path when the user opts to connect to one automatically upon startup. | ||
""" | ||
config = configparser.ConfigParser() | ||
config.read(config_path) | ||
config.sections() | ||
startup_db = config['STARTUP_CONNECTION']['startup_db'] | ||
|
||
return startup_db | ||
|
||
|
||
config_path: str = CONFIG_PATH | ||
|
||
# Flag to determine whether there is an active database connection. Most project-related functions | ||
# should be disabled unless a connection is established. | ||
connection_established = False | ||
db = None | ||
|
||
|
||
# If a startup db has been indicated, get the path. | ||
if os.path.isfile(config_path): | ||
startup_db: str = get_startup_db_path(config_path=config_path) | ||
if startup_db is not None: | ||
db = startup_db | ||
else: | ||
startup_db: None = None | ||
|
||
def set_db(path: str) -> None: | ||
global db | ||
db = path | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.