-
Notifications
You must be signed in to change notification settings - Fork 6
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
Created UserManager #46
Conversation
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.
нормас
src/unit/unit_wrapper.py
Outdated
|
||
|
||
UnitWrapper = UnitWrapper() | ||
BaseUnitWrapper = UnitWrapper() |
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.
а был смысл его переименовывать? думаю нет
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.
Такая штука была, что импортился класс UnitManager, а не его экземпляр. Поэтому переименовал
src/unit/UnitManager.py
Outdated
self.collection = "unitData" | ||
self.database = BaseMongoDbWrapper |
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.
лучше сделать как аттрибут класса
class UnitManager:
collection = "..."
wrapper = "..."
src/unit/UnitManager.py
Outdated
@lru_cache(maxsize=4) | ||
def _get_cur_unit(self) -> Unit: |
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.
я уверен что эта штука мега жидко обосрется, если и делать кеш - то его надо как-то инвалидировать когда юнит снимается с воркбенча например, а тут этого нет
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.
вообще можно поиграться и сделать просто current_unit как property, будет ярко
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.
Кстати, я читал, что запросы в монгу по дефолту кешируются. Что скажешь по этому поводу?
src/unit/UnitManager.py
Outdated
translation("Component") | ||
+ " " | ||
+ component.model_name | ||
+ " " | ||
+ translation("NotPartOfUnit") | ||
+ " " | ||
+ self.model_name |
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.
раз уж переделываем сделай тут через f-strings пожалуйста)))
хотя в этом случае хорошо будет смотреться .format()
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.
- ок
src/unit/UnitManager.py
Outdated
) | ||
metrics.register_complete_unit(None, self) | ||
|
||
self.employee = None |
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.
почему-то в конце нигде нет пустых строк) а они должны быть в конце любого .py файла, гитхаб не просто так этот значок ставит
…aemon into ref/unit-mongo
No description provided.