Reference
Code
dataclass
Dataclass representing code object with attribute language
and code
Attributes:
Name | Type | Description |
---|---|---|
code |
Union[str, None]
|
The code text |
language |
Union[str, None]
|
the programming language. The programming language is guessed |
Source code in codesnipper/codesnipper.py
8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
CodeSnipper
Source code in codesnipper/codesnipper.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
__init__(text=None, file_path=None)
Reads for code snippets within a text. A section is considered a code snippet if it's text is enclosed in triple backticks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
Union[str, None]
|
text to check code in |
None
|
file_path |
Union[str, None]
|
filepath from where to read the text |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If both |
ValueError
|
If none of |
Source code in codesnipper/codesnipper.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|