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 2021/02/28 00:45:03 UTC

[GitHub] [airflow] turbaszek commented on a change in pull request #14519: Add CLI check for scheduler

turbaszek commented on a change in pull request #14519:
URL: https://github.com/apache/airflow/pull/14519#discussion_r584211180



##########
File path: airflow/cli/cli_parser.py
##########
@@ -120,15 +120,21 @@ def add_to_parser(self, parser: argparse.ArgumentParser):
         parser.add_argument(*self.flags, **self.kwargs)
 
 
-def positive_int(value):
+def positive_int(*, allow_zero):
     """Define a positive int type for an argument."""
-    try:
-        value = int(value)
-        if value > 0:
-            return value
-    except ValueError:
-        pass
-    raise argparse.ArgumentTypeError(f"invalid positive int value: '{value}'")
+
+    def _check(value):
+        try:
+            value = int(value)
+            if allow_zero and value == 0:
+                return True
+            if value > 0:
+                return value

Review comment:
       The return value is either bool or an int - is this inconsistency expected?




----------------------------------------------------------------
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.

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