ldap-sync: fix data_yaml lint and mypy errors

MR48 ("Ensure group member lists are flattened") introduced two CI gate failures on main:

  • ruff E501: the explanatory comment above the new _flatten_string_list call is 108 chars (> 100)
  • mypy invariance error: narrowing item to list[str] and passing it to a list[str | list[str]] parameter fails because list is invariant in T

Wrap the comment to fit.

Also replace the parameter type with a recursive alias NestedStrList = list[str | NestedStrList] so the isinstance-narrowed branch can recurse without a variance violation

NOTE: We could fix this with just flattening one level of list. However, that ends up being more lines of code, so I think this approach is slightly better. The main downside is recursion is a bit confusing, but OTOH it does match the shape of the problem we're solving

Bug: T420691

Edited by Ryan Kemper

Merge request reports

Loading