class_docstr: A ``format`` property checker.
  
  JSON Schema does not mandate that the ``format`` property actually do any
  validation. If validation is desired however, instances of this class can
  be hooked into validators to enable format validation.
  
  `FormatChecker` objects always return ``True`` when asked about
  formats that they do not know how to validate.
  
  To check a custom format using a function that takes an instance and
  returns a ``bool``, use the `FormatChecker.checks` or
  `FormatChecker.cls_checks` decorators.
  
  Arguments:
  
      formats (~collections.Iterable):
  
          The known formats to validate. This argument can be used to
          limit which formats will be used during validation.
class_docstr_tok: ["A","``","format","``","property","checker",".","JSON","Schema","does","not","mandate","that","the","``","format","``","property","actually","do","any","validation",".","If","validation","is","desired","however",",","instances","of","this","class","can","be","hooked","into","validators","to","enable","format","validation",".","`","FormatChecker","`","objects","always","return","``","True","``","when","asked","about","formats","that","they","do","not","know","how","to","validate",".","To","check","a","custom","format","using","a","function","that","takes","an","instance","and","returns","a","``","bool","``",",","use","the","`","FormatChecker.checks","`","or","`","FormatChecker.cls_checks","`","decorators",".","Arguments",":","formats","(","~collections.Iterable",")",":","The","known","formats","to","validate",".","This","argument","can","be","used","to","limit","which","formats","will","be","used","during","validation","."]
docstr: Check whether the instance conforms to the given format.
  
  Arguments:
  
      instance (*any primitive type*, i.e. str, number, bool):
  
          The instance to check
  
      format (str):
  
          The format that instance should conform to
  
  
  Raises:
  
      FormatError: if the instance does not conform to ``format``
docstr_tok: ["Check","whether","the","instance","conforms","to","the","given","format",".","Arguments",":","instance","(","*","any","primitive","type","*",",","i.e",".","str",",","number",",","bool",")",":","The","instance","to","check","format","(","str",")",":","The","format","that","instance","should","conform","to","Raises",":","FormatError",":","if","the","instance","does","not","conform","to","``","format","``"]
code: def check(self, instance, format):
      """
      Check whether the instance conforms to the given format.
  
      Arguments:
  
          instance (*any primitive type*, i.e. str, number, bool):
  
              The instance to check
  
          format (str):
  
              The format that instance should conform to
  
  
      Raises:
  
          FormatError: if the instance does not conform to ``format``
      """
  
      if format not in self.checkers:
          return
  
      func, raises = self.checkers[format]
      result, cause = None, None
      try:
          result = func(instance)
      except raises as e:
          cause = e
      if not result:
          raise FormatError(
              "%r is not a %r" % (instance, format),
              cause=cause,
          )
  
file_path: catboost/contrib/python/jsonschema/py2/jsonschema/_format.py
imports: import datetime
  import re
  import socket
  import struct
  from jsonschema.compat import str_types
  from jsonschema.exceptions import FormatError
label_desc: Use image node_id 4 for calling the FormatChecker obj's underlying member method code with example usage: obj.check(instance, format) without return types