From b40cae139f364bc9e46911389075754f9684e932 Mon Sep 17 00:00:00 2001 From: Teddy Sudol Date: Thu, 13 Sep 2018 13:00:04 -0700 Subject: [PATCH] Add more complete type hints for pkg_resources. (#2433) The current file only covers pkg_resources/__init__.py. pkg_resources/py31compat.pyi is used by setuptools, for example. --- .../__init__.pyi} | 0 third_party/3/pkg_resources/py31compat.pyi | 14 ++++++++++++++ 2 files changed, 14 insertions(+) rename third_party/3/{pkg_resources.pyi => pkg_resources/__init__.pyi} (100%) create mode 100644 third_party/3/pkg_resources/py31compat.pyi diff --git a/third_party/3/pkg_resources.pyi b/third_party/3/pkg_resources/__init__.pyi similarity index 100% rename from third_party/3/pkg_resources.pyi rename to third_party/3/pkg_resources/__init__.pyi diff --git a/third_party/3/pkg_resources/py31compat.pyi b/third_party/3/pkg_resources/py31compat.pyi new file mode 100644 index 000000000..e7b17a3c4 --- /dev/null +++ b/third_party/3/pkg_resources/py31compat.pyi @@ -0,0 +1,14 @@ +from typing import Text +import os +import sys + +needs_makedirs: bool + +def _makedirs_31(path: Text, exist_ok: bool = ...) -> None: ... + +# _makedirs_31 has special behavior to handle an edge case that was removed in +# 3.4.1. No one should be using 3.4 instead of 3.4.1, so this should be fine. +if sys.version_info >= (3,): + makedirs = os.makedirs +else: + makedirs = _makedirs_31