Skip to content

Commit

Permalink
small documentation and typing additions
Browse files Browse the repository at this point in the history
  • Loading branch information
wagner-intevation committed Apr 28, 2023
1 parent 46a9b7a commit b462836
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/user/bots.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,7 @@ RemoveAffix
**Configuration Parameters**
* `remove_prefix`: True - cut from start, False - cut from end
* `remove_prefix`: True - cut from start, False - cut from end. Default: True
* `affix`: example 'www.'
* `field`: example field 'source.fqdn'
Expand Down
5 changes: 3 additions & 2 deletions intelmq/lib/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import warnings
from collections import defaultdict
from datetime import datetime, timedelta
from typing import Any, List, Optional, Union
from typing import Any, List, Optional, Union, Tuple

import intelmq.lib.message as libmessage
from intelmq import (DEFAULT_LOGGING_PATH,
Expand Down Expand Up @@ -563,7 +563,7 @@ def __print_log_buffer(self):
print(level.upper(), '-', message)
self.__log_buffer = []

def __check_bot_id(self, name: str):
def __check_bot_id(self, name: str) -> Tuple[str, str, str]:
res = re.fullmatch(r'([0-9a-zA-Z\-]+)(\.[0-9]+)?', name)
if res:
if not (res.group(2) and threading.current_thread() == threading.main_thread()):
Expand All @@ -572,6 +572,7 @@ def __check_bot_id(self, name: str):
"Invalid bot id, must match '"
r"[^0-9a-zA-Z\-]+'."))
self.stop()
return False, False, False

def __connect_pipelines(self):
pipeline_args = {key: getattr(self, key) for key in dir(self) if not inspect.ismethod(getattr(self, key)) and (key.startswith('source_pipeline_') or key.startswith('destination_pipeline'))}
Expand Down

0 comments on commit b462836

Please sign in to comment.