profile.mojo (891B)
1 from hyf_runtime.errors import raise_runtime_contract_error 2 3 4 comptime _INTERACTIVE_USER_PROFILE = "interactive_user" 5 comptime _SERVICE_HOST_PROFILE = "service_host" 6 comptime _REPO_LOCAL_PROFILE = "repo_local" 7 8 9 def interactive_user_profile() -> String: 10 return _INTERACTIVE_USER_PROFILE 11 12 13 def service_host_profile() -> String: 14 return _SERVICE_HOST_PROFILE 15 16 17 def repo_local_profile() -> String: 18 return _REPO_LOCAL_PROFILE 19 20 21 def validate_runtime_profile(profile: String) raises: 22 if ( 23 profile != _INTERACTIVE_USER_PROFILE 24 and profile != _SERVICE_HOST_PROFILE 25 and profile != _REPO_LOCAL_PROFILE 26 ): 27 raise_runtime_contract_error( 28 "profile must be '" 29 + _INTERACTIVE_USER_PROFILE 30 + "', '" 31 + _SERVICE_HOST_PROFILE 32 + "', or '" 33 + _REPO_LOCAL_PROFILE 34 + "'" 35 )