class_docstr: class to return canonical code(s) from code or aliases
  
  The concept is a lot easier to read in the implementation and
  tests than it is to explain, so...
  
  >>> # If you have some codes, and several aliases, like this:
  >>> code1 = 1; aliases1=['one', 'first']
  >>> code2 = 2; aliases2=['two', 'second']
  >>> # You might want to do this:
  >>> codes = [[code1]+aliases1,[code2]+aliases2]
  >>> recodes = Recoder(codes)
  >>> recodes.code['one']
  1
  >>> recodes.code['second']
  2
  >>> recodes.code[2]
  2
  >>> # Or maybe you have a code, a label and some aliases
  >>> codes=((1,'label1','one', 'first'),(2,'label2','two'))
  >>> # you might want to get back the code or the label
  >>> recodes = Recoder(codes, fields=('code','label'))
  >>> recodes.code['first']
  1
  >>> recodes.code['label1']
  1
  >>> recodes.label[2]
  'label2'
  >>> # For convenience, you can get the first entered name by
  >>> # indexing the object directly
  >>> recodes[2]
  2
class_docstr_tok: ["class","to","return","canonical","code","(","s",")","from","code","or","aliases","The","concept","is","a","lot","easier","to","read","in","the","implementation","and","tests","than","it","is","to","explain",",","so","...",">",">",">","#","If","you","have","some","codes",",","and","several","aliases",",","like","this",":",">",">",">","code1","=","1",";","aliases1=","[","'one","'",",","'first","'","]",">",">",">","code2","=","2",";","aliases2=","[","'two","'",",","'second","'","]",">",">",">","#","You","might","want","to","do","this",":",">",">",">","codes","=","[","[","code1","]","+aliases1",",","[","code2","]","+aliases2","]",">",">",">","recodes","=","Recoder","(","codes",")",">",">",">","recodes.code","[","'one","'","]","1",">",">",">","recodes.code","[","'second","'","]","2",">",">",">","recodes.code","[","2","]","2",">",">",">","#","Or","maybe","you","have","a","code",",","a","label","and","some","aliases",">",">",">","codes=","(","(","1",",","'label1","'",",","'one","'",",","'first","'",")",",","(","2",",","'label2","'",",","'two","'",")",")",">",">",">","#","you","might","want","to","get","back","the","code","or","the","label",">",">",">","recodes","=","Recoder","(","codes",",","fields=","(","'code","'",",","'label","'",")",")",">",">",">","recodes.code","[","'first","'","]","1",">",">",">","recodes.code","[","'label1","'","]","1",">",">",">","recodes.label","[","2","]","'label2'",">",">",">","#","For","convenience",",","you","can","get","the","first","entered","name","by",">",">",">","#","indexing","the","object","directly",">",">",">","recodes","[","2","]","2"]
docstr: Create recoder object
  
  ``codes`` give a sequence of code, alias sequences
  ``fields`` are names by which the entries in these sequences can be
  accessed.
  
  By default ``fields`` gives the first column the name
  "code".  The first column is the vector of first entries
  in each of the sequences found in ``codes``.  Thence you can
  get the equivalent first column value with ob.code[value],
  where value can be a first column value, or a value in any of
  the other columns in that sequence.
  
  You can give other columns names too, and access them in the
  same way - see the examples in the class docstring.
  
  Parameters
  ----------
  codes : sequence of sequences
      Each sequence defines values (codes) that are equivalent
  fields : {('code',) string sequence}, optional
      names by which elements in sequences can be accessed
  map_maker: callable, optional
      constructor for dict-like objects used to store key value pairs.
      Default is ``dict``.  ``map_maker()`` generates an empty mapping.
      The mapping need only implement ``__getitem__, __setitem__, keys,
      values``.
docstr_tok: ["Create","recoder","object","``","codes","``","give","a","sequence","of","code",",","alias","sequences","``","fields","``","are","names","by","which","the","entries","in","these","sequences","can","be","accessed",".","By","default","``","fields","``","gives","the","first","column","the","name","''","code","''",".","The","first","column","is","the","vector","of","first","entries","in","each","of","the","sequences","found","in","``","codes","``",".","Thence","you","can","get","the","equivalent","first","column","value","with","ob.code","[","value","]",",","where","value","can","be","a","first","column","value",",","or","a","value","in","any","of","the","other","columns","in","that","sequence",".","You","can","give","other","columns","names","too",",","and","access","them","in","the","same","way","-","see","the","examples","in","the","class","docstring",".","Parameters","--","--","--","--","--","codes",":","sequence","of","sequences","Each","sequence","defines","values","(","codes",")","that","are","equivalent","fields",":","{","(","'code","'",",",")","string","sequence","}",",","optional","names","by","which","elements","in","sequences","can","be","accessed","map_maker",":","callable",",","optional","constructor","for","dict-like","objects","used","to","store","key","value","pairs",".","Default","is","``","dict","``",".","``","map_maker","(",")","``","generates","an","empty","mapping",".","The","mapping","need","only","implement","``","__getitem__",",","__setitem__",",","keys",",","values","``","."]
code: def __init__(
      self,
      codes: ty.Sequence[ty.Sequence[ty.Hashable]],
      fields: ty.Sequence[str] = ("code",),
      map_maker: type[ty.Mapping[ty.Hashable, ty.Hashable]] = dict,
  ):
      """Create recoder object
  
      ``codes`` give a sequence of code, alias sequences
      ``fields`` are names by which the entries in these sequences can be
      accessed.
  
      By default ``fields`` gives the first column the name
      "code".  The first column is the vector of first entries
      in each of the sequences found in ``codes``.  Thence you can
      get the equivalent first column value with ob.code[value],
      where value can be a first column value, or a value in any of
      the other columns in that sequence.
  
      You can give other columns names too, and access them in the
      same way - see the examples in the class docstring.
  
      Parameters
      ----------
      codes : sequence of sequences
          Each sequence defines values (codes) that are equivalent
      fields : {('code',) string sequence}, optional
          names by which elements in sequences can be accessed
      map_maker: callable, optional
          constructor for dict-like objects used to store key value pairs.
          Default is ``dict``.  ``map_maker()`` generates an empty mapping.
          The mapping need only implement ``__getitem__, __setitem__, keys,
          values``.
      """
      self.fields = tuple(fields)
      self.field1 = {}  # a placeholder for the check below
      for name in fields:
          if name in self.__dict__:
              raise KeyError(
                  f"Input name {name} already in object dict"
              )
          self.__dict__[name] = map_maker()
      self.field1 = self.__dict__[fields[0]]
      self.add_codes(codes)
  
imports: from __future__ import annotations
  import io
  import sys
  import typing
  import warnings
  from functools import reduce
  from operator import getitem, mul
  from os.path import exists, splitext
  import numpy
  from ._compression import COMPRESSED_FILE_LIKES
  from .casting import OK_FLOATS, shared_range
  from .externals.oset import OrderedSet
label_desc: Use image node_id 1 to create a new Recoder object  with example: obj = Recoder(codes, fields, map_maker)