-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from vliz-be-opsci/refactor
refactor + new features (conditional, repeated sink paths, collection source, generator settings)
- Loading branch information
Showing
27 changed files
with
856 additions
and
1,135 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,6 @@ __pycache__/ | |
|
||
# local dependency to xmltodict | ||
src/xmltodict | ||
|
||
examples/data | ||
tests/tmp |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
Example of running pysubyt on a conditional basis. | ||
Only when the input data has been updated, a new output file is generated. | ||
Run this script from the root of the repository. | ||
""" | ||
|
||
import logging | ||
|
||
from pysubyt import Subyt | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
|
||
subyt_it = Subyt( | ||
source="./tests/resources/data.csv", | ||
sink="./examples/data/{key}.ttl", | ||
template_name="data.ttl.j2", | ||
template_folder="./tests/resources", | ||
conditional=True, | ||
) | ||
|
||
subyt_it.process() | ||
|
||
subyt_no_it = Subyt( | ||
extra_sources={"data": "./tests/resources/data.csv"}, | ||
sink="./examples/data/data.ttl", | ||
template_name="data_no-it.ttl.j2", | ||
template_folder="./tests/resources", | ||
mode="no-it", | ||
conditional=True, | ||
) | ||
|
||
subyt_no_it.process() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
Example of running pysubyt in "it" mode with duplicated data items. | ||
Run this script from the root of the repository. | ||
""" | ||
|
||
import logging | ||
|
||
from pysubyt import Subyt | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
|
||
subyt = Subyt( | ||
source="./tests/resources/data_with_repeated_identifiers.csv", | ||
sink="./examples/data/{key}.ttl", | ||
template_name="data.ttl.j2", | ||
template_folder="./tests/resources", | ||
conditional=True, | ||
allow_repeated_sink_paths=True, | ||
) | ||
|
||
subyt.process() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
Example of running pysubyt as a python library. | ||
This examples uses the "it" mode to generate a multiple {key}.ttl files from a | ||
single data.csv file. | ||
Run this script from the root of the repository. | ||
""" | ||
|
||
import logging | ||
|
||
from pysubyt import Subyt | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
|
||
subyt = Subyt( | ||
source="./tests/resources/data.csv", | ||
sink="./examples/data/{key}.ttl", | ||
template_name="data.ttl.j2", | ||
template_folder="./tests/resources", | ||
) | ||
|
||
subyt.process() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
Example of running pysubyt as a python library. | ||
This examples uses the no-it mode to generate a single data.ttl from a data.csv | ||
file. | ||
Run this script from the root of the repository. | ||
""" | ||
|
||
import logging | ||
|
||
from pysubyt import Subyt | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
|
||
subyt = Subyt( | ||
extra_sources={"data": "./tests/resources/data.csv"}, | ||
sink="./examples/data/data.ttl", | ||
template_name="data_no-it.ttl.j2", | ||
template_folder="./tests/resources", | ||
mode="no-it", | ||
) | ||
|
||
subyt.process() |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
Oops, something went wrong.