def _GetSignatureScanner(cls, specification_store):
    """Initializes a signature scanner based on a specification store.

    Args:
      specification_store (FormatSpecificationStore): specification store.

    Returns:
      pysigscan.scanner: signature scanner.
    """
    signature_scanner = pysigscan.scanner()
    signature_scanner.set_scan_buffer_size(cls._SCAN_BUFFER_SIZE)

    for format_specification in specification_store.specifications:
      for signature in format_specification.signatures:
        pattern_offset = signature.offset

        if pattern_offset is None:
          signature_flags = pysigscan.signature_flags.NO_OFFSET
        elif pattern_offset < 0:
          pattern_offset *= -1
          signature_flags = pysigscan.signature_flags.RELATIVE_FROM_END
        else:
          signature_flags = pysigscan.signature_flags.RELATIVE_FROM_START

        signature_scanner.add_signature(
            signature.identifier, pattern_offset, signature.pattern,
            signature_flags)

    return signature_scanner
def _GetSignatureScanner ( cls , specification_store ) : signature_scanner = pysigscan . scanner ( ) signature_scanner . set_scan_buffer_size ( cls . _SCAN_BUFFER_SIZE ) for format_specification in specification_store . specifications : for signature in format_specification . signatures : pattern_offset = signature . offset if pattern_offset is None : signature_flags = pysigscan . signature_flags . NO_OFFSET elif pattern_offset < 0 : pattern_offset *= - 1 signature_flags = pysigscan . signature_flags . RELATIVE_FROM_END else : signature_flags = pysigscan . signature_flags . RELATIVE_FROM_START signature_scanner . add_signature ( signature . identifier , pattern_offset , signature . pattern , signature_flags ) return signature_scanner
Initializes a signature scanner based on a specification store.

    Args:
      specification_store (FormatSpecificationStore): specification store.

    Returns:
      pysigscan.scanner: signature scanner.