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

10 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-05-27 20:29 +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 

27class Information( metaclass = __.ImmutableDataclass ): 

28 ''' Information about an application. ''' 

29 

30 name: __.typx.Annotated[ 

31 str, 

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

33 ] = __.package_name 

34 publisher: __.typx.Annotated[ 

35 __.typx.Optional[ str ], 

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

37 __.tyro.conf.Suppress, 

38 ] = None 

39 version: __.typx.Annotated[ 

40 __.typx.Optional[ str ], 

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

42 __.tyro.conf.Suppress, 

43 ] = None 

44 

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

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

47 arguments = dict( appname = self.name, ensure_exists = True ) 

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

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

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