Skip to content

Commit b794d15

Browse files
pyth0n1cljstella
authored andcommitted
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 eeaeb4d commit b794d15

File tree

6 files changed

+15
-196
lines changed

6 files changed

+15
-196
lines changed

contentctl/actions/new_content.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import questionary
33
from typing import Any
44
from contentctl.input.new_content_questions import NewContentQuestions
5-
from contentctl.output.new_content_yml_output import NewContentYmlOutput
65
from contentctl.objects.config import new, NewContentType
76
import uuid
87
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 & 65 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)