mirror of
https://github.com/PR0M3TH3AN/python_charts.git
synced 2026-11-06 13:50:39 +00:00
Refactor imports in chart scripts to use package-qualified paths
Updated import statements in `bitcoin_m2_chart.py` and `lagged_oil_unrate_chart_styled.py` to use package-qualified paths for better clarity and consistency. Cleaned up code formatting for improved readability. Added a new output image file for the lagged oil-unrate chart.
This commit is contained in:
1 parent
e5b1d091c5
commit
040b45b093
4 files changed
+25
-24
No files matched your search
+7
-6
@@ -12,7 +12,7 @@ set -euo pipefail
|
||||
|
||||
REQ_FILE="requirements.txt"
|
||||
DATA_DB="data/fred.db"
|
||||
DEFAULT_SCRIPT="scripts/lagged_oil_unrate_chart_styled.py"
|
||||
DEFAULT_MODULE="scripts.lagged_oil_unrate_chart_styled"
|
||||
|
||||
# 1) Ensure pip & setuptools are up to date
|
||||
echo "🛠 Upgrading pip & setuptools…"
|
||||
@@ -25,19 +25,20 @@ pip install --upgrade -r "$REQ_FILE"
|
||||
# 3) Ensure data exists
|
||||
if [[ ! -f "$DATA_DB" ]]; then
|
||||
echo "🔄 Data not found—downloading FRED series…"
|
||||
python scripts/refresh_data.py
|
||||
python -m scripts.refresh_data
|
||||
fi
|
||||
|
||||
# 4) Dispatch to the right command
|
||||
if [[ $# -eq 0 ]]; then
|
||||
# no args → run default plot
|
||||
CMD=(python "$DEFAULT_SCRIPT" --offset 18)
|
||||
# no args → run default plot module with offset 18
|
||||
CMD=(python -m "$DEFAULT_MODULE" --offset 18)
|
||||
elif [[ "$1" == --* ]]; then
|
||||
# args start with -- → forward to default plot
|
||||
CMD=(python "$DEFAULT_SCRIPT" "$@")
|
||||
# args start with -- → forward to default plot module
|
||||
CMD=(python -m "$DEFAULT_MODULE" "$@")
|
||||
else
|
||||
# first token is script or other command
|
||||
if [[ -f "$1" || "$1" == *.py ]]; then
|
||||
# If they explicitly say “scripts/whatever.py …” or “some_test.py …”, run as script
|
||||
CMD=(python "$@")
|
||||
else
|
||||
CMD=("$@")
|
||||
|
||||
Reference in new issue
Block a user