[ 
https://issues.apache.org/jira/browse/CASSANDRA-17914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17741143#comment-17741143
 ] 

Brandon Williams commented on CASSANDRA-17914:
----------------------------------------------

If you are naming the branch with a slash, that's going to be problematic (and 
why my example used dashes.)

bq. Sorry, I don't have slack!

Sent you an invite if you want it!

> Argparse migration as the Python Optparse library is deprecated
> ---------------------------------------------------------------
>
>                 Key: CASSANDRA-17914
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17914
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL/Interpreter
>            Reporter: Brad Schoening
>            Assignee: Vineet Gali
>            Priority: Normal
>
> [Deprecated since version 2.7: The optparse module is deprecated and will not 
> be developed further; development will continue with the argparse 
> module.|https://docs.python.org/2/library/optparse.html]
> Argparse is described in [PEP 389 – argparse - New Command Line Parsing 
> Module|https://peps.python.org/pep-0389/]
>  
> A partial upgrade path from 
> [{{optparse}}|https://docs.python.org/3/library/optparse.html#module-optparse]
>  to 
> [{{argparse}}|https://docs.python.org/3/library/argparse.html#module-argparse]:
> https://docs.python.org/3/library/argparse.html#upgrading-optparse-code
>  * Replace all 
> [{{optparse.OptionParser.add_option()}}|https://docs.python.org/3/library/optparse.html#optparse.OptionParser.add_option]
>  calls with 
> [{{ArgumentParser.add_argument()}}|https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.add_argument]
>  calls.
>  * Replace {{(options, args) = parser.parse_args()}} with {{args = 
> parser.parse_args()}} and add additional 
> [{{ArgumentParser.add_argument()}}|https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.add_argument]
>  calls for the positional arguments. Keep in mind that what was previously 
> called {{{}options{}}}, now in the 
> [{{argparse}}|https://docs.python.org/3/library/argparse.html#module-argparse]
>  context is called {{{}args{}}}.
>  * Replace 
> [{{optparse.OptionParser.disable_interspersed_args()}}|https://docs.python.org/3/library/optparse.html#optparse.OptionParser.disable_interspersed_args]
>  by using 
> [{{parse_intermixed_args()}}|https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.parse_intermixed_args]
>  instead of 
> [{{parse_args()}}|https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.parse_args].
>  * Replace callback actions and the {{callback_*}} keyword arguments with 
> {{type}} or {{action}} arguments.
>  * Replace string names for {{type}} keyword arguments with the corresponding 
> type objects (e.g. int, float, complex, etc).
>  * Replace {{optparse.Values}} with 
> [{{Namespace}}|https://docs.python.org/3/library/argparse.html#argparse.Namespace]
>  and {{optparse.OptionError}} and {{optparse.OptionValueError}} with 
> {{{}ArgumentError{}}}.
>  * Replace strings with implicit arguments such as {{%default}} or {{%prog}} 
> with the standard Python syntax to use dictionaries to format strings, that 
> is, {{%(default)s}} and {{{}%(prog)s{}}}.
>  * Replace the OptionParser constructor {{version}} argument with a call to 
> {{{}parser.add_argument('--version', action='version', version='<the 
> version>'){}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to