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: Add codes to object
  
  Parameters
  ----------
  code_syn_seqs : sequence
      sequence of sequences, where each sequence ``S = code_syn_seqs[n]``
      for n in 0..len(code_syn_seqs), is a sequence giving values in the
      same order as ``self.fields``.  Each S should be at least of the
      same length as ``self.fields``.  After this call, if ``self.fields
      == ['field1', 'field2'], then ``self.field1[S[n]] == S[0]`` for all
      n in 0..len(S) and ``self.field2[S[n]] == S[1]`` for all n in
      0..len(S).
  
  Examples
  --------
  >>> code_syn_seqs = ((2, 'two'), (1, 'one'))
  >>> rc = Recoder(code_syn_seqs)
  >>> rc.value_set() == set((1,2))
  True
  >>> rc.add_codes(((3, 'three'), (1, 'first')))
  >>> rc.value_set() == set((1,2,3))
  True
  >>> print(rc.value_set())  # set is actually ordered
  OrderedSet([2, 1, 3])
docstr_tok: ["Add","codes","to","object","Parameters","--","--","--","--","--","code_syn_seqs",":","sequence","sequence","of","sequences",",","where","each","sequence","``","S","=","code_syn_seqs","[","n","]","``","for","n","in","0","..","len","(","code_syn_seqs",")",",","is","a","sequence","giving","values","in","the","same","order","as","``","self.fields","``",".","Each","S","should","be","at","least","of","the","same","length","as","``","self.fields","``",".","After","this","call",",","if","``","self.fields","==","[","'field1","'",",","'field2","'","]",",","then","``","self.field1","[","S","[","n","]","]","==","S","[","0","]","``","for","all","n","in","0","..","len","(","S",")","and","``","self.field2","[","S","[","n","]","]","==","S","[","1","]","``","for","all","n","in","0","..","len","(","S",")",".","Examples","--","--","--","--",">",">",">","code_syn_seqs","=","(","(","2",",","'two","'",")",",","(","1",",","'one","'",")",")",">",">",">","rc","=","Recoder","(","code_syn_seqs",")",">",">",">","rc.value_set","(",")","==","set","(","(","1,2",")",")","True",">",">",">","rc.add_codes","(","(","(","3",",","'three","'",")",",","(","1",",","'first","'",")",")",")",">",">",">","rc.value_set","(",")","==","set","(","(","1,2,3",")",")","True",">",">",">","print","(","rc.value_set","(",")",")","#","set","is","actually","ordered","OrderedSet","(","[","2",",","1",",","3","]",")"]
code: def add_codes(
      self, code_syn_seqs: ty.Sequence[ty.Sequence[ty.Hashable]]
  ) -> None:
      """Add codes to object
  
      Parameters
      ----------
      code_syn_seqs : sequence
          sequence of sequences, where each sequence ``S = code_syn_seqs[n]``
          for n in 0..len(code_syn_seqs), is a sequence giving values in the
          same order as ``self.fields``.  Each S should be at least of the
          same length as ``self.fields``.  After this call, if ``self.fields
          == ['field1', 'field2'], then ``self.field1[S[n]] == S[0]`` for all
          n in 0..len(S) and ``self.field2[S[n]] == S[1]`` for all n in
          0..len(S).
  
      Examples
      --------
      >>> code_syn_seqs = ((2, 'two'), (1, 'one'))
      >>> rc = Recoder(code_syn_seqs)
      >>> rc.value_set() == set((1,2))
      True
      >>> rc.add_codes(((3, 'three'), (1, 'first')))
      >>> rc.value_set() == set((1,2,3))
      True
      >>> print(rc.value_set())  # set is actually ordered
      OrderedSet([2, 1, 3])
      """
      for code_syns in code_syn_seqs:
          # Add all the aliases
          for alias in code_syns:
              # For all defined fields, make every value in the sequence be
              # an entry to return matching index value.
              for field_ind, field_name in enumerate(self.fields):
                  self.__dict__[field_name][alias] = code_syns[
                      field_ind
                  ]
  
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 3 for calling the Recoder obj's underlying member method code with example usage: obj.add_codes(code_syn_seqs) without return types