parameters: (self)
return_statement: return []
docstring: Called by Sphinx when the .. sourcelink:: directive is encountered.
docstring_summary: Called by Sphinx when the .. sourcelink:: directive is encountered.
docstring_tokens: Called by Sphinx when the .. sourcelink :: directive is encountered .
function: def execute(self):
          """
          Called by Sphinx when the .. sourcelink:: directive is encountered.
          """
          file_paths = {}
          error_string = ""
          sanity_checks = self.options.get("sanity_checks", 1)
          file_name = self.options.get("filename", None)
  
          if file_name is None:
              # build a sensible default
              file_name = self.algorithm_name()
              if (self.algorithm_version() != 1) and (self.algorithm_version() is not None):
                  file_name += str(self.algorithm_version())
  
          for extension in self.file_types.keys():
              file_paths[extension] = self.options.get(extension, None)
              if file_paths[extension] is None:
                  try:
                      fname = self.find_source_file(file_name, extension)
                      file_paths[extension] = fname if fname is not None else None
                  except SourceLinkError as err:
                      error_string += str(err) + "\n"
              elif file_paths[extension].lower() == "none":
                  # the users has specifically chosen to suppress this - set it to a "proper" None
                  # but do not search for this file
                  file_paths[extension] = None
              else:
                  # prepend the base framework directory
                  fname = os.path.join(self.source_root, file_paths[extension])
                  file_paths[extension] = fname
                  if not os.path.exists(file_paths[extension]):
                      error_string += "Cannot find {} file at {}\n".format(
                          extension, file_paths[extension])
  
          # throw accumulated errors now if you have any
          if error_string != "":
              raise SourceLinkError(error_string)
  
          self.output_to_page(file_paths, file_name, sanity_checks)
  
          return []
function_tokens: def execute ( self ) : file_paths = { } error_string = "" sanity_checks = self . options . get ( "sanity_checks" , 1 ) file_name = self . options . get ( "filename" , None ) if file_name is None : # build a sensible default file_name = self . algorithm_name ( ) if ( self . algorithm_version ( ) != 1 ) and ( self . algorithm_version ( ) is not None ) : file_name += str ( self . algorithm_version ( ) ) for extension in self . file_types . keys ( ) : file_paths [ extension ] = self . options . get ( extension , None ) if file_paths [ extension ] is None : try : fname = self . find_source_file ( file_name , extension ) file_paths [ extension ] = fname if fname is not None else None except SourceLinkError as err : error_string += str ( err ) + "\n" elif file_paths [ extension ] . lower ( ) == "none" : # the users has specifically chosen to suppress this - set it to a "proper" None # but do not search for this file file_paths [ extension ] = None else : # prepend the base framework directory fname = os . path . join ( self . source_root , file_paths [ extension ] ) file_paths [ extension ] = fname if not os . path . exists ( file_paths [ extension ] ) : error_string += "Cannot find {} file at {}\n" . format ( extension , file_paths [ extension ] ) # throw accumulated errors now if you have any if error_string != "" : raise SourceLinkError ( error_string ) self . output_to_page ( file_paths , file_name , sanity_checks ) return [ ]