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
""" | |
This script fetches cryptocurrency data from the Polarity Digital API. It retrieves historical and | |
additional data for a list of cryptocurrencies and saves them as JSON files. | |
The script uses the requests library to make API calls and argparse for | |
command line argument parsing. | |
Data is fetched for each coin and metric, then saved in files named with the | |
format YYYYMMDD-{coin}-{metric}.json. | |
SETUP: |
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
if args or kwargs: | |
# TODO remove *args and **kwargs in Airflow 2.0 | |
warnings.warn( | |
'Invalid arguments were passed to {c} (task_id: {t}). ' | |
'Support for passing such arguments will be dropped in ' | |
'Airflow 2.0. Invalid arguments were:' | |
'\n*args: {a}\n**kwargs: {k}'.format( | |
c=self.__class__.__name__, a=args, k=kwargs, t=task_id), | |
category=PendingDeprecationWarning, | |
stacklevel=3 |
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
class DatastoreExportOperator(BaseOperator): | |
""" (...) """ | |
@apply_defaults | |
def __init__(self, | |
bucket, | |
namespace=None, | |
datastore_conn_id='google_cloud_default', | |
(...) | |
overwrite_existing=False, | |
*args, |
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
dadjoke () { | |
echo $(curl -s https://icanhazdadjoke.com/) | |
} | |
pr () { | |
# No args: defaults to default reviewers, opens file for edit with template and dad joke | |
# 1 arg: Argument is string of the reviewers to place | |
dj=$(dadjoke) | |
if [ "$#" == "0" ]; then |
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
def get(self, section, key, **kwargs): | |
section = str(section).lower() | |
key = str(key).lower() | |
deprecated_name = self.deprecated_options.get(section, {}).get(key, None) | |
# first check environment variables | |
option = self._get_env_var_option(section, key) | |
if option is not None: | |
return option |