Coverage for sources / ictr / records.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2025-12-12 01:33 +0000

1# vim: set filetype=python fileencoding=utf-8: 

2# -*- coding: utf-8 -*- 

3 

4#============================================================================# 

5# # 

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

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

8# You may obtain a copy of the License at # 

9# # 

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

11# # 

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

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

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

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

16# limitations under the License. # 

17# # 

18#============================================================================# 

19 

20 

21''' Records to inscribe. ''' 

22 

23 

24from . import __ 

25from . import flavors as _flavors 

26 

27 

28MessageDetail: __.typx.TypeAlias = str 

29MessageDetails: __.typx.TypeAlias = tuple[ MessageDetail, ... ] 

30MessageSummary: __.typx.TypeAlias = str | BaseException 

31 

32 

33class Content( __.immut.DataclassObject ): 

34 ''' Abstract base class for content. ''' 

35 

36 

37class MessageContent( Content ): 

38 ''' Content for standard messages. ''' 

39 

40 summary: MessageSummary 

41 details: MessageDetails 

42 

43 

44class Record( __.immut.DataclassObject ): 

45 ''' Content with metadata. ''' 

46 

47 address: str 

48 content: Content 

49 flavor: _flavors.Flavor 

50 # TODO? 'ttl' for printing to other reporters 

51 ctime: __.Datetime = __.dcls.field( 

52 default_factory = lambda: __.Datetime.now( __.Timezone.utc ) ) 

53 # TODO? 'excinfo' (exception info)