def get_external_file_with_sentinels(self, root): ''' root is an @<file> node. Return the result of writing the file *with* sentinels, even if the external file would normally *not* have sentinels. ''' c = self.c if root.isAtAutoNode(): # Special case @auto nodes: # Leo does not write sentinels in the root @auto node. at = c.atFileCommands ok = at.writeOneAtAutoNode( root, toString=True, force=True, trialWrite=False, forceSentinels=True, ) return ok and at.stringOutput or '' else: return g.composeScript( # Fix # 429. c = c, p = root, s = root.b, forcePythonSentinels=False, # See #247. useSentinels=True)
def get_external_file_with_sentinels(self, root): ''' root is an @<file> node. Return the result of writing the file *with* sentinels, even if the external file would normally *not* have sentinels. ''' c = self.c if root.isAtAutoNode(): # Special case @auto nodes: # Leo does not write sentinels in the root @auto node. at = c.atFileCommands ivar = 'force_sentinels' try: setattr(at, ivar, True) s = at.atAutoToString(root) finally: if hasattr(at, ivar): delattr(at, ivar) return s return g.composeScript( # Fix # 429. c=c, p=root, s=root.b, forcePythonSentinels=False, # See #247. useSentinels=True)
def get_external_file_with_sentinels(self, root): ''' root is an @<file> node. Return the result of writing the file *with* sentinels, even if the external file would normally *not* have sentinels. ''' c = self.c if root.isAtAutoNode(): # Special case @auto nodes: # Leo does not write sentinels in the root @auto node. at = c.atFileCommands ivar = 'force_sentinels' try: setattr(at, ivar, True) s = at.atAutoToString(root) finally: if hasattr(at, ivar): delattr(at, ivar) return s else: return g.composeScript( # Fix # 429. c = c, p = root, s = root.b, forcePythonSentinels=False, # See #247. useSentinels=True)