From 5fe70f5668fd60bd7ab9b41731ba2fef8a9d310a Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Mon, 7 Oct 2019 20:58:57 +0530 Subject: [PATCH 1/5] [WIP] __init__.pyi: Add missing methods on pkg_resources.VersionConflict Closes: #3279 --- third_party/3/pkg_resources/__init__.pyi | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/third_party/3/pkg_resources/__init__.pyi b/third_party/3/pkg_resources/__init__.pyi index 55914e12bae0..98f3350858f1 100644 --- a/third_party/3/pkg_resources/__init__.pyi +++ b/third_party/3/pkg_resources/__init__.pyi @@ -202,7 +202,15 @@ class IMetadataProvider: class ResolutionError(Exception): ... class DistributionNotFound(ResolutionError): ... -class VersionConflict(ResolutionError): ... + +class VersionConflict(ResolutionError): + @property + def dist(self) -> List[Any]: ... + @property + def req(self) -> List[Any]: ... + def report(self) -> str: ... + def with_context(self, required_by: Dict[str, Any]) -> ContextualVersionConflict: ... + class UnknownExtra(ResolutionError): ... class ExtractionError(Exception): From acd74021c182188d75d09db22aa091c6bbf06f33 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Mon, 7 Oct 2019 21:15:08 +0530 Subject: [PATCH 2/5] [WIP] __init__.pyi: Add missing class: pkg_resources.ContextualVersionConflict --- third_party/3/pkg_resources/__init__.pyi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/third_party/3/pkg_resources/__init__.pyi b/third_party/3/pkg_resources/__init__.pyi index 98f3350858f1..acc237fc13b9 100644 --- a/third_party/3/pkg_resources/__init__.pyi +++ b/third_party/3/pkg_resources/__init__.pyi @@ -211,6 +211,10 @@ class VersionConflict(ResolutionError): def report(self) -> str: ... def with_context(self, required_by: Dict[str, Any]) -> ContextualVersionConflict: ... +class ContextualVersionConflict(VersionConflict): + @property + def required_by(self) -> List[Any]: ... + class UnknownExtra(ResolutionError): ... class ExtractionError(Exception): From 1fe8d05153d2263745cab806c20f83a95d034ac2 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Tue, 8 Oct 2019 22:05:56 +0530 Subject: [PATCH 3/5] __init__.pyi: Add missing methods on pkg_resources.VersionConflict --- third_party/3/pkg_resources/__init__.pyi | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/third_party/3/pkg_resources/__init__.pyi b/third_party/3/pkg_resources/__init__.pyi index acc237fc13b9..33f2c700b49d 100644 --- a/third_party/3/pkg_resources/__init__.pyi +++ b/third_party/3/pkg_resources/__init__.pyi @@ -1,6 +1,6 @@ # Stubs for pkg_resources (Python 3.4) -from typing import Any, Callable, Dict, IO, Iterable, Generator, Optional, Sequence, Tuple, List, Union, TypeVar, overload +from typing import Any, Callable, Dict, IO, Iterable, Generator, Optional, Sequence, Tuple, List, Set, Union, TypeVar, overload from abc import ABCMeta import importlib.abc import types @@ -205,15 +205,18 @@ class DistributionNotFound(ResolutionError): ... class VersionConflict(ResolutionError): @property - def dist(self) -> List[Any]: ... + def dist(self) -> Any: ... @property - def req(self) -> List[Any]: ... + def req(self) -> Any: ... def report(self) -> str: ... - def with_context(self, required_by: Dict[str, Any]) -> ContextualVersionConflict: ... + if bool(required_by) == False: + def with_context(self, required_by: Dict[str, Any]) -> VersionConflict: ... + else: + def with_context(self, required_by: Dict[str, Any]) -> ContextualVersionConflict: ... class ContextualVersionConflict(VersionConflict): @property - def required_by(self) -> List[Any]: ... + def required_by(self) -> Set[Any]: ... class UnknownExtra(ResolutionError): ... From 37a334abc8648d3e1ea02c3f4d4ba8cc8895b1fc Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Tue, 8 Oct 2019 22:13:18 +0530 Subject: [PATCH 4/5] __init__.pyi: Fix missing methods on pkg_resources.VersionConflict --- third_party/3/pkg_resources/__init__.pyi | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/third_party/3/pkg_resources/__init__.pyi b/third_party/3/pkg_resources/__init__.pyi index 33f2c700b49d..3128b5c97c6a 100644 --- a/third_party/3/pkg_resources/__init__.pyi +++ b/third_party/3/pkg_resources/__init__.pyi @@ -209,10 +209,7 @@ class VersionConflict(ResolutionError): @property def req(self) -> Any: ... def report(self) -> str: ... - if bool(required_by) == False: - def with_context(self, required_by: Dict[str, Any]) -> VersionConflict: ... - else: - def with_context(self, required_by: Dict[str, Any]) -> ContextualVersionConflict: ... + def with_context(self, required_by: Dict[str, Any]) -> ContextualVersionConflict: ... class ContextualVersionConflict(VersionConflict): @property From f172fcbb1ac02ab45a06093f55c7fd3779a3bf5f Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Tue, 8 Oct 2019 23:39:01 +0530 Subject: [PATCH 5/5] __init__.pyi: Fix missing methods on pkg_resources.VersionConflict --- third_party/3/pkg_resources/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/3/pkg_resources/__init__.pyi b/third_party/3/pkg_resources/__init__.pyi index 3128b5c97c6a..0b6eb3af0758 100644 --- a/third_party/3/pkg_resources/__init__.pyi +++ b/third_party/3/pkg_resources/__init__.pyi @@ -209,7 +209,7 @@ class VersionConflict(ResolutionError): @property def req(self) -> Any: ... def report(self) -> str: ... - def with_context(self, required_by: Dict[str, Any]) -> ContextualVersionConflict: ... + def with_context(self, required_by: Dict[str, Any]) -> VersionConflict: ... class ContextualVersionConflict(VersionConflict): @property