class_docstr: Stores the information necessary for producing an Xy-pic
  description of an arrow.
  
  The principal goal of this class is to abstract away the string
  representation of an arrow and to also provide the functionality
  to produce the actual Xy-pic string.
  
  ``unit`` sets the unit which will be used to specify the amount of
  curving and other distances.  ``horizontal_direction`` should be a
  string of ``"r"`` or ``"l"`` specifying the horizontal offset of the
  target cell of the arrow relatively to the current one.
  ``vertical_direction`` should  specify the vertical offset using a
  series of either ``"d"`` or ``"u"``.  ``label_position`` should be
  either ``"^"``, ``"_"``,  or ``"|"`` to specify that the label should
  be positioned above the arrow, below the arrow or just over the arrow,
  in a break.  Note that the notions "above" and "below" are relative
  to arrow direction.  ``label`` stores the morphism label.
  
  This works as follows (disregard the yet unexplained arguments):
  
  >>> from sympy.categories.diagram_drawing import ArrowStringDescription
  >>> astr = ArrowStringDescription(
  ... unit="mm", curving=None, curving_amount=None,
  ... looping_start=None, looping_end=None, horizontal_direction="d",
  ... vertical_direction="r", label_position="_", label="f")
  >>> print(str(astr))
  \ar[dr]_{f}
  
  ``curving`` should be one of ``"^"``, ``"_"`` to specify in which
  direction the arrow is going to curve. ``curving_amount`` is a number
  describing how many ``unit``'s the morphism is going to curve:
  
  >>> astr = ArrowStringDescription(
  ... unit="mm", curving="^", curving_amount=12,
  ... looping_start=None, looping_end=None, horizontal_direction="d",
  ... vertical_direction="r", label_position="_", label="f")
  >>> print(str(astr))
  \ar@/^12mm/[dr]_{f}
  
  ``looping_start`` and ``looping_end`` are currently only used for
  loop morphisms, those which have the same domain and codomain.
  These two attributes should store a valid Xy-pic direction and
  specify, correspondingly, the direction the arrow gets out into
  and the direction the arrow gets back from:
  
  >>> astr = ArrowStringDescription(
  ... unit="mm", curving=None, curving_amount=None,
  ... looping_start="u", looping_end="l", horizontal_direction="",
  ... vertical_direction="", label_position="_", label="f")
  >>> print(str(astr))
  \ar@(u,l)[]_{f}
  
  ``label_displacement`` controls how far the arrow label is from
  the ends of the arrow.  For example, to position the arrow label
  near the arrow head, use ">":
  
  >>> astr = ArrowStringDescription(
  ... unit="mm", curving="^", curving_amount=12,
  ... looping_start=None, looping_end=None, horizontal_direction="d",
  ... vertical_direction="r", label_position="_", label="f")
  >>> astr.label_displacement = ">"
  >>> print(str(astr))
  \ar@/^12mm/[dr]_>{f}
  
  Finally, ``arrow_style`` is used to specify the arrow style.  To
  get a dashed arrow, for example, use "{-->}" as arrow style:
  
  >>> astr = ArrowStringDescription(
  ... unit="mm", curving="^", curving_amount=12,
  ... looping_start=None, looping_end=None, horizontal_direction="d",
  ... vertical_direction="r", label_position="_", label="f")
  >>> astr.arrow_style = "{-->}"
  >>> print(str(astr))
  \ar@/^12mm/@{-->}[dr]_{f}
  
  Notes
  =====
  
  Instances of :class:`ArrowStringDescription` will be constructed
  by :class:`XypicDiagramDrawer` and provided for further use in
  formatters.  The user is not expected to construct instances of
  :class:`ArrowStringDescription` themselves.
  
  To be able to properly utilise this class, the reader is encouraged
  to checkout the Xy-pic user guide, available at [Xypic].
  
  See Also
  ========
  
  XypicDiagramDrawer
  
  References
  ==========
  
  .. [Xypic] https://xy-pic.sourceforge.net/
