notionary 0.2.15__py3-none-any.whl → 0.2.17__py3-none-any.whl

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 (38) hide show
  1. notionary/__init__.py +9 -5
  2. notionary/base_notion_client.py +19 -8
  3. notionary/blocks/__init__.py +2 -0
  4. notionary/blocks/document_element.py +194 -0
  5. notionary/blocks/registry/block_registry.py +27 -3
  6. notionary/database/__init__.py +4 -0
  7. notionary/database/database.py +481 -0
  8. notionary/database/{filter_builder.py → database_filter_builder.py} +27 -29
  9. notionary/database/{notion_database_provider.py → database_provider.py} +6 -10
  10. notionary/database/notion_database.py +73 -32
  11. notionary/file_upload/__init__.py +7 -0
  12. notionary/file_upload/client.py +254 -0
  13. notionary/file_upload/models.py +60 -0
  14. notionary/file_upload/notion_file_upload.py +387 -0
  15. notionary/page/notion_page.py +5 -6
  16. notionary/telemetry/__init__.py +19 -0
  17. notionary/telemetry/service.py +136 -0
  18. notionary/telemetry/views.py +73 -0
  19. notionary/user/__init__.py +11 -0
  20. notionary/user/base_notion_user.py +52 -0
  21. notionary/user/client.py +129 -0
  22. notionary/user/models.py +83 -0
  23. notionary/user/notion_bot_user.py +227 -0
  24. notionary/user/notion_user.py +256 -0
  25. notionary/user/notion_user_manager.py +173 -0
  26. notionary/user/notion_user_provider.py +1 -0
  27. notionary/util/__init__.py +5 -5
  28. notionary/util/{factory_decorator.py → factory_only.py} +9 -5
  29. notionary/util/fuzzy.py +74 -0
  30. notionary/util/logging_mixin.py +12 -12
  31. notionary/workspace.py +38 -2
  32. {notionary-0.2.15.dist-info → notionary-0.2.17.dist-info}/METADATA +3 -1
  33. {notionary-0.2.15.dist-info → notionary-0.2.17.dist-info}/RECORD +37 -20
  34. notionary/util/fuzzy_matcher.py +0 -82
  35. /notionary/database/{database_exceptions.py → exceptions.py} +0 -0
  36. /notionary/util/{singleton_decorator.py → singleton.py} +0 -0
  37. {notionary-0.2.15.dist-info → notionary-0.2.17.dist-info}/LICENSE +0 -0
  38. {notionary-0.2.15.dist-info → notionary-0.2.17.dist-info}/WHEEL +0 -0
@@ -1,6 +1,6 @@
1
- notionary/__init__.py,sha256=4eO6Jx57VRR_Ejo9w7IJeET8SZOvxFl_1lOB39o39No,250
2
- notionary/base_notion_client.py,sha256=bqQu9uEdDmZhMAGGv6e_B8mBLOAWLWjoP8s9L6UaQks,6714
3
- notionary/blocks/__init__.py,sha256=MFBxK3zZ28tV_u8XT20Q6HY39KENCfJDfDflLTYVt4E,2019
1
+ notionary/__init__.py,sha256=oVZiZglID0yNOWB6VjIpN9HMpsROBDRraWJjUp43qvQ,511
2
+ notionary/base_notion_client.py,sha256=WIAIKZeGCeAwtHWnL4Kfcmzv2TBlxvz7cfGF26i89y0,7067
3
+ notionary/blocks/__init__.py,sha256=-Za7ipQtuHtYplx9yYuA4Smt0c1JxU0ymOWw1EFEfMs,2090
4
4
  notionary/blocks/audio_element.py,sha256=rQbWz8akbobci8CFvnFuuHoDNJCG7mcuSXdB8hHjqLU,5355
5
5
  notionary/blocks/bookmark_element.py,sha256=gW6uKCkuWFpHEzq-g1CbvKvma6hyTMUH2XMczI0U-5M,8080
6
6
  notionary/blocks/bulleted_list_element.py,sha256=Uv_ohhF0MTwQ29w_RUX91NFuz57Dtr4vQpV8seRAgy0,2599
@@ -8,6 +8,7 @@ notionary/blocks/callout_element.py,sha256=Cya-1HIRBiCiyMgQq6PqXU4_iGj2O3qAPirht
8
8
  notionary/blocks/code_block_element.py,sha256=w0AN5m1qEFEEMDZ5dicCUhh4RwQpjByzDW3PuHgvgt0,7466
9
9
  notionary/blocks/column_element.py,sha256=qzbrTcWWOhGts2fAWHTwQUW8Ca6yoQEMZol9ZxUDCCI,12669
10
10
  notionary/blocks/divider_element.py,sha256=eCX2OupttnjGUaIaF59RhULKqh8R6d8KPnpctMMaXJs,2267
11
+ notionary/blocks/document_element.py,sha256=VgICkBrSLKzQ_kuyzMiaJg__ccCiM6x1hqGj5lfwANQ,7035
11
12
  notionary/blocks/embed_element.py,sha256=MFHh3ZFNntvaJ1NiEs0bzpbmJTRm0Axqdtf5oputbi0,4516
12
13
  notionary/blocks/heading_element.py,sha256=aALMpclbPTvKfJOICJdgP0y-y7w5jhv7rUQl04TQpeg,3051
13
14
  notionary/blocks/image_element.py,sha256=SEZ31_uDBRy6_lpn8E_GMX5uzI7-c-pJB9idUGZiTrE,4695
@@ -19,7 +20,7 @@ notionary/blocks/paragraph_element.py,sha256=-zCwJOanOVjv07DRArD13yRYaxfL8sCob6o
19
20
  notionary/blocks/prompts/element_prompt_builder.py,sha256=rYMKPmpEFyk26JFZlwcTzMHATpvHnn4Dn284vewFog0,2953
20
21
  notionary/blocks/prompts/element_prompt_content.py,sha256=ItnhGwKsHGnnY9E_LGgZZeTCT9ZfnkJY8xad4wFViWk,1567
21
22
  notionary/blocks/qoute_element.py,sha256=pkeT6N7PZrepIod8WLrY1DMe2DW6fM98Y4zXiiACenw,6059
22
- notionary/blocks/registry/block_registry.py,sha256=hEBa8PdFn1CeevFBqKbcFX7yuBjulwGASUMKoHRsm9s,4305
23
+ notionary/blocks/registry/block_registry.py,sha256=fEKe03bJYkzy19cbkeO2d30nvSThG6TWHXHxf_-aUbg,4961
23
24
  notionary/blocks/registry/block_registry_builder.py,sha256=FA_0WOajaeVaqdphNh8EyN0p_7ItzFqEufYa6YVBLeY,8731
24
25
  notionary/blocks/table_element.py,sha256=DzXbSVm3KwTfnLF2cp765gj-VC50zWvj_0RU_WcQDJw,11184
25
26
  notionary/blocks/text_inline_formatter.py,sha256=aKnaR1LvmbBkRdJVId8xtMkrbw1xaw6e4ZLUH97XLfU,8583
@@ -27,15 +28,20 @@ notionary/blocks/todo_element.py,sha256=6ndhgGJNiy7eb-Ll--Va7zEqQySxFAFYpzY4PWJb
27
28
  notionary/blocks/toggle_element.py,sha256=2gofKL4ndVkRxkuH-iYVx0YFUc649gpQQbZtwh2BpY8,11017
28
29
  notionary/blocks/toggleable_heading_element.py,sha256=fkXvKtgCg6PuHqrHq7LupmqzpasJ1IyVf2RBLYTiVIo,9893
29
30
  notionary/blocks/video_element.py,sha256=C19XxFRyAUEbhhC9xvhAAGN8YBYP6ON1vm_x7b_gUrY,5664
30
- notionary/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ notionary/database/__init__.py,sha256=4tdML0fBzkOCpiWT6q-L--5NELFLbTPD0IUA_E8yZno,155
31
32
  notionary/database/client.py,sha256=ZcfydeYlpgGJt6wV1ib33KeXUiL-cGNJ1qraQZ4RVRc,4775
