Skip to content

Commit

Permalink
fix missing dotenv file
Browse files Browse the repository at this point in the history
  • Loading branch information
karolzak committed Sep 16, 2020
1 parent e6a5e1c commit 42f19e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions pre_commit_nb/base64_to_external_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import mimetypes
import os
import re
import traceback
import urllib.request
from typing import Optional, Sequence
from urllib.parse import urlparse
Expand Down Expand Up @@ -116,16 +117,23 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
help='Forces `git commit` to go through even when there were some files modified with this git hook. Default behavior for `pre-commit` manager is to abort commit if git hook made any changes to staged files') # NOQA E501
args = parser.parse_args(argv)

if not os.path.exists(args.dotenv_file_path):
print("WARNING! Couldn't find dotenv file under specified path: " + args.dotenv_file_path) # NOQA E501
load_dotenv(verbose=True, override=True, dotenv_path=args.dotenv_file_path)

az_blob_container_url = os.environ.get("AZ_BLOB_CONTAINER_URL")
az_blob_container_sas_token_upload = os.environ.get("AZ_BLOB_CONTAINER_SAS_TOKEN_UPLOAD") # NOQA E501
az_blob_container_sas_token_download = os.environ.get("AZ_BLOB_CONTAINER_SAS_TOKEN_DOWNLOAD") # NOQA E501
az_blob_container_url, az_blob_container_sas_token_upload, az_blob_container_sas_token_download = validate_env_vars( # NOQA E501
az_blob_container_url, az_blob_container_sas_token_upload, az_blob_container_sas_token_download) # NOQA E501

retv = 0

try:
az_blob_container_url, az_blob_container_sas_token_upload, az_blob_container_sas_token_download = validate_env_vars( # NOQA E501
az_blob_container_url, az_blob_container_sas_token_upload, az_blob_container_sas_token_download) # NOQA E501
except Exception:
traceback.print_exc()
return 1

for filename in args.filenames:
return_value = process_nb(
filename=filename,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="pre_commit_nb",
version="0.2.4a4",
version="0.2.4a5",
description="Set of git pre-commit hooks for Jupyter Notebooks compatible with https://pre-commit.com/ framework", # NOQA E501
long_description=long_description,
long_description_content_type="text/markdown", # This is important!
Expand Down

0 comments on commit 42f19e5

Please sign in to comment.