"""Utils.""" from yt_conflict_elasticsearch.flows.elasticsearch_export import config def get_s3_csv_gz_file_key(date, conflict_status): """Get the s3 file key from date and conflict_status. Args: conflict_status (str): Status of conflicts """ path = config.S3_FOLDER_TEMPLATE.format(date=date.replace('-', '_')) filename = config.CSV_FILE_TEMPLATE.format(status=conflict_status) return '{}/{}.gz'.format(path, filename) def get_json_filename(conflict_status, gzipped=False): """Get the filename for JSON Elasticsearch data.""" filename = config.JSON_FILE_TEMPLATE.format( status=conflict_status) if gzipped: filename = '{}.gz'.format(filename) return filename def get_s3_json_gz_file_key(date, conflict_status): """Get the s3 file key from date and conflict_status. Args: conflict_status (str): Status of conflicts """ path = config.S3_FOLDER_TEMPLATE.format(date=date.replace('-', '_')) filename = get_json_filename(conflict_status, gzipped=True) return '{}/{}'.format(path, filename)