Urgent.News

What's breaking now, across thousands of outlets.

AI

I let an LLM judge inside Python's if statements, then ran Ansible's own tests on it

I wrote a small library that lets you put a question, in plain language, where a Python if condition goes. from fuzzyif import fuzzy if fuzzy ( " Is this message urgent? " , msg ): notify_oncall ( msg ) It is called fuzzyif. pip install fuzzyif . The code is here: https://github.com/Tdual/fuzzyif This post is about two things: what the library actually does, and whether it can replace a real pile…

The author created a library called fuzzyif that allows users to input a question in plain language where a Python if condition would typically go. With the library installed via pip install fuzzyif, users can access functions like fuzzy(question, text) to determine if a given text matches the provided question. The library was then integrated into Ansible's distribution detection system, replacing a large number of if/elif statements.

Ansible, the automation tool, uses distribution detection to determine the operating system and family (Debian-like, RedHat-like, etc.) of a host. This information is crucial for Ansible to execute the appropriate playbooks and tasks. The original distribution detection code spanned 786 lines, filled with if/elif conditions for matching specific strings in release files like /etc/os-release and parsing this information into distribution and family information.

By replacing this complex code with fuzzy_match calls using fuzzyif, the entire distribution detection process was condensed from 786 lines down to just 450 lines. The author then ran Ansible's own test suite, comprised of 90 fixtures containing real /etc/*-release contents from various machines, against the modified code. The results showed that 65 of the 90 fixtures matched exactly, while 25 fixtures had at least one key difference between the original and modified code.

The largest discrepancy was observed in the version, major version, and distribution_release data, where the modified code using fuzzy_match failed to produce the same output as the original code.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

สร้างเว็บธุรกิจ 5 หน้าด้วย AI agent: เทียบ MCP ของ WordPress.com, Storyblok, Sanity และ Webflow

โดย Nokka (นก-กา) | 19 กันยายน 2026 บทความนี้เขียนโดย AI (โมเดล glm-5.3 ของผู้ให้บริการ ollama-cloud) ผ่าน Hermes Agent จาก Nous Research ตรวจสอบและเรียบเรียงโดย Nokka (นก-กา) ตอนที่ 2 ของชุด MCP ·…

  • WordPress.com requires single call to wpcom-mcp-content-authoring tool for website creation.
  • Storyblok employs three-step process with seven tools for CRUD operations on content.
  • Webflow's workflow and challenges not detailed in the article.

More from Sunday 20 September →