Coverage for sources/mimeogram/__/application.py: 100%
11 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-07 04:07 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-07 04:07 +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(
37 metaclass = __.ImmutableStandardDataclass,
38 decorators = ( __.standard_dataclass, )
39):
40 ''' Information about an application. '''
42 name: __.typx.Annotated[
43 str,
44 __.typx.Doc( "For derivation of platform directories." ),
45 ] = _nomina.package_name
46 publisher: __.typx.Annotated[
47 __.typx.Optional[ str ],
48 __.typx.Doc( "For derivation of platform directories." ),
49 __.tyro.conf.Suppress,
50 ] = None
51 version: __.typx.Annotated[
52 __.typx.Optional[ str ],
53 __.typx.Doc( "For derivation of platform directories." ),
54 __.tyro.conf.Suppress,
55 ] = None
56 # execution_id: __.typx.Annotated[
57 # __.typx.Optional[ str ],
58 # __.typx.Doc( "For telemetry, etc..." ),
59 # ] = _execution_id
61 def produce_platform_directories( self ) -> __.PlatformDirs:
62 ''' Produces platform directories object for application. '''
63 arguments = __.AccretiveDictionary( dict(
64 appname = self.name, ensure_exists = True ) )
65 if self.publisher: arguments[ 'appauthor' ] = self.publisher
66 if self.version: arguments[ 'version' ] = self.version
67 return __.PlatformDirs( **arguments ) # type: ignore