Coverage for sources/librovore/interfaces.py: 100%
34 statements
« prev ^ index » next coverage.py v7.10.4, created at 2025-08-17 23:43 +0000
« prev ^ index » next coverage.py v7.10.4, created at 2025-08-17 23:43 +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''' Common enumerations and interfaces. '''
24from . import __
27class FilterCapability( __.immut.DataclassObject ):
28 ''' Describes a filter supported by a processor. '''
30 name: str
31 description: str
32 type: str # "string", "enum", "boolean"
33 values: __.typx.Optional[ list[ str ] ] = None # For enums
34 required: bool = False
37class DisplayFormat( __.enum.Enum ):
38 ''' Enumeration for CLI display formats. '''
40 JSON = 'json'
41 Markdown = 'markdown'
44class ProcessorGenera( __.enum.Enum ):
45 ''' Enumeration for processor types/genera. '''
47 Inventory = 'inventory'
48 Structure = 'structure'
51class InventoryQueryDetails( __.enum.IntFlag ):
52 ''' Enumeration for inventory query detail levels. '''
54 Name = 0 # Object names only (baseline)
55 Signature = __.enum.auto( ) # Include signatures
56 Summary = __.enum.auto( ) # Include brief descriptions
57 Documentation = __.enum.auto( ) # Include full documentation
60class MatchMode( str, __.enum.Enum ):
61 ''' Enumeration for different term matching modes. '''
63 Exact = 'exact'
64 Regex = 'regex'
65 Fuzzy = 'fuzzy'
68class SearchBehaviors( __.immut.DataclassObject ):
69 ''' Search behavior configuration for the search engine. '''
71 match_mode: MatchMode = MatchMode.Fuzzy
72 fuzzy_threshold: int = 50
75_search_behaviors_default = SearchBehaviors( )
76_filters_default = __.immut.Dictionary[ str, __.typx.Any ]( )
79class ProcessorCapabilities( __.immut.DataclassObject ):
80 ''' Complete capability description for a processor. '''
82 processor_name: str
83 version: str
84 supported_filters: list[ FilterCapability ]
85 results_limit_max: __.typx.Optional[ int ] = None
86 response_time_typical: __.typx.Optional[ str ] = None # "fast", etc.
87 notes: __.typx.Optional[ str ] = None