Skip to content

Commit 9fb10fa

Browse files
committed
docs(py): document some methods in the Rules object.
Add documentation for `imports`, `serialize_into` and `deserialize_from`.
1 parent fd17833 commit 9fb10fa

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

site/content/docs/api/python.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,38 @@ Returns: [yara_x.ScanResults](#scanresults)
328328

329329
Raises: [yara_x.ScanError](#scanerror), [yara_x.TimeoutError](#timeouterror)
330330

331+
#### .imports()
332+
333+
An array with the names of the modules imported by the rules.
334+
335+
#### .serialize_into(file)
336+
337+
Serializes the rules into a file-like object.
338+
339+
##### Example
340+
341+
```python
342+
rules = yara_x.compile("rule test { condition: true }")
343+
f = io.BytesIO()
344+
rules.serialize_into(f)
345+
f.seek(0)
346+
rules = yara_x.Rules.deserialize_from(f)
347+
```
348+
349+
#### .deserialize_from(file)
350+
351+
Deserializes rules from a file-like object.
352+
353+
##### Example
354+
355+
```python
356+
rules = yara_x.compile("rule test { condition: true }")
357+
f = io.BytesIO()
358+
rules.serialize_into(f)
359+
f.seek(0)
360+
rules = yara_x.Rules.deserialize_from(f)
361+
```
362+
331363
---------
332364

333365
### Scanner
@@ -426,8 +458,6 @@ during the scan, if any.
426458
A tuple of pairs `(identifier, value)` with the metadata associated to the
427459
rule.
428460

429-
---------
430-
431461
### Pattern
432462

433463
Type that represents a pattern in a [Rule](#rule). Contains information about

0 commit comments

Comments
 (0)