Commit Graph
2437 Commits
Author SHA1 Message Date
Michael LeeandGitHub 44e6b6e0d4 Add Str.kind field to typed_ast stubs (#2699)
We recently cut a new-ish release of typed-ast that [adds a new field][0]
named `kind` to the `ast27.Str` and `ast3.Str` classes. This field
stores whatever string modifiers (like `b` or `u`) were present on the
original string.

As a note, I've confirmed that this field is indeed a str (and not
bytes) for ast27's Str class.

  [0]: https://github.com/python/typed_ast/pull/49
2018-12-18 10:37:19 -08:00
Dan ČermákandSebastian Rittau f7c9677703 Add members marker and unsafe_name to pkg_resources.Requirement (#2693)
For now specify Requirement.marker as Optional[Any] (as suggested by @srittau)
as we can't import packaging.markers (pkg_resource does that via runtime magic
in pkg_resources.external)

Closes #2961
2018-12-18 16:26:56 +01:00
Andrew GaulandSebastian Rittau 6206c5a9d3 Add stubs for tabulate (#2384) 2018-12-17 19:16:25 +01:00
Ville SkyttäandSebastian Rittau 0956a24eb2 bytes/bytearray.startswith fixes (#2696) 2018-12-17 18:57:07 +01:00
Kai WilladsenandSebastian Rittau 4d85e5365f Add missing ENOTSUP alias to errno (#2692) 2018-12-17 17:46:32 +01:00
Ilya KonstantinovandSebastian Rittau 1564770456 Add pynamodb.models.Model.get_attribute and narrow down the type (#2689) 2018-12-17 17:06:42 +01:00
Philipp HahnandSebastian Rittau bf410fb9ef Logging (#2687)
* logging: Add logging.Logger().fatal()

fatal() is an alias for critical(): It is just another name for the same
implementation.

* logging: Fix logging.Logger().warn()

warn() was an alias for warning(), but got deprecated with Python3.
In Python2 warn() is just another name for the same method.
In Python3 they have their own implementations, which adds a deprecation
warning before calling the new function.

PS: LoggerAdapter in Python2 never has the warn() method, but Python3
still implements the deprecation wrapper function.
2018-12-17 15:39:01 +01:00
Dave HalterandSebastian Rittau 5c69373890 macpath, os/path, posixpath and ntpath should basically be the same files (#2637) 2018-12-17 15:02:18 +01:00
gnattishnessandJelle Zijlstra ea0dbfa313 Fix typo for Message.add_attachment in message.pyi (#2697) 2018-12-15 19:11:15 -08:00
Michael J. SullivanandSebastian Rittau 95afb86022 Move posix.stat_result to os.stat_result on python 3 (#2683)
In python 3, posix.stat_result is a re-export of os.stat_result, while
in python 2 it was the reverse. Update typeshed to reflect this.
2018-12-13 19:20:42 +01:00
Andrew SvetlovandJelle Zijlstra b9be76c255 Task.current_task() and Task.all_tasks() have an optional loop parameter (#2690) 2018-12-12 13:18:18 -08:00
Philipp HahnandSebastian Rittau d57e8c69f3 urllib2: timeout: int -> Optional[float] (#2685) 2018-12-12 15:47:53 +01:00
Kostya EsmukovandSebastian Rittau 2469a3ccda Fix signature of ConfigParser's dict_type argument (#2684) 2018-12-12 08:22:31 +01:00
Sander VoermanandSebastian Rittau 1b24d80087 Add get_loop() to asyncio.Future [Python 3.7] (#2680) 2018-12-09 21:37:37 +01:00
Brandt BucherandSebastian Rittau 0b49ce75b4 Add contextlib.nullcontext [Python 3.7]. (#2677)
Closes #2676
2018-12-08 02:55:47 +01:00
Dominik GabiandSebastian Rittau dd2400df6a Fix property annotation in third_party/2and3/boto/connection.pyi (#2675) 2018-12-07 23:35:37 +01:00
Utkarsh GuptaandSebastian Rittau b3ced5b8c0 decimal.pyi: Add overload for Decimal.__round__() (#2674)
Fixes #2528
2018-12-07 10:00:24 +01:00
Jukka LehtosaloandSebastian Rittau 184148611a Fix signature of TypedDict has_key() (#2672) 2018-12-05 18:17:37 +01:00
Michael LeeandSebastian Rittau 6f061bbf1e Add 'Literal[...]' to typing_extension stubs (#2664)
This pull request adds 'Literal' to the typing_extension stubs
and serves as the dual of this PR:
https://github.com/python/typing/pull/591

For background context, here's the associated PEP draft:
https://github.com/Michael0x2a/peps/pull/1
2018-12-05 00:46:23 +01:00
Jukka LehtosaloandGitHub c8890b0f93 Add mypy fallback class for TypedDict methods to mypy_extensions (#2670)
This class is not defined at runtime but it's used by
mypy internally to support TypedDict methods.

Use NoReturn in argument types for better type safety
when the related mypy plugin hook is not active.
2018-12-04 18:21:58 +00:00
Sebastian RittauandGitHub 53d8756214 Guidelines for incomplete stubs (#2661)
* Remove the guideline to use any for preliminary stubs

Closes #2648
2018-12-04 19:20:13 +01:00
Guido van RossumandSebastian Rittau e08a5ac367 Tweak how ast.pyi imports typing (#2668)
When we import typeshed internally at Dropbox, somehow the fact that
these files are all stubs gets lost (it's a long story...).  This
causes errors like this:

  .../stdlib/2/ast.pyi:6: error: Name 'typing' already defined (by an import)

The quickest way around this is to rename the import to _typing.
2018-12-04 17:25:23 +01:00
Utkarsh GuptaandSebastian Rittau 3e4737c683 ast.pyi: Fix return type of generic_visit() (#2667)
Fixes #2085
2018-12-04 08:02:39 +01:00
jhanceandIvan Levkivskyi 1254b30f94 [protobuf] add deterministc option (#2666) 2018-12-03 21:53:31 +00:00
Brandt BucherandSebastian Rittau ac8f5da324 Replace Loader with PEP 451 _Loader protocol in _importlib_modulespec.pyi annotations. (#2626) 2018-12-03 21:26:37 +01:00
Utkarsh GuptaandSebastian Rittau bee236fb5d builtins.pyi: Return complex from __(r)pow__() (#2662)
Closes #1406
2018-12-03 14:21:27 +01:00
Michael LeeandGitHub 7b76fb9b20 Make contribution guidelines state when to use (and not use) 'Any' (#2540)
This pull request modifies the contribution guidelines to clarify
when and where 'Any' should be used.

In particular, it clarifies that 'Any' is meant mainly to be used as
a "fallback" -- if it's not possible to express a certain type, if we're not
sure what the correct type in some case is, to avoid Union returns, etc...

It also explicitly notes that 'object' should be used over 'Any' when we
want to indicate that some function can accept literally anything.

Typing stubs this way probably won't impact most people, but does make
life a bit easier for people (like me) who want to restrict/forbid the
use of Any as much as possible.
2018-12-02 15:16:29 -08:00
Sebastian RittauandGitHub 4fb22f61e4 Reference black, split long functions (#2651)
Closes #2598
2018-12-01 22:45:10 +01:00
Utkarsh GuptaandJelle Zijlstra 9f9d15e311 itertools.pyi: Allow omitting repeat argument in Python 3 (#2659)
Fixes #2561
2018-11-30 15:58:21 -08:00
Guido van RossumandGitHub de50614957 Stop inheriting Sized in collection ABCs (#2658)
Instead define abstract __len__ in affected classes.

Fixes #2655 without breaking
https://github.com/rominf/ordered-set-stubs/issues/1
2018-11-30 13:10:35 -08:00
Jukka LehtosaloandIvan Levkivskyi eaeb5fcf13 Revert "Move Sized earlier in the bases of Sequence (#2602)" (#2657)
This reverts commit 4dc21f04dd.

Fixes #2655.
2018-11-30 14:48:55 +00:00
Pascal CorpetandSebastian Rittau b4b81fba24 Properly type the ToJsonString method of time well known types in google protobuf (#2656) 2018-11-30 13:42:58 +01:00
Utkarsh GuptaandSebastian Rittau 407e4bb679 decorators.pyi: Add Any angument to Callable[] (#2654)
Fixes #2615
2018-11-30 10:33:22 +01:00
Jukka LehtosaloandJelle Zijlstra 84548f5bba Revert "fix list concatenation (#2404)" (#2653)
The fix caused regressions for mypy that are difficult to
fix.  See https://github.com/python/mypy/issues/5492 for
context.

This reverts commit 1a42a2c3ea.
2018-11-29 12:20:29 -08:00
Sebastian RittauandJelle Zijlstra ece96777a7 Re-export pyexpat instead of using check_consistency (#2649) 2018-11-29 07:29:59 -08:00
anentropicandSebastian Rittau 98e63d2d2f staticmethod and classmethod can wrap any callable (#2650)
Closes: #2645
2018-11-29 14:36:08 +01:00
Michael R. CrusoeandSebastian Rittau 48183b1d27 Unicode fixes for url2pathname() and pathname2url() (#2555) 2018-11-29 14:28:07 +01:00
Florian BruhinandSebastian Rittau f2e842b2d9 Fix handling of logging args (#2635)
* Use _ArgsType for logging.makeRecord
* The "args" argument is passed to LogMessage, so passing a tuple in is fine as
well.
* Use Mapping rather than Dict, see https://bugs.python.org/issue21172
2018-11-29 12:56:01 +01:00
Utkarsh GuptaandJelle Zijlstra 388de0876b threading.pyi: Add currentThread for all versions (#2647)
Fixes https://github.com/python/typeshed/issues/2625
2018-11-28 18:52:27 -08:00
jhanceandIvan Levkivskyi 5663dba895 [gflags] add known_only arg to __call__ (#2646) 2018-11-28 18:45:51 +00:00
Utkarsh GuptaandSebastian Rittau 03981de076 __init__.pyi: Fix dump() (#2640)
Fixes #2089
2018-11-28 09:08:30 +01:00
Florian BruhinandJelle Zijlstra 25c5f3cace yaml: Add __version__ attribute (#2636) 2018-11-27 20:56:01 -08:00
Brandt BucherandJelle Zijlstra 1857435e6f types.CodeType.co_filename isn't Optional. (#2639) 2018-11-27 20:53:05 -08:00
Guido van RossumandGitHub f9ba5402f8 Improve overloads of parse_args() -- it never returns None (#2643)
Fixes #2641
2018-11-27 18:11:30 -08:00
Maarten ter HuurneandSebastian Rittau eaae246062 Change argument type for xml.etree.ElementTree.iselement() to object (#2642)
It should be possible to ask for every object whether it looks like
an element. If only Elements are accepted, this function would always
return True.

Fixes #2629
2018-11-28 02:34:27 +01:00
Florian BruhinandSebastian Rittau 489180ffcc Add stubs for the faulthandler stdlib module (#2627) 2018-11-26 16:39:47 +01:00
Dave HalterandSebastian Rittau 96ed18f6e1 Add posix attributes for Python 3 (#2631)
The posix module in Python 3 lacks some attributes that are present in both
os/__init__.pyi and Python 2's posix.pyi
2018-11-26 14:39:12 +01:00
Joel RosdahlandSebastian Rittau 41d6a2791a Fix return type of datetime.datetime.dst (#2634)
Fixes #2633.
2018-11-26 14:35:23 +01:00
Dave HalterandSebastian Rittau 84daf7c93b Add __getnewargs__ to float, int, bool, str, bytes, unicode (#2632) 2018-11-26 10:43:12 +01:00
Keith GrayandSebastian Rittau 9c3978e337 Added cyaml.pyi (#2613)
Closes #1996
2018-11-24 18:13:14 +01:00