notionary 0.1.7__tar.gz → 0.1.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. {notionary-0.1.7 → notionary-0.1.9}/PKG-INFO +1 -1
  2. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/content/page_content_manager.py +10 -5
  3. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/notion_page_manager.py +1 -0
  4. {notionary-0.1.7 → notionary-0.1.9}/notionary/util/page_id_utils.py +11 -8
  5. {notionary-0.1.7 → notionary-0.1.9}/notionary.egg-info/PKG-INFO +1 -1
  6. {notionary-0.1.7 → notionary-0.1.9}/setup.py +1 -1
  7. {notionary-0.1.7 → notionary-0.1.9}/LICENSE +0 -0
  8. {notionary-0.1.7 → notionary-0.1.9}/README.md +0 -0
  9. {notionary-0.1.7 → notionary-0.1.9}/notionary/__init__.py +0 -0
  10. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/__init__.py +0 -0
  11. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/bookmark_element.py +0 -0
  12. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/callout_element.py +0 -0
  13. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/code_block_element.py +0 -0
  14. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/column_element.py +0 -0
  15. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/divider_element.py +0 -0
  16. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/heading_element.py +0 -0
  17. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/image_element.py +0 -0
  18. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/list_element.py +0 -0
  19. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/notion_block_element.py +0 -0
  20. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/paragraph_element.py +0 -0
  21. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/qoute_element.py +0 -0
  22. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/table_element.py +0 -0
  23. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/text_inline_formatter.py +0 -0
  24. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/todo_lists.py +0 -0
  25. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/toggle_element.py +0 -0
  26. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/elements/video_element.py +0 -0
  27. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/markdown_to_notion_converter.py +0 -0
  28. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/notion_to_markdown_converter.py +0 -0
  29. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/registry/block_element_registry.py +0 -0
  30. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/converters/registry/block_element_registry_builder.py +0 -0
  31. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/database/database_info_service.py +0 -0
  32. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/database/models/page_result.py +0 -0
  33. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/database/notion_database_manager.py +0 -0
  34. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/database/notion_database_manager_factory.py +0 -0
  35. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/database/notion_database_schema.py +0 -0
  36. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/notion_client.py +0 -0
  37. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/metadata/metadata_editor.py +0 -0
  38. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/metadata/notion_icon_manager.py +0 -0
  39. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/metadata/notion_page_cover_manager.py +0 -0
  40. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/properites/database_property_service.py +0 -0
  41. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/properites/page_property_manager.py +0 -0
  42. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/properites/property_formatter.py +0 -0
  43. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/properites/property_operation_result.py +0 -0
  44. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/properites/property_value_extractor.py +0 -0
  45. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/relations/notion_page_relation_manager.py +0 -0
  46. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/relations/notion_page_title_resolver.py +0 -0
  47. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/relations/page_database_relation.py +0 -0
  48. {notionary-0.1.7 → notionary-0.1.9}/notionary/core/page/relations/relation_operation_result.py +0 -0
  49. {notionary-0.1.7 → notionary-0.1.9}/notionary/exceptions/database_exceptions.py +0 -0
  50. {notionary-0.1.7 → notionary-0.1.9}/notionary/exceptions/page_creation_exception.py +0 -0
  51. {notionary-0.1.7 → notionary-0.1.9}/notionary/util/logging_mixin.py +0 -0
  52. {notionary-0.1.7 → notionary-0.1.9}/notionary/util/singleton_decorator.py +0 -0
  53. {notionary-0.1.7 → notionary-0.1.9}/notionary.egg-info/SOURCES.txt +0 -0
  54. {notionary-0.1.7 → notionary-0.1.9}/notionary.egg-info/dependency_links.txt +0 -0
  55. {notionary-0.1.7 → notionary-0.1.9}/notionary.egg-info/requires.txt +0 -0
  56. {notionary-0.1.7 → notionary-0.1.9}/notionary.egg-info/top_level.txt +0 -0
  57. {notionary-0.1.7 → notionary-0.1.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notionary
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: A toolkit to convert between Markdown and Notion blocks
5
5
  Home-page: https://github.com/mathisarends/notionary
6
6
  Author: Mathis Arends
@@ -48,25 +48,30 @@ class PageContentManager(LoggingMixin):
48
48
  return "No content to delete."
49
49
 
50
50
  deleted = 0
51
- for b in results:
52
- if await self._client.delete(f"blocks/{b['id']}"):
51
+ skipped = 0
52
+ for block in results:
53
+ if block.get("type") in ["child_database", "database", "linked_database"]:
54
+ skipped += 1
55
+ continue
56
+
57
+ if await self._client.delete(f"blocks/{block['id']}"):
53
58
  deleted += 1
54
59
 
55
- return f"Deleted {deleted}/{len(results)} blocks."
60
+ return f"Deleted {deleted}/{len(results)} blocks. Skipped {skipped} database blocks."
56
61
 
57
62
  async def get_blocks(self) -> List[Dict[str, Any]]:
58
63
  result = await self._client.get(f"blocks/{self.page_id}/children")
59
64
  if not result:
60
65
  self.logger.error("Error retrieving page content: %s", result.error)
61
66
  return []
62
- return result.data.get("results", [])
67
+ return result.get("results", [])
63
68
 
64
69
  async def get_block_children(self, block_id: str) -> List[Dict[str, Any]]:
65
70
  result = await self._client.get(f"blocks/{block_id}/children")
66
71
  if not result:
67
72
  self.logger.error("Error retrieving block children: %s", result.error)
68
73
  return []
69
- return result.data.get("results", [])
74
+ return result.get("results", [])
70
75
 
71
76
  async def get_page_blocks_with_children(self) -> List[Dict[str, Any]]:
72
77
  blocks = await self.get_blocks()
@@ -305,6 +305,7 @@ async def main():
305
305
 
306
306
  print("\nDemonstration abgeschlossen.")
307
307
 
308
+
308
309
  if __name__ == "__main__":
309
310
  asyncio.run(main())
310
311
  print("\nDemonstration completed.")
@@ -4,36 +4,39 @@ from typing import Optional
4
4
  UUID_PATTERN = r"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
5
5
  UUID_RAW_PATTERN = r"([a-f0-9]{32})"
6
6
 
7
-
8
7
  def extract_uuid(source: str) -> Optional[str]:
8
+ if is_valid_uuid(source):
9
+ return source
10
+
9
11
  match = re.search(UUID_RAW_PATTERN, source.lower())
10
12
  if not match:
11
13
  return None
12
-
14
+
13
15
  uuid_raw = match.group(1)
14
16
  return f"{uuid_raw[0:8]}-{uuid_raw[8:12]}-{uuid_raw[12:16]}-{uuid_raw[16:20]}-{uuid_raw[20:32]}"
15
17
 
16
-
17
18
  def is_valid_uuid(uuid: str) -> bool:
18
19
  return bool(re.match(UUID_PATTERN, uuid.lower()))
19
20
 
20
-
21
21
  def format_uuid(value: str) -> Optional[str]:
22
22
  if is_valid_uuid(value):
23
23
  return value
24
24
  return extract_uuid(value)
25
25
 
26
-
27
26
  def extract_and_validate_page_id(page_id: Optional[str], url: Optional[str]) -> str:
28
27
  if not page_id and not url:
29
28
  raise ValueError("Either page_id or url must be provided")
30
-
29
+
31
30
  candidate = page_id or url
31
+
32
+ if is_valid_uuid(candidate):
33
+ return candidate
34
+
32
35
  extracted_id = extract_uuid(candidate)
33
36
  if not extracted_id:
34
37
  raise ValueError(f"Could not extract a valid UUID from: {candidate}")
35
-
38
+
36
39
  formatted = format_uuid(extracted_id)
37
- if not is_valid_uuid(formatted):
40
+ if not formatted or not is_valid_uuid(formatted):
38
41
  raise ValueError(f"Invalid UUID format: {formatted}")
39
42
  return formatted
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notionary
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: A toolkit to convert between Markdown and Notion blocks
5
5
  Home-page: https://github.com/mathisarends/notionary
6
6
  Author: Mathis Arends
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
2
2
 
3
3
  setup(
4
4
  name="notionary",
5
- version="0.1.7",
5
+ version="0.1.9",
6
6
  packages=find_namespace_packages(include=["notionary*"]),
7
7
  install_requires=[
8
8
  "notion-client>=2.0.0",
File without changes
File without changes
File without changes