Skip to content

Commit

Permalink
remove files that are no longer used anymore. Add logic to serialize …
Browse files Browse the repository at this point in the history
…StrEnum and IntEnum when writing YMLs from objects that contain them.
  • Loading branch information
pyth0n1c committed Dec 6, 2024
1 parent ed958cc commit 0237ccd
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 197 deletions.
1 change: 0 additions & 1 deletion contentctl/actions/new_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import questionary
from typing import Any
from contentctl.input.new_content_questions import NewContentQuestions
from contentctl.output.new_content_yml_output import NewContentYmlOutput
from contentctl.objects.config import new, NewContentType
import uuid
from datetime import datetime
Expand Down
28 changes: 0 additions & 28 deletions contentctl/output/detection_writer.py

This file was deleted.

56 changes: 0 additions & 56 deletions contentctl/output/new_content_yml_output.py

This file was deleted.

66 changes: 0 additions & 66 deletions contentctl/output/yml_output.py

This file was deleted.

15 changes: 15 additions & 0 deletions contentctl/output/yml_writer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@

import yaml
from typing import Any
from enum import StrEnum, IntEnum

# Set the following so that we can write StrEnum and IntEnum
# to files. Otherwise, we will get the following errors when trying
# to write to files:
# yaml.representer.RepresenterError: ('cannot represent an object',.....
yaml.SafeDumper.add_multi_representer(
StrEnum,
yaml.representer.SafeRepresenter.represent_str
)

yaml.SafeDumper.add_multi_representer(
IntEnum,
yaml.representer.SafeRepresenter.represent_int
)

class YmlWriter:

Expand Down
46 changes: 0 additions & 46 deletions enums_test.py

This file was deleted.

0 comments on commit 0237ccd

Please sign in to comment.