Coverage for src/jsoncrack_for_sphinx/config/config_classes.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.10.0, created at 2025-07-24 22:26 +0000

1""" 

2Configuration classes for JSONCrack components. 

3""" 

4 

5from typing import Union 

6 

7from ..utils.types import Directions, RenderMode 

8 

9 

10class ContainerConfig: 

11 """Container configuration.""" 

12 

13 def __init__( 

14 self, 

15 direction: Directions = Directions.RIGHT, 

16 height: Union[int, str] = "500", 

17 width: Union[int, str] = "100%", 

18 ): 

19 """ 

20 Args: 

21 direction: Visualization direction 

22 height: Container height in pixels or string 

23 width: Container width in pixels, percentage, or string 

24 """ 

25 self.direction = direction 

26 self.height = str(height) 

27 self.width = str(width) 

28 

29 def __repr__(self) -> str: 

30 return ( 

31 f"ContainerConfig(direction={self.direction}, " 

32 f"height='{self.height}', width='{self.width}')" 

33 ) 

34 

35 

36class RenderConfig: 

37 """Render configuration.""" 

38 

39 def __init__( 

40 self, mode: Union[RenderMode.OnClick, RenderMode.OnLoad, RenderMode.OnScreen] 

41 ): 

42 """ 

43 Args: 

44 mode: Render mode instance 

45 """ 

46 self.mode = mode 

47 

48 def __repr__(self) -> str: 

49 return f"RenderConfig(mode={self.mode})"