Top

filetype.match module

# -*- coding: utf-8 -*-

from types import types
from utils import get_bytes


def match(obj):
    """
    Performs bytes matching comparison agains the
    available type matchers.

    :param buf list
    :rtype bool
    """
    buf = get_bytes(obj)

    for matcher in types:
        if matcher.match(buf):
            return matcher

    return None

Module variables

var types

Functions

def match(

obj)

Performs bytes matching comparison agains the available type matchers.

:param buf list :rtype bool

def match(obj):
    """
    Performs bytes matching comparison agains the
    available type matchers.

    :param buf list
    :rtype bool
    """
    buf = get_bytes(obj)

    for matcher in types:
        if matcher.match(buf):
            return matcher

    return None