call_report.core.FileMetadataDiff#

class call_report.core.FileMetadataDiff(*, name_changed: bool, periods_changed: bool, file_schema_diff: FieldSchemaDiff)[source]#

Bases: object

The result of comparing two FileMetadata via FileMetadata.compare.

name and periods are compared directly. Field-level differences are delegated entirely to FieldSchema.compare (see file_schema_diff).

Attributes:
name_changedbool

Whether the two files have different name values.

periods_changedbool

Whether the two files have different publication periods.

file_schema_diffFieldSchemaDiff

The field-level differences, delegated to FieldSchema.compare.

Examples

>>> empty = FieldSchemaDiff(added=(), removed=(), changed=())
>>> diff = FileMetadataDiff(
...     name_changed=False, periods_changed=False, file_schema_diff=empty
... )
>>> diff.name_changed
False
property is_empty: bool[source]#

Return whether the two files being compared were identical.

A convenience for the common “did anything change” check, without inspecting name_changed/periods_changed/file_schema_diff individually.

Returns:
bool

True if name/periods matched and file_schema_diff is empty too.

Examples

>>> empty = FieldSchemaDiff(added=(), removed=(), changed=())
>>> FileMetadataDiff(
...     name_changed=False, periods_changed=False, file_schema_diff=empty
... ).is_empty
True
>>> FileMetadataDiff(
...     name_changed=True, periods_changed=False, file_schema_diff=empty
... ).is_empty
False