parameters: (unicode_dir=_UNICODE_DIR)
return_statement: return categories
docstring: Returns dict mapping category names to code lists.
  
    Args:
      unicode_dir: Unicode data directory
  
    Returns:
      dict mapping category names to code lists
docstring_summary: Returns dict mapping category names to code lists.
docstring_tokens: Returns dict mapping category names to code lists .
function: def Categories(unicode_dir=_UNICODE_DIR):
    """Returns dict mapping category names to code lists.
  
    Args:
      unicode_dir: Unicode data directory
  
    Returns:
      dict mapping category names to code lists
    """
  
    categories = {}
  
    def DoLine(codes, fields):
      """Process single UnicodeData.txt line, updating categories."""
      category = fields[2]
      categories.setdefault(category, []).extend(codes)
      # Add codes from Lu into L, etc.
      if len(category) > 1:
        short = category[0]
        categories.setdefault(short, []).extend(codes)
  
    ReadUnicodeTable(unicode_dir+"/UnicodeData.txt", 15, DoLine)
    return categories
function_tokens: def Categories ( unicode_dir = _UNICODE_DIR ) : categories = { } def DoLine ( codes , fields ) : """Process single UnicodeData.txt line, updating categories.""" category = fields [ 2 ] categories . setdefault ( category , [ ] ) . extend ( codes ) # Add codes from Lu into L, etc. if len ( category ) > 1 : short = category [ 0 ] categories . setdefault ( short , [ ] ) . extend ( codes ) ReadUnicodeTable ( unicode_dir + "/UnicodeData.txt" , 15 , DoLine ) return categories