@@ -39,6 +39,7 @@ <h1 class="title">Module <code>continuous_delivery_scripts.utils.news_file</code
3939import enum
4040import pathlib
4141from datetime import datetime
42+ from typing import Any
4243
4344
4445class NewsType(enum.Enum):
@@ -52,9 +53,14 @@ <h1 class="title">Module <code>continuous_delivery_scripts.utils.news_file</code
5253 removal = 5
5354
5455
55- def create_news_file(news_dir: str, news_text: str, news_type: NewsType ) -> pathlib.Path:
56+ def create_news_file(news_dir: str, news_text: str, news_type: Any ) -> pathlib.Path:
5657 """Facilitates creating a news file, determining it's file name based on the type."""
57- file_path = determine_news_file_path(news_dir, news_type)
58+ message_type = NewsType.misc
59+ if isinstance(news_type, str):
60+ message_type = NewsType[news_type]
61+ elif isinstance(news_type, NewsType):
62+ message_type = news_type
63+ file_path = determine_news_file_path(news_dir, message_type)
5864 _write_file(file_path, news_text)
5965 return file_path
6066
@@ -89,17 +95,22 @@ <h1 class="title">Module <code>continuous_delivery_scripts.utils.news_file</code
8995< h2 class ="section-title " id ="header-functions "> Functions</ h2 >
9096< dl >
9197< dt id ="continuous_delivery_scripts.utils.news_file.create_news_file "> < code class ="name flex ">
92- < span > def < span class ="ident "> create_news_file</ span > </ span > (< span > news_dir: str, news_text: str, news_type: < a title =" continuous_delivery_scripts.utils.news_file.NewsType " href =" #continuous_delivery_scripts.utils.news_file.NewsType " > NewsType </ a > ) ‑> pathlib.Path</ span >
98+ < span > def < span class ="ident "> create_news_file</ span > </ span > (< span > news_dir: str, news_text: str, news_type: Any ) ‑> pathlib.Path</ span >
9399</ code > </ dt >
94100< dd >
95101< div class ="desc "> < p > Facilitates creating a news file, determining it's file name based on the type.</ p > </ div >
96102< details class ="source ">
97103< summary >
98104< span > Expand source code</ span >
99105</ summary >
100- < pre > < code class ="python "> def create_news_file(news_dir: str, news_text: str, news_type: NewsType ) -> pathlib.Path:
106+ < pre > < code class ="python "> def create_news_file(news_dir: str, news_text: str, news_type: Any ) -> pathlib.Path:
101107 """Facilitates creating a news file, determining it's file name based on the type."""
102- file_path = determine_news_file_path(news_dir, news_type)
108+ message_type = NewsType.misc
109+ if isinstance(news_type, str):
110+ message_type = NewsType[news_type]
111+ elif isinstance(news_type, NewsType):
112+ message_type = news_type
113+ file_path = determine_news_file_path(news_dir, message_type)
103114 _write_file(file_path, news_text)
104115 return file_path</ code > </ pre >
105116</ details >
0 commit comments