Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created November 16, 2024 02:13
Show Gist options
  • Save mypy-play/5a0cdacae405dcb56655758d617c7cc7 to your computer and use it in GitHub Desktop.
Save mypy-play/5a0cdacae405dcb56655758d617c7cc7 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from dataclasses import dataclass, fields
import os
@dataclass(kw_only=False)
class ConveyorInfo:
conveyor_id: str
conveyor_run_id: int
release_identifier: str
revert: bool
sf_fbpackage_version: str
sub_event_id: int
def load_conveyor_info_from_env() -> ConveyorInfo:
"""
Loads conveyor information from environment variables and returns a ConveyorInfo object.
This function retrieves the values of environment variables corresponding to the fields
of the ConveyorInfo dataclass. It constructs a dictionary with these values and uses it
to instantiate and return a ConveyorInfo object.
Returns:
ConveyorInfo: An instance of the ConveyorInfo dataclass populated with values from
the environment variables.
"""
conveyor_info_values = {
}
return ConveyorInfo(**conveyor_info_values)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment