anki.importing.noteimp
======================

.. py:module:: anki.importing.noteimp


Attributes
----------

.. autoapisummary::

   anki.importing.noteimp.TagMappedUpdate
   anki.importing.noteimp.TagModifiedUpdate
   anki.importing.noteimp.NoTagUpdate
   anki.importing.noteimp.Updates
   anki.importing.noteimp.UPDATE_MODE
   anki.importing.noteimp.IGNORE_MODE
   anki.importing.noteimp.ADD_MODE


Classes
-------

.. autoapisummary::

   anki.importing.noteimp.ForeignNote
   anki.importing.noteimp.ForeignCard
   anki.importing.noteimp.NoteImporter


Module Contents
---------------

.. py:data:: TagMappedUpdate

.. py:data:: TagModifiedUpdate

.. py:data:: NoTagUpdate

.. py:data:: Updates

.. py:class:: ForeignNote

   An temporary object storing fields and attributes.


   .. py:attribute:: fields
      :type:  list[str]
      :value: []



   .. py:attribute:: tags
      :type:  list[str]
      :value: []



   .. py:attribute:: deck
      :value: None



   .. py:attribute:: cards
      :type:  dict[int, ForeignCard]


   .. py:attribute:: fieldsStr
      :value: ''



.. py:class:: ForeignCard

   .. py:attribute:: due
      :value: 0



   .. py:attribute:: ivl
      :value: 1



   .. py:attribute:: factor
      :value: 2500



   .. py:attribute:: reps
      :value: 0



   .. py:attribute:: lapses
      :value: 0



.. py:data:: UPDATE_MODE
   :value: 0


.. py:data:: IGNORE_MODE
   :value: 1


.. py:data:: ADD_MODE
   :value: 2


.. py:class:: NoteImporter(col: anki.collection.Collection, file: str)

   Bases: :py:obj:`anki.importing.base.Importer`


   .. py:attribute:: needMapper
      :value: True



   .. py:attribute:: needDelimiter
      :value: False



   .. py:attribute:: allowHTML
      :value: False



   .. py:attribute:: importMode
      :value: 0



   .. py:attribute:: mapping
      :type:  list[str] | None


   .. py:attribute:: tagModified
      :type:  str | None


   .. py:attribute:: model


   .. py:method:: run() -> None

      Import.



   .. py:method:: fields() -> int

      The number of fields.



   .. py:method:: initMapping() -> None


   .. py:method:: mappingOk() -> bool


   .. py:method:: foreignNotes() -> list

      Return a list of foreign notes for importing.



   .. py:method:: importNotes(notes: list[ForeignNote]) -> None

      Convert each card into a note, apply attributes and add to col.



   .. py:method:: newData(n: ForeignNote) -> tuple[anki.notes.NoteId, str, anki.models.NotetypeId, int, int, str, str, str, int, int, str]


   .. py:method:: addNew(rows: list[tuple[anki.notes.NoteId, str, anki.models.NotetypeId, int, int, str, str, str, int, int, str]]) -> None


   .. py:method:: updateData(n: ForeignNote, id: anki.notes.NoteId, sflds: list[str]) -> Updates | None


   .. py:method:: addUpdates(rows: list[Updates]) -> None


   .. py:method:: processFields(note: ForeignNote, fields: list[str] | None = None) -> None


   .. py:method:: updateCards() -> None


