Coverage for sources/librovore/inventories/mkdocs/main.py: 0%

11 statements  

« prev     ^ index     » next       coverage.py v7.10.5, created at 2025-08-29 01:14 +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''' MkDocs inventory processor for search_index.json format. ''' 

22 

23from . import __ 

24from . import detection as _detection 

25 

26 

27class MkDocsInventoryProcessor( __.Processor ): 

28 ''' Processes MkDocs search index files (search_index.json format). ''' 

29 

30 name: str = 'mkdocs' 

31 

32 @property 

33 def capabilities( self ) -> __.ProcessorCapabilities: 

34 ''' Returns MkDocs inventory processor capabilities. ''' 

35 return __.ProcessorCapabilities( 

36 processor_name = 'mkdocs', 

37 version = '1.0.0', 

38 supported_filters = [ 

39 __.FilterCapability( 

40 name = 'location', 

41 description = 'Filter by page location/URL pattern', 

42 type = 'string' 

43 ), 

44 __.FilterCapability( 

45 name = 'title', 

46 description = 'Filter by page title pattern', 

47 type = 'string' 

48 ), 

49 ], 

50 results_limit_max = 10000, 

51 response_time_typical = 'fast', 

52 notes = 'Processes MkDocs search index files (search_index.json)' 

53 ) 

54 

55 async def detect( 

56 self, auxdata: __.ApplicationGlobals, source: str 

57 ) -> __.InventoryDetection: 

58 ''' Detects if source has a MkDocs search index file. ''' 

59 base_url = __.normalize_base_url( source ) 

60 inventory_data, confidence = await _detection.probe_search_index( 

61 auxdata, base_url ) 

62 return _detection.MkDocsInventoryDetection( 

63 processor = self, 

64 confidence = confidence, 

65 inventory_data = inventory_data )