Data
get_path_for_key(key: Key, data_path: Path = DATA_PATH) -> Path
Gets the path to the file in data_path
for the given key
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
Key
|
The key to get the path for. |
required |
data_path |
Path
|
The path to the data directory. |
DATA_PATH
|
Returns:
Type | Description |
---|---|
Path
|
The path to the file in |
Source code in aoc/data.py
10 11 12 13 14 15 16 17 18 19 20 |
|
load_data(key: Key, data_path: Path = DATA_PATH, encoding: str = DEFAULT_ENCODING, errors: str = DEFAULT_ERRORS) -> str
Loads the data for the given key
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
Key
|
The key to load the data for. |
required |
data_path |
Path
|
The path to the data directory. |
DATA_PATH
|
encoding |
str
|
The encoding to use. |
DEFAULT_ENCODING
|
errors |
str
|
The error handling of the encoding to use. |
DEFAULT_ERRORS
|
Returns:
Type | Description |
---|---|
str
|
The data for the given |
Raises:
Type | Description |
---|---|
DataNotFound
|
|
Source code in aoc/data.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
dump_data(data: str, key: Key, data_path: Path = DATA_PATH, encoding: str = DEFAULT_ENCODING, errors: str = DEFAULT_ERRORS) -> None
Dumps the data
for the given key
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
str
|
The data to dump. |
required |
key |
Key
|
The key to dump the data for. |
required |
data_path |
Path
|
The path to the data directory. |
DATA_PATH
|
encoding |
str
|
The encoding to use. |
DEFAULT_ENCODING
|
errors |
str
|
The error handling of the encoding to use. |
DEFAULT_ERRORS
|
Source code in aoc/data.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|