Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/proto/marshal/compat.py: 67%

18 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2023-12-08 06:45 +0000

1# Copyright 2018 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# https://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 

15# This file pulls in the container types from internal protocol buffers, 

16# and exports the types available. 

17# 

18# If the C extensions were not installed, then their container types will 

19# not be included. 

20 

21from google.protobuf.internal import containers 

22 

23# Import protobuf 4.xx first and fallback to earlier version 

24# if not present. 

25try: 

26 from google._upb import _message 

27except ImportError: 

28 _message = None 

29 

30if not _message: 

31 try: 

32 from google.protobuf.pyext import _message 

33 except ImportError: 

34 _message = None 

35 

36repeated_composite_types = (containers.RepeatedCompositeFieldContainer,) 

37repeated_scalar_types = (containers.RepeatedScalarFieldContainer,) 

38map_composite_types = (containers.MessageMap,) 

39 

40if _message: 

41 repeated_composite_types += (_message.RepeatedCompositeContainer,) 

42 repeated_scalar_types += (_message.RepeatedScalarContainer,) 

43 map_composite_types += (_message.MessageMapContainer,) 

44 

45 

46__all__ = ( 

47 "repeated_composite_types", 

48 "repeated_scalar_types", 

49 "map_composite_types", 

50)