Coverage for collectra/text/base.py: 0.00%

10 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-16 09:56 +0000

1"""Text handling and processing classes for Collectra workflows. 

2 

3This module provides basic text data structures and utilities for handling 

4textual content within Collectra workflows. It supports text content with 

5optional path associations for file-based text processing tasks. 

6 

7Classes: 

8 Text: Basic text container with content and optional path metadata 

9""" 

10 

11from dataclasses import dataclass 

12from pathlib import Path 

13 

14 

15@dataclass(kw_only=True) 

16class Text: 

17 """Basic text container for handling textual content in workflows. 

18 

19 Provides a simple data structure for storing text content along with 

20 optional path metadata for file-based text processing operations. 

21 

22 Attributes: 

23 content (str): The actual text content. 

24 path (Path): Optional path to the source file. 

25 """ 

26 

27 content: str 

28 path: Path 

29 

30 def __init__(self, content: str): 

31 """Initialize a Text instance with content. 

32 

33 Args: 

34 content (str): The text content to store. 

35 """ 

36 self.content = content 

37 

38 def __str__(self): 

39 """Return the text content as a string. 

40 

41 Returns: 

42 str: The stored text content. 

43 """ 

44 return self.content