-
Notifications
You must be signed in to change notification settings - Fork 3
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
[Halpy-111] Case Management Commands & Notes #336
Conversation
Also includes logic to announce IRCN if different, catch more invalid IRCNs, and begin automatic processing of notes.
What was I thinking, we don't need this...
Also adds a CaseType enum, included by default on new cases. Removes the Debug board stuff, since we can recreate most of this functionality now.
Signed-off-by: David Sangrey <rixxan@hullseals.space>
halpybot/commands/caseutils.py
Outdated
filtered_cases = [ | ||
case | ||
for case in caseboard.values() | ||
if (not list_filter) | ||
or ( | ||
list_filter | ||
in ( | ||
case.platform.name.casefold().replace("_horizons", ""), | ||
case.case_type.name.casefold(), | ||
) | ||
) | ||
] |
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.
The cognitive complexity of this expression is very high. consider refactoring.
halpybot/commands/caseutils.py
Outdated
else: | ||
list_filter = None | ||
|
||
filtered_cases = [ |
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.
[optimization] replace the list comprehension with a series of generator expressions.
This will allow you to reduce the cognitive complexity and increase expressiveness.
It also turns your current 2 * O(n) into an O(n)
Co-authored-by: Joshua Salzedo <thHunkn0WNd@gmail.com> Signed-off-by: David Sangrey <davidsangrey@gmail.com>
Co-authored-by: Joshua Salzedo <thHunkn0WNd@gmail.com> Signed-off-by: David Sangrey <davidsangrey@gmail.com>
Co-authored-by: Joshua Salzedo <thHunkn0WNd@gmail.com> Signed-off-by: David Sangrey <davidsangrey@gmail.com>
cdee7e9
to
d79b154
Compare
401d61c
to
5502e13
Compare
"""Utilities for Wrapping EDSM Commands""" | ||
|
||
@staticmethod | ||
def gather_case(len_args_expected: int): |
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.
this len_args_expected
thing feels bugprone, I am not convinced it should even be a thing.
Co-Authored-By: Joshua Salzedo <joshuasalzedo@gmail.com>
Relies upon #334
Key Features:
Also includes:
Future Enhancements to be Investigated:
Closes #327, #111