Use pathlib instead of os.path where applicable (#112)
* Use pathlib in test_creation.py * Use pathlib for PROJECT_DIR example in make_dataset.py * Add pathlib2 for backwards compatibility if project is Python 2
This commit is contained in:
committed by
Peter Bull
parent
72b3e66989
commit
74a2e29fef
@@ -8,3 +8,8 @@ coverage
|
||||
awscli
|
||||
flake8
|
||||
python-dotenv>=0.5.1
|
||||
{% if cookiecutter.python_interpreter != 'python3' %}
|
||||
|
||||
# backwards compatibility
|
||||
pathlib2
|
||||
{% endif %}
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import click
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from dotenv import find_dotenv, load_dotenv
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ if __name__ == '__main__':
|
||||
logging.basicConfig(level=logging.INFO, format=log_fmt)
|
||||
|
||||
# not used in this stub but often useful for finding various files
|
||||
project_dir = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)
|
||||
project_dir = Path(__file__).resolve().parents[2]
|
||||
|
||||
# find .env automagically by walking up directories until it's found, then
|
||||
# load up the .env entries as environment variables
|
||||
|
||||
Reference in New Issue
Block a user