# Buggy code
def remove_key(self, key):
    from google.cloud import storage
    from google.cloud.exceptions import NotFound

    gcs = storage.Client(project=self.project)
    bucket = gcs.get_bucket(self.bucket)
    try:
        bucket.delete_blobs(blobs=bucket.list_blobs(prefix=self.prefix))
    except NotFound:
        return False
    return True


# Traceback (TypeError)
jovyan@41da7a95ddee:~/ecp-jupyter-notebooks$ great_expectations checkpoint run parquet_check
Heads up! This feature is Experimental. It may change. Please give us your feedback!
Error running action with name update_data_docs
Traceback (most recent call last):
File "/opt/conda/lib/python3.8/site-packages/great_expectations/validation_operators/validation_operators.py", line 379, in _run_actions
action_result = self.actions[action["name"]].run(
File "/opt/conda/lib/python3.8/site-packages/great_expectations/validation_operators/actions.py", line 46, in run
return self._run(
File "/opt/conda/lib/python3.8/site-packages/great_expectations/validation_operators/actions.py", line 436, in _run
data_docs_index_pages = self.data_context.build_data_docs(
File "/opt/conda/lib/python3.8/site-packages/great_expectations/core/usage_statistics/usage_statistics.py", line 257, in usage_statistics_wrapped_method
result = func(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/great_expectations/data_context/data_context.py", line 1572, in build_data_docs
index_page_resource_identifier_tuple = site_builder.build(
File "/opt/conda/lib/python3.8/site-packages/great_expectations/render/renderer/site_builder.py", line 292, in build
index_page_resource_identifier_tuple = self.site_index_builder.build()
File "/opt/conda/lib/python3.8/site-packages/great_expectations/render/renderer/site_builder.py", line 767, in build
self.target_store.store_backends[
File "/opt/conda/lib/python3.8/site-packages/great_expectations/data_context/store/tuple_store_backend.py", line 699, in remove_key
bucket.delete_blobs(blobs=bucket.list_blobs(prefix=self.prefix))
File "/opt/conda/lib/python3.8/site-packages/google/cloud/storage/bucket.py", line 1608, in delete_blobs
len(blobs),
TypeError: object of type 'HTTPIterator' has no len()
Traceback (most recent call last):
File "/opt/conda/bin/great_expectations", line 8, in <module>
sys.exit(main())
File "/opt/conda/lib/python3.8/site-packages/great_expectations/cli/cli.py", line 73, in main
cli()
File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/great_expectations/cli/mark.py", line 28, in wrapper
func(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/great_expectations/cli/checkpoint.py", line 296, in checkpoint_run
results = context.run_validation_operator(
File "/opt/conda/lib/python3.8/site-packages/great_expectations/core/usage_statistics/usage_statistics.py", line 257, in usage_statistics_wrapped_method
result = func(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/great_expectations/data_context/data_context.py", line 1001, in run_validation_operator
return validation_operator.run(
File "/opt/conda/lib/python3.8/site-packages/great_expectations/validation_operators/validation_operators.py", line 328, in run
batch_actions_results = self._run_actions(
File "/opt/conda/lib/python3.8/site-packages/great_expectations/validation_operators/validation_operators.py", line 398, in _run_actions
raise e
File "/opt/conda/lib/python3.8/site-packages/great_expectations/validation_operators/validation_operators.py", line 379, in _run_actions
action_result = self.actions[action["name"]].run(
File "/opt/conda/lib/python3.8/site-packages/great_expectations/validation_operators/actions.py", line 46, in run
return self._run(
File "/opt/conda/lib/python3.8/site-packages/great_expectations/validation_operators/actions.py", line 436, in _run
data_docs_index_pages = self.data_context.build_data_docs(
File "/opt/conda/lib/python3.8/site-packages/great_expectations/core/usage_statistics/usage_statistics.py", line 257, in usage_statistics_wrapped_method
result = func(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/great_expectations/data_context/data_context.py", line 1572, in build_data_docs
index_page_resource_identifier_tuple = site_builder.build(
File "/opt/conda/lib/python3.8/site-packages/great_expectations/render/renderer/site_builder.py", line 292, in build
index_page_resource_identifier_tuple = self.site_index_builder.build()
File "/opt/conda/lib/python3.8/site-packages/great_expectations/render/renderer/site_builder.py", line 767, in build
self.target_store.store_backends[
File "/opt/conda/lib/python3.8/site-packages/great_expectations/data_context/store/tuple_store_backend.py", line 699, in remove_key
bucket.delete_blobs(blobs=bucket.list_blobs(prefix=self.prefix))
File "/opt/conda/lib/python3.8/site-packages/google/cloud/storage/bucket.py", line 1608, in delete_blobs
len(blobs),
TypeError: object of type 'HTTPIterator' has no len()

# Fixed code
def remove_key(self, key):
    from google.cloud import storage
    from google.cloud.exceptions import NotFound

    gcs = storage.Client(project=self.project)
    bucket = gcs.get_bucket(self.bucket)
    try:
        bucket.delete_blobs(blobs=list(bucket.list_blobs(prefix=self.prefix)))
    except NotFound:
        return False
    return True