Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8a8abc

Browse files
authored
chore: add py.typed file for PEP 561 (googleapis#716)
1 parent d72a9de commit e8a8abc

File tree

12 files changed

+27
-11
lines changed

12 files changed

+27
-11
lines changed

google/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
try:
16-
import pkg_resources
16+
import pkg_resources # type: ignore
1717

1818
pkg_resources.declare_namespace(__name__)
1919
except ImportError:

google/cloud/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
try:
16-
import pkg_resources
16+
import pkg_resources # type: ignore
1717

1818
pkg_resources.declare_namespace(__name__)
1919
except ImportError:

google/cloud/storage/_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import os
2323
from urllib.parse import urlsplit
2424

25-
from google import resumable_media
25+
from google import resumable_media # type: ignore
2626
from google.auth import environment_vars
2727
from google.cloud.storage.constants import _DEFAULT_TIMEOUT
2828
from google.cloud.storage.retry import DEFAULT_RETRY

google/cloud/storage/_http.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
import functools
1818
import os
19-
import pkg_resources
19+
import pkg_resources # type: ignore
2020

21-
from google.cloud import _http
21+
from google.cloud import _http # type: ignore
2222

2323
from google.cloud.storage import __version__
2424

google/cloud/storage/acl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ def get_entities(self):
412412
self._ensure_loaded()
413413
return list(self.entities.values())
414414

415-
@property
415+
@property # type: ignore
416416
def client(self):
417417
"""Abstract getter for the object client."""
418418
raise NotImplementedError

google/cloud/storage/batch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import io
2424
import json
2525

26-
import requests
26+
import requests # type: ignore
2727

2828
from google.cloud import _helpers
2929
from google.cloud import exceptions

google/cloud/storage/blob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
from urllib.parse import urlunsplit
4343
import warnings
4444

45-
from google import resumable_media
45+
from google import resumable_media # type: ignore
4646
from google.resumable_media.requests import ChunkedDownload
4747
from google.resumable_media.requests import Download
4848
from google.resumable_media.requests import RawDownload

google/cloud/storage/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
from google.auth.credentials import AnonymousCredentials
2727

28-
from google import resumable_media
28+
from google import resumable_media # type: ignore
2929

3030
from google.api_core import page_iterator
3131
from google.cloud._helpers import _LocalStack, _NOW

google/cloud/storage/py.typed

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Marker file for PEP 561.
2+
# The google-cloud-storage package uses inline types.

google/cloud/storage/retry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import requests
16-
import requests.exceptions as requests_exceptions
15+
import requests # type: ignore
16+
import requests.exceptions as requests_exceptions # type: ignore
1717

1818
from google.api_core import exceptions as api_exceptions
1919
from google.api_core import retry

mypy.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[mypy]
2+
python_version = 3.7
3+
namespace_packages = True
4+
ignore_missing_imports = True

noxfile.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ def blacken(session):
6363
)
6464

6565

66+
@nox.session(python=DEFAULT_PYTHON_VERSION)
67+
def mypy(session):
68+
"""Verify type hints are mypy compatible."""
69+
session.install("-e", ".")
70+
session.install(
71+
"mypy", "types-setuptools", "types-requests",
72+
)
73+
session.run("mypy", "-p", "google.cloud.storage", "--no-incremental")
74+
75+
6676
@nox.session(python=DEFAULT_PYTHON_VERSION)
6777
def lint_setup_py(session):
6878
"""Verify that setup.py is valid (including RST check)."""

0 commit comments

Comments
 (0)