Repository Analysis

pyinfra-dev/pyinfra

🔧 pyinfra turns Python code into shell commands and runs them on your servers. Execute ad-hoc commands and write declarative operations. Target SSH servers, local machine and Docker containers. Fast and scales from one server to thousands.

13.9 Low AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of pyinfra-dev/pyinfra, a Python project with 5,923 GitHub stars. SynthScan v2.0 examined 82,164 lines of code across 1791 source files, recording 807 pattern matches distributed across 15 syntactic categories. The overall adjusted score of 13.9 places this repository in the Low AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

13.9
Adjusted Score
13.9
Raw Score
100%
Time Factor
2026-07-27
Last Push
5.9K
Stars
Python
Language
82.2K
Lines of Code
1.8K
Files
807
Pattern Hits
2026-08-02
Scan Date
0.04
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

Longitudinal tracking requires multiple scan runs. Once this repository is re-scanned after new commits land, this chart will visualise how the synthetic code signal evolves over time — enabling you to detect whether AI authorship is growing, stabilising, or being actively corrected by human engineers.

No multi-scan history yet — run the scanner again to build trend data.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 0HIGH 80MEDIUM 18LOW 709

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 807 distinct pattern matches across 15 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Hyper-Verbose Identifiers342 hits · 346 pts
SeverityFileLineSnippetContext
LOWtests/test_facts_documentation.py4def test_deb_package_documents_package_resolution():CODE
LOWtests/test_facts_packages.py12 def test_numeric_run_compares_as_int_not_lexicographic(self):CODE
LOWtests/test_facts_packages.py18 def test_trailing_revision_sorts_after_base(self):CODE
LOWtests/test_facts_packages.py21 def test_equal_versions_have_equal_keys(self):CODE
LOWtests/test_facts_packages.py24 def test_shorter_version_sorts_before_its_extension(self):CODE
LOWtests/test_facts_packages.py33 def test_defaults_to_installed_status(self):CODE
LOWtests/test_facts_packages.py43 def test_installed_version_returns_highest(self):CODE
LOWtests/test_facts_packages.py47 def test_installed_version_none_when_no_versions(self):CODE
LOWtests/test_facts_packages.py81 def test_held_takes_precedence_over_upgradeable(self):CODE
LOWtests/test_facts_packages.py90 def test_handles_empty_versions(self):CODE
LOWtests/test_facts_packages.py95 def test_multiple_versions_sorted_natural_order(self):CODE
LOWtests/test_facts_packages.py107 def test_multiple_versions_natural_order_beats_lexicographic(self):CODE
LOWtests/test_operations_utils.py33 def test_zero_prefixed_string(self):CODE
LOWtests/test_operations_utils.py36 def test_octal_prefixed_string(self):CODE
LOWtests/test_operations_utils.py39 def test_uppercase_octal_prefixed_string(self):CODE
LOWtests/test_operations_utils.py45 def test_symbolic_mode_passes_through(self):CODE
LOWtests/test_operations_utils.py51 def test_non_octal_int_raises(self):CODE
LOWtests/test_operations_utils.py55 def test_non_octal_string_raises(self):CODE
LOWtests/test_operations_utils.py79 def test_ip_address_with_port(self):CODE
LOWtests/test_operations_utils.py85 def test_invalid_port_raises_error(self):CODE
LOWtests/test_operations_utils.py90 def test_empty_port_raises_error(self):CODE
LOWtests/test_operations_utils.py95 def test_negative_port_raises_error(self):CODE
LOWtests/test_operations_utils.py100 def test_port_too_large_raises_error(self):CODE
LOWtests/test_operations_utils.py105 def test_float_port_raises_error(self):CODE
LOWtests/test_operations_utils.py132 def test_repository_with_digest(self):CODE
LOWtests/test_operations_utils.py142 def test_repository_with_tag_and_digest(self):CODE
LOWtests/test_operations_utils.py152 def test_namespace_repository(self):CODE
LOWtests/test_operations_utils.py162 def test_namespace_repository_with_tag(self):CODE
LOWtests/test_operations_utils.py182 def test_registry_with_port_repository(self):CODE
LOWtests/test_operations_utils.py192 def test_registry_namespace_repository(self):CODE
LOWtests/test_operations_utils.py202 def test_registry_with_port_namespace_repository(self):CODE
LOWtests/test_operations_utils.py296 def test_empty_image_raises_error(self):CODE
LOWtests/test_operations_utils.py301 def test_whitespace_only_image_raises_error(self):CODE
LOWtests/test_operations_utils.py306 def test_none_image_raises_error(self):CODE
LOWtests/test_operations_utils.py311 def test_invalid_registry_port_raises_error(self):CODE
LOWtests/test_operations_utils.py355 def test_old_format_installed_no_latest(self):CODE
LOWtests/test_operations_utils.py360 def test_old_format_multiple_versions_noop_is_sorted(self):CODE
LOWtests/test_operations_utils.py366 def test_old_format_latest_blindly_upgrades(self):CODE
LOWtests/test_operations_utils.py370 def test_old_format_missing_installs(self):CODE
LOWtests/test_operations_utils.py374 def test_new_format_installed_uses_status(self):CODE
LOWtests/test_operations_utils.py384 def test_new_format_latest_only_upgrades_upgradeable(self):CODE
LOWtests/test_operations_utils.py488 def test_new_format_uninstall_removes_installed_package(self):CODE
LOWtests/test_operations_utils.py497 def test_new_format_uninstall_held_package_proceeds(self):CODE
LOWtests/test_operations_utils.py505 def test_new_format_uninstall_missing_package_is_noop(self):CODE
LOWtests/test_operations_utils.py510 def test_new_format_multi_version_noop_lists_all_versions(self):CODE
LOWtests/test_operations_utils.py67 def test_registry_without_port(self):CODE
LOWtests/test_operations_utils.py242 def test_complex_tag_with_colon_in_registry(self):CODE
LOWtests/test_operations_utils.py274 def test_property_registry_without_port(self):CODE
LOWtests/test_operations_utils.py285 def test_property_full_reference(self):CODE
LOWtests/test_operations_utils.py326 def test_github_container_registry_image(self):CODE
LOWtests/test_operations_utils.py400 def test_new_format_held_is_noop_even_when_latest(self):CODE
LOWtests/test_operations_utils.py413 def test_new_format_missing_installs(self):CODE
LOWtests/test_operations_utils.py417 def test_new_format_versioned_match_is_noop(self):CODE
LOWtests/test_operations_utils.py440 def test_new_format_versioned_mismatch_installs_pinned(self):CODE
LOWtests/test_operations_utils.py462 def test_new_format_upgradeable_with_pinned_version_installs_not_upgrades(self):CODE
LOWtests/test_operations_utils.py523 def test_new_format_multi_version_pinned_match_against_any_version(self):CODE
LOWtests/test_units.py4def test_parse_human_readable_size():CODE
LOWtests/paramiko_util.py31class FakeAgentRequestHandler:CODE
LOWtests/paramiko_util.py69 def set_missing_host_key_policy(self, _):CODE
LOWtests/test_global_arguments.py41 def test_operations_do_not_use_global_arguments(self):CODE
282 more matches not shown…
Cross-Language Confusion59 hits · 285 pts
SeverityFileLineSnippetContext
HIGHtests/test_connectors/test_util.py134 "sh -c 'export key=value anotherkey=anothervalue && uptime'",CODE
HIGHtests/test_connectors/test_util.py135 "sh -c 'export anotherkey=anothervalue key=value && uptime'",CODE
HIGHtests/test_connectors/test_util.py186 assert command.get_raw_value() == "sh -c 'cd /opt/somedir && uptime'"CODE
HIGHtests/test_connectors/test_util.py210 "'bash -c '\"'\"'cd /opt/somedir && export key=value " # shell and export bitCODE
HIGHtests/test_connectors/test_ssh.py1176 "/tmp/pyinfra-e9c0d3c8ffca943daa0e75511b0a09c84b59c508 && chmod +r /tmp/pyinfra-e9c0d3c8ffca943dCODE
HIGHtests/test_connectors/test_ssh.py1227 "/tmp/pyinfra-e9c0d3c8ffca943daa0e75511b0a09c84b59c508 && chmod +r /tmp/pyinfra-e9c0d3c8ffca943dCODE
HIGHtests/test_connectors/test_ssh.py1268 "/tmp/pyinfra-e9c0d3c8ffca943daa0e75511b0a09c84b59c508 && chmod +r /tmp/pyinfra-e9c0d3c8ffca943dCODE
HIGHtests/test_connectors/test_ssh.py1321 "/tmp/pyinfra-e9c0d3c8ffca943daa0e75511b0a09c84b59c508 && chmod +r "CODE
HIGHtests/test_api/test_api_operations.py391 hosts=(("somehost", {"ssh_config_file": "/home/me/ssh_test_config && echo hi"}),)CODE
HIGHtests/test_api/test_api_operations.py409 "-F '/home/me/ssh_test_config && echo hi'\""CODE
HIGHsrc/pyinfra/operations/files.py2043 "2>/dev/null || stat -f %Lp",CODE
HIGHsrc/pyinfra/operations/files.py2045 '2>/dev/null)" &&',CODE
HIGHsrc/pyinfra/operations/files.py2053 '2>/dev/null || stat -f "%u:%g"',CODE
HIGHsrc/pyinfra/operations/files.py2055 '2>/dev/null || echo $(id -un):$(id -gn))" &&',CODE
HIGHsrc/pyinfra/operations/files.py251 "(( sha1sum {0} 2> /dev/null || shasum {0} || sha1 {0} ) | grep {1} ) "CODE
HIGHsrc/pyinfra/operations/files.py262 "(( sha256sum {0} 2> /dev/null || shasum -a 256 {0} || sha256 {0} ) "CODE
HIGHsrc/pyinfra/operations/files.py273 "(( sha384sum {0} 2> /dev/null || shasum -a 384 {0} ) "CODE
HIGHsrc/pyinfra/operations/files.py283 ("(( md5sum {0} 2> /dev/null || md5 {0} ) | grep {1} ) || ( echo {2} && exit 1 )"),CODE
HIGHsrc/pyinfra/operations/server.py104 "( sleep 1 && reboot ) </dev/null >/dev/null 2>&1 &",CODE
HIGHsrc/pyinfra/operations/runit.py158 f" sv status {service} > /dev/null && exit 0\n"CODE
HIGHsrc/pyinfra/operations/apt.py448 "2> /dev/null || true",CODE
HIGHsrc/pyinfra/operations/util/packaging.py335 yield f"rpm -q `rpm -qp {source}` 2> /dev/null || rpm -i {source}"CODE
HIGHsrc/pyinfra/facts/files.py456 ("{3} -e {0} {1} 2> /dev/null || ( find {1} -type f > /dev/null && echo {2} || true )"),CODE
HIGHsrc/pyinfra/facts/files.py666 "(find {0} -type f > /dev/null && echo {1} || echo {2} )",CODE
HIGHsrc/pyinfra/facts/git.py43 return f"git config {level} -l || true"CODE
HIGHsrc/pyinfra/facts/git.py86 return f"! test -d {repo} || (cd {repo} && git rev-parse {ref} 2>/dev/null) || true"CODE
HIGHsrc/pyinfra/facts/server.py838 LASTLOG=`(((lastlog -u $i || lastlogin $i) 2> /dev/null) | grep ^$i | tr -s ' ')`;CODE
HIGHsrc/pyinfra/facts/server.py838 LASTLOG=`(((lastlog -u $i || lastlogin $i) 2> /dev/null) | grep ^$i | tr -s ' ')`;CODE
HIGHsrc/pyinfra/facts/server.py839 PASSWORD=`(grep ^$i: /etc/shadow || grep ^$i: /etc/master.passwd) 2> /dev/null | cut -d: -f2`;CODE
HIGHsrc/pyinfra/facts/server.py484 return "ss -lpuntn || true"STRING
HIGHsrc/pyinfra/facts/server.py487 return "netstat -tunp 2>/dev/null || true"STRING
HIGHsrc/pyinfra/facts/server.py613 return "! test -f /proc/modules || cat /proc/modules"STRING
HIGHsrc/pyinfra/facts/server.py749 return StringCommand("sysctl -a 2>/dev/null || true")STRING
HIGHsrc/pyinfra/facts/server.py750 return StringCommand("sysctl", *[QuoteString(key) for key in keys], "2>/dev/null || true")STRING
HIGHsrc/pyinfra/facts/server.py910 return StringCommand("cat", QuoteString(path), "2>/dev/null || true")STRING
HIGHsrc/pyinfra/facts/server.py914 return StringCommand("cat", f"~{user}/.ssh/authorized_keys", "2>/dev/null || true")STRING
HIGHsrc/pyinfra/facts/server.py1109 return "ls /usr/bin/*session || true"STRING
HIGHsrc/pyinfra/facts/server.py1231 return "! test -e /etc/security/limits.conf || cat /etc/security/limits.conf"STRING
HIGHsrc/pyinfra/facts/server.py1431 return make_formatted_string_command("cat {0} 2>/dev/null || true", QuoteString(path))STRING
HIGHsrc/pyinfra/facts/server.py1497 return "last -Fwi 2>/dev/null || last -w 2>/dev/null || last 2>/dev/null || true"STRING
HIGHsrc/pyinfra/facts/server.py1568 return "cat /proc/loadavg 2>/dev/null || uptime"STRING
HIGHsrc/pyinfra/facts/server.py1616 return "lastb -Fwi 2>/dev/null || lastb 2>/dev/null || true"STRING
HIGHsrc/pyinfra/facts/selinux.py83 return f"set -o pipefail && semanage fcontext -n -l | (grep '^{target}' || true)"CODE
HIGHsrc/pyinfra/facts/selinux.py156 return f"(sepolicy network -p {port} 2>/dev/null || true) | grep {protocol}"CODE
HIGHsrc/pyinfra/facts/deb.py90 "test -f {0} && case {0} in *.deb) dpkg -I {0} ;; *) dpkg -s {0} 2>/dev/null || true ;; esac || dpkg -s {0} CODE
HIGHsrc/pyinfra/facts/efibootmgr.py49 return "efibootmgr || true"CODE
HIGHsrc/pyinfra/facts/crontab.py168 return StringCommand("crontab -l || true")STRING
HIGHsrc/pyinfra/facts/freebsd.py61 ("pkg info -E -- {0} 2> /dev/null || true"), QuoteString(package)CODE
HIGHsrc/pyinfra/facts/freebsd.py65 ("pkg -j {0} info -E -- {1} 2> /dev/null || true"),CODE
HIGHsrc/pyinfra/facts/docker.py83 ids=$(docker ps -qa) && [ -n "$ids" ] && docker container inspect $ids || echo "[]"CODE
HIGHsrc/pyinfra/facts/docker.py95 ids=$(docker images -q) && [ -n "$ids" ] && docker image inspect $ids || echo "[]"CODE
HIGHsrc/pyinfra/facts/docker.py127 ids=$(docker plugin ls -q) && [ -n "$ids" ] && docker plugin inspect $ids || echo "[]"CODE
HIGHsrc/pyinfra/facts/gpg.py178 f' gpg --list-keys --with-colons --keyring "$1" --no-default-keyring 2>/dev/null || true\' _ {{}} \\; ;'CODE
HIGHsrc/pyinfra/facts/gpg.py180 f' -exec sh -c \'echo "KEYRING:$1"; gpg --with-colons "$1" 2>/dev/null || true\' _ {{}} \\;'CODE
HIGHsrc/pyinfra/facts/hardware.py142 return "getconf NPROCESSORS_ONLN 2> /dev/null || getconf _NPROCESSORS_ONLN"CODE
HIGHsrc/pyinfra/facts/hardware.py352 return "ip -j addr show 2> /dev/null || ip addr show 2> /dev/null || ifconfig -a"CODE
HIGHsrc/pyinfra/facts/pkg.py26 return "pkg info || pkg_info || true"CODE
HIGHsrc/pyinfra/facts/brew.py119 r'if brew --version | grep -q -e "Homebrew\ +(1\.|2\.[0-5]).*" 1>/dev/null;'CODE
HIGHsrc/pyinfra/facts/util/__init__.py30 "done || true"CODE
Unused Imports166 hits · 162 pts
SeverityFileLineSnippetContext
LOWtests/__init__.py6CODE
LOWtests/test_connectors/conftest.py1CODE
LOWtests/test_connectors/test_ssh_util.py1CODE
LOWtests/test_cli/deploy/group_data/imports_leak.py5CODE
LOWtests/test_cli/deploy/group_data/imports_leak.py7CODE
LOWscripts/generate_llms_txt.py11CODE
LOWsrc/pyinfra_cli/util.py1CODE
LOWsrc/pyinfra_cli/prints.py1CODE
LOWsrc/pyinfra_cli/commands.py1CODE
LOWsrc/pyinfra/__init__.py14CODE
LOWsrc/pyinfra/__init__.py14CODE
LOWsrc/pyinfra/__init__.py14CODE
LOWsrc/pyinfra/__init__.py14CODE
LOWsrc/pyinfra/__init__.py17CODE
LOWsrc/pyinfra/connectors/ssh_util.py18CODE
LOWsrc/pyinfra/connectors/ssh_util.py19CODE
LOWsrc/pyinfra/connectors/fake.py11CODE
LOWsrc/pyinfra/connectors/util.py1CODE
LOWsrc/pyinfra/connectors/local.py23CODE
LOWsrc/pyinfra/connectors/chroot.py20CODE
LOWsrc/pyinfra/connectors/chroot.py21CODE
LOWsrc/pyinfra/connectors/chroot.py22CODE
LOWsrc/pyinfra/connectors/docker.py1CODE
LOWsrc/pyinfra/connectors/ssh.py1CODE
LOWsrc/pyinfra/connectors/base.py1CODE
LOWsrc/pyinfra/connectors/dockerssh.py19CODE
LOWsrc/pyinfra/connectors/dockerssh.py20CODE
LOWsrc/pyinfra/connectors/dockerssh.py21CODE
LOWsrc/pyinfra/connectors/sshuserclient/__init__.py1CODE
LOWsrc/pyinfra/connectors/scp/client.py1CODE
LOWsrc/pyinfra/connectors/scp/__init__.py1CODE
LOWsrc/pyinfra/operations/xbps.py5CODE
LOWsrc/pyinfra/operations/postgresql.py1CODE
LOWsrc/pyinfra/operations/pacman.py5CODE
LOWsrc/pyinfra/operations/files.py5CODE
LOWsrc/pyinfra/operations/git.py5CODE
LOWsrc/pyinfra/operations/server.py6CODE
LOWsrc/pyinfra/operations/zypper.py1CODE
LOWsrc/pyinfra/operations/selinux.py5CODE
LOWsrc/pyinfra/operations/systemd.py5CODE
LOWsrc/pyinfra/operations/cargo.py5CODE
LOWsrc/pyinfra/operations/crontab.py1CODE
LOWsrc/pyinfra/operations/apk.py5CODE
LOWsrc/pyinfra/operations/snap.py5CODE
LOWsrc/pyinfra/operations/docker.py7CODE
LOWsrc/pyinfra/operations/npm.py5CODE
LOWsrc/pyinfra/operations/choco.py5CODE
LOWsrc/pyinfra/operations/yum.py5CODE
LOWsrc/pyinfra/operations/sysvinit.py5CODE
LOWsrc/pyinfra/operations/dnf.py5CODE
LOWsrc/pyinfra/operations/vzctl.py5CODE
LOWsrc/pyinfra/operations/pkgin.py5CODE
LOWsrc/pyinfra/operations/puppet.py1CODE
LOWsrc/pyinfra/operations/runit.py5CODE
LOWsrc/pyinfra/operations/apt.py5CODE
LOWsrc/pyinfra/operations/flatpak.py5CODE
LOWsrc/pyinfra/operations/bsdinit.py5CODE
LOWsrc/pyinfra/operations/postgres.py17CODE
LOWsrc/pyinfra/operations/python.py5CODE
LOWsrc/pyinfra/operations/go.py5CODE
106 more matches not shown…
Cross-File Repetition19 hits · 95 pts
SeverityFileLineSnippetContext
HIGHdocs/api/connectors.md0execute a command. args: command (stringcommand): actual command to execute print_output (bool): whether to print commanSTRING
HIGHsrc/pyinfra/connectors/local.py0execute a command. args: command (stringcommand): actual command to execute print_output (bool): whether to print commanSTRING
HIGHsrc/pyinfra/connectors/base.py0execute a command. args: command (stringcommand): actual command to execute print_output (bool): whether to print commanSTRING
HIGHdocs/api/connectors.md0upload a local file or io object by copying it to a temporary directory and then writing it to the upload location. retuSTRING
HIGHsrc/pyinfra/connectors/base.py0upload a local file or io object by copying it to a temporary directory and then writing it to the upload location. retuSTRING
HIGHsrc/pyinfra/connectors/local.py0upload a local file or io object by copying it to a temporary directory and then writing it to the upload location. retuSTRING
HIGHdocs/api/connectors.md0download a local file by copying it to a temporary location and then writing it to our filename or io object. returns: bSTRING
HIGHsrc/pyinfra/connectors/base.py0download a local file by copying it to a temporary location and then writing it to our filename or io object. returns: bSTRING
HIGHsrc/pyinfra/connectors/local.py0download a local file by copying it to a temporary location and then writing it to our filename or io object. returns: bSTRING
HIGHsrc/pyinfra/facts/xbps.py0returns a dict of installed brew casks: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/pacman.py0returns a dict of installed brew casks: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/deb.py0returns a dict of installed brew casks: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/apk.py0returns a dict of installed brew casks: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/pkgin.py0returns a dict of installed brew casks: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/pkg.py0returns a dict of installed brew casks: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/rpm.py0returns a dict of installed brew casks: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/pip.py0returns a dict of installed brew casks: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/pipx.py0returns a dict of installed brew casks: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/brew.py0returns a dict of installed brew casks: .. code:: python { "package_name": ["version"], }STRING
Deep Nesting78 hits · 76 pts
SeverityFileLineSnippetContext
LOWtests/test_connectors/test_sshuserclient.py421CODE
LOWscripts/generate_facts_docs.py87CODE
LOWscripts/docs_utils.py29CODE
LOWscripts/lint_arguments_sync.py25CODE
LOWscripts/lint_arguments_sync.py40CODE
LOWscripts/lint_arguments_sync.py56CODE
LOWscripts/lint_arguments_sync.py116CODE
LOWscripts/generate_operations_docs.py92CODE
LOWsrc/pyinfra_cli/cli.py552CODE
LOWsrc/pyinfra_cli/exceptions.py42CODE
LOWsrc/pyinfra_cli/prints.py133CODE
LOWsrc/pyinfra_cli/prints.py362CODE
LOWsrc/pyinfra_cli/prints.py401CODE
LOWsrc/pyinfra_cli/inventory.py61CODE
LOWsrc/pyinfra_cli/inventory.py298CODE
LOWsrc/pyinfra/connectors/ssh_util.py63CODE
LOWsrc/pyinfra/connectors/terraform.py83CODE
LOWsrc/pyinfra/connectors/local.py107CODE
LOWsrc/pyinfra/connectors/local.py159CODE
LOWsrc/pyinfra/connectors/chroot.py109CODE
LOWsrc/pyinfra/connectors/chroot.py158CODE
LOWsrc/pyinfra/connectors/docker.py224CODE
LOWsrc/pyinfra/connectors/ssh.py218CODE
LOWsrc/pyinfra/connectors/sshuserclient/config.py48CODE
LOWsrc/pyinfra/connectors/sshuserclient/config.py64CODE
LOWsrc/pyinfra/connectors/sshuserclient/client.py276CODE
LOWsrc/pyinfra/connectors/scp/client.py132CODE
LOWsrc/pyinfra/operations/files.py308CODE
LOWsrc/pyinfra/operations/files.py957CODE
LOWsrc/pyinfra/operations/files.py1008CODE
LOWsrc/pyinfra/operations/files.py1922CODE
LOWsrc/pyinfra/operations/git.py92CODE
LOWsrc/pyinfra/operations/git.py235CODE
LOWsrc/pyinfra/operations/server.py320CODE
LOWsrc/pyinfra/operations/server.py470CODE
LOWsrc/pyinfra/operations/server.py684CODE
LOWsrc/pyinfra/operations/server.py762CODE
LOWsrc/pyinfra/operations/server.py830CODE
LOWsrc/pyinfra/operations/server.py1011CODE
LOWsrc/pyinfra/operations/crontab.py13CODE
LOWsrc/pyinfra/operations/snap.py13CODE
LOWsrc/pyinfra/operations/docker.py208CODE
LOWsrc/pyinfra/operations/docker.py605CODE
LOWsrc/pyinfra/operations/zfs.py11CODE
LOWsrc/pyinfra/operations/sysvinit.py18CODE
LOWsrc/pyinfra/operations/gpg.py94CODE
LOWsrc/pyinfra/operations/gpg.py142CODE
LOWsrc/pyinfra/operations/gpg.py231CODE
LOWsrc/pyinfra/operations/apt.py92CODE
LOWsrc/pyinfra/operations/go.py34CODE
LOWsrc/pyinfra/operations/pip.py18CODE
LOWsrc/pyinfra/operations/mysql.py58CODE
LOWsrc/pyinfra/operations/util/files.py264CODE
LOWsrc/pyinfra/operations/util/docker.py49CODE
LOWsrc/pyinfra/operations/util/packaging.py176CODE
LOWsrc/pyinfra/operations/freebsd/service.py21CODE
LOWsrc/pyinfra/operations/freebsd/sysrc.py20CODE
LOWsrc/pyinfra/api/facts.py256CODE
LOWsrc/pyinfra/api/config.py86CODE
LOWsrc/pyinfra/api/operations.py61CODE
18 more matches not shown…
Redundant / Tautological Comments22 hits · 33 pts
SeverityFileLineSnippetContext
LOWtests/test_connectors/test_sshuserclient.py441 # Check if AskPolicy respects not importing and properly raises SSHExceptionCOMMENT
LOWtests/test_connectors/test_sshuserclient.py448 # Check if AskPolicy properly appends to hostfileCOMMENT
LOWtests/facts/server.RebootRequired/linux_no_reboot.json2 "command": "\n# Get OS type\nOS_TYPE=$(uname -s)\nif [ \"$OS_TYPE\" = \"Linux\" ]; then\n # Check if it's Alpine CODE
LOW…facts/server.RebootRequired/linux_reboot_required.json2 "command": "\n# Get OS type\nOS_TYPE=$(uname -s)\nif [ \"$OS_TYPE\" = \"Linux\" ]; then\n # Check if it's Alpine CODE
LOW…cts/server.RebootRequired/freebsd_reboot_required.json2 "command": "\n# Get OS type\nOS_TYPE=$(uname -s)\nif [ \"$OS_TYPE\" = \"Linux\" ]; then\n # Check if it's Alpine CODE
LOW…acts/server.RebootRequired/alpine_reboot_required.json2 "command": "\n# Get OS type\nOS_TYPE=$(uname -s)\nif [ \"$OS_TYPE\" = \"Linux\" ]; then\n # Check if it's Alpine CODE
LOWscripts/lint_arguments_sync.py76 # Check if this arg has a defaultCOMMENT
LOWscripts/lint_arguments_sync.py160 # Check if it's just an Optional wrapper differenceCOMMENT
LOWsrc/pyinfra_cli/commands.py20 # Check if we're JSON (in which case we expect a list of two items:COMMENT
LOWsrc/pyinfra_cli/inventory.py105 # Read the files locals into a dictCOMMENT
LOWsrc/pyinfra/operations/files.py706 # Check if this directory is actually a symlinkCOMMENT
LOWsrc/pyinfra/operations/files.py731 # Check if this is a symlinkCOMMENT
LOWsrc/pyinfra/operations/gpg.py147 # Check if the destination keyring exists and contains the target keysCOMMENT
LOWsrc/pyinfra/operations/gpg.py326 # Check if key already exists (for idempotence)COMMENT
LOWsrc/pyinfra/operations/gpg.py334 # Check if our destination keyring exists in the factCOMMENT
LOWsrc/pyinfra/operations/gpg.py341 # Check if all requested keys already existCOMMENT
LOWsrc/pyinfra/operations/gpg.py443 # Check if it's an ASCII armored key and handle accordinglyCOMMENT
LOWsrc/pyinfra/operations/postgres.py176 # Check if any attributes need updatingCOMMENT
LOWsrc/pyinfra/api/operation.py305 # Check if we're actually running the operation on this hostCOMMENT
LOWsrc/pyinfra/api/operations.py152 # Check if we should retryCOMMENT
LOWsrc/pyinfra/facts/files.py138 # Check if year_or_time is a year (4 digits) or time (HH:MM)COMMENT
LOWsrc/pyinfra/facts/server.py1277 # Check if it's Alpine LinuxCOMMENT
AI Structural Patterns35 hits · 33 pts
SeverityFileLineSnippetContext
LOWsrc/pyinfra/connectors/util.py386CODE
LOWsrc/pyinfra/operations/files.py79CODE
LOWsrc/pyinfra/operations/files.py308CODE
LOWsrc/pyinfra/operations/files.py616CODE
LOWsrc/pyinfra/operations/files.py1008CODE
LOWsrc/pyinfra/operations/files.py1557CODE
LOWsrc/pyinfra/operations/files.py1664CODE
LOWsrc/pyinfra/operations/files.py1766CODE
LOWsrc/pyinfra/operations/files.py1922CODE
LOWsrc/pyinfra/operations/git.py92CODE
LOWsrc/pyinfra/operations/git.py235CODE
LOWsrc/pyinfra/operations/server.py1011CODE
LOWsrc/pyinfra/operations/zypper.py113CODE
LOWsrc/pyinfra/operations/systemd.py37CODE
LOWsrc/pyinfra/operations/crontab.py13CODE
LOWsrc/pyinfra/operations/docker.py26CODE
LOWsrc/pyinfra/operations/docker.py286CODE
LOWsrc/pyinfra/operations/docker.py476CODE
LOWsrc/pyinfra/operations/docker.py812CODE
LOWsrc/pyinfra/operations/yum.py139CODE
LOWsrc/pyinfra/operations/dnf.py140CODE
LOWsrc/pyinfra/operations/gpg.py231CODE
LOWsrc/pyinfra/operations/runit.py18CODE
LOWsrc/pyinfra/operations/apt.py581CODE
LOWsrc/pyinfra/operations/postgres.py62CODE
LOWsrc/pyinfra/operations/postgres.py224CODE
LOWsrc/pyinfra/operations/uv.py234CODE
LOWsrc/pyinfra/operations/iptables.py62CODE
LOWsrc/pyinfra/operations/pip.py122CODE
LOWsrc/pyinfra/operations/mysql.py58CODE
LOWsrc/pyinfra/operations/mysql.py292CODE
LOWsrc/pyinfra/operations/mysql.py395CODE
LOWsrc/pyinfra/operations/freebsd/freebsd_update.py12CODE
LOWsrc/pyinfra/api/arguments_typed.py27CODE
LOWsrc/pyinfra/facts/files.py484CODE
Self-Referential Comments14 hits · 28 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_api/test_api_operations.py915 # Create a counter to track retry_until callsCOMMENT
MEDIUMtests/test_api/test_api_operations.py918 # Create a retry_until function that returns True (retry) for first two callsCOMMENT
MEDIUMtests/test_api/test_api_operations.py1018 # Create a retry_until function that raises an exceptionCOMMENT
MEDIUMsrc/pyinfra/operations/server.py462 # Create a whole new hostname fileSTRING
MEDIUMsrc/pyinfra/operations/server.py1118 # Create the user w/home/shellSTRING
MEDIUMsrc/pyinfra/operations/zypper.py52 # Create the repository file from baseurl/etcSTRING
MEDIUMsrc/pyinfra/operations/docker.py438 # Create a Docker volumeSTRING
MEDIUMsrc/pyinfra/operations/yum.py79 # Create the repository file from baseurl/etcSTRING
MEDIUMsrc/pyinfra/operations/dnf.py80 # Create the repository file from baseurl/etcSTRING
MEDIUMsrc/pyinfra/operations/mysql.py111 # Create a user with resource limitsSTRING
MEDIUMsrc/pyinfra/operations/mysql.py119 # Create a user that requires SSL for connectionsSTRING
MEDIUMsrc/pyinfra/operations/mysql.py127 # Create a user that requires a specific certificateSTRING
MEDIUMsrc/pyinfra/api/arguments.py272# Create a dictionary for retry argumentsCOMMENT
MEDIUMsrc/pyinfra/api/inventory.py58 # Create the actual host instances and groupsCOMMENT
Excessive Try-Catch Wrapping19 hits · 20 pts
SeverityFileLineSnippetContext
MEDIUMscripts/generate_changelog.py135 print("Error: could not determine previous tag", file=sys.stderr)CODE
LOWscripts/generate_llms_txt.py130 except Exception as exc: # broad: importing plugin code can trigger extras, env checksCODE
LOWsrc/pyinfra_cli/log.py16 except Exception:CODE
MEDIUMsrc/pyinfra_cli/log.py12def emit(self, record):CODE
LOWsrc/pyinfra_cli/util.py70 except Exception as e:CODE
LOWsrc/pyinfra_cli/util.py190 except Exception as e:CODE
LOWsrc/pyinfra_cli/util.py226 except Exception as e:CODE
MEDIUMsrc/pyinfra_cli/util.py218def load_file(local_host):CODE
LOWsrc/pyinfra_cli/cli.py296 except Exception as e:CODE
LOWsrc/pyinfra_cli/inventory.py230 except Exception as e:CODE
LOWsrc/pyinfra/version.py8except Exception:CODE
LOWsrc/pyinfra/connectors/util.py267 except Exception as e:STRING
LOWsrc/pyinfra/connectors/ssh.py322 except Exception:STRING
LOWsrc/pyinfra/connectors/ssh.py341 except Exception:STRING
LOWsrc/pyinfra/connectors/sshuserclient/config.py37 except Exception as e:CODE
LOWsrc/pyinfra/connectors/sshuserclient/client.py181 except Exception as e:CODE
LOWsrc/pyinfra/api/command.py255 except Exception as e:CODE
LOWsrc/pyinfra/api/operations.py113 except Exception as e:CODE
LOWsrc/pyinfra/api/operations.py174 except Exception as e:CODE
Fake / Example Data17 hits · 20 pts
SeverityFileLineSnippetContext
LOWtests/test_connectors/test_ssh.py253 fake_key = mock.MagicMock()CODE
LOWtests/test_connectors/test_ssh.py254 fake_key_open.return_value = fake_keyCODE
LOWtests/test_connectors/test_ssh.py261 fake_key.load_certificate.assert_called_with("testkey-cert.pub")CODE
LOWtests/test_connectors/test_ssh.py268 pkey=fake_key,CODE
LOWtests/test_connectors/test_ssh.py394 fake_key = mock.MagicMock()CODE
LOWtests/test_connectors/test_ssh.py399 return fake_keyCODE
LOWtests/test_connectors/test_ssh.py408 fake_key.load_certificate.assert_called_with("testkey-cert.pub")CODE
LOWtests/test_connectors/test_ssh.py452 fake_key = mock.MagicMock()CODE
LOWtests/test_connectors/test_ssh.py453 fake_key_open.return_value = fake_keyCODE
LOWtests/test_connectors/test_ssh.py500 fake_key = mock.MagicMock()CODE
LOWtests/test_connectors/test_ssh.py501 fake_key_open.return_value = fake_keyCODE
LOWtests/test_connectors/test_ssh.py423 fake_key = mock.MagicMock()CODE
LOWtests/test_connectors/test_ssh.py428 return fake_keyCODE
LOWtests/test_connectors/test_ssh.py439 fake_key.load_certificate.assert_called_with("testkey-cert.pub")CODE
LOWtests/operations/snap.package/install_packages.json9 "publisher": "Acme Corp",CODE
LOW…/operations/snap.package/install_refresh_packages.json17 "publisher": "Acme Corp",CODE
LOWdocs/inventory-data.md98See [Dynamic Inventories & Data](examples/dynamic_inventories_data.md) for a worked example, including building a fake-dCODE
Overly Generic Function Names17 hits · 12 pts
SeverityFileLineSnippetContext
LOWsrc/pyinfra/api/facts.py128 def process_data(self, data):CODE
LOWsrc/pyinfra/facts/server.py1054 def process_data(self, data) -> str:STRING
LOWsrc/pyinfra/facts/server.py1141 def process_data(self, data) -> bool:STRING
LOWsrc/pyinfra/facts/docker.py193 def process_data(self, data):STRING
LOWsrc/pyinfra/facts/docker.py214 def process_data(self, data):STRING
LOWsrc/pyinfra/facts/docker.py229 def process_data(self, data):STRING
LOWsrc/pyinfra/facts/docker.py241 def process_data(self, data):STRING
LOWsrc/pyinfra/facts/docker.py256 def process_data(self, data):STRING
LOWsrc/pyinfra/facts/docker.py271 def process_data(self, data):STRING
LOWsrc/pyinfra/facts/docker.py290 def process_data(self, data):STRING
LOWsrc/pyinfra/facts/docker.py304 def process_data(self, data):STRING
LOWsrc/pyinfra/facts/docker.py316 def process_data(self, data):STRING
LOWsrc/pyinfra/facts/zfs.py64 def process_data(self, data):CODE
LOWsrc/pyinfra/facts/zfs.py72 def process_data(self, data):CODE
LOWsrc/pyinfra/facts/zfs.py80 def process_data(self, data):CODE
LOWsrc/pyinfra/facts/hardware.py594 def process_data(self, data):CODE
LOWsrc/pyinfra/facts/hardware.py656 def process_data(self, data):CODE
AI Slop Vocabulary7 hits · 11 pts
SeverityFileLineSnippetContext
LOWsrc/pyinfra_cli/virtualenv.py40 # but others can symlink *to* the venv Python, so we can't just use sys.executable.COMMENT
LOWsrc/pyinfra_cli/inventory.py355 # we're not ready to make an Inventory. So here we just create a fake one, andCOMMENT
LOWsrc/pyinfra/progress.py68 # If there's no current state context we're not in CLI mode, so just return a noopCOMMENT
LOWsrc/pyinfra/operations/files.py1374 # To pass variables to the template file, just add them to the operation call.STRING
LOWsrc/pyinfra/operations/bsdinit.py52 # BSD init is simple, just add/remove <service>_enabled="YES"COMMENT
MEDIUMsrc/pyinfra/api/config.py160 # were required. To facilitate checking extras we have to pass the extraCOMMENT
LOWsrc/pyinfra/api/inventory.py105 # Execution connector? Simple, just set it for their hostCOMMENT
Docstring Block Structure2 hits · 10 pts
SeverityFileLineSnippetContext
HIGHsrc/pyinfra/operations/files.py1313 Generate a template using jinja2 and write it to the remote system. + src: template filename or IO-like objectSTRING
HIGHsrc/pyinfra/operations/util/docker.py50 Parse a registry string into host and port components. Args: registry: String like "registry.io:5000" STRING
Over-Commented Block6 hits · 6 pts
SeverityFileLineSnippetContext
LOWsrc/pyinfra_cli/inventory.py181 # (Un)fortunately the CLI is pretty flexible for inventory inputs; we support inventory files, aCOMMENT
LOWsrc/pyinfra/api/config.py21 # % of hosts which have to fail for all operations to stopCOMMENT
LOWsrc/pyinfra/api/config.py141 # This would raise a DistributionNotFound error from pkg_resources.require()COMMENT
LOWsrc/pyinfra/api/arguments_typed.py61 #COMMENT
LOWsrc/pyinfra/facts/systemd.py1from __future__ import annotationsCOMMENT
LOWsrc/pyinfra/facts/snap.py81 # Discard header output line from snap list commandCOMMENT
Modern Structural Boilerplate4 hits · 4 pts
SeverityFileLineSnippetContext
LOWsrc/pyinfra_cli/cli.py749def _set_fail_prompts(state: State, config: Config) -> None:CODE
LOWsrc/pyinfra/api/output.py43def set_formatter(func: Callable[..., str]) -> None:CODE
LOWsrc/pyinfra/api/output.py49def set_echo(func: Callable[..., None]) -> None:CODE
LOWsrc/pyinfra/api/state.py283 def set_stage(self, stage: StateStage) -> None:CODE