Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/google/api_core/gapic_v1/__init__.py: 92%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

12 statements  

1# Copyright 2017 Google LLC 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14 

15import importlib.util 

16from typing import Set 

17 

18_has_grpc = importlib.util.find_spec("grpc") is not None 

19 

20# PEP 0810: Explicit Lazy Imports 

21# Python 3.15+ natively intercepts and defers these imports. 

22# Developers can disable this behavior and force eager imports. 

23# For more information, see: 

24# https://docs.python.org/3.15/library/sys.html#sys.set_lazy_imports_filter 

25# Older Python versions safely ignore this variable. 

26__lazy_modules__: Set[str] = { 

27 "google.api_core.gapic_v1.client_info", 

28 "google.api_core.gapic_v1.requests", 

29 "google.api_core.gapic_v1.routing_header", 

30} 

31__all__ = ["client_info", "requests", "routing_header"] 

32 

33if _has_grpc: 

34 __lazy_modules__.update( 

35 { 

36 "google.api_core.gapic_v1.config", 

37 "google.api_core.gapic_v1.config_async", 

38 "google.api_core.gapic_v1.method", 

39 "google.api_core.gapic_v1.method_async", 

40 } 

41 ) 

42 

43from google.api_core.gapic_v1 import ( # noqa: E402 

44 client_info, 

45 requests, 

46 routing_header, 

47) 

48 

49if _has_grpc: 

50 from google.api_core.gapic_v1 import ( # noqa: F401 

51 config, 

52 config_async, 

53 method, 

54 method_async, 

55 ) 

56 

57 __all__.extend(["config", "config_async", "method", "method_async"])