From 9715995b2d57bd65b12553c792c0746e736fe870 Mon Sep 17 00:00:00 2001 From: Jakub Stasiak Date: Fri, 5 Aug 2016 14:51:20 +0200 Subject: [PATCH] Remove undesired type variable from lxml.objectify (#441) typing.AnyStr usage here was a mistake that I noticed too late, from a GitHub comment[1]: AnyStr is a type variable so in your version of objectify.fromstring() the types if text and base_url have to correspond -- but with unions they can each be either str or bytes, and that's how the rest of the API is defined. [1] https://github.com/python/typeshed/pull/436#issuecomment-237708512 --- third_party/3/lxml/objectify.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/third_party/3/lxml/objectify.pyi b/third_party/3/lxml/objectify.pyi index b5a7ac1a5..74293c4cd 100644 --- a/third_party/3/lxml/objectify.pyi +++ b/third_party/3/lxml/objectify.pyi @@ -1,13 +1,13 @@ # Hand-written stub, incomplete -from typing import AnyStr +from typing import Union from lxml.etree import ElementBase, XMLParser class ObjectifiedElement(ElementBase): pass -def fromstring(text: AnyStr, +def fromstring(text: Union[bytes, str], parser: XMLParser = ..., *, - base_url: AnyStr = ...) -> ObjectifiedElement: ... + base_url: Union[bytes, str] = ...) -> ObjectifiedElement: ...