[GitHub] [kafka] tanay27 commented on a diff in pull request #14035: KAFKA-15199: Remove Leading and Trailing Spaces

2023-07-18 Thread via GitHub


tanay27 commented on code in PR #14035:
URL: https://github.com/apache/kafka/pull/14035#discussion_r1266542795


##
release.py:
##
@@ -692,7 +700,7 @@ def select_gpg_key():
 fail("Ok, giving up")
 if not user_ok("Ok to push RC tag %s (y/n)?: " % rc_tag):
 fail("Ok, giving up")
-cmd("Pushing RC tag", "git push %s %s" % (PUSH_REMOTE_NAME, rc_tag))
+cmd("Pushing RC tag", f"git push {PUSH_REMOTE_NAME} {rc_tag}")

Review Comment:
   Writing it, I wanted to get an opinion on if we can use new way of string 
formatting. This is better for readability than the other two methods.
   Ex.
   1. "git push %s %s" % (PUSH_REMOTE_NAME, rc_tag) --> "Old Style"
   2. "git push {} {}".format(PUSH_REMOTE_NAME, rc_tag) --> "New Style"
   3. f"git push {PUSH_REMOTE_NAME} {rc_tag}" --> From 3.6 onwards, Python 
supports string interpolation and is preferred mehtod to format string.
   



-- 
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: jira-unsubscr...@kafka.apache.org

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



[GitHub] [kafka] tanay27 commented on a diff in pull request #14035: KAFKA-15199: Remove Leading and Trailing Spaces

2023-07-18 Thread via GitHub


tanay27 commented on code in PR #14035:
URL: https://github.com/apache/kafka/pull/14035#discussion_r1266544074


##
release.py:
##
@@ -310,17 +310,25 @@ def validate_release_num(version):
 fail("The specified version is not a valid release version number")
 validate_release_version_parts(version)
 
+def sanitize_input(input_msg: str) -> str:
+"""Sanitize inputs from users. This removes leading and trailing spaces.
+   Use this function instead of input where user input is needed.
+"""
+input_from_user = input(input_msg)
+return input_from_user.replace(' ', '')

Review Comment:
   Yes, my bad, I assumed it would always be a one line input, will modify this.



-- 
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: jira-unsubscr...@kafka.apache.org

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



[GitHub] [kafka] tanay27 commented on a diff in pull request #14035: KAFKA-15199: Remove Leading and Trailing Spaces

2023-07-18 Thread via GitHub


tanay27 commented on code in PR #14035:
URL: https://github.com/apache/kafka/pull/14035#discussion_r1266542795


##
release.py:
##
@@ -692,7 +700,7 @@ def select_gpg_key():
 fail("Ok, giving up")
 if not user_ok("Ok to push RC tag %s (y/n)?: " % rc_tag):
 fail("Ok, giving up")
-cmd("Pushing RC tag", "git push %s %s" % (PUSH_REMOTE_NAME, rc_tag))
+cmd("Pushing RC tag", f"git push {PUSH_REMOTE_NAME} {rc_tag}")

Review Comment:
   Writing it, I wanted to get an opinion on if we can use new way of string 
formatting. This is better for readability than the other two methods.
   Ex.
   1. "git push %s %s" % (PUSH_REMOTE_NAME, rc_tag) --> "Old Style"
   2. "git push {} {}".format(PUSH_REMOTE_NAME, rc_tag) --> "New Style"
   3. f"git push {PUSH_REMOTE_NAME} {rc_tag}" --> From 3.6 onwards, Python 
supports string interpolation and is preferred method to format string.
   



-- 
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: jira-unsubscr...@kafka.apache.org

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



[GitHub] [kafka] tanay27 commented on a diff in pull request #14035: KAFKA-15199: Remove Leading and Trailing Spaces

2023-07-18 Thread via GitHub


tanay27 commented on code in PR #14035:
URL: https://github.com/apache/kafka/pull/14035#discussion_r1267071244


##
release.py:
##
@@ -692,7 +700,7 @@ def select_gpg_key():
 fail("Ok, giving up")
 if not user_ok("Ok to push RC tag %s (y/n)?: " % rc_tag):
 fail("Ok, giving up")
-cmd("Pushing RC tag", "git push %s %s" % (PUSH_REMOTE_NAME, rc_tag))
+cmd("Pushing RC tag", f"git push {PUSH_REMOTE_NAME} {rc_tag}")

Review Comment:
   got it, reverting.



-- 
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: jira-unsubscr...@kafka.apache.org

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