__init__ constructor

init

Initializes a new instance of the RedactorSettings class.

def __init__(self):
    ...

init

Initializes a new RedactorSettings instance with the specified logger.

def __init__(self, logger):
    ...
Parameter Type Description
logger ILogger An instance of a class implementing the ILogger interface.

Example

from groupdocs.redaction.options import RedactorSettings

class Log:
    def __init__(self):
        self.errors, self.traces = [], []

    def error(self, message):
        self.errors.append(message)

    def warning(self, message):
        pass

    def trace(self, message):
        self.traces.append(message)

log = Log()
settings = RedactorSettings(logger=log)

init

Initializes a new RedactorSettings instance with a given IRedactionCallback implementation.

def __init__(self, callback):
    ...
Parameter Type Description
callback IRedactionCallback An instance of a class implementing the IRedactionCallback interface.

Example

from groupdocs.redaction.options import RedactorSettings

def accept_first_only(description):
    # Accept only the first redaction change
    return True

# Create settings with a callback function
settings = RedactorSettings(callback=accept_first_only)

init

Initializes a new RedactorSettings instance with the specified IOcrConnector.

def __init__(self, ocr_connector):
    ...
Parameter Type Description
ocr_connector IOcrConnector A valid implementation of the IOcrConnector interface.

init

Initializes a new instance of the RedactorSettings class with given ILogger and IRedactionCallback instances.

def __init__(self, logger, callback):
    ...
Parameter Type Description
logger ILogger An instance of a class implementing the ILogger interface.
callback IRedactionCallback An instance of a class implementing the IRedactionCallback interface.

init

Initializes a new RedactorSettings instance with optional logger, callback, and OCR connector.

The logger argument should be an object implementing the ILogger interface.
The callback argument should be an object implementing the IRedactionCallback interface.
The ocr_connector argument should implement IOcrConnector; it may be None when OCR integration is not required.

def __init__(self, logger, callback, ocr_connector):
    ...
Parameter Type Description
logger ILogger An instance of a class implementing the ILogger interface.
callback IRedactionCallback An instance of a class implementing the IRedactionCallback interface.
ocr_connector IOcrConnector An instance of an IOcrConnector implementation, or None.

Example

from groupdocs.redaction.options import RedactorSettings

class Log:
    def error(self, message): pass
    def warning(self, message): pass
    def trace(self, message): pass

def accept_first_only(description):
    # Accept only the first redaction change
    return len(description.original_text) > 0

# Create settings with a logger, a callback function, and no OCR connector
settings = RedactorSettings(logger=Log(), callback=accept_first_only, ocr_connector=None)

See Also