AI Slop Code RIsk Monitor

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.

14.9 Moderate pattern signal View on GitHub

Maintenance and Governance Review

This report summarizes scanner evidence for pyinfra-dev/pyinfra, a Python project with 6,028 GitHub stars. SynthScan examined 86,304 lines of code across 1915 source files, recording 865 pattern matches distributed across 16 syntactic categories. The legacy adjusted pattern signal is 14.9 (Moderate pattern signal); it is not an authorship estimate.

Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.

14.9
Adjusted Signal
14.9
Raw Pattern Score
100%
Time Factor
2026-09-22
Last Push
6.0K
Stars
Python
Language
86.3K
Lines of Code
1.9K
Files
865
Pattern Hits
2026-10-12
Scan Date
0.05
HC Hit Rate

Risk Review · v3

Use each vector to guide manual verification of the underlying findings.

Cognitive Ownership Risk 28.5/100 · MEDIUM

Can maintainers explain intent, assumptions, and trade-offs? 552 finding(s).

Hallucinated Dependency & Supply Chain Risk 25.1/100 · MEDIUM

Are imports declared and package/API names verified? 252 finding(s).

Agent Over-Engineering Ratio 29.6/100 · MEDIUM

Are wrappers, guards, and repeated structures necessary? 461 finding(s).

PR Review Velocity Impact 56.2/100 · HIGH

Which changes need focused human review? 865 finding(s).

What These Metrics Mean

Adjusted Signal
Legacy pattern score normalized per 1,000 scanned lines and multiplied by the repository-level time factor. It is not an estimate of AI authorship.
Raw Pattern Score
Sum of severity- and context-weighted pattern findings before applying the time factor.
Time Factor
A coarse multiplier based on repository last-push metadata. It does not identify when individual code was written.
Pattern Hits
Count of configured pattern findings. Review each location and surrounding code before acting.
HC Hit Rate
High- and critical-severity findings per scanned file. Severity is a configured detector weight, not proof of a vulnerability or authorship.
Lines / Files
Scan coverage denominators used by the legacy normalized score.

Pattern-Signal History

This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.

Severity Breakdown

Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.

CRITICAL 0HIGH 105MEDIUM 18LOW 742

Directory Score Breakdown

This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.

Pattern Findings

The scanner identified 865 distinct pattern matches across 16 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. 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 configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.

