Skip to content

Commit

Permalink
Please flake8
Browse files Browse the repository at this point in the history
References bar-429

Signed-off-by: Giulio Calacoci <[email protected]>
  • Loading branch information
gcalacoci committed Oct 30, 2024
1 parent 53b00b0 commit 0949af7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
12 changes: 5 additions & 7 deletions barman/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, config, path):
# If custom_compression_magic is set then we should not assume
# unidentified files are custom compressed and should rely on the
# magic for identification instead.
elif type(config.custom_compression_magic) == str:
elif isinstance(config.custom_compression_magic, str):
# Since we know the custom compression magic we can now add it
# to the class property.
compression_registry["custom"].MAGIC = binascii.unhexlify(
Expand Down Expand Up @@ -419,14 +419,12 @@ def __init__(self, config, compression, path=None):
:param compression: str compression name
:param path: str|None
"""
if (
config.custom_compression_filter is None
or type(config.custom_compression_filter) != str
if config.custom_compression_filter is None or not isinstance(
config.custom_compression_filter, str
):
raise CompressionIncompatibility("custom_compression_filter")
if (
config.custom_decompression_filter is None
or type(config.custom_decompression_filter) != str
if config.custom_decompression_filter is None or not isinstance(
config.custom_decompression_filter, str
):
raise CompressionIncompatibility("custom_decompression_filter")

Expand Down
6 changes: 3 additions & 3 deletions tests/test_compressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,11 @@ def test_get_pg_basebackup_compression(
)
base_backup_compression = get_pg_basebackup_compression(server)

assert type(base_backup_compression) == expected_class
assert type(base_backup_compression) is expected_class
if base_backup_compression is not None:
assert type(base_backup_compression.options) == expected_option_class
assert type(base_backup_compression.options) is expected_option_class
assert (
type(base_backup_compression.compression) == expected_compression_class
type(base_backup_compression.compression) is expected_compression_class
)

def test_get_pg_basebackup_compression_not_supported(self):
Expand Down

0 comments on commit 0949af7

Please sign in to comment.