32
- notionary/database/database_exceptions.py,sha256=jwFdxoIQHLO3mO3p5t890--1FjbTX60fNyqBAe-sszo,452
33
+ notionary/database/database.py,sha256=7KBe6DWbtsakPvjUO45eCphD2sq0ZKuYHY3kXJsk4P8,16582
34
+ notionary/database/database_filter_builder.py,sha256=PCnq3M9REt-NHRgBIfSrTCIPykUqBs5RqZK13WOAHKA,5950
35
+ notionary/database/database_provider.py,sha256=MveBSMkYG8nLUzKTS7KjbFVH8H-vLdH0t6yGArs-vPQ,8976
36
+ notionary/database/exceptions.py,sha256=jwFdxoIQHLO3mO3p5t890--1FjbTX60fNyqBAe-sszo,452
33
37
  notionary/database/factory.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- notionary/database/filter_builder.py,sha256=4EJnWUF73l5oi-HnvMu-mI1OncLzEs2o2mr_xG75quk,6315
35
38
  notionary/database/models/page_result.py,sha256=Vmm5_oYpYAkIIJVoTd1ZZGloeC3cmFLMYP255mAmtaw,233
36
- notionary/database/notion_database.py,sha256=7_BdQUbXjdSHgK9heV3aIWLHdr5jPtofsY3_LHo2ZKs,15317
37
- notionary/database/notion_database_provider.py,sha256=-cw94OdvjX3aFeWxIf1eD4dLcRaDC6ni6DBTqO0JPaY,9065
39
+ notionary/database/notion_database.py,sha256=wSqPfVtOnDL-aKRrE9BSMP1cpHe0_8RYyfCMxrlJSNo,16746
38
40
  notionary/elements/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
+ notionary/file_upload/__init__.py,sha256=7TNyiIgLMD_IGRXTwRiAmStokF3rLoG4zXPwNb9KQqk,168
42
+ notionary/file_upload/client.py,sha256=qlxgu7_Ia0wbBflInoGki4mR8Po_RZgfLjO2wa279jY,8581
43
+ notionary/file_upload/models.py,sha256=0mYtuGkZ_eh_YmX0uxqye5vg3wWgqWuwOupAmLJXMUY,1625
44
+ notionary/file_upload/notion_file_upload.py,sha256=DZHRyKtGcLubgNE6yg5Nibs7mpWxp18YFBGJBBxSjsk,13163
39
45
  notionary/models/notion_block_response.py,sha256=gzL4C6K9QPcaMS6NbAZaRceSEnMbNwYBVVzxysza5VU,6002
40
46
  notionary/models/notion_database_response.py,sha256=3kvADIP1dSxgITSK4n8Ex3QpF8n_Lxnu_IXbPVGcq4o,7648
41
47
  notionary/models/notion_page_response.py,sha256=7ZwDYhlyK-avix_joQpGuNQZopjlQFI8jS3nvNNumoc,1544
@@ -48,21 +54,32 @@ notionary/page/content/page_content_writer.py,sha256=VVvK-Z8NvyIhi7Crcm9mZQuuD_L
48
54
  notionary/page/formatting/markdown_to_notion_converter.py,sha256=9RyGON8VrJv6XifdQdOt5zKgKT3irc974zcbGDBhmLY,17328
49
55
  notionary/page/formatting/spacer_rules.py,sha256=j2RHvdXT3HxXPVBEuCtulyy9cPxsEcOmj71pJqV-D3M,15677
50
56
  notionary/page/markdown_syntax_prompt_generator.py,sha256=uHCPNV9aQi3GzLVimyUKwza29hfxu6DTMVIa_QevJbk,4987
51
- notionary/page/notion_page.py,sha256=G639FNg8eIvQ9t3-Aa3W0vtmxHOhwCnuFICLFKUA4KE,19142
57
+ notionary/page/notion_page.py,sha256=4KXPtDORuk7-8bJ5NV_x9RplLTgNHl72ngECc_M32xA,19126
52
58
  notionary/page/notion_to_markdown_converter.py,sha256=_MJWWwsBvgZ3a8tLZ23ZCIA_G9Qfvt2JG1FqVTlRxHs,6308