class_docstr_tok: ["Stores","the","information","necessary","for","producing","an","Xy-pic","description","of","an","arrow",".","The","principal","goal","of","this","class","is","to","abstract","away","the","string","representation","of","an","arrow","and","to","also","provide","the","functionality","to","produce","the","actual","Xy-pic","string",".","``","unit","``","sets","the","unit","which","will","be","used","to","specify","the","amount","of","curving","and","other","distances",".","``","horizontal_direction","``","should","be","a","string","of","``","``","r","''","``","or","``","``","l","''","``","specifying","the","horizontal","offset","of","the","target","cell","of","the","arrow","relatively","to","the","current","one",".","``","vertical_direction","``","should","specify","the","vertical","offset","using","a","series","of","either","``","``","d","''","``","or","``","``","u","''","``",".","``","label_position","``","should","be","either","``","``","^","''","``",",","``","``","_","''","``",",","or","``","``","|","''","``","to","specify","that","the","label","should","be","positioned","above","the","arrow",",","below","the","arrow","or","just","over","the","arrow",",","in","a","break",".","Note","that","the","notions","``","above","''","and","``","below","''","are","relative","to","arrow","direction",".","``","label","``","stores","the","morphism","label",".","This","works","as","follows","(","disregard","the","yet","unexplained","arguments",")",":",">",">",">","from","sympy.categories.diagram_drawing","import","ArrowStringDescription",">",">",">","astr","=","ArrowStringDescription","(","...","unit=","''","mm","''",",","curving=None",",","curving_amount=None",",","...","looping_start=None",",","looping_end=None",",","horizontal_direction=","''","d","''",",","...","vertical_direction=","''","r","''",",","label_position=","''","_","''",",","label=","''","f","''",")",">",">",">","print","(","str","(","astr",")",")","\\ar","[","dr","]","_","{","f","}","``","curving","``","should","be","one","of","``","``","^","''","``",",","``","``","_","''","``","to","specify","in","which","direction","the","arrow","is","going","to","curve",".","``","curving_amount","``","is","a","number","describing","how","many","``","unit","``","'s","the","morphism","is","going","to","curve",":",">",">",">","astr","=","ArrowStringDescription","(","...","unit=","''","mm","''",",","curving=","''","^","''",",","curving_amount=12",",","...","looping_start=None",",","looping_end=None",",","horizontal_direction=","''","d","''",",","...","vertical_direction=","''","r","''",",","label_position=","''","_","''",",","label=","''","f","''",")",">",">",">","print","(","str","(","astr",")",")","\\ar","@","\/^12mm\/","[","dr","]","_","{","f","}","``","looping_start","``","and","``","looping_end","``","are","currently","only","used","for","loop","morphisms",",","those","which","have","the","same","domain","and","codomain",".","These","two","attributes","should","store","a","valid","Xy-pic","direction","and","specify",",","correspondingly",",","the","direction","the","arrow","gets","out","into","and","the","direction","the","arrow","gets","back","from",":",">",">",">","astr","=","ArrowStringDescription","(","...","unit=","''","mm","''",",","curving=None",",","curving_amount=None",",","...","looping_start=","''","u","''",",","looping_end=","''","l","''",",","horizontal_direction=","''","''",",","...","vertical_direction=","''","''",",","label_position=","''","_","''",",","label=","''","f","''",")",">",">",">","print","(","str","(","astr",")",")","\\ar","@","(","u",",","l",")","[","]","_","{","f","}","``","label_displacement","``","controls","how","far","the","arrow","label","is","from","the","ends","of","the","arrow",".","For","example",",","to","position","the","arrow","label","near","the","arrow","head",",","use","``",">","''",":",">",">",">","astr","=","ArrowStringDescription","(","...","unit=","''","mm","''",",","curving=","''","^","''",",","curving_amount=12",",","...","looping_start=None",",","looping_end=None",",","horizontal_direction=","''","d","''",",","...","vertical_direction=","''","r","''",",","label_position=","''","_","''",",","label=","''","f","''",")",">",">",">","astr.label_displacement","=","``",">","''",">",">",">","print","(","str","(","astr",")",")","\\ar","@","\/^12mm\/","[","dr","]","_",">","{","f","}","Finally",",","``","arrow_style","``","is","used","to","specify","the","arrow","style",".","To","get","a","dashed","arrow",",","for","example",",","use","``","{","--",">","}","''","as","arrow","style",":",">",">",">","astr","=","ArrowStringDescription","(","...","unit=","''","mm","''",",","curving=","''","^","''",",","curving_amount=12",",","...","looping_start=None",",","looping_end=None",",","horizontal_direction=","''","d","''",",","...","vertical_direction=","''","r","''",",","label_position=","''","_","''",",","label=","''","f","''",")",">",">",">","astr.arrow_style","=","``","{","--",">","}","''",">",">",">","print","(","str","(","astr",")",")","\\ar","@","\/^12mm\/","@","{","--",">","}","[","dr","]","_","{","f","}","Notes","=====","Instances","of",":","class",":","`","ArrowStringDescription","`","will","be","constructed","by",":","class",":","`","XypicDiagramDrawer","`","and","provided","for","further","use","in","formatters",".","The","user","is","not","expected","to","construct","instances","of",":","class",":","`","ArrowStringDescription","`","themselves",".","To","be","able","to","properly","utilise","this","class",",","the","reader","is","encouraged","to","checkout","the","Xy-pic","user","guide",",","available","at","[","Xypic","]",".","See","Also","========","XypicDiagramDrawer","References","==========","..","[","Xypic","]","https",":","\/\/xy-pic.sourceforge.net\/"]
code: def __init__(
      self,
      unit,
      curving,
      curving_amount,
      looping_start,
      looping_end,
      horizontal_direction,
      vertical_direction,
      label_position,
      label,
  ):
      self.unit = unit
      self.curving = curving
      self.curving_amount = curving_amount
      self.looping_start = looping_start
      self.looping_end = looping_end
      self.horizontal_direction = horizontal_direction
      self.vertical_direction = vertical_direction
      self.label_position = label_position
      self.label = label
  
      self.label_displacement = ""
      self.arrow_style = ""
  
      # This flag shows that the position of the label of this
      # morphism was set while typesetting a curved morphism and
      # should not be modified later.
      self.forced_label_position = False
  
imports: from sympy.categories import CompositeMorphism, IdentityMorphism, NamedMorphism, Diagram
  from sympy.core import Dict, Symbol, default_sort_key
  from sympy.printing.latex import latex
  from sympy.sets import FiniteSet
  from sympy.utilities.iterables import iterable
  from sympy.utilities.decorator import doctest_depends_on
  from itertools import chain
label_desc: Use image node_id 1 to create a new ArrowStringDescription object  with example: obj = ArrowStringDescription(unit, curving, curving_amount, looping_start, looping_end, horizontal_direction, vertical_direction, label_position, label)