Codebase list gfapy / debian/1.2.1+dfsg-1 gfapy / symbol_invert.py
debian/1.2.1+dfsg-1

Tree @debian/1.2.1+dfsg-1 (Download .tar.gz)

symbol_invert.py @debian/1.2.1+dfsg-1raw · history · blame

import gfapy

def invert(symbol):
  """Computes the inverted orientation or end_type symbol.

  Parameters:
    symbol (str) : a one-character string, symbolizing an orientation (+ or -)
      or an end-type (L or R)

  Returns:
    str : the other one character string of the same category (e.g. - for +)

  Raises:
    gfapy.error.ValueError : if a string other than the mentioned ones is used
  """
  if symbol == "+":
    return "-"
  elif symbol == "-":
    return "+"
  elif symbol == "L":
    return "R"
  elif symbol == "R":
    return "L"
  else:
    raise gfapy.ValueError("No inverse defined for {}".format(symbol))