Jelle Zijlstra
43e93f803f
use _typeshed's Path aliases ( #4214 )
2020-06-10 20:57:09 -07:00
Jelle Zijlstra
d261f14886
add constructors for configparser errors ( #4215 )
...
Fixes #4058
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com >
2020-06-10 12:32:18 -07:00
Shantanu
de4305760d
configparser: add undocumented parameter to SectionProxy.get ( #3826 )
2020-03-07 12:46:32 +01:00
Brian Maissy
48d77d5f06
update SectionProxy.getint()/float/bool stubs to match those of ConfigParser ( #3687 )
2020-01-30 09:37:29 +01:00
Brian Maissy
e5999ac76b
make stubs for configparser.getint()/float/bool accept a generically-typed fallback ( #3684 )
...
Closes #3681
2020-01-29 14:43:46 +01:00
Shantanu
b972427ad4
configparser: fix various arguments ( #3632 )
...
* configparser: fix various arguments
* configparser.ConfigParser: inherit __init__
2020-01-26 13:51:04 +01:00
Sebastian Rittau
07c8675ba5
Remove unused # type: ignore comments ( #3325 )
2019-10-09 10:27:18 -07:00
Sebastian Rittau
c32e1e2280
Enable --disallow-any-generics for stubs ( #3288 )
2019-10-01 05:31:34 -07:00
Vasily Zakharov
c441a1f5b8
Added ConfigParser.BOOLEAN_STATES # Undocumented ( #3281 )
2019-09-30 17:10:48 +02:00
The Fox in the Shell
e7d7a44411
Make the signature of ConfigParser.get() polymorphic ( #2406 )
...
The documentation [explicitly specifies](https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.get ) that `None` is a legitimate `fallback` value.
Thanks to @wiml for suggesting this approach.
2019-05-06 12:00:52 -04:00
Michael Lee
efb67946f8
Use variable annotations everywhere ( #2909 )
2019-04-13 10:40:52 +02:00
Vasily Zakharov
08555f80d1
Make vars arguments Optional, as they default to None ( #2853 )
...
Closes #2847
2019-03-11 15:12:35 +01:00
Kostya Esmukov
2469a3ccda
Fix signature of ConfigParser's dict_type argument ( #2684 )
2018-12-12 08:22:31 +01:00
Scott Colby
25c9fdc20d
Add bytes as legal type for RawConfigParser.read. ( #2484 )
...
Add `bytes` as legal type for `RawConfigParser.read` in 3.7.
Closes #2476 .
https://bugs.python.org/issue31307
2018-09-26 23:27:33 -07:00
Sebastian Rittau
44bdf6c6c7
Fix RawConfigParser.readfp() annotation ( #2443 )
...
Closes #689
2018-09-11 08:22:36 -07:00
Yusuke Miyazaki
581705d9ee
Prefer to use ellipsis over pass ( #2292 )
2018-06-28 10:29:45 -07:00
Jelle Zijlstra
7abcd0f71f
add ConfigParser.readfp in Python 3 ( #2123 )
...
https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.readfp
Fixes #2112
2018-06-11 14:10:52 -07:00
Pradyun Gedam
b6bd58268b
Update base class to match the source file ( #1899 )
2018-02-18 09:03:09 -08:00
Jelle Zijlstra
324f1761f4
Change more defaults to ... ( #1727 )
2017-11-09 10:32:17 -08:00
Jelle Zijlstra
54dd6ba27c
Change numerous default values to ... ( #1722 )
...
This is the convention, and some default values (e.g. strings) apparently
break pytype.
2017-11-09 06:28:40 -08:00
Daniel Watkins
1050b383a3
RawConfigParser dict_type argument should be a Type ( #1572 )
...
Fixes #1571 .
2017-08-22 14:59:59 -07:00
Daniel Watkins
e8ece8ccce
Replicate RawConfigParser.get* methods in SectionProxy ( #1568 )
...
These methods are partially applied (with the section that is being
proxied in SectionProxy) at runtime, so will always be present.
Fixes #1543 .
2017-08-21 15:00:16 -07:00
Daniel Watkins
24a7bfb4bf
Make configparser.RawConfigParser use SectionProxy where appropriate ( #1527 )
...
* Make configparser.RawConfigParser.__getitem__ return a SectionProxy
This reflects the code in the cpython tree and makes the following
(valid) code type-check correctly:
```
from configparser import ConfigParser
config = ConfigParser()
config.read_dict({'section': {'key': 'false'}})
assert config['section'].getboolean('key') is False
```
* RawConfigParser.items() returns SectionProxys not mappings
Because .items() uses __getitem__ to produce second item in each tuple.
* section argument to RawConfigParser.items is Optional
* Add comment explaining the status of RawConfigParser.items
TL;DR, we're hitting https://github.com/python/mypy/issues/3805 when
implemented correctly as an override, and
https://github.com/python/mypy/issues/1855 when we try to work around
that with a union.
* Correctly implement RawConfigParser.items overloading
* RawConfigParser.items(str) returns a List not an Iterable
2017-08-21 14:46:50 -07:00
Daniel Watkins
6f848e8ed8
Add definition for RawConfigParser._get_conv ( #1542 )
...
This allows subclasses that define get* methods to wrap _get_conv whilst
still typechecking correctly.
2017-08-21 14:09:42 -07:00
Jelle Zijlstra
5c328f12e1
configparser: support PathLike ( #1547 )
...
RawConfigParser.read has code explicitly supporting PathLike objects.
Also removed an unused import and widened the accepted type from
Sequence to Iterable.
2017-08-21 13:42:35 -07:00
Guido van Rossum
350563223f
Add Optional[] for all remaining cases of x: <type> = None ( #1424 )
...
* Final round of adding Optional[] to type of arguments with default = None
* Update Travis to use --no-implicit-optionals and clarify CONTRIBUTING.md
2017-06-21 10:50:21 -07:00
Jelle Zijlstra
0bda8c0cef
fixes and additions to the configparser stub ( #1311 )
...
* fixes and additions to the configparser stub
This broke pytype because of the type ignore. I think it's OK to blacklist
because another instance of this same error (stdlib/3/email/policy.pyi line 95)
is already blacklisted. We can remove it when the pytype parser is fixed to
allow type ignores in this context.
* add SectionProxy.__getattr__
* the __getattr__ returns Any
* don't need type ignore for pytype if we put it all on one line
2017-05-23 15:36:42 -07:00
Guido van Rossum
b369a3f2db
Fix return type of RawConfigParser.items()
2017-01-11 07:09:27 -08:00
Madeleine Thompson
d7edb0365f
RawConfigParser.items ( #820 )
...
The corresponding line is already present in the Python 2 ConfigParser stubs.
2017-01-10 15:56:26 -08:00
Lukasz Langa
6e2709906b
Fixing flake8 B errors
2016-12-20 01:17:38 -08:00
Elazar
59585bbf54
Update signature of ConfigParser.get() ( #501 )
...
Fix #492
Also add RawConfigParser
2016-08-29 12:44:30 -07:00
Mickaël S
4f1eb9a63c
Fix argument type for configparser.write ( #284 )
2016-06-10 19:49:37 +01:00
Martin Geisler
808016a510
Add stubs for configparser
2016-03-15 09:52:24 +01:00