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
#!/bin/bash | |
# .git/hookds/pre-commit | |
# This pre-commit hook clears output cells in Jupyter notebooks | |
# setting bash strict mode | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
IFS=$'\n\t' |
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
""" | |
Remove fields with empty strings recursively from | |
nested structure using boltons.iterutils.remap. | |
This comes in handy, for example, when bulk-indexing | |
to elasticsearch. | |
References: | |
* https://boltons.readthedocs.io/en/latest/iterutils.html#nested | |
* https://sedimental.org/remap.html#drop-empty-values | |
""" |
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
import hashlib | |
from pydantic import BaseModel, validator | |
from typing import Optional | |
class Person(BaseModel): | |
first: str | |
last: str | |
hash: Optional[str] |