Skip to content

Commit 0237ccd

Browse files
committed
remove files that are no longer used anymore. Add logic to serialize StrEnum and IntEnum when writing YMLs from objects that contain them.
1 parent ed958cc commit 0237ccd

File tree

6 files changed

+15
-197
lines changed

6 files changed

+15
-197
lines changed

contentctl/actions/new_content.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import questionary
55
from typing import Any
66
from contentctl.input.new_content_questions import NewContentQuestions
7-
from contentctl.output.new_content_yml_output import NewContentYmlOutput
87
from contentctl.objects.config import new, NewContentType
98
import uuid
109
from datetime import datetime

contentctl/output/detection_writer.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

contentctl/output/new_content_yml_output.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

contentctl/output/yml_output.py

Lines changed: 0 additions & 66 deletions
This file was deleted.

contentctl/output/yml_writer.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11

22
import yaml
33
from typing import Any
4+
from enum import StrEnum, IntEnum
5+
6+
# Set the following so that we can write StrEnum and IntEnum
7+
# to files. Otherwise, we will get the following errors when trying
8+
# to write to files:
9+
# yaml.representer.RepresenterError: ('cannot represent an object',.....
10+
yaml.SafeDumper.add_multi_representer(
11+
StrEnum,
12+
yaml.representer.SafeRepresenter.represent_str
13+
)
14+
15+
yaml.SafeDumper.add_multi_representer(
16+
IntEnum,
17+
yaml.representer.SafeRepresenter.represent_int
18+
)
419

520
class YmlWriter:
621

enums_test.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)