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.routing_header", 

29} 

30__all__ = ["client_info", "routing_header"] 

31 

32if _has_grpc: 

33 __lazy_modules__.update( 

34 { 

35 "google.api_core.gapic_v1.config", 

36 "google.api_core.gapic_v1.config_async", 

37 "google.api_core.gapic_v1.method", 

38 "google.api_core.gapic_v1.method_async", 

39 } 

40 ) 

41 

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

43 client_info, 

44 routing_header, 

45) 

46 

47if _has_grpc: 

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

49 config, 

50 config_async, 

51 method, 

52 method_async, 

53 ) 

54 

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