class_docstr: Record validators are a generic mechanism for checking the DHT records including:
    - Enforcing a data schema (e.g. checking content types)
    - Enforcing security requirements (e.g. allowing only the owner to update the record)
class_docstr_tok: ["Record","validators","are","a","generic","mechanism","for","checking","the","DHT","records","including",":","-","Enforcing","a","data","schema","(","e.g",".","checking","content","types",")","-","Enforcing","security","requirements","(","e.g",".","allowing","only","the","owner","to","update","the","record",")"]
docstr: By default, all validators are applied sequentially (i.e. we require all validate() calls
  to return True for a record to be validated successfully).
  
  However, you may want to define another policy for combining your validator classes
  (e.g. for schema validators, we want to require only one validate() call to return True
  because each validator bears a part of the schema).
  
  This can be achieved with overriding merge_with(). It should:
  
    - Return True if it has successfully merged the `other` validator to `self`,
      so that `self` became a validator that combines the old `self` and `other` using
      the necessary policy. In this case, `other` should remain unchanged.
  
    - Return False if the merging has not happened. In this case, both `self` and `other`
      should remain unchanged. The DHT will try merging `other` to another validator or
      add it as a separate validator (to be applied sequentially).
docstr_tok: ["By","default",",","all","validators","are","applied","sequentially","(","i.e",".","we","require","all","validate","(",")","calls","to","return","True","for","a","record","to","be","validated","successfully",")",".","However",",","you","may","want","to","define","another","policy","for","combining","your","validator","classes","(","e.g",".","for","schema","validators",",","we","want","to","require","only","one","validate","(",")","call","to","return","True","because","each","validator","bears","a","part","of","the","schema",")",".","This","can","be","achieved","with","overriding","merge_with","(",")",".","It","should",":","-","Return","True","if","it","has","successfully","merged","the","`","other","`","validator","to","`","self","`",",","so","that","`","self","`","became","a","validator","that","combines","the","old","`","self","`","and","`","other","`","using","the","necessary","policy",".","In","this","case",",","`","other","`","should","remain","unchanged",".","-","Return","False","if","the","merging","has","not","happened",".","In","this","case",",","both","`","self","`","and","`","other","`","should","remain","unchanged",".","The","DHT","will","try","merging","`","other","`","to","another","validator","or","add","it","as","a","separate","validator","(","to","be","applied","sequentially",")","."]
code: def merge_with(self, other: "RecordValidatorBase") -> bool:
      """
      By default, all validators are applied sequentially (i.e. we require all validate() calls
      to return True for a record to be validated successfully).
  
      However, you may want to define another policy for combining your validator classes
      (e.g. for schema validators, we want to require only one validate() call to return True
      because each validator bears a part of the schema).
  
      This can be achieved with overriding merge_with(). It should:
  
        - Return True if it has successfully merged the `other` validator to `self`,
          so that `self` became a validator that combines the old `self` and `other` using
          the necessary policy. In this case, `other` should remain unchanged.
  
        - Return False if the merging has not happened. In this case, both `self` and `other`
          should remain unchanged. The DHT will try merging `other` to another validator or
          add it as a separate validator (to be applied sequentially).
      """
  
      return False
  
file_path: hivemind/hivemind/dht/validation.py
imports: import dataclasses
  from abc import ABC, abstractmethod
  from typing import Iterable
label_desc: Use image node_id 5 for calling the RecordValidatorBase obj's underlying member method code with example usage: obj.merge_with(other) and returns: False