(
        self, profile: dict, profile_name: str
    )
Given a profile, write it to the current project's profiles.yml.
        This will overwrite any profile with a matching name.
Given a profile, write it to the current project's profiles.yml.
        This will overwrite any profile with a matching name.
Given a profile write it to the current project s profiles . yml . This will overwrite any profile with a matching name .
def write_profile(
        self, profile: dict, profile_name: str
    ):
        """Given a profile, write it to the current project's profiles.yml.
        This will overwrite any profile with a matching name."""
        # Create the profile directory if it doesn't exist
        profiles_filepath = Path(flags.PROFILES_DIR) / Path("profiles.yml")
        if profiles_filepath.exists():
            with open(profiles_filepath, "r+") as f:
                profiles = yaml.safe_load(f) or {}
                profiles[profile_name] = profile
                f.seek(0)
                yaml.dump(profiles, f)
                f.truncate()
        else:
            profiles = {profile_name: profile}
            with open(profiles_filepath, "w") as f:
                yaml.dump(profiles, f)
def write_profile ( self , profile : dict , profile_name : str ) : # Create the profile directory if it doesn't exist profiles_filepath = Path ( flags . PROFILES_DIR ) / Path ( "profiles.yml" ) if profiles_filepath . exists ( ) : with open ( profiles_filepath , "r+" ) as f : profiles = yaml . safe_load ( f ) or { } profiles [ profile_name ] = profile f . seek ( 0 ) yaml . dump ( profiles , f ) f . truncate ( ) else : profiles = { profile_name : profile } with open ( profiles_filepath , "w" ) as f : yaml . dump ( profiles , f )