orthonym.assembly.handlers.n_oxide#

Note

Internal API. Names and behaviour may change between releases.

a phase N-oxide handler — direct-return; recursive name_compound permitted.

Verbatim lift of the N-oxide dispatch logic from composer.py:813-820 (inline branch) + composer.py:2044-2174 (body of _try_name_n_oxide + _name_aromatic_n_oxide + _name_aliphatic_n_oxide). Per internal notes, the body stays in composer.py until Plan-03 commit 03-10 thinning.

IUPAC cite: (N-oxides; functional class naming).

Special case (per internal notes + internal notes-DECOMP.md): - _try_name_n_oxide makes a recursive name_fragment_recursively call

on a reduced (N-oxide → parent amine) RWMol copy. The recursion is PERMITTED because: (a) the recursive call instantiates a FRESH push_pool/pop_pool lifecycle

per a phase;

  1. RWMol mutation operates on a COPY (Chem.RWMol(features.mol)), NOT the input features.mol;

  2. the recursive name_fragment_recursively runs in an isolated pool scope; no cross-handler shared state leaks.

  • side_effect_inventory remains per hard invariant (recursion is not a side effect on the outer features / outer pool).

Predicate strategy (per internal notes): - The predicate checks features.functional_groups.get('n_oxide_aromatic')

or features.functional_groups.get('n_oxide_aliphatic') (the keys populated by perception/functional_groups.py:70-71). This filters out non-N-oxide molecules at the predicate layer so dispatch_inner can proceed to the next priority entry. The handler body still calls _try_name_n_oxide(features) which re-runs the SMARTS pattern AND applies the is_top_level_naming guard + reduced-molecule recursion; the handler returns None if those guards fail (e.g., during fragment naming recursion), in which case the dispatch loop’s caller (composer.py) falls through to the inline cascade.

References: - composer.py:813-820 (inline dispatch branch; REMOVED at this commit). - composer.py:2044-2174 (_try_name_n_oxide + aromatic/aliphatic helpers). - internal notes-DECOMP.md row ‘n_oxide’ + (recursive call audit). - internal notes (n_oxide direct-return shape).

orthonym.assembly.handlers.n_oxide.name_n_oxide(features, mol=None, style='pin')#

a phase direct-return N-oxide handler.

Verbatim semantics of composer.py:813-820 (inline branch). Returns NamingResult(name, tree=None, atom_to_locant_hint=<heterocycle locant map>) on success; None when not an N-oxide.

Per internal notes-DECOMP.md: the recursive name_fragment_recursively call inside _try_name_n_oxide is PERMITTED under because it instantiates a fresh push_pool/pop_pool lifecycle per a phase and operates on a COPY of features.mol (no outer mutation).