ruff: Fix RUF015 Prefer next(iter(…)) over single element slice.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-10-30 10:59:16 -07:00
parent 610683ea41
commit 347490c647
2 changed files with 3 additions and 3 deletions

View file

@ -1023,9 +1023,9 @@ def add_zulip_subscriptions(verbose: bool) -> None:
unauthorized = res.get("unauthorized")
if verbose:
if already is not None and len(already) > 0:
logger.info("\nAlready subscribed to: %s", ", ".join(list(already.values())[0]))
logger.info("\nAlready subscribed to: %s", ", ".join(next(iter(already.values()))))
if new is not None and len(new) > 0:
logger.info("\nSuccessfully subscribed to: %s", ", ".join(list(new.values())[0]))
logger.info("\nSuccessfully subscribed to: %s", ", ".join(next(iter(new.values()))))
if unauthorized is not None and len(unauthorized) > 0:
logger.info(
"\n%s\n\n %s",

View file

@ -50,7 +50,7 @@ def read_config_from_env_vars(bot_name: Optional[str] = None) -> Dict[str, Dict[
# exist in the configuration provided via the environment
# variable, use the first bot in the environment variable,
# with name updated to match, along with a warning.
first_bot_name = list(env_config.keys())[0]
first_bot_name = next(iter(env_config.keys()))
bots_config[bot_name] = env_config[first_bot_name]
logging.warning(
"First bot name in the config list was changed from %r to %r",