Messages

pytidyhtml5.Message(Document document)

Instances that get passed to pytidyhtml5.Document.message_callback.

Getters

Message.document

The assigned document.

Message.default

Get the message with the format string already completed, in Tidy’s default localization.

Returns

  • str – Default message string.

  • None – The message expired, i.e. the callback was already left.

Message.message

Get the message with the format string already completed, in Tidy’s current localization.

Returns

  • str – Default message string.

  • None – The message expired, i.e. the callback was already left.

Message.format_default

Get the default format string, which is the format string for the message in Tidy’s default localization (en_us).

Returns

  • str – Default format string

  • None – The message expired, i.e. the callback was already left.

Message.format

Get the localized format string. If a localized version of the format string doesn’t exist, then the default version will be returned.

Returns

  • str – Default localized string

  • None – The message expired, i.e. the callback was already left.

Message.pos_default

Get the position part part of the message in the default language.

Returns

  • str – position part

  • None – The message expired, i.e. the callback was already left.

Message.pos

Get the position part part of the message in the current language.

Returns

  • str – position part

  • None – The message expired, i.e. the callback was already left.

Message.prefix_default

Get the prefix part of a message in the default localization.

Returns

  • str – prefix part

  • None – The message expired, i.e. the callback was already left.

Message.prefix

Get the prefix part of a message in the current language.

Returns

  • str – prefix part

  • None – The message expired, i.e. the callback was already left.

Message.output_default

Get the complete message as Tidy would emit it in the default language.

Returns

  • str – complete message

  • None – The message expired, i.e. the callback was already left.

Message.output

Get the complete message as Tidy would emit it in the current localization.

Returns

  • str – complete message

  • None – The message expired, i.e. the callback was already left.

Message.code

Get the message code.

This method is not useful. :-)

Returns

  • int – Message code

  • None – The message expired, i.e. the callback was already left.

Message.key

Get the message key string.

Returns

  • str – Message key

  • None – The message expired, i.e. the callback was already left.

Message.position

Get the line number and column the message applies to.

Returns

  • tuple[int, int] – Line number and column

  • None – The message expired, i.e. the callback was already left.

Message.is_muted

Get the muted status of the message, that is, whether or not the current configuration indicated that this message should be muted.

Returns

  • bool – True if muted

  • None – The message expired, i.e. the callback was already left.

Message.level

Get the TidyReportLevel of the message.

Returns

Iterators

Message.iter_args(self)

An iterator yielding pytidyhtml5.MessageArg objects.

Yields

pytidyhtml5.MessageArg – Arguments for the current message.

Message.iter_values(self)

An iterator yielding argument values.

Funtionally equivalent to:

for arg in self.iter_args():
    yield arg.value
Yields

int|str|float – Argument value

Miscellaneous

Message.__bool__()

A Message is only valid in its callback. After the callback returns, no values can be queried anymore.

Getters as methods

All getters exist as methods, too:

pytidyhtml5.Message.get_document(self)

The assigned document.

pytidyhtml5.Message.get_default(self)

Get the message with the format string already completed, in Tidy’s default localization.

pytidyhtml5.Message.get_message(self)

Get the message with the format string already completed, in Tidy’s current localization.

pytidyhtml5.Message.get_format_default(self)

Get the default format string, which is the format string for the message in Tidy’s default localization (en_us).

pytidyhtml5.Message.get_format(self)

Get the localized format string.

pytidyhtml5.Message.get_pos_default(self)

Get the position part part of the message in the default language.

pytidyhtml5.Message.get_pos(self)

Get the position part part of the message in the current language.

pytidyhtml5.Message.get_prefix_default(self)

Get the prefix part of a message in the default localization.

pytidyhtml5.Message.get_prefix(self)

Get the prefix part of a message in the current language.

pytidyhtml5.Message.get_output_default(self)

Get the complete message as Tidy would emit it in the default language.

pytidyhtml5.Message.get_output(self)

Get the complete message as Tidy would emit it in the current localization.

pytidyhtml5.Message.get_code(self)

Get the message code.

pytidyhtml5.Message.get_key(self)

Get the message key string.

pytidyhtml5.Message.get_position(self)

Get the line number and column the message applies to.

pytidyhtml5.Message.get_is_muted(self)

Get the muted status of the message, that is, whether or not the current configuration indicated that this message should be muted.

pytidyhtml5.Message.get_level(self)

Get the TidyReportLevel of the message.