-
Notifications
You must be signed in to change notification settings - Fork 23
Include dependencies and let some code more readable #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,18 +51,14 @@ def __str__(self): | |
| type(self).__name__, self.name, self.provider, self.handler) | ||
|
|
||
| def apply_message_translator(self, message): | ||
| processed_message = {'content': message, | ||
| 'metadata': {}} | ||
| if not self.message_translator: | ||
| return processed_message | ||
| return {'content': message, 'metadata': {}} | ||
|
|
||
| translated = self.message_translator.translate(processed_message['content']) | ||
| processed_message['metadata'].update(translated.get('metadata', {})) | ||
| processed_message['content'] = translated['content'] | ||
| if not processed_message['content']: | ||
| translated = self.message_translator.translate(message) | ||
| if not translated['content']: | ||
| raise ValueError('{} failed to translate message={}'.format(self.message_translator, message)) | ||
|
|
||
| return processed_message | ||
| return translated | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might override metadata values if we apply the translator several times. I'll check and then we can improve this on the side. |
||
|
|
||
| async def deliver(self, raw_message): | ||
| message = self.apply_message_translator(raw_message) | ||
|
|
@@ -72,7 +68,7 @@ async def deliver(self, raw_message): | |
| async def error_handler(self, exc_info, message): | ||
| logger.info('error handler process originated by message={}'.format(message)) | ||
|
|
||
| if self._error_handler is not None: | ||
| if self._error_handler: | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one as well. |
||
| return await run_in_loop_or_executor(self._error_handler, exc_info, message) | ||
|
|
||
| return False | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ pytest | |
| pytest-asyncio | ||
| pytest-cov | ||
| pytest-deadfixtures | ||
| pytest-runner | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you give me more context about this?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's required on The IDE show an warnning
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's your IDE, I could not find anything in regular environments or circleci. Please revert this change. |
||
| codecov | ||
| asynctest | ||
| pre-commit | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any problem with readability here.