Skip to content
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

feature/form-filling-scenario-params-masking: #154

Conversation

Mikhail-Gl96
Copy link
Contributor

  • add masking for logging data_extracted_str

- add masking for logging data_extracted_str
@lru_cache
def _get_common_masking_fields(user) -> list:
"""Get global masking fields from user settings from file with name template_settings."""
return user.settings['template_settings'].get('masking_fields', []) if user is not None else []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

двойные кавычки пожалуйста

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -174,14 +176,25 @@ async def get_reply(self, user, text_preprocessing_result, reply_actions, field,
user.last_scenarios.delete(self.id)
return action_messages

@staticmethod
@lru_cache
def _get_common_masking_fields(user) -> list:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return type - словарь
masking_fields в template_config словарь

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@lru_cache
def _get_common_masking_fields(user) -> list:
"""Get global masking fields from user settings from file with name template_settings."""
return user.settings['template_settings'].get('masking_fields', []) if user is not None else []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

дефолтное значение - словарь

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

def _get_masked_params(self, data: dict, user) -> dict:
"""Masking data by global masking fields."""
masking_fields = self._get_common_masking_fields(user)
return masking(data=deepcopy(data), masking_fields=masking_fields)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

masking не меняет передаваемый объект, поэтому deepcopy не нужен

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@DimaProskurin DimaProskurin merged commit 3823c8f into salute-developers:main Oct 26, 2023
6 checks passed
DimaProskurin pushed a commit that referenced this pull request Nov 8, 2023
* feature/form-filling-scenario-params-masking:
- add masking for logging data_extracted_str

* feature/form-filling-scenario-params-masking:
- review fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants