Skip to content

Commit edcde75

Browse files
committed
Remove redundant helper
1 parent cd9fc82 commit edcde75

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

src/_notion_scripts/upload.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from enum import Enum
1010
from functools import cache
1111
from pathlib import Path
12-
from typing import TYPE_CHECKING, Any
12+
from typing import TYPE_CHECKING
1313
from urllib.parse import urlparse
1414
from urllib.request import url2pathname
1515

@@ -184,20 +184,6 @@ def _block_with_uploaded_file(
184184
return block
185185

186186

187-
@beartype
188-
def _block_from_details(
189-
*,
190-
details: dict[str, Any],
191-
session: Session,
192-
) -> Block:
193-
"""
194-
Create a Block from a serialized block details, recursively processing
195-
children.
196-
"""
197-
block = Block.wrap_obj_ref(UnoObjAPIBlock.model_validate(obj=details))
198-
return _block_with_uploaded_file(block=block, session=session)
199-
200-
201187
@beartype
202188
class _ParentType(Enum):
203189
"""
@@ -305,9 +291,13 @@ def main(
305291
existing_page_block.delete()
306292

307293
block_objs_to_upload = [
308-
_block_from_details(details=details, session=session)
294+
Block.wrap_obj_ref(UnoObjAPIBlock.model_validate(obj=details))
309295
for details in blocks[delete_start_index:]
310296
]
311-
page.append(blocks=block_objs_to_upload)
297+
block_objs_with_uploaded_files = [
298+
_block_with_uploaded_file(block=block, session=session)
299+
for block in block_objs_to_upload
300+
]
301+
page.append(blocks=block_objs_with_uploaded_files)
312302

313303
click.echo(message=f"Updated existing page: '{title}' ({page.url})")

0 commit comments

Comments
 (0)