Coverage for sources/mimeogram/__/application.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-02-19 23:01 +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''' Information about application. ''' 

22 

23 

24from . import imports as __ 

25 

26 

27# # Note: We reuse a fixed execution ID across instances of this class 

28# # which are default arguments to various preparation functions. 

29# # This is done to improve import times with the understanding 

30# # that not more than one execution ID should be needed during 

31# # the lifetime of the process importing the library. 

32# _execution_id = __.uuid4( ).urn 

33 

34 

35class Information( 

36 metaclass = __.ImmutableStandardDataclass, 

37 decorators = ( __.standard_dataclass, ) 

38): 

39 ''' Information about an application. ''' 

40 

41 name: __.typx.Annotated[ 

42 str, 

43 __.typx.Doc( "For derivation of platform directories." ), 

44 ] = __.package_name 

45 publisher: __.typx.Annotated[ 

46 __.typx.Optional[ str ], 

47 __.typx.Doc( "For derivation of platform directories." ), 

48 __.tyro.conf.Suppress, 

49 ] = None 

50 version: __.typx.Annotated[ 

51 __.typx.Optional[ str ], 

52 __.typx.Doc( "For derivation of platform directories." ), 

53 __.tyro.conf.Suppress, 

54 ] = None 

55 # execution_id: __.typx.Annotated[ 

56 # __.typx.Optional[ str ], 

57 # __.typx.Doc( "For telemetry, etc..." ), 

58 # ] = _execution_id 

59 

60 def produce_platform_directories( self ) -> __.PlatformDirs: 

61 ''' Produces platform directories object for application. ''' 

62 arguments = __.AccretiveDictionary( dict( 

63 appname = self.name, ensure_exists = True ) ) 

64 if self.publisher: arguments[ 'appauthor' ] = self.publisher 

65 if self.version: arguments[ 'version' ] = self.version 

66 return __.PlatformDirs( **arguments ) # type: ignore