[
https://issues.apache.org/jira/browse/CASSANDRA-17914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17744301#comment-17744301
]
Brandon Williams commented on CASSANDRA-17914:
----------------------------------------------
I tested locally without an issue so I suspect we'll have better luck this time.
||Branch||CI||
|[4.1|https://github.com/driftx/cassandra/tree/CASSANDRA-17914-4.1]|[j8|https://app.circleci.com/pipelines/github/driftx/cassandra/1140/workflows/5f63ef4f-02ff-473e-8b80-c96572b86d1c],
[j11|https://app.circleci.com/pipelines/github/driftx/cassandra/1140/workflows/1808e9fe-e563-4913-889e-f05b94a9b9a5]|
> 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: [email protected]
For additional commands, e-mail: [email protected]