GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: suppress no project id warning (#160) · googleapis/python-aiplatform@ce7b7a3

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • google/cloud/aiplatform
    • base.py
    • initializer.py
    • utils.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎google/cloud/aiplatform/base.py‎

Copy file name to clipboardExpand all lines: google/cloud/aiplatform/base.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ def _instantiate_client(
276276
"""Helper method to instantiate service client for resource noun.
277277
278278
Args:
279-
project (str): Project of the resource noun.
280279
location (str): The location of the resource noun.
281280
credentials (google.auth.credentials.Credentials):
282281
Optional custom credentials to use when accessing interacting with
Collapse file

‎google/cloud/aiplatform/initializer.py‎

Copy file name to clipboardExpand all lines: google/cloud/aiplatform/initializer.py
+12-1Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,20 @@ def staging_bucket(self) -> Optional[str]:
116116

117117
@property
118118
def credentials(self) -> Optional[auth_credentials.Credentials]:
119-
"""Default credentials, if provided."""
119+
"""Default credentials."""
120120
return self._credentials
121121

122+
@credentials.setter
123+
def credentials(self, credentials):
124+
"""Set credentials if provided, or to the default credentials, ."""
125+
if not credentials:
126+
logger = logging.getLogger("google.auth._default")
127+
logging_warning_filter = utils.LoggingWarningFilter()
128+
logger.addFilter(logging_warning_filter)
129+
credentials, _ = google.auth.default()
130+
logger.removeFilter(logging_warning_filter)
131+
self._credentials = credentials
132+
122133
def get_client_options(
123134
self, location_override: Optional[str] = None, prediction_client: bool = False,
124135
) -> client_options.ClientOptions:
Collapse file

‎google/cloud/aiplatform/utils.py‎

Copy file name to clipboardExpand all lines: google/cloud/aiplatform/utils.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818

1919
import re
20+
import logging
2021

2122
from typing import Any, Match, Optional, Type, TypeVar, Tuple
2223
from collections import namedtuple
@@ -308,3 +309,8 @@ def __getattr__(self, name: str) -> Any:
308309
client_info=self._client_info,
309310
)
310311
return getattr(temporary_client, name)
312+
313+
314+
class LoggingWarningFilter(logging.Filter):
315+
def filter(self, record):
316+
return record.levelname == logging.WARNING

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.