Coverage for sources/mimeogram/__/application.py: 100%
11 statements
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-05 19:15 +0000
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-05 19:15 +0000
1# vim: set filetype=python fileencoding=utf-8:
2# -*- coding: utf-8 -*-
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#============================================================================#
21''' Information about application. '''
24from . import imports as __
25from . import nomina as _nomina
28# # Note: We reuse a fixed execution ID across instances of this class
29# # which are default arguments to various preparation functions.
30# # This is done to improve import times with the understanding
31# # that not more than one execution ID should be needed during
32# # the lifetime of the process importing the library.
33# _execution_id = __.uuid4( ).urn
36class Information( __.immut.DataclassObject ):
37 ''' Information about an application. '''
39 name: __.typx.Annotated[
40 str,
41 __.typx.Doc( "For derivation of platform directories." ),
42 ] = _nomina.package_name
43 publisher: __.typx.Annotated[
44 __.typx.Optional[ str ],
45 __.typx.Doc( "For derivation of platform directories." ),
46 __.tyro.conf.Suppress,
47 ] = None
48 version: __.typx.Annotated[
49 __.typx.Optional[ str ],
50 __.typx.Doc( "For derivation of platform directories." ),
51 __.tyro.conf.Suppress,
52 ] = None
53 # execution_id: __.typx.Annotated[
54 # __.typx.Optional[ str ],
55 # __.typx.Doc( "For telemetry, etc..." ),
56 # ] = _execution_id
58 def produce_platform_directories( self ) -> __.PlatformDirs:
59 ''' Produces platform directories object for application. '''
60 arguments = __.accret.Dictionary( dict(
61 appname = self.name, ensure_exists = True ) )
62 if self.publisher: arguments[ 'appauthor' ] = self.publisher
63 if self.version: arguments[ 'version' ] = self.version
64 return __.PlatformDirs( **arguments ) # type: ignore