Skip to content

Instantly share code, notes, and snippets.

@2tony2
Created May 22, 2024 07:35
Show Gist options
  • Select an option

  • Save 2tony2/cbcb0b02fde1b8542fcd1943eef5e158 to your computer and use it in GitHub Desktop.

Select an option

Save 2tony2/cbcb0b02fde1b8542fcd1943eef5e158 to your computer and use it in GitHub Desktop.
from typing import TypedDict
class DataPipelineConfig(TypedDict):
name: str
batch_size: int
is_active: bool
def display_pipeline_config(config: DataPipelineConfig) -> str:
status = 'active' if config['is_active'] else 'inactive'
return (f"Pipeline {config['name']} with batch size {config['batch_size']} is currently {status}.")
pipeline_config: DataPipelineConfig = {
"name": "User ETL",
"batch_size": 1000,
"is_active": True
}
print(display_pipeline_config(pipeline_config))
# Output: Pipeline User ETL with batch size 1000 is currently active.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment