requests.Session().headers has a type of CaseInsensitiveDict; however, it is defined as being a MutableMapping[Text, Text] and so is missing a copy() method. Mypy incorrectly raises an error, error: "MutableMapping[str, str]" has no attribute "copy"
|
headers: MutableMapping[Text, Text] |
The definition for a CaseInsensitiveDict itself is also missing a copy() method
|
class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]): |
The copy() method is defined here
https://github.com/kennethreitz/requests/blob/4983a9bde39c6320aa4f3e34e50dac6e263dab6f/requests/structures.py#L80
requests.Session().headershas a type ofCaseInsensitiveDict; however, it is defined as being aMutableMapping[Text, Text]and so is missing acopy()method. Mypy incorrectly raises an error,error: "MutableMapping[str, str]" has no attribute "copy"typeshed/third_party/2and3/requests/sessions.pyi
Line 65 in d64a26c
The definition for a
CaseInsensitiveDictitself is also missing acopy()methodtypeshed/third_party/2and3/requests/structures.pyi
Line 5 in d64a26c
The
copy()method is defined herehttps://github.com/kennethreitz/requests/blob/4983a9bde39c6320aa4f3e34e50dac6e263dab6f/requests/structures.py#L80