Hyper-Verbose Identifiers364 hits · 364 pts
SeverityFileLineSnippetContext
LOWtests/test_facts_documentation.py4def test_deb_package_documents_package_resolution():CODE
LOW⚡tests/test_facts_packages.py12 def test_numeric_run_compares_as_int_not_lexicographic(self):CODE
LOW⚡tests/test_facts_packages.py18 def test_trailing_revision_sorts_after_base(self):CODE
LOW⚡tests/test_facts_packages.py21 def test_equal_versions_have_equal_keys(self):CODE
LOW⚡tests/test_facts_packages.py24 def test_shorter_version_sorts_before_its_extension(self):CODE
LOW⚡tests/test_facts_packages.py33 def test_defaults_to_installed_status(self):CODE
LOW⚡tests/test_facts_packages.py43 def test_installed_version_returns_highest(self):CODE
LOW⚡tests/test_facts_packages.py47 def test_installed_version_none_when_no_versions(self):CODE
LOW⚡tests/test_facts_packages.py81 def test_held_takes_precedence_over_upgradeable(self):CODE
LOW⚡tests/test_facts_packages.py90 def test_handles_empty_versions(self):CODE
LOW⚡tests/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
LOW⚡tests/test_operations_utils.py33 def test_zero_prefixed_string(self):CODE
LOW⚡tests/test_operations_utils.py36 def test_octal_prefixed_string(self):CODE
LOW⚡tests/test_operations_utils.py39 def test_uppercase_octal_prefixed_string(self):CODE
LOW⚡tests/test_operations_utils.py45 def test_symbolic_mode_passes_through(self):CODE
LOW⚡tests/test_operations_utils.py51 def test_non_octal_int_raises(self):CODE
LOW⚡tests/test_operations_utils.py55 def test_non_octal_string_raises(self):CODE
LOW⚡tests/test_operations_utils.py79 def test_ip_address_with_port(self):CODE
LOW⚡tests/test_operations_utils.py85 def test_invalid_port_raises_error(self):CODE
LOW⚡tests/test_operations_utils.py90 def test_empty_port_raises_error(self):CODE
LOW⚡tests/test_operations_utils.py95 def test_negative_port_raises_error(self):CODE
LOW⚡tests/test_operations_utils.py100 def test_port_too_large_raises_error(self):CODE
LOW⚡tests/test_operations_utils.py105 def test_float_port_raises_error(self):CODE
LOW⚡tests/test_operations_utils.py132 def test_repository_with_digest(self):CODE
LOW⚡tests/test_operations_utils.py142 def test_repository_with_tag_and_digest(self):CODE
LOW⚡tests/test_operations_utils.py152 def test_namespace_repository(self):CODE
LOW⚡tests/test_operations_utils.py162 def test_namespace_repository_with_tag(self):CODE
LOW⚡tests/test_operations_utils.py182 def test_registry_with_port_repository(self):CODE
LOW⚡tests/test_operations_utils.py192 def test_registry_namespace_repository(self):CODE
LOW⚡tests/test_operations_utils.py202 def test_registry_with_port_namespace_repository(self):CODE
LOW⚡tests/test_operations_utils.py296 def test_empty_image_raises_error(self):CODE
LOW⚡tests/test_operations_utils.py301 def test_whitespace_only_image_raises_error(self):CODE
LOW⚡tests/test_operations_utils.py306 def test_none_image_raises_error(self):CODE
LOW⚡tests/test_operations_utils.py311 def test_invalid_registry_port_raises_error(self):CODE
LOW⚡tests/test_operations_utils.py355 def test_old_format_installed_no_latest(self):CODE
LOW⚡tests/test_operations_utils.py360 def test_old_format_multiple_versions_noop_is_sorted(self):CODE
LOW⚡tests/test_operations_utils.py366 def test_old_format_latest_blindly_upgrades(self):CODE
LOW⚡tests/test_operations_utils.py370 def test_old_format_missing_installs(self):CODE
LOW⚡tests/test_operations_utils.py374 def test_new_format_installed_uses_status(self):CODE
LOW⚡tests/test_operations_utils.py384 def test_new_format_latest_only_upgrades_upgradeable(self):CODE
LOW⚡tests/test_operations_utils.py488 def test_new_format_uninstall_removes_installed_package(self):CODE
LOW⚡tests/test_operations_utils.py497 def test_new_format_uninstall_held_package_proceeds(self):CODE
LOW⚡tests/test_operations_utils.py505 def test_new_format_uninstall_missing_package_is_noop(self):CODE
LOW⚡tests/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
304 more matches not shown…
Cross-Language Confusion67 hits · 315 pts
SeverityFileLineSnippetContext
HIGH⚡tests/test_connectors/test_util.py134 "sh -c 'export key=value anotherkey=anothervalue && uptime'",CODE
HIGH⚡tests/test_connectors/test_util.py135 "sh -c 'export anotherkey=anothervalue key=value && uptime'",CODE
HIGH⚡tests/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.py1273 "/tmp/pyinfra-e9c0d3c8ffca943daa0e75511b0a09c84b59c508 && chmod +r /tmp/pyinfra-e9c0d3c8ffca943dCODE
HIGHtests/test_connectors/test_ssh.py1324 "/tmp/pyinfra-e9c0d3c8ffca943daa0e75511b0a09c84b59c508 && chmod +r /tmp/pyinfra-e9c0d3c8ffca943dCODE
HIGHtests/test_connectors/test_ssh.py1365 "/tmp/pyinfra-e9c0d3c8ffca943daa0e75511b0a09c84b59c508 && chmod +r /tmp/pyinfra-e9c0d3c8ffca943dCODE
HIGHtests/test_connectors/test_ssh.py1418 "/tmp/pyinfra-e9c0d3c8ffca943daa0e75511b0a09c84b59c508 && chmod +r "CODE
HIGHtests/test_api/test_api_operations.py587 hosts=(("somehost", {"ssh_config_file": "/home/me/ssh_test_config && echo hi"}),)CODE
HIGHtests/test_api/test_api_operations.py605 "-F '/home/me/ssh_test_config && echo hi'\""CODE
HIGH⚡src/pyinfra/operations/files.py2093 "2>/dev/null || stat -f %Lp",CODE
HIGH⚡src/pyinfra/operations/files.py2095 '2>/dev/null)" &&',CODE
HIGH⚡src/pyinfra/operations/files.py2103 '2>/dev/null || stat -f "%u:%g"',CODE
HIGH⚡src/pyinfra/operations/files.py2105 '2>/dev/null || echo $(id -un):$(id -gn))" &&',CODE
HIGHsrc/pyinfra/operations/files.py252 "(( sha1sum {0} 2> /dev/null || shasum {0} || sha1 {0} ) | grep {1} ) "CODE
HIGHsrc/pyinfra/operations/files.py263 "(( sha256sum {0} 2> /dev/null || shasum -a 256 {0} || sha256 {0} ) "CODE
HIGHsrc/pyinfra/operations/files.py274 "(( sha384sum {0} 2> /dev/null || shasum -a 384 {0} ) "CODE
HIGHsrc/pyinfra/operations/files.py284 ("(( md5sum {0} 2> /dev/null || md5 {0} ) | grep {1} ) || ( echo {2} && exit 1 )"),CODE
HIGHsrc/pyinfra/operations/server.py103 "( sleep 1 && reboot ) </dev/null >/dev/null 2>&1 &",CODE
HIGHsrc/pyinfra/operations/server.py205 commands=["source /opt/example/setupvars.sh && make"],CODE
HIGHsrc/pyinfra/operations/runit.py158 f" sv status {service} > /dev/null && exit 0\n"CODE
HIGHsrc/pyinfra/operations/apt.py451 "2> /dev/null || true",CODE
HIGHsrc/pyinfra/operations/util/packaging.py332 yield f"rpm -q `rpm -qp {source}` 2> /dev/null || rpm -i {source}"CODE
HIGHsrc/pyinfra/facts/files.py381 "test {0} -ef {1} && echo true || echo false",CODE
HIGHsrc/pyinfra/facts/files.py473 ("{3} -e {0} {1} 2> /dev/null || ( find {1} -type f > /dev/null && echo {2} || true )"),CODE
HIGHsrc/pyinfra/facts/files.py683 "(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
HIGH⚡src/pyinfra/facts/server.py838 LASTLOG=`(((lastlog -u $i || lastlogin $i) 2> /dev/null) | grep ^$i | tr -s ' ')`;CODE
HIGH⚡src/pyinfra/facts/server.py838 LASTLOG=`(((lastlog -u $i || lastlogin $i) 2> /dev/null) | grep ^$i | tr -s ' ')`;CODE
HIGH⚡src/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.py1519 return make_formatted_string_command("cat {0} 2>/dev/null || true", QuoteString(path))STRING
HIGHsrc/pyinfra/facts/server.py1585 return "last -Fwi 2>/dev/null || last -w 2>/dev/null || last 2>/dev/null || true"STRING
HIGHsrc/pyinfra/facts/server.py1656 return "cat /proc/loadavg 2>/dev/null || uptime"STRING
HIGHsrc/pyinfra/facts/server.py1704 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
HIGH⚡src/pyinfra/facts/podman.py76 "ExposedPorts": null,STRING
HIGH⚡src/pyinfra/facts/podman.py81 "Labels": null,STRING
HIGH⚡src/pyinfra/facts/podman.py91 "Ports": null,STRING
HIGH⚡src/pyinfra/facts/podman.py93 "Size": null,STRING
HIGHsrc/pyinfra/facts/podman.py121 "RepoTags": null,STRING
HIGHsrc/pyinfra/facts/podman.py129 "Labels": null,STRING
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
7 more matches not shown…
Unused Imports168 hits · 164 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/pnpm.py9CODE
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
108 more matches not shown…
Empty Error Handlers18 hits · 90 pts
SeverityFileLineSnippetContext
HIGHsrc/pyinfra_cli/util.py147except (TypeError, ValueError):CODE
HIGHsrc/pyinfra_cli/util.py152except ValueError:CODE
HIGHsrc/pyinfra_cli/util.py158except (SyntaxError, ValueError):CODE
HIGHsrc/pyinfra_cli/cli.py892except PyinfraError:CODE
HIGHsrc/pyinfra_cli/commands.py25except ValueError:CODE
HIGHsrc/pyinfra_cli/virtualenv.py35except OSError:CODE
HIGHsrc/pyinfra/local.py39except ValueError:CODE
HIGHsrc/pyinfra/progress.py48except IndexError:CODE
HIGHsrc/pyinfra/connectors/ssh_util.py157except SSHException:CODE
HIGHsrc/pyinfra/connectors/ssh.py346except Exception:CODE
HIGHsrc/pyinfra/operations/gpg.py362except (KeyError, AttributeError):CODE
HIGHsrc/pyinfra/operations/gpg.py378except (KeyError, AttributeError):CODE
HIGHsrc/pyinfra/api/util.py97except ValueError:CODE
HIGHsrc/pyinfra/api/host.py70except KeyError:CODE
HIGHsrc/pyinfra/facts/server.py1674except ValueError:CODE
HIGHsrc/pyinfra/facts/hardware.py148except ValueError:CODE
HIGHsrc/pyinfra/facts/launchd.py39except ValueError:CODE
HIGHsrc/pyinfra/facts/util/win_files.py37except ValueError:CODE
Cross-File Repetition18 hits · 90 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 pipx packages: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/pacman.py0returns a dict of installed pipx packages: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/deb.py0returns a dict of installed pipx packages: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/apk.py0returns a dict of installed pipx packages: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/pkgin.py0returns a dict of installed pipx packages: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/pkg.py0returns a dict of installed pipx packages: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/rpm.py0returns a dict of installed pipx packages: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/pip.py0returns a dict of installed pipx packages: .. code:: python { "package_name": ["version"], }STRING
HIGHsrc/pyinfra/facts/pipx.py0returns a dict of installed pipx packages: .. code:: python { "package_name": ["version"], }STRING
Deep Nesting83 hits · 78 pts
SeverityFileLineSnippetContext
LOWtests/test_connectors/test_sshuserclient.py462CODE
LOWtests/test_api/test_api_operations.py964CODE
LOWtests/test_api/test_api_operations.py1013CODE
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.py581CODE
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.py236CODE
LOWsrc/pyinfra/connectors/ssh.py223CODE
LOWsrc/pyinfra/connectors/sshuserclient/config.py48CODE
LOWsrc/pyinfra/connectors/sshuserclient/config.py64CODE
LOWsrc/pyinfra/connectors/sshuserclient/client.py297CODE
LOWsrc/pyinfra/connectors/sshuserclient/client.py448CODE
LOWsrc/pyinfra/connectors/scp/client.py132CODE
LOWsrc/pyinfra/operations/files.py309CODE
LOWsrc/pyinfra/operations/files.py958CODE
LOWsrc/pyinfra/operations/files.py1009CODE
LOWsrc/pyinfra/operations/files.py1972CODE
LOWsrc/pyinfra/operations/files.py2238CODE
LOWsrc/pyinfra/operations/git.py138CODE
LOWsrc/pyinfra/operations/git.py296CODE
LOWsrc/pyinfra/operations/server.py327CODE
LOWsrc/pyinfra/operations/server.py477CODE
LOWsrc/pyinfra/operations/server.py691CODE
LOWsrc/pyinfra/operations/server.py769CODE
LOWsrc/pyinfra/operations/server.py837CODE
LOWsrc/pyinfra/operations/server.py1020CODE
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.py93CODE
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.py173CODE
LOWsrc/pyinfra/operations/freebsd/service.py21CODE
23 more matches not shown…
Redundant / Tautological Comments24 hits · 36 pts
SeverityFileLineSnippetContext
LOWtests/test_connectors/test_sshuserclient.py482 # Check if AskPolicy respects not importing and properly raises SSHExceptionCOMMENT
LOWtests/test_connectors/test_sshuserclient.py489 # 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.py707 # Check if this directory is actually a symlinkCOMMENT
LOWsrc/pyinfra/operations/files.py732 # Check if this is a symlinkCOMMENT
LOWsrc/pyinfra/operations/files.py2308 # Check if the remote archive existsCOMMENT
LOWsrc/pyinfra/operations/gpg.py147 # Check if the destination keyring exists and contains the target keysCOMMENT
LOW⚡src/pyinfra/operations/gpg.py326 # Check if key already exists (for idempotence)COMMENT
LOW⚡src/pyinfra/operations/gpg.py334 # Check if our destination keyring exists in the factCOMMENT
LOW⚡src/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/files.py405 # Read files through stdin so checksum tools never see the filename,COMMENT
LOWsrc/pyinfra/facts/server.py1277 # Check if it's Alpine LinuxCOMMENT
AI Structural Patterns36 hits · 34 pts
SeverityFileLineSnippetContext
LOWsrc/pyinfra_cli/cli.py111CODE
LOWsrc/pyinfra/connectors/util.py393CODE
LOWsrc/pyinfra/operations/files.py80CODE
LOWsrc/pyinfra/operations/files.py309CODE
LOWsrc/pyinfra/operations/files.py617CODE
LOWsrc/pyinfra/operations/files.py1009CODE
LOWsrc/pyinfra/operations/files.py1599CODE
LOWsrc/pyinfra/operations/files.py1713CODE
LOWsrc/pyinfra/operations/files.py1815CODE
LOWsrc/pyinfra/operations/files.py1972CODE
LOWsrc/pyinfra/operations/git.py138CODE
LOWsrc/pyinfra/operations/git.py296CODE
LOWsrc/pyinfra/operations/server.py1020CODE
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.py594CODE
LOWsrc/pyinfra/operations/postgres.py62CODE
LOWsrc/pyinfra/operations/postgres.py224CODE
LOWsrc/pyinfra/operations/uv.py234CODE
LOWsrc/pyinfra/operations/iptables.py70CODE
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.py501CODE
Self-Referential Comments14 hits · 28 pts
SeverityFileLineSnippetContext
MEDIUM⚡tests/test_api/test_api_operations.py1189 # Create a counter to track retry_until callsCOMMENT
MEDIUM⚡tests/test_api/test_api_operations.py1192 # Create a retry_until function that returns True (retry) for first two callsCOMMENT
MEDIUMtests/test_api/test_api_operations.py1292 # Create a retry_until function that raises an exceptionCOMMENT
MEDIUMsrc/pyinfra/operations/server.py469 # Create a whole new hostname fileSTRING
MEDIUMsrc/pyinfra/operations/server.py1127 # 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
MEDIUM⚡src/pyinfra/operations/mysql.py111 # Create a user with resource limitsSTRING
MEDIUM⚡src/pyinfra/operations/mysql.py119 # Create a user that requires SSL for connectionsSTRING
MEDIUM⚡src/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 Wrapping21 hits · 22 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.py71 except Exception as e:CODE
LOWsrc/pyinfra_cli/util.py200 except Exception as e:CODE
LOWsrc/pyinfra_cli/util.py236 except Exception as e:CODE
MEDIUMsrc/pyinfra_cli/util.py228def load_file(local_host):CODE
LOWsrc/pyinfra_cli/cli.py334 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.py327 except Exception:STRING
LOWsrc/pyinfra/connectors/ssh.py346 except Exception:STRING
LOWsrc/pyinfra/connectors/sshuserclient/config.py37 except Exception as e:CODE
LOWsrc/pyinfra/connectors/sshuserclient/client.py326 except Exception as e:CODE
LOWsrc/pyinfra/connectors/sshuserclient/client.py353 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
LOWsrc/pyinfra/facts/podman.py24 except Exception as e:CODE
Fake / Example Data17 hits · 20 pts
SeverityFileLineSnippetContext
LOW⚡tests/test_connectors/test_ssh.py255 fake_key = mock.MagicMock()CODE
LOW⚡tests/test_connectors/test_ssh.py256 fake_key_open.return_value = fake_keyCODE
LOW⚡tests/test_connectors/test_ssh.py263 fake_key.load_certificate.assert_called_with("testkey-cert.pub")CODE
LOW⚡tests/test_connectors/test_ssh.py270 pkey=fake_key,CODE
LOW⚡tests/test_connectors/test_ssh.py396 fake_key = mock.MagicMock()CODE
LOW⚡tests/test_connectors/test_ssh.py401 return fake_keyCODE
LOW⚡tests/test_connectors/test_ssh.py410 fake_key.load_certificate.assert_called_with("testkey-cert.pub")CODE
LOW⚡tests/test_connectors/test_ssh.py454 fake_key = mock.MagicMock()CODE
LOW⚡tests/test_connectors/test_ssh.py455 fake_key_open.return_value = fake_keyCODE
LOW⚡tests/test_connectors/test_ssh.py502 fake_key = mock.MagicMock()CODE
LOW⚡tests/test_connectors/test_ssh.py503 fake_key_open.return_value = fake_keyCODE
LOWtests/test_connectors/test_ssh.py425 fake_key = mock.MagicMock()CODE
LOWtests/test_connectors/test_ssh.py430 return fake_keyCODE
LOWtests/test_connectors/test_ssh.py441 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.py127 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
LOW⚡src/pyinfra/facts/zfs.py64 def process_data(self, data):CODE
LOW⚡src/pyinfra/facts/zfs.py72 def process_data(self, data):CODE
LOW⚡src/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.py1375 # To pass variables to the template file, just add them to the operation call.STRING
LOWsrc/pyinfra/operations/bsdinit.py82 # BSD init is simple, just add/remove <service>_enabled="YES"COMMENT
MEDIUMsrc/pyinfra/api/config.py162 # 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.py1314 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 Block5 hits · 5 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/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
LOW⚡src/pyinfra_cli/cli.py778def _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