Add linters.

This commit is contained in:
Jakub Gocławski 2024-05-28 15:35:00 +02:00
commit e1a2eabc08
No known key found for this signature in database
GPG key ID: DB23479BBC13E2A3
22 changed files with 82 additions and 54 deletions

View file

@ -3,7 +3,6 @@ import re
from routeros_api import exceptions
from routeros_api import query
response_re = re.compile(rb'^!(re|trap|fatal|done)$')
attribute_re = re.compile(rb'^=([^=]+)=(.*)$', re.DOTALL)
tag_re = re.compile(rb'^\.tag=(.*)$')
@ -26,7 +25,6 @@ class ResponseSentence(object):
sentence)
return response
def parse_attributes(self, serialized_attributes):
for serialized in serialized_attributes:
attribute_match = attribute_re.match(serialized)
@ -57,8 +55,8 @@ class CommandSentence(object):
formated = [self.path + self.command]
for key, value in self.attributes.items():
formated.append(b'=' + key + b'=' + value)
for query in self.queries:
formated.extend(query.get_api_format())
for _query in self.queries:
formated.extend(_query.get_api_format())
if self.tag is not None:
formated.append(b'.tag=' + self.tag)
return formated