@@ -416,32 +416,31 @@ def create_section(self, section: SDocSection) -> None:
416
416
417
417
def create_inline_link (self , new_link : InlineLink ):
418
418
assert isinstance (new_link , InlineLink )
419
+
419
420
# InlineLink points to a section, node or to anchor.
420
- # FIXME: De-nest this code by returning early.
421
- if self .graph_database .has_link (
421
+ assert self .graph_database .has_link (
422
422
link_type = GraphLinkType .UID_TO_NODE , lhs_node = new_link .link
423
- ):
424
- node_or_anchor : Union [
425
- SDocDocument , SDocNode , SDocSection , Anchor
426
- ] = assert_cast (
423
+ )
424
+
425
+ node_or_anchor : Union [ SDocDocument , SDocNode , SDocSection , Anchor ] = (
426
+ assert_cast (
427
427
self .graph_database .get_link_value (
428
428
link_type = GraphLinkType .UID_TO_NODE ,
429
429
lhs_node = new_link .link ,
430
430
),
431
431
(SDocDocument , SDocNode , SDocSection , Anchor ),
432
432
)
433
- self .graph_database .create_link (
434
- link_type = GraphLinkType .NODE_TO_INCOMING_LINKS ,
435
- lhs_node = node_or_anchor .reserved_mid ,
436
- rhs_node = new_link ,
437
- )
438
- self .graph_database .create_link (
439
- link_type = GraphLinkType .MID_TO_NODE ,
440
- lhs_node = new_link .reserved_mid ,
441
- rhs_node = new_link ,
442
- )
443
- else :
444
- raise NotImplementedError
433
+ )
434
+ self .graph_database .create_link (
435
+ link_type = GraphLinkType .NODE_TO_INCOMING_LINKS ,
436
+ lhs_node = node_or_anchor .reserved_mid ,
437
+ rhs_node = new_link ,
438
+ )
439
+ self .graph_database .create_link (
440
+ link_type = GraphLinkType .MID_TO_NODE ,
441
+ lhs_node = new_link .reserved_mid ,
442
+ rhs_node = new_link ,
443
+ )
445
444
446
445
def update_last_updated (self ) -> None :
447
446
"""
0 commit comments