Skip to content

Commit

Permalink
QA fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Apr 22, 2022
1 parent 0f034b0 commit 3e8c41e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions fastybird_devices_module/entities/device.py
Expand Up @@ -957,8 +957,8 @@ def content( # pylint: disable=too-many-branches
elif self.identifier == DeviceAttributeName.HARDWARE_MAC_ADDRESS.value:
if (
content is not None
and len(re.findall("^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", content)) == 0
and len(re.findall("^([0-9A-Fa-f]{12})$", content)) == 0
and len(re.findall("^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", str(content))) == 0
and len(re.findall("^([0-9A-Fa-f]{12})$", str(content))) == 0
):
raise InvalidArgumentException("Provided mac address is not in valid format")

Expand Down
4 changes: 2 additions & 2 deletions src/Entities/Devices/Attributes/Attribute.php
Expand Up @@ -215,8 +215,8 @@ public function setContent($content): void
} elseif ($this->getIdentifier() === MetadataTypes\DeviceAttributeNameType::ATTRIBUTE_HARDWARE_MAC_ADDRESS) {
if (
$content !== null
&& preg_match('/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/', $content) === 0
&& preg_match('/^([0-9A-Fa-f]{12})$/', $content) === 0
&& preg_match('/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/', (string) $content) === 0
&& preg_match('/^([0-9A-Fa-f]{12})$/', (string) $content) === 0
) {
throw new Exceptions\InvalidArgumentException('Provided mac address is not in valid format.');
}
Expand Down

0 comments on commit 3e8c41e

Please sign in to comment.