53
59
  notionary/page/properites/property_value_extractor.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
60
  notionary/page/property_formatter.py,sha256=_978ViH83gfcr-XtDscWTfyBI2srGW2hzC-gzgp5NR8,3788
55
61
  notionary/page/search_filter_builder.py,sha256=wZpW_KHmPXql3sNIyQd9EzZ2-ERy2i0vYNdoLkoBUfc,4597
56
62
  notionary/page/utils.py,sha256=2nfBrWeczBdPH13R3q8dKP4OY4MwEdfKbcs2UJ9kg1o,2041
57
- notionary/util/__init__.py,sha256=EzAmP2uEFfazWapb41BY9kAua1ZEiuLRPaBMtw_cOYg,358
58
- notionary/util/factory_decorator.py,sha256=3SD63EPxXMmKQ8iF7sF88xUFMG8dy14L2DJZ7XdcYm4,1110
59
- notionary/util/fuzzy_matcher.py,sha256=RYR86hMTp8lrWl3PeOa3RpDpzh04HJ30qrIlrq6_qDo,2442
60
- notionary/util/logging_mixin.py,sha256=d5sRSmUtgQeuckdNBkO025IXPGe4oOb-7ueVAIP8amU,1846
63
+ notionary/telemetry/__init__.py,sha256=Y7KyXeN4PiA6GtzV3NnwoH4hJnPwdjikWP22ckPYuHM,511
64
+ notionary/telemetry/service.py,sha256=DD7RbkSN0HWRK2YpOJTgFD7PeXGhSe9KrLkhiVIaC7Y,4763
65
+ notionary/telemetry/views.py,sha256=FgFZGYaxP7pRYx-9wg18skMh_MJAwf4W3rCfe9JOZe4,1796
66
+ notionary/user/__init__.py,sha256=D8r_WtQimdT-l3P1wd8O9Iki5JXF7jg2KV_hOgzWraw,281
67
+ notionary/user/base_notion_user.py,sha256=QB1701CfQTeu1ZNWOHYnGvTSHZuiritr6xYNMqyVg_U,1500
68
+ notionary/user/client.py,sha256=v8-lpyKzY_gSWPdWkBEjqxEPSg1WCy9AYSAJLXRrfKA,4563
69
+ notionary/user/models.py,sha256=3WPUysO96hMZUZYUWoCH5cdqNvnWgdiw5Qd7QKOv2UY,2063
70
+ notionary/user/notion_bot_user.py,sha256=cwrwmfst5RbAgppIjoFMJjExms1epfRM9VBd-S-3y5Q,7784
71
+ notionary/user/notion_user.py,sha256=l0GOMakk_xzsUUt7SsDJ5j-3dbtX64cUyyQPxn0r0Zc,8512
72
+ notionary/user/notion_user_manager.py,sha256=JQddAvbKJiLCLCn0mfxmvoi5uLW95vHhMWEYZD_F9zk,6339
73
+ notionary/user/notion_user_provider.py,sha256=7ImQ7T76g88W4YyHGOoO0aUJQfdGlhbh1fMT9PzR1mU,19
74
+ notionary/util/__init__.py,sha256=Bu2yGFd3xPasBrMRMk-6DcmMXfkdXn-KfFRETApBcP8,351
75
+ notionary/util/factory_only.py,sha256=q-ZXUEvQ8lsuD1JQwx-ai6e9Lhie65waRE1BcRhCR_4,1235
76
+ notionary/util/fuzzy.py,sha256=lTlWuYEs0lhLa7QIRre3GVJ8-biIV_NmcJnMzBYFF5U,2061
77
+ notionary/util/logging_mixin.py,sha256=t08dx3nhSJq2-6_N8G39aydPEkQ76D4MlRfymxCsCVM,1690
61
78
  notionary/util/page_id_utils.py,sha256=AA00kRO-g3Cc50tf_XW_tb5RBuPKLuBxRa0D8LYhLXg,736
62
- notionary/util/singleton_decorator.py,sha256=CKAvykndwPRZsA3n3MAY_XdCR59MBjjKP0vtm2BcvF0,428
79
+ notionary/util/singleton.py,sha256=CKAvykndwPRZsA3n3MAY_XdCR59MBjjKP0vtm2BcvF0,428
63
80
  notionary/util/singleton_metaclass.py,sha256=uNeHiqS6TwhljvG1RE4NflIp2HyMuMmrCg2xI-vxmHE,809
64
- notionary/workspace.py,sha256=kW9fbVUSECivlvABBwnks2nALfk09V6g6Oc2Eq_pK5U,2511
65
- notionary-0.2.15.dist-info/LICENSE,sha256=zOm3cRT1qD49eg7vgw95MI79rpUAZa1kRBFwL2FkAr8,1120
66
- notionary-0.2.15.dist-info/METADATA,sha256=rFzkz08VRrwANPLLkbDTrfG5vhR7opqj35ApvYQd0kA,6784
67
- notionary-0.2.15.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
68
- notionary-0.2.15.dist-info/RECORD,,
81
+ notionary/workspace.py,sha256=W3YybEUI7Kwp1sa7DRI-kc7ViMBLRs1kIkum2G8bqqM,3878
82
+ notionary-0.2.17.dist-info/LICENSE,sha256=zOm3cRT1qD49eg7vgw95MI79rpUAZa1kRBFwL2FkAr8,1120
83
+ notionary-0.2.17.dist-info/METADATA,sha256=b9HAyv9WytOyw5-OnObrvTs1FOfAuho1-gCCzeQ9frk,6867
84
+ notionary-0.2.17.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
85
+ notionary-0.2.17.dist-info/RECORD,,
@@ -1,82 +0,0 @@
1
- from __future__ import annotations
2
- import difflib
3
- from typing import List, Any, TypeVar, Callable, Optional
4
- from dataclasses import dataclass
5
-
6
- T = TypeVar("T")
7
-
8
-
9
- @dataclass
10
- class MatchResult:
11
- """Result of a fuzzy match operation."""
12
-
13
- item: Any
14
- similarity: float
15
- matched_text: str
16
-
17
-
18
- class FuzzyMatcher:
19
- """Utility class for fuzzy string matching operations."""
20
-
21
- @staticmethod
22
- def calculate_similarity(query: str, target: str) -> float:
23
- """Calculate similarity between two strings using difflib."""
24
- return difflib.SequenceMatcher(
25
- None, query.lower().strip(), target.lower().strip()
26
- ).ratio()
27
-
28
- @classmethod
29
- def find_best_matches(
30
- cls,
31
- query: str,
32
- items: List[T],
33
- text_extractor: Callable[[T], str],
34
- min_similarity: float = 0.0,
35
- limit: Optional[int] = None,
36
- ) -> List[MatchResult[T]]:
37
- """
38
- Find best fuzzy matches from a list of items.
39
-
40
- Args:
41
- query: The search query
42
- items: List of items to search through
43
- text_extractor: Function to extract text from each item
44
- min_similarity: Minimum similarity threshold (0.0 to 1.0)
45
- limit: Maximum number of results to return
46
-
47
- Returns:
48
- List of MatchResult objects sorted by similarity (highest first)
49
- """
50
- results = []
51
-
52
- for item in items:
53
- text = text_extractor(item)
54
- similarity = cls.calculate_similarity(query, text)
55
-
56
- if similarity >= min_similarity:
57
- results.append(
58
- MatchResult(item=item, similarity=similarity, matched_text=text)
59
- )
60
-
61
- # Sort by similarity (highest first)
62
- results.sort(key=lambda x: x.similarity, reverse=True)
63
-
64
- # Apply limit if specified
65
- if limit:
66
- results = results[:limit]
67
-
68
- return results
69
-
70
- @classmethod
71
- def find_best_match(
72
- cls,
73
- query: str,
74
- items: List[T],
75
- text_extractor: Callable[[T], str],
76
- min_similarity: float = 0.0,
77
- ) -> Optional[MatchResult[T]]:
78
- """Find the single best fuzzy match."""
79
- matches = cls.find_best_matches(
80
- query, items, text_extractor, min_similarity, limit=1
81
- )
82
- return matches[0] if matches else None
File without changes