This file contains hidden or 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 string | |
| import yaml | |
| def load_yaml(f, context=None): | |
| if context is None: | |
| context = {} | |
| def string_constructor(loader, node): | |
This file contains hidden or 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 os | |
| import json | |
| import requests | |
| _PUBLIC_SECRET = os.environ['KLAVIYO_PUBLIC_SECRET'] | |
| _API_ROOT = 'https://a.klaviyo.com/api' | |
| _VALID_EXTRA_ATTRIBUTES = [ |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # MIT LICENSE | |
| # | |
| # Copyright 2023 Dustin Oprea | |
| # | |
| # 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 |
This file contains hidden or 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 yaml | |
| def load_and_assert_uniqueness(x): | |
| # We'd like to detect duplicates. Since PyYAML both loads things depth-first | |
| # *and* doesn't give us the parent when processing a child node, we'll index | |
| # of all of the object IDs as we're constructing them, and then see which | |
| # are disappeared from the final hierarchy. Since all we can do is pass a | |
| # class, we need to inline the class in order to load into an index within | |
| # our scope. |
This file contains hidden or 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 logging | |
| import collections | |
| _LOGGER = logging.getLogger(__name__) | |
| _OPERATION_METADATA_COLLECTION = \ | |
| collections.namedtuple( | |
| '_OPERATION_METADATA_COLLECTION', [ | |
| 'reader_input_metadata', | |
| 'reader_output_metadata', |
This file contains hidden or 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
| _ENCODED_ESCAPE_TRANSLATION = str.maketrans({ | |
| '\\': r'\\', | |
| ',': r'\,', | |
| '=': r'\=', | |
| }) | |
| def dictionary_to_string(d): | |
| components = [ |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| """ | |
| Copyright 2024 Dustin Oprea | |
| MIT LICENSE | |
| 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 |
This file contains hidden or 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
| """ | |
| Copyright 2024 Dustin Oprea | |
| MIT LICENSE | |
| 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 |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| """ | |
| Copyright 2024 Dustin Oprea | |
| MIT LICENSE | |
| 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 |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| """ | |
| Apply data from one or more CSVs to translate values in the CSV on STDIN. | |
| This will only read a certain source CSV once even if provided multiple times to | |
| translate multiple columns in the principal data. | |
| """ | |
| """ | |
| Copyright 2024 Dustin Oprea |