Commit Graph

14 Commits

Author SHA1 Message Date
Jelle Zijlstra
5d553c9584 apply black and isort (#4287)
* apply black and isort

* move some type ignores
2020-06-28 13:31:00 -07:00
Denis Laxalde
b3c86bd7ff Fix type of of optparse.Option's _{check,set}_opt_strings() methods (#3895) 2020-04-10 00:17:34 +02:00
Rune Tynan
ebc521869d Add missing parameter types to optparse (#3711)
* Add missing parameter types to optparse

* mark add_option_group arg as positional-only

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2020-02-02 22:13:56 -08:00
Guido van Rossum
b336182b69 Fix some errors with --disallow-any-generics (#3276)
See #3267. Covers all of stdlib/2and3.
2019-09-29 09:15:27 -07:00
Michael Lee
efb67946f8 Use variable annotations everywhere (#2909) 2019-04-13 10:40:52 +02:00
Maxim Kurnikov
5ae8fbaa61 add __setattr__ to optparse.Values (#2622) 2018-11-22 20:37:51 +01:00
Sebastian Rittau
006a79220f Flake8 fixes (#2549)
* Fix over-indented continuation lines

* Fix under-indented continuation lines

* Fix whitespace around default operator problems

* Limit line lengths

* Fix inconsistent files
2018-10-24 07:20:53 -07:00
Rebecca Chen
9fda6b20ec Make the signature of optparse.OptionParser.parse_args more precise. (#2464) 2018-09-25 21:15:10 -07:00
Philipp Hahn
df516fab59 Some optparse improvements (#2290)
* optparse.Option.dest is a string

* optparse.OptionParser.epilog is a string

* optparse.OptionParser.prog is string

* optparse.OptionParser.values is Values

Shuffle code to resolve forward reference

* optparse.OptionParser.*option_list is a list of Options

* optparse.OptionParser.parse_args returns 2-tuple

<https://docs.python.org/2/library/optparse.html#parsing-arguments>

* minor improvements to Values
2018-08-21 21:51:30 -07:00
Philipp Hahn
02c42c9cf6 optparse.Values.__getattr__ like argparse.Namespace (#2228)
optparse.Values is like argparse.Namespace and also has a __getattr__() method to return the parsed options.
Apply commits 54b4983 and 9ae0c0b from python/typeshed#25
2018-06-14 06:13:10 -07:00
Jelle Zijlstra
f8d06c88e5 fix reverse comparison in optparse (#1337) 2017-05-26 09:31:30 -07:00
Joe Bateson
385b9c8b66 Fix optparse OptionGroup __init__ to allow missing description (#1248) 2017-05-06 12:39:55 -07:00
Guido van Rossum
a934d57f3b [optparse] Change Uses of List[] to Sequence[] in argument positions. (#1179)
* Change Uses of List[] to Sequence[] in argument positions.

One of these (parse_args()) broke in real-world code, because the
expected type was List[Union[str, bytes]] but the actual type was
List[str] (because List is invariant).  That is ridiculous, so I
changed the accepted type to Sequence[_Text] which is covariant.  Then
I found a few other methods/functions that probably should also be
changed to Sequence, but I'm less certain of those.  I'm not at all
sure about the instance/class attributes, so I left those alone
(though I suspect those might also have to switch).

* Fixes suggested by code review

- Changed Sequence[Option] to Iterable[Option] everywhere
- Changed _process_args to plain List
2017-04-21 12:22:24 -07:00
Ethan
625ea80a99 update OptParse to work on 2and3 (#1164)
* update OptParse to work on 2and3

* remove duplicative dunder methods in Option

* Union Nones to Optional and Text->_Text
2017-04-19 06:10:07 -07:00