Skip to content

[google-cloud-ndb] from_environment() can return None - #16876

Open
ArnabDutta01 wants to merge 1 commit into
python:mainfrom
ArnabDutta01:fix/google-cloud-ndb-from-environment-none
Open

ArnabDutta01 wants to merge 1 commit into
python:mainfrom
ArnabDutta01:fix/google-cloud-ndb-from-environment-none

Conversation

@ArnabDutta01

Copy link
Copy Markdown
Contributor

RedisCache.from_environment() and MemcacheCache.from_environment() return None when REDIS_CACHE_URL / MEMCACHED_HOSTS is not set. Their docstrings already say Optional[RedisCache] / Optional[MemcacheCache], but the stubs annotate both as Self.

>>> from google.cloud.ndb.global_cache import RedisCache, MemcacheCache
>>> print(RedisCache.from_environment(), MemcacheCache.from_environment())
None None

This changes both return types to Self | None.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant