diff --git a/.github/workflows/black.yaml b/.github/workflows/black.yaml new file mode 100644 index 0000000..f596e78 --- /dev/null +++ b/.github/workflows/black.yaml @@ -0,0 +1,14 @@ +name: Lint + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: psf/black@stable + with: + options: "--check --verbose --color" + src: "./scripts" + \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4390b57 --- /dev/null +++ b/.gitignore @@ -0,0 +1,133 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ +.DS_Store + +# Ignore DataSpell +.idea/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..30570f3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 ONE Campaign + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..25b1166 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Project title +Project description \ No newline at end of file diff --git a/output/README.md b/output/README.md new file mode 100644 index 0000000..e69de29 diff --git a/raw_data/README.md b/raw_data/README.md new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..e69de29 diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/config.py b/scripts/config.py new file mode 100644 index 0000000..f02a0b1 --- /dev/null +++ b/scripts/config.py @@ -0,0 +1,10 @@ +from pathlib import Path + + +class Paths: + """Class to store the paths to the data and output folders.""" + + project = Path(__file__).resolve().parent.parent + raw_data = project / "raw_data" + output = project / "output" + scripts = project / "scripts" diff --git a/scripts/logger.py b/scripts/logger.py new file mode 100644 index 0000000..72cd099 --- /dev/null +++ b/scripts/logger.py @@ -0,0 +1,25 @@ +import logging +from scripts.config import Paths + +# Create a root logger +logger = logging.getLogger(__name__) + +# Create the terminal handler +shell_handler = logging.StreamHandler() + +# Set levels for the logger, shell and file +logger.setLevel(logging.DEBUG) +shell_handler.setLevel(logging.DEBUG) + +# Format the outputs +fmt_file = "%(levelname)s (%(asctime)s): %(message)s" +fmt_shell = "%(levelname)s [%(funcName)s:] %(message)s" + +# Create formatters +shell_formatter = logging.Formatter(fmt_shell) + +# Add formatters to handlers +shell_handler.setFormatter(shell_formatter) + +# Add handlers to the logger +logger.addHandler(shell_handler)