mirror of
https://github.com/mandiant/capa.git
synced 2026-02-04 11:07:53 -08:00
rules: don't eagerly import ruamel until needed
This commit is contained in:
committed by
Willi Ballenthin
parent
fdd097a141
commit
4e2f175b9f
@@ -31,7 +31,6 @@ from dataclasses import asdict, dataclass
|
||||
|
||||
import yaml
|
||||
import pydantic
|
||||
import ruamel.yaml
|
||||
import yaml.parser
|
||||
|
||||
import capa.perf
|
||||
@@ -1053,6 +1052,11 @@ class Rule:
|
||||
|
||||
@staticmethod
|
||||
def _get_ruamel_yaml_parser():
|
||||
# we use lazy importing here to avoid eagerly loading dependencies
|
||||
# that some specialized environments may not have,
|
||||
# e.g., those that run capa without ruamel.
|
||||
import ruamel.yaml
|
||||
|
||||
# use ruamel to enable nice formatting
|
||||
|
||||
# we use the ruamel.yaml parser because it supports roundtripping of documents with comments.
|
||||
|
||||
Reference in New Issue
Block a user