@@ -64,7 +64,7 @@ def format_message_blocks(self, blocks: Sequence[MessageBlock]) -> str:
6464 def format_message_block (self , block : MessageBlock | ExpandableBlock ) -> str :
6565 if isinstance (block , HeaderBlock ):
6666 return self ._wrap_section (
67- f'<h1 style="margin:0;font-size:18px;line-height:1.4;">{ escape (block .text )} </h1>'
67+ f'<h1 style="margin:0;font-size:18px;line-height:1.4;">{ escape (block .text )} </h1>' # noqa: E231,E702
6868 )
6969 elif isinstance (block , CodeBlock ):
7070 code_html = escape (block .text )
@@ -97,7 +97,7 @@ def _wrap_section(self, html: str) -> str:
9797 return f'<div style="{ self ._SECTION_MARGIN } ">{ html } </div>'
9898
9999 def _format_icon (self , icon : Icon ) -> str :
100- return f'<span style="margin-right:4px;">{ escape (ICON_TO_UNICODE [icon ])} </span>'
100+ return f'<span style="margin-right:4px;">{ escape (ICON_TO_UNICODE [icon ])} </span>' # noqa: E231,E702
101101
102102 def _format_text_block (self , block : TextBlock ) -> str :
103103 text = escape (block .text )
@@ -127,7 +127,7 @@ def _format_inline_block(self, block: InlineBlock) -> str:
127127 f"{ escape (block .code )} </code>"
128128 )
129129 elif isinstance (block , MentionBlock ):
130- return f'<span style="color:#0ea5e9;">{ escape (block .user )} </span>'
130+ return f'<span style="color:#0ea5e9;">{ escape (block .user )} </span>' # noqa: E231,E702
131131 elif isinstance (block , LineBlock ):
132132 return self ._format_line_block (block )
133133 elif isinstance (block , WhitespaceBlock ):
@@ -151,7 +151,7 @@ def _format_lines_block(self, block: LinesBlock) -> str:
151151 return self ._format_as_bullet_list (block )
152152
153153 lines_html = [
154- f'<div style="margin:0;">{ self ._format_line_block (line_block )} </div>'
154+ f'<div style="margin:0;">{ self ._format_line_block (line_block )} </div>' # noqa: E231,E702
155155 for line_block in block .lines
156156 ]
157157 return self ._wrap_section ("" .join (lines_html ))
@@ -220,14 +220,18 @@ def _format_as_bullet_list(self, block: LinesBlock) -> str:
220220 if isinstance (bullet_inline , IconBlock ):
221221 bullet_html = self ._format_icon (bullet_inline .icon )
222222 list_items .append (
223- f'<li style="margin:0 0 4px;list-style:none;">'
224- f'<span style="margin-right:6px;">{ bullet_html } </span>{ content_html } </li>'
223+ f'<li style="margin:0 0 4px;list-style:none;">' # noqa: E231,E702
224+ f'<span style="margin-right:6px;">{ bullet_html } </span>{ content_html } </li>' # noqa: E231,E702
225225 )
226226 else :
227227 # Text bullet - use native list styling
228- list_items .append (f'<li style="margin:0 0 4px;">{ content_html } </li>' )
228+ list_items .append (
229+ f'<li style="margin:0 0 4px;">{ content_html } </li>' # noqa: E231,E702
230+ )
229231
230- ul_style = "margin:0;padding-left:24px;list-style-position:outside;"
232+ ul_style = (
233+ "margin:0;padding-left:24px;list-style-position:outside;" # noqa: E231,E702
234+ )
231235 return self ._wrap_section (f'<ul style="{ ul_style } ">{ "" .join (list_items )} </ul>' )
232236
233237 def _format_fact_list_block (self , block : FactListBlock ) -> str :
@@ -244,12 +248,12 @@ def _format_fact_list_block(self, block: FactListBlock) -> str:
244248 def _format_fact_row (self , fact : FactBlock ) -> str :
245249 title_html = self ._format_line_block (fact .title )
246250 value_html = self ._format_line_block (fact .value )
247- title_style = (
251+ title_style = ( # noqa: E231,E702
248252 "padding:4px 12px;font-weight:600;font-size:14px;color:#111827;"
249253 "max-width:200px;white-space:nowrap;"
250254 )
251255 value_weight = "700" if fact .primary else "400"
252- value_style = f"padding:4px 12px;font-weight:{ value_weight } ;font-size:14px;"
256+ value_style = f"padding:4px 12px;font-weight:{ value_weight } ;font-size:14px;" # noqa: E231,E702
253257 return (
254258 "<tr>"
255259 f'<td style="{ title_style } ">{ title_html } </td>'
@@ -261,23 +265,23 @@ def _format_table_block(self, block: TableBlock) -> str:
261265 header_html = ""
262266 if block .headers :
263267 header_cells = "" .join (
264- f'<th style="text-align:left;padding:8px;border-bottom:1px solid #e5e7eb;'
265- f'font-weight:600;font-size:14px;background-color:#f8fafc;">{ escape (header )} </th>'
268+ f'<th style="text-align:left;padding:8px;border-bottom:1px solid #e5e7eb;' # noqa: E231,E702
269+ f'font-weight:600;font-size:14px;background-color:#f8fafc;">{ escape (header )} </th>' # noqa: E231,E702
266270 for header in block .headers
267271 )
268272 header_html = f"<thead><tr>{ header_cells } </tr></thead>"
269273 body_rows = [
270274 "<tr>"
271275 + "" .join (
272- f'<td style="padding:8px;border-bottom:1px solid #f3f4f6;vertical-align:top;font-size:14px;">'
276+ f'<td style="padding:8px;border-bottom:1px solid #f3f4f6;vertical-align:top;font-size:14px;">' # noqa: E231,E702
273277 f"{ escape (self ._coerce_table_cell (cell ))} </td>"
274278 for cell in row
275279 )
276280 + "</tr>"
277281 for row in block .rows
278282 ]
279283 body_html = "<tbody>" + "" .join (body_rows ) + "</tbody>"
280- table_style = (
284+ table_style = ( # noqa: E231,E702
281285 "width:100%;border-collapse:collapse;margin:0 0 12px;"
282286 "border:1px solid #e5e7eb;border-radius:6px;overflow:hidden;"
283287 )
@@ -295,8 +299,12 @@ def _format_expandable_block(self, block: ExpandableBlock) -> str:
295299 )
296300 # Show appropriate arrow based on expanded state
297301 arrow = "▼" if block .expanded else "▶"
298- arrow_style = "margin-right:8px;color:#6b7280;font-size:10px;"
299- body_style = "padding:12px 16px;border-top:1px solid #e5e7eb;"
302+ arrow_style = (
303+ "margin-right:8px;color:#6b7280;font-size:10px;" # noqa: E231,E702
304+ )
305+ body_style = (
306+ "padding:12px 16px;border-top:1px solid #e5e7eb;" # noqa: E231,E702
307+ )
300308 open_attr = " open" if block .expanded else ""
301309 # Need inline style to hide webkit disclosure marker
302310 summary_with_marker_hidden = (
@@ -321,8 +329,8 @@ def _coerce_table_cell(self, cell: object) -> str:
321329 def _build_container_style (self , color : Color | None ) -> str :
322330 styles : list [str ] = list (self ._CONTAINER_STYLES )
323331 if color and color in COLOR_MAP :
324- styles .append (f"border-left:4px solid { COLOR_MAP [color ]} " )
325- styles .append ("padding-left:12px" )
332+ styles .append (f"border-left:4px solid { COLOR_MAP [color ]} " ) # noqa: E231
333+ styles .append ("padding-left:12px" ) # noqa: E231
326334 return ";" .join (styles )
327335
328336
0 commit comments