You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/29 09:09:35 UTC

[GitHub] [airflow] potiuk commented on a diff in pull request #28627: Change Architecture and OperatingSystem classies into Enums

potiuk commented on code in PR #28627:
URL: https://github.com/apache/airflow/pull/28627#discussion_r1058830142


##########
airflow/cli/commands/info_command.py:
##########
@@ -155,12 +156,16 @@ class Architecture:
     ARM = "arm"
 
     @staticmethod
-    def get_current():
+    def get_current() -> Architecture:
         """Get architecture."""
-        return _MACHINE_TO_ARCHITECTURE.get(platform.machine().lower())
+        current_architecture = _MACHINE_TO_ARCHITECTURE.get(platform.machine().lower())
+        if current_architecture:
+            return current_architecture
+        else:
+            raise RuntimeError(f"Unknown architecture for machine: {platform.machine()}")

Review Comment:
   Right. I changed it and added UNKNOWN returned instead and removed the conditional (It was in one place). Also I noticed that OperatingSystem was similar and I changed it into Enum as well (there we had to use "UNKNOWN" because it was more likely we will have some unhandled platform